/* Irish League Edge — 3D hero stage (js/hero3d.js). Load after site.css.

   Layers inside .hero (site.css gives .hero isolation: isolate):
     .hero__bg (stadium-night.svg, z -2)  <  .hero3d stage: poster <img>, then the WebGL canvas (z -1)  <  copy

   Phones only ever see the poster; three.js is not downloaded there.
   Below 1100px the mark sits above the copy ("stacked"). Every size there is a multiple of --u, so
   the poster and the live scene line up at any size: the mark is centred at 36.6% of the stage
   height and is 0.72 x the stage height wide (--hero3d-y / --hero3d-wh, read by hero3d.js).
   From 1100px the mark sits in the right column, sized by [data-hero3d-anchor]. */

.hero--3d { --u: 1vw; }

.hero3d {
  position: absolute; left: 0; right: 0; top: 0; z-index: -1;
  height: calc(100 * var(--u));
  overflow: hidden; pointer-events: none;
  background: #000;
  --hero3d-x: 0.5; --hero3d-y: 0.366; --hero3d-wh: 0.72;
}
.hero3d picture { display: contents; }
/* The SVG stadium (site.css) stays underneath as the last fallback, cut to the same block */
.hero--3d .hero__bg { bottom: auto; height: calc(100 * var(--u)); }
.hero3d__poster {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: calc(100 * var(--u)); height: auto; max-width: none;
}
/* Fade into the page under the copy. It starts just below the mark (which ends at about 56% of the stage):
   the logo is never dimmed, so its silver and emerald stay the logo's own colours (10.10). */
.hero3d::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0) 57%, rgba(0,0,0,0.9) 69%, #000 84%);
}
.hero--3d .wrap { padding-top: calc(57 * var(--u)); }
.hero3d-anchor { display: none; }

/* Tablets and small laptops: smaller mark, live 3D (unless reduced motion / no WebGL) */
@media (min-width: 768px) {
  .hero--3d { --u: min(1vw, 1vh); }
  .hero3d, .hero--3d .hero__bg { height: calc(68 * var(--u)); }
  /* Tablet poster (2112×880, POSTER_FRAMES.tablet): exactly as tall as the stage and centred, so it
     fills the width like the live canvas, in portrait and in landscape up to a 2.4:1 stage */
  .hero3d__poster {
    width: auto; height: calc(68 * var(--u));
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 4%, #000 96%, transparent 100%);
  }
  .hero3d::after { background: linear-gradient(180deg, rgba(0,0,0,0) 57%, rgba(0,0,0,0.88) 69%, #000 86%); }
  .hero--3d .wrap { padding-top: calc(39 * var(--u)); }
}

/* Desktop: copy left, mark right, stage behind the whole hero */
@media (min-width: 1100px) {
  .hero--3d { min-height: clamp(640px, calc(100svh - 76px), 900px); display: grid; align-items: center; }
  .hero3d, .hero--3d .hero__bg { bottom: 0; height: auto; }
  .hero3d { --hero3d-x: initial; --hero3d-y: initial; --hero3d-wh: initial; }
  /* Top padding 128px (was 96): the taller copy (label + supporting line) otherwise starts level with the
     left floodlight at 1100–1300px wide. Same total height as before. */
  .hero--3d .wrap {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center;
    padding-block: var(--space-10) var(--space-9);
  }
  .hero3d-anchor { display: block; height: clamp(340px, 36vw, 520px); }
  /* 1:1 (no scaling) so the poster lines up with the live scene, which keeps the mark a fixed size */
  .hero3d__poster {
    top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 1600px; height: 1000px; max-width: none; object-fit: cover;
    -webkit-mask-image: none; mask-image: none;
  }
  /* Scrim behind the copy: strong enough that the far touchline does not run through the lead text.
     It is masked off before the right column (46% -> 51% of the width), so it never darkens the mark:
     the logo keeps its own colours (10.10). The bottom fade stays full width, below the mark. */
  .hero3d::before {
    content: ""; position: absolute; inset: 0; z-index: 1;
    background: radial-gradient(42% 64% at 26% 54%, rgba(0,0,0,0.80) 0%, rgba(0,0,0,0.62) 40%, rgba(0,0,0,0) 80%);
    -webkit-mask-image: linear-gradient(90deg, #000 46%, transparent 51%);
    mask-image: linear-gradient(90deg, #000 46%, transparent 51%);
  }
  .hero3d::after { background: linear-gradient(180deg, rgba(0,0,0,0) 74%, #000 100%); }
}
/* Very wide screens: the 1600px poster melts into black at its edges */
@media (min-width: 1601px) {
  .hero3d__poster {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 10%, #000 90%, transparent 100%);
  }
}
