/* ==========================================================================
   Home hero — V draw, capability word cycle, media cut at the V angle.
   Mobile-first. Geometry: every slanted edge uses --v-slope (tan 15.7°), so
   a cut's horizontal size = its height × slope and edges stay parallel to the V.
   ========================================================================== */

.hero {
  --media-h: 64vw;                          /* mobile: media panel height */
  --cut: calc(var(--media-h) * var(--v-slope));
  --stripe-unit: 0.4rem;                    /* width of the V's white stripe */
  --stripes-w: calc(var(--stripe-unit) * (var(--v-ratio-red) + var(--v-ratio-white) + var(--v-ratio-navy)));
  --media-left: 12%;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
}

/* ------------------------------------------------------------ Media panel */
.hero__media {
  --p: 0;                                   /* wipe progress, tweened by motion.js */
  position: relative;
  margin-left: var(--media-left);
  height: var(--media-h);
  overflow: hidden;
  background: var(--color-bg-secondary);
  clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%);
}
.hero__slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
}
.hero__slide.is-active { visibility: visible; z-index: 1; }
.hero__slide.is-next {
  visibility: visible;
  z-index: 2;
  /* edge travels right → left, slanted like the V */
  clip-path: polygon(
    calc((1 - var(--p)) * (100% + var(--cut))) 0,
    100% 0,
    100% 100%,
    calc((1 - var(--p)) * (100% + var(--cut)) - var(--cut)) 100%
  );
}
.hero__slide picture, .hero__slide img { width: 100%; height: 100%; }
.hero__slide img { object-fit: cover; }

/* Dark scrim on the left of the media so overlapping words stay legible. */
.hero__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(10 13 20 / 0) 55%, rgb(10 13 20 / 0.55) 100%);
}

/* Stripe sweep that rides the wipe edge during a slide change */
.hero__sweep {
  position: absolute;
  z-index: 4;
  top: 0;
  bottom: 0;
  left: calc((1 - var(--p)) * (100% + var(--cut)) - var(--cut) / 2 - var(--stripes-w) / 2);
  display: flex;
  gap: 0;
  transform: skewX(calc(-1 * var(--v-lean)));
  opacity: 0;
  pointer-events: none;
}

/* Static V stripes along the media's slanted edge */
.hero__stripes {
  position: absolute;
  z-index: 1;                               /* behind the content; words carry a dark halo instead */
  box-shadow: 0 0 0 var(--stripe-unit) var(--color-bg-primary);  /* dark gap so red text never merges with the red stripe */
  top: 0;
  height: var(--media-h);
  left: calc(var(--media-left) + var(--cut) / 2 - var(--stripes-w) - var(--stripe-unit));
  display: flex;
  transform: skewX(calc(-1 * var(--v-lean)));
  pointer-events: none;
}
.hero__stripes span, .hero__sweep span { display: block; height: 100%; transform-origin: 50% 0; }
.hero__stripes span:nth-child(1), .hero__sweep span:nth-child(1) { width: calc(var(--stripe-unit) * var(--v-ratio-red)); background: var(--v-red); }
.hero__stripes span:nth-child(2), .hero__sweep span:nth-child(2) { width: calc(var(--stripe-unit) * var(--v-ratio-white)); background: var(--v-white); }
.hero__stripes span:nth-child(3), .hero__sweep span:nth-child(3) { width: calc(var(--stripe-unit) * var(--v-ratio-navy)); background: var(--v-navy); }

/* -------------------------------------------------------------- Content */
.hero__content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  padding-top: var(--space-5);
  padding-bottom: var(--space-7);
}
.hero__index {
  display: flex;
  gap: var(--space-4);
  align-items: baseline;
  margin-bottom: var(--space-3);
}
.hero__count { flex: none; white-space: nowrap; color: var(--color-text-primary); font-variant-numeric: tabular-nums; }  /* "04 / 06" never breaks beside a long service name */
.hero__service { color: var(--color-text-link); }

/* All six word pairs share one grid cell; each is sized so its longest line
   fills the available width (container query units). --em = that line's width in em,
   from per-letter widths in _data/hero.js. */
.hero__words {
  container-type: inline-size;
  display: grid;
  margin-inline: -0.04em;                   /* optical: align heavy caps to the grid edge */
}
.hero__word {
  grid-area: 1 / 1;
  align-self: end;
  font-size: min(8.5rem, calc(100cqi / var(--em)));
  visibility: hidden;
}
.hero__word.is-active { visibility: visible; }
/* Dark halo (background colour) so letters stay separate from the stripes and image. */
.hero__word {
  --halo: max(3px, 0.035em);
  --halo-c: var(--color-bg-primary);
  text-shadow:
    var(--halo) 0 0 var(--halo-c), calc(-1 * var(--halo)) 0 0 var(--halo-c),
    0 var(--halo) 0 var(--halo-c), 0 calc(-1 * var(--halo)) 0 var(--halo-c),
    var(--halo) var(--halo) 0 var(--halo-c), calc(-1 * var(--halo)) calc(-1 * var(--halo)) 0 var(--halo-c),
    var(--halo) calc(-1 * var(--halo)) 0 var(--halo-c), calc(-1 * var(--halo)) var(--halo) 0 var(--halo-c);
}
.hero__line { display: block; overflow: hidden; padding-block: 0.02em 0.04em; }
.hero__line-inner { display: block; will-change: transform; }

