/* ============================================================
   video-hero.css - the shared full-bleed video hero (`.vhero*`).
   Used by index.html and all five solutions pages; to add another,
   link this, copy the markup, and give the section a modifier class
   that sets --vhero-poster.

   Namespaced `vhero` so none of it reaches the older `.hero` block in
   styles.css, which every page loads and index-photo-hero.html uses,
   nor `.page-hero`, which the other four solutions pages use.

   Each page supplies its own clip and poster: the clip through the
   video element's data-webm/data-mp4, the poster through the
   --vhero-poster custom property. Both are per-page values that would
   otherwise want an inline style, which the CSP forbids.

   All values come from the design tokens in styles.css. Motion
   stays inside the brand guide's ceiling (500ms deliberate) and
   the global prefers-reduced-motion rule in styles.css already
   kills every transition and animation with !important, so this
   file only has to deal with what that rule cannot: swapping the
   video out for the still.
   ============================================================ */

/* ---------- The hero ---------- */

/* Pulled up 88px under the fixed transparent header, exactly as
   .hero/.page-hero do in styles.css, so the footage runs behind
   the nav. The hero therefore starts at viewport y = --annc-h,
   which is what the height subtracts.

   svh, not vh: on a phone the URL bar collapses on first scroll
   and a vh-sized hero would resize underneath the reader. The
   clamp keeps it sane on a laptop in landscape and on a 27in
   display. ~92svh rather than 100 so the Trusted-by band peeks
   above the fold and the page reads as scrollable. */
.vhero{
  position:relative;
  margin-top:-88px;
  min-height:clamp(560px, calc(92svh - var(--annc-h)), 1000px);
  display:flex;
  align-items:flex-start;
  overflow:hidden;
  isolation:isolate;
  background:#000;
  color:var(--white);
}

/* The copy is centred inside the top 700px rather than inside the
   whole hero, which is what puts it at the same height as the
   product and solutions pages. Those heroes are a flat 700px with
   align-items:center (see .page-hero in facecapture.css), so their
   copy sits at (700 - its own height) / 2 - which is why the
   absolute position differs between facecapture, mineworks and the
   solutions pages and the rule is the thing to match, not any one
   of their numbers. The hero itself stays ~92svh so the footage
   still fills the screen and the next section still peeks. */
.vhero>.container{
  display:flex;
  align-items:center;
  min-height:700px;
}
.vhero__inner{width:100%}

/* Starts transparent and is faded in by js/video-hero.js once the clip
   is genuinely playing, so the cut from the black hero into the
   clip's own fade-up from black is invisible. */
.vhero__video{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;         /* overrides the global img/media height:auto reset */
  object-fit:cover;
  z-index:-2;
  opacity:0;
  transition:opacity var(--motion-deliberate);
}
.vhero.is-playing .vhero__video{opacity:1}

/* The still, shown wherever the video does not play: phones,
   reduced motion, and autoplay refused (iOS Low Power Mode). */
.vhero--home{--vhero-poster:url(../images/home-hero-v2-poster.webp)}
.vhero--contractors{--vhero-poster:url(../images/contractor-hero-poster.webp)}
.vhero--operations{--vhero-poster:url(../images/operations-hero-poster.webp)}
.vhero--geology{--vhero-poster:url(../images/geology-hero-poster.webp)}
.vhero--engineering{--vhero-poster:url(../images/engineering-hero-poster.webp)}
.vhero--geotechnical{--vhero-poster:url(../images/geotechnical-hero-poster.webp)}

.vhero--still{
  background-image:var(--vhero-poster);
  background-size:cover;
  background-position:50% 50%;
}

