/* ======================================================
   Hero (Hero Image 1B). Ported from fdmdesignsystem.html.
   A container query on .hero-wrap switches composition at 720px.
   Positions are measured from the PSDs (5318 × 2368 and 1886 × 3352)
   and expressed in container units, so the composition scales exactly.
   ====================================================== */
.hero-wrap {
  container-type: inline-size;
  container-name: hero;
}
.hero {
  position: relative;
  aspect-ratio: 16 / 9; /* the film's own frame: nothing is cropped */
  --dy: 5.86cqw; /* centres the 5318 × 2368 PSD composition in 16:9 */
  background: var(--fdm-black);
  color: var(--fdm-ash);
  overflow: hidden;
  isolation: isolate;
}

.hero__portrait {
  position: absolute;
  left: 30.52cqw;
  top: calc(3.93cqw + var(--dy));
  width: 39.41cqw;
  aspect-ratio: 2096 / 3143;
  z-index: var(--z-portrait);
}
.hero__portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.hero__rule {
  position: absolute;
  left: 21.15cqw;
  width: 57.31cqw;
  height: var(--rule-hair);
  background: var(--rule);
  z-index: var(--z-base);
  transform-origin: center;
}
.hero__rule--top {
  top: calc(13.88cqw + var(--dy));
}
.hero__rule--bottom {
  top: calc(27.45cqw + var(--dy));
}

.hero__name,
.hero__lockup {
  position: absolute;
  top: calc(13.88cqw + var(--dy));
  height: 13.57cqw;
  display: flex;
  align-items: center;
  margin: 0;
}
.hero__name {
  left: 21.21cqw;
  z-index: var(--z-base);
  font-size: 3.127cqw;
  line-height: var(--lh-stack);
  letter-spacing: var(--track-tight);
  color: var(--fdm-ash);
  text-wrap: nowrap;
}
.hero__lockup {
  right: 21.55cqw;
  z-index: var(--z-over);
}
.hero__lockup img {
  display: block;
  height: 7.94cqw;
  width: auto;
  aspect-ratio: 1344 / 740;
}

.hero__values {
  position: absolute;
  left: 21.38cqw;
  width: 57.07cqw;
  top: calc(31.2cqw + var(--dy));
  z-index: var(--z-over);
  font-size: max(0.6875rem, 0.903cqw);
  --values-track: 0.2em;
  gap: 0.4em;
}
.hero__tagline {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(36.1cqw + var(--dy));
  z-index: var(--z-over);
  text-align: center;
  font-weight: var(--weight-bold);
  font-size: max(0.875rem, 1.39cqw);
  letter-spacing: var(--track-tight);
  line-height: 1.2;
  color: var(--fdm-ash);
}
.hero__tagline .m-br {
  display: none;
}
@container hero (min-width: 1024px) {
  .hero__values {
    --values-track: 0.5em;
  }
}
@container hero (min-width: 1280px) {
  .hero__values {
    --values-track: var(--track-values);
  }
}

/* ---------- Mobile composition ---------- */
@container hero (max-width: 719px) {
  .hero {
    aspect-ratio: 9 / 16; /* the vertical tile loop's own frame */
  }
  .hero__portrait {
    left: 20.3cqw;
    top: 10.55cqw;
    width: 111.1cqw;
    bottom: -1px; /* reach the hero's bottom edge: no gap under the portrait */
    aspect-ratio: auto;
  }
  .hero__portrait img {
    object-fit: fill;
  }
  .hero__rule {
    left: 13.31cqw;
    width: 75.4cqw;
  }
  .hero__rule--top {
    top: 33.35cqw;
  }
  .hero__rule--bottom {
    top: 82.18cqw;
  }
  .hero__name {
    left: 13.31cqw;
    top: 32.45cqw;
    height: 48.83cqw; /* the corner of the s tucks slightly behind the shoulder */
    font-size: 11.27cqw;
  }
  .hero__lockup {
    left: 13.31cqw;
    right: auto;
    top: 91.57cqw;
    height: auto;
  }
  .hero__lockup img {
    height: 18.03cqw;
  }
  .hero__values {
    left: 13.31cqw;
    width: 75.2cqw;
    top: 166.2cqw;
    font-size: 2.2cqw;
    --values-track: var(--track-values-sm);
    gap: 0;
  }
  .hero__tagline {
    left: 13.63cqw;
    right: auto;
    top: 21.9cqw;
    text-align: left;
    font-size: 3.29cqw;
    line-height: 1.21;
  }
  .hero__tagline .m-br {
    display: inline;
  }
}

/* ---------- Hero film ---------- */
/* Posters are backgrounds gated by container and motion queries: a phone never
   requests a desktop file, and reduced motion never requests the intro. */
.hero__film {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--fdm-black) center / cover no-repeat;
  pointer-events: none;
}
.hero__film video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* The tile loop is stacked BEHIND the intro and is always fully opaque: it starts running
   before the handoff, so hiding the intro reveals it with no gap and no fade through black. */
.hero__film-loop {
  z-index: 0;
}
.hero__film-intro {
  z-index: 1;
}
.hero.is-looping .hero__film-intro {
  visibility: hidden;
}
@container hero (min-width: 720px) {
  .hero.is-still .hero__film,
  .hero.hero--film.is-returning:not(.is-looping) .hero__film {
    background-image: url("/brand/posters/fdm-tile-loop-poster.jpg");
  }
  @media (prefers-reduced-motion: no-preference) {
    .hero:not(.is-looping) .hero__film {
      background-image: url("/brand/posters/fdm-hero-intro-poster.jpg");
    }
  }
}
@container hero (max-width: 719px) {
  .hero__film-intro {
    display: none; /* mobile: no intro, the tile loop only */
  }
  .hero__film {
    background-image: url("/brand/posters/fdm-tile-loop-vertical-poster.jpg");
  }
}

/* Before the overlay lands the film plays alone. Only when script runs and motion is
   allowed: otherwise the final state renders at once over the loop's poster. */
@media (scripting: enabled) and (prefers-reduced-motion: no-preference) {
  .hero--film:not(.is-playing)
    :is(.hero__rule, .hero__name, .hero__portrait, .hero__lockup, .hero__values, .hero__tagline) {
    opacity: 0;
  }
}
@media (scripting: none), (prefers-reduced-motion: reduce) {
  @container hero (min-width: 720px) {
    .hero.hero--film .hero__film {
      background-image: url("/brand/posters/fdm-tile-loop-poster.jpg");
    }
  }
}

/* The opening: the one orchestrated moment on the site */
@media (prefers-reduced-motion: no-preference) {
  .hero.is-playing .hero__rule {
    animation: fdm-draw var(--dur-reveal) var(--ease-move) both;
  }
  .hero.is-playing .hero__portrait {
    animation: fdm-fade 1400ms var(--ease-out) both;
  }
  .hero.is-playing .hero__name,
  .hero.is-playing .hero__lockup {
    animation: fdm-fade 700ms var(--ease-out) 600ms both;
  }
  .hero.is-playing .values > [aria-hidden] {
    animation: fdm-fade 500ms var(--ease-out) both;
    animation-delay: calc(1100ms + var(--i, 0) * var(--stagger));
  }
  .hero.is-playing .hero__tagline {
    animation: fdm-fade 700ms var(--ease-out) 2000ms both;
  }
}
@keyframes fdm-draw {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}
@keyframes fdm-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