.hero__footer { margin-top: var(--space-6); }
.hero__lead { max-width: 40ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

/* ------------------------------------------------------------- Controls */
.hero__controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-7);
}
.hero__progress {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;   /* the space between bars is padding inside each dot, so all six stay ≥ 44 px wide at 375 */
}
.hero__dot {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-target-min);
  text-align: left;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  transition: color var(--duration-fast) var(--easing-default);
}
/* labels hidden on mobile (bars only), visible from 960px */
.hero__dot { font-size: 0; }
.hero__dot:not(:last-child) { padding-inline-end: var(--space-2); }
.hero__dot:hover, .hero__dot[aria-current="true"] { color: var(--color-text-primary); }
.hero__bar {
  position: relative;
  display: block;
  height: 2px;
  background: var(--color-border-primary);
  overflow: hidden;
}
.hero__bar span {
  position: absolute;
  inset: 0;
  background: var(--color-accent-primary);
  transform: scaleX(0);
  transform-origin: left;
}
.hero__dot[aria-current="true"] .hero__bar span { transform: scaleX(1); }
.hero.is-playing .hero__dot[aria-current="true"] .hero__bar span { transform: scaleX(var(--progress, 0)); }

.hero__pause { flex: none; }
.hero__pause .icon-play { display: none; }
.hero__pause[aria-pressed="true"] .icon-pause { display: none; }
.hero__pause[aria-pressed="true"] .icon-play { display: block; }
html:not(.js) .hero__controls { display: none; }

/* ------------------------------------------------------ Intro (pre-anim)
   Set synchronously by an inline script when motion is allowed; motion.js
   removes it. A timeout in the same script removes it if JS fails. */
.hero.is-intro .hero__stripes span { transform: scaleY(0); }
.hero.is-intro .hero__word.is-active .hero__line-inner { transform: translateY(110%); }
.hero.is-intro .hero__slide.is-active { visibility: hidden; }

/* ------------------------------------------------------------ ≥ 640px */
@media (min-width: 640px) {
  .hero { --media-h: 52vw; --stripe-unit: 0.5rem; --media-left: 18%; }
}

/* ------------------------------------------------------------ ≥ 960px
   Media becomes a full-height panel on the right; words overlap it. */
@media (min-width: 960px) {
  .hero {
    --hero-h: clamp(38rem, calc(100svh - var(--header-height)), 58rem);
    --media-h: var(--hero-h);
    --media-left: 46%;
    --stripe-unit: 0.6rem;
    min-height: var(--hero-h);
    justify-content: flex-end;
  }
  .hero__media {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: var(--media-left);
    height: auto;
    margin: 0;
  }
  .hero__media::after {
    background:
      linear-gradient(90deg, rgb(10 13 20 / 0.7) 0%, rgb(10 13 20 / 0) 45%),
      linear-gradient(180deg, rgb(10 13 20 / 0) 60%, rgb(10 13 20 / 0.6) 100%);
  }
  .hero__stripes { height: 100%; }
  .hero__content { flex: 1; justify-content: flex-end; padding-top: var(--space-9); padding-bottom: 0; }
  .hero__footer {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: end;
  }
  .hero__actions { margin-top: var(--space-5); }
  .hero__lead { grid-column: 1; }
  .hero__actions { grid-column: 1; }
  .hero__dot { font-size: var(--font-size-xs); }
  /* Solid index band: media and stripes end above it, labels never sit on the stripes. */
  .hero__controls {
    position: relative;
    z-index: 4;
    margin-top: var(--space-8);
    padding-block: var(--space-4) var(--space-6);
    background: var(--color-bg-primary);
    border-top: var(--border-width-hairline) solid var(--color-border-primary);
    box-shadow: 0 0 0 100vmax var(--color-bg-primary);
    clip-path: inset(0 -100vmax);             /* sideways only — never paint over content below */
  }
}

/* ------------------------------------------------- Line-art slide
   Concept Design draws the wireframe morph (lineart.js) on the panel colour.
   A faint navy glow sits behind the model; the model clears the scrim on desktop. */
.hero__slide--lineart {
  background:
    radial-gradient(ellipse 60% 55% at 50% 55%, var(--color-accent-glow), transparent 70%),
    var(--color-bg-secondary);
}
.hero__lineart { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
html:not(.js) .hero__lineart { display: none; }
@media (min-width: 960px) {
  .hero__slide--lineart {
    background:
      radial-gradient(ellipse 45% 40% at 60% 48%, var(--color-accent-glow), transparent 70%),
      var(--color-bg-secondary);
  }
}