/* Legibility. The footage is dark but has headlamp flares that
   blow out to white and would swallow the headline, so there is
   a horizontal gradient weighted to the left, where the copy sits,
   on top of a vertical one. Same shape the photo heroes use (see
   .page-hero:after in about.css and friends), just stronger - a
   clip swings a headlamp into frame, which a still never does.
   The vertical gradient's top end is weighted for the white nav
   over the footage, its bottom end for the scroll cue.

   The numbers are measured, not guessed. The clips carry a gamma 1.25
   lift (see the encode recipe in CLAUDE.md), and behind the text block
   the Nov 2026 home cut runs median 68, 90th percentile 98, with the
   brightest pixels peaking at 192 around 5s. That is under the 201 peak
   of the cut it replaced, which is why the stops below did not need to
   move.
   This scrim is sized to hold that worst frame, not the average one,
   which is why it is heavier than the photo heroes'. Measured against
   it: 4.73:1 for the lead paragraph, against a 4.5:1 minimum.

   Re-measure if a clip is ever swapped or regraded - render the hero
   at the clip's brightest frame, crop the copy column, and compute
   contrast against white. Lifting the grade without re-checking this
   is what takes it under: the same scrim measured 4.37:1 immediately
   after the gamma lift, before these stops were raised. */
.vhero__scrim{
  position:absolute;
  inset:0;
  z-index:-1;
  background:
    linear-gradient(90deg, #101418cc 0%, #101418ad 40%, #10141859 68%, #10141833 100%),
    linear-gradient(180deg, #101418b8 0%, #1014184d 26%, #1014184d 68%, #101418d6 100%);
}

/* The contractor clip is far darker and far flatter than the home one:
   behind the text block it peaks at luma 90, where the home clip hits
   201. At 90 the copy sits around 8:1 against white with no scrim at
   all, so the heavy gradient above was pure cost there - it was
   crushing footage that never threatened legibility.

   This override keeps enough at the top for the white nav to stay
   readable over the footage and enough at the bottom for the scroll
   cue, and gets out of the way through the middle. */
.vhero--contractors .vhero__scrim{
  background:
    linear-gradient(90deg, #1014187a 0%, #10141859 40%, #10141826 68%, #10141814 100%),
    linear-gradient(180deg, #1014188f 0%, #1014181f 26%, #1014181f 68%, #101418a6 100%);
}

/* Home: lighter on the right only, so more of the footage shows. The copy
   column (0-40%) and the vertical gradient keep the full stops, so the
   4.73:1 measured for the lead paragraph above still holds. */
.vhero--home .vhero__scrim{
  background:
    linear-gradient(90deg, #101418cc 0%, #101418ad 40%, #10141833 68%, #10141814 100%),
    linear-gradient(180deg, #101418b8 0%, #1014184d 26%, #1014184d 68%, #101418d6 100%);
}

/* The operations clip gets no override and keeps the full scrim. Its
   control-room shots put lit monitors behind the copy: the 90th
   percentile pixel behind the text block runs to luma 203, as bright as
   the home clip, and at the contractor setting a white monitor pixel
   behind the lead paragraph would drop it to about 3:1.

   The geology clip keeps the full scrim too. It is darker overall, but
   hi-vis vests and headlamps cross the text block: the 90th percentile
   pixel there runs to 165 and peaks at luma 187, too close to the
   operations clip to justify the lighter setting.

   The engineering clip is the brightest yet: an outdoor shot puts sky
   behind the copy (mean luma behind the text block reaches 165, its 90th
   percentile pixel 202). The full scrim still holds it: even a pure
   white pixel behind the lead paragraph composites to about 8.5:1.

   Geotechnical sits with geology: dark overall, but headlamps and
   hi-vis cross the text block (90th percentile pixel 174, peaking at
   198), so it keeps the full scrim too. */

/* ---------- Hero copy ---------- */

/* Same words as /index, ranged left with a sage eyebrow above the
   h1 - the layout every .page-hero on the site uses. */
.vhero__inner{
  max-width:760px;
  padding-block:4rem;
  transition:opacity var(--motion-deliberate), transform var(--motion-deliberate);
}
/* Sage on dark, as .page-hero .eyebrow is everywhere else. The base
   .eyebrow in styles.css is --olive-text, meant for light sections,
   and would all but vanish against the footage. */
.vhero .eyebrow{
  color:var(--sage);
  text-shadow:0 1px 8px #000000a6;
}
.vhero__inner h1{
  color:var(--white);
  font-size:clamp(2.4rem, 4.8vw, 4rem);
  font-weight:700;
  line-height:.98;
  letter-spacing:-.03em;
  margin:0 0 1.4rem;
  text-shadow:0 2px 28px #00000073;
}
.vhero__subhead{
  font-family:var(--font-display);
  color:var(--white);
  font-size:clamp(1.3rem, 2.2vw, 1.75rem);
  font-weight:600;
  line-height:1.3;
  max-width:46ch;
  margin:0 0 .9rem;
  text-shadow:0 2px 20px #0000008c;
}
.vhero__lead{
  font-size:var(--fs-lead);
  /* Full white, not the #ffffffd9 the production hero uses. At 85%
     over the brightest frame this was the one element that failed
     contrast; over the dark frames that are typical the difference
     is not perceptible. */
  color:var(--white);
  max-width:52ch;
  margin:0;
  text-shadow:0 2px 20px #0000008c;
}

/* Once the reader has committed to scrolling, the copy gets out
   of the way of the footage instead of sliding up still fully
   opaque over it. Driven by a class from js/video-hero.js - no inline
   styles, the CSP has no unsafe-inline. */
.vhero.is-scrolled .vhero__inner{
  opacity:0;
  transform:translateY(-16px);
}

/* ---------- Scroll cue ---------- */

/* An anchor, not a button, so it still works with JS off, and it
   lands on #trusted-by rather than being decorative only. */
.vhero__cue{
  position:absolute;
  left:50%;
  bottom:1.9rem;
  transform:translateX(-50%);
  z-index:1;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:.55rem;
  color:#ffffffb3;
  transition:color var(--motion-color), opacity var(--motion-considered);
}
.vhero__cue:hover,.vhero__cue:focus-visible{color:var(--white)}
.vhero__cue-line{
  width:1px;
  height:38px;
  background:linear-gradient(180deg,#ffffff00,#ffffff8c);
}
.vhero__cue svg{width:20px;height:20px;animation:vheroNudge 2.4s var(--ease) infinite}
@keyframes vheroNudge{
  0%,100%{transform:translateY(0);opacity:.55}
  50%{transform:translateY(5px);opacity:1}
}
/* Pointless once you have started scrolling, and it would sit on
   top of the Trusted-by band. */
.vhero.is-scrolled .vhero__cue{opacity:0;pointer-events:none}

/* ---------- Reveal stagger ---------- */

/* styles.css already staggers .sol-card via :nth-child, and that
   selector is more specific than these, so the Solutions grid is
   untouched - js/video-hero.js skips it. These carry the case-study
   cards, the product cards and the metric row. Delays are attribute
   selectors rather than a transition-delay set from JS, because a
   style attribute would be blocked by the CSP. */
.reveal[data-stagger="1"]{transition-delay:.07s}
.reveal[data-stagger="2"]{transition-delay:.14s}
.reveal[data-stagger="3"]{transition-delay:.21s}
.reveal[data-stagger="4"]{transition-delay:.28s}
.reveal[data-stagger="5"]{transition-delay:.35s}

/* ---------- Phones ---------- */

/* The video element is removed outright below 760px rather than
   just hidden: 4.7MB of decorative background over cell data is
   not a trade worth making, and object-fit cover on a 9:16 screen
   crops a 16:9 clip down to a letterbox of itself anyway. The
   still does the same job for 28KB. */
@media (width<=760px){
  .vhero{
    min-height:auto;
    padding-block:7rem 5rem;
    background-image:var(--vhero-poster);
    background-size:cover;
    background-position:50% 50%;
  }
  .vhero__video{display:none}
  .vhero>.container{display:block;min-height:0}
  .vhero__inner{padding-block:0}
  .vhero__inner h1{font-size:clamp(1.9rem,8.5vw,2.6rem)}
  .vhero__cue{display:none}
}

/* ---------- Reduced motion ---------- */

/* The global rule in styles.css kills the transitions and the cue
   animation already. What it cannot do is stop a 40-second clip
   from playing, which is the actual motion on this page. */
@media (prefers-reduced-motion:reduce){
  .vhero{
    background-image:var(--vhero-poster);
    background-size:cover;
    background-position:50% 50%;
  }
  .vhero__video{display:none}
  .vhero.is-scrolled .vhero__inner{opacity:1;transform:none}
  .vhero.is-scrolled .vhero__cue{opacity:1}
}
