/* ==========================================================================
   Home — page-specific only. Anything reusable lives in css/components/.
   ========================================================================== */

@layer pages {

  /* --- Video hero --------------------------------------------------------- */

  /* `isolation: isolate` is what lets the footage and its shade sit at negative
     z-indexes: they stack behind the copy but stay trapped in this section
     rather than sliding under the page background.

     `svh`, not `vh`: on mobile `100vh` is the viewport with the browser chrome
     retracted, so a `vh` hero is taller than the screen on first paint and the
     bottom-anchored copy starts below the fold. The `vh` line before it is the
     fallback for anything that does not know the unit. */
  .hero-video {
    /* The logo bar sits in flow above this section, so a plain 100svh hero runs
       a header's height past the fold — and takes the scroll cue at its bottom
       edge with it, which is the one thing that must be seen without scrolling.
       Subtracting it makes the hero exactly the screen a visitor first sees.

       Mirrors css/components/site-header.css — 2 x padding + logo + hairline.
       If the logo height changes there, change it here. */
    --header-h: calc(var(--space-5) * 2 + 57px + 1px);

    /* Where the copy starts: the content edge .wrap resolves to, pulled inboard
       by --copy-shift. Sitting exactly on that column edge read as centred once
       the page got wide, and a full-bleed hero wants its statement anchored to
       the frame. One number to tune; the max() floor keeps it off the page
       margin on a narrow screen, where the container is not centring anything
       and there is nothing to pull back from. */
    --copy-shift: 100px;
    --copy-edge: max(var(--gutter), calc((100% - var(--container)) / 2 + var(--gutter) - var(--copy-shift)));

    position: relative;
    display: grid;
    min-height: calc(100vh - var(--header-h));
    min-height: calc(100svh - var(--header-h));
    overflow: hidden;
    isolation: isolate;
    background: var(--surface-page);
    border-bottom: 1px solid var(--line);
  }

  .hero-video__media {
    position: absolute;
    inset: 0;
    z-index: -3;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    animation: hero-video-in 1.4s ease-out both;
  }

  /* Two gradients, one element: the 90deg wash darkens the side the copy sits
     on, the 180deg one seats the header at the top and blends the bottom edge
     into the section below. */
  .hero-video__shade {
    position: absolute;
    inset: 0;
    z-index: -2;
    background:
      linear-gradient(90deg, rgba(7, 10, 8, .88) 0%, rgba(7, 10, 8, .6) 42%, rgba(7, 10, 8, .1) 74%),
      linear-gradient(180deg, rgba(7, 10, 8, .48) 0%, transparent 28%, transparent 62%, rgba(7, 10, 8, .72) 100%);
  }

  /* A dot grid at soft-light — invisible as texture, but it breaks up the
     banding a smooth gradient shows across a wide dark screen. */
  .hero-video__shade::after {
    content: "";
    position: absolute;
    inset: 0;
    opacity: .08;
    background-image: radial-gradient(rgba(255, 255, 255, .55) .5px, transparent .5px);
    background-size: 4px 4px;
    mix-blend-mode: soft-light;
  }

  /* Anchored to the bottom of the frame, not centred: it keeps the upper half
     of the footage clear and gives the scroll cue a line to sit on. */
  .hero-video__content {
    align-self: end;
    width: min(780px, calc(100% - 2 * var(--copy-edge)));
    margin: 0 0 clamp(86px, 12vh, 132px) var(--copy-edge);
  }

  .hero-video__eyebrow {
    display: flex;
    align-items: center;
    gap: .8em;
    margin-bottom: clamp(22px, 4vh, 38px);
    font-size: clamp(10px, .9vw, 12px);
    font-weight: var(--weight-bold);
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--cx-green-bright);
  }

  .hero-video__eyebrow::before {
    content: "";
    width: clamp(34px, 4vw, 58px);
    height: 1px;
    background: var(--cx-green);
  }

  /* The middots, dimmed so they separate without competing. */
  .hero-video__eyebrow span { opacity: .62; }

  /* 16ch and a lower ceiling than the reference's 12ch/104px: this headline is
     51 characters against its 30, and at that measure it stacked five lines of
     display type that overran a laptop viewport. */
  /* `line-height` has to clear the ink, not the em box. At 72px this face draws
     56px above the baseline and 16px below — 72px of ink against the reference's
     .94 line box of 67.9px, so descenders landed on the next line's capitals.
     1.04 puts ~3px of air between them.

     Tracking is loosened from the reference's -.052em for the same reason: at
     this size that was -3.8px a letter, which closed the gaps inside pairs like
     "rg" and "gy". */
  .hero-video__title {
    max-width: 16ch;
    font-size: clamp(40px, 5.6vw, 80px);
    font-weight: var(--weight-semibold);
    line-height: 1.04;
    letter-spacing: -.02em;
    color: var(--text-primary);
    text-wrap: balance;
    text-shadow: 0 4px 30px rgba(0, 0, 0, .28);
  }

  .hero-video__title em {
    font-style: normal;
    font-weight: var(--weight-light);
    color: var(--cx-green-bright);
  }

  .hero-video__lede {
    max-width: 610px;
    margin-top: clamp(24px, 3.5vh, 34px);
    padding-left: clamp(18px, 2vw, 28px);
    font-size: clamp(15px, 1.25vw, 18px);
    line-height: 1.7;
    color: rgba(239, 236, 228, .82);
    border-left: 1px solid rgba(92, 240, 147, .55);
  }

  /* A ruled link rather than a filled button: over footage a solid green slab
     fights the image, and the widening gap on hover reads as motion. */
  .hero-video__cta {
    display: inline-flex;
    align-items: center;
    gap: 34px;
    margin-top: clamp(30px, 4vh, 42px);
    padding: 13px 0 11px;
    font-size: 12px;
    font-weight: var(--weight-bold);
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(92, 240, 147, .65);
    transition: color .25s, gap .25s, border-color .25s;
  }

  .hero-video__cta:hover {
    gap: 44px;
    color: var(--cx-green-bright);
    border-color: var(--cx-green-bright);
  }

  /* Scroll cue — set vertically down the right edge, with a hairline that fades
     out the way the eye is meant to travel. */
  /* Pinned to the corner on the page gutter, not the container edge: the cue
     marks the frame rather than the text column, so it holds the same inset at
     every width instead of drifting inward as the page gets wide. */
  .hero-video__scroll {
    position: absolute;
    right: var(--gutter);
    bottom: clamp(34px, 5vh, 54px);
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 10px;
    font-weight: var(--weight-semibold);
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(239, 236, 228, .72);
    writing-mode: vertical-rl;
    transition: color .25s;
  }

  .hero-video__scroll:hover { color: var(--cx-green-bright); }

  .hero-video__scroll i {
    width: 1px;
    height: 54px;
    background: linear-gradient(var(--cx-green), transparent);
  }

  /* The hero is above the fold at first paint, so its entrance runs on a delay
     rather than through reveal.js — there is nothing to scroll into view. */
  :where(.js) .hero-video__eyebrow,
  :where(.js) .hero-video__title,
  :where(.js) .hero-video__lede,
  :where(.js) .hero-video__cta {
    opacity: 0;
    transform: translateY(24px);
    animation: hero-copy-in .9s var(--ease-out) forwards;
  }

  :where(.js) .hero-video__title { animation-delay: .16s; }
  :where(.js) .hero-video__lede { animation-delay: .3s; }
  :where(.js) .hero-video__cta { animation-delay: .42s; }

  @keyframes hero-copy-in { to { opacity: 1; transform: none; } }

  @keyframes hero-video-in {
    from { opacity: .4; scale: 1.025; }
    to { opacity: 1; scale: 1; }
  }

  /* The home page is the only one that sets a looser default leading; the
     other five pages use the 1.5 in reset.css. */
  body { line-height: 1.6; }

  /* --- Nexus intro --------------------------------------------------------
     This heading runs larger than .display-2 — it is the page's second hero,
     not a section title. Sizes here are the design's own, not scale steps.
     ------------------------------------------------------------------------ */
  .nexus__title {
    max-width: 13ch;
    margin-top: 24px;
    font-size: clamp(40px, 5.4vw, 72px);
  }

  .nexus__lede {
    max-width: 560px;
    font-size: clamp(16px, 1.35vw, 20px);
  }

  .nexus__actions {
    gap: 28px;
    margin-top: 36px;
  }

  /* --- Track record ------------------------------------------------------- */
  .track-record {
    margin-top: clamp(32px, 4vh, 48px);
    padding-top: clamp(28px, 3.5vh, 40px);
    border-top: 1px solid var(--line);
  }

  .track-record__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: clamp(22px, 3vh, 32px);
  }

  .track-record__note {
    max-width: 440px;
    font-size: 13.5px;
    line-height: var(--leading-normal);
    color: var(--text-muted);
  }

  .metrics { display: grid; grid-template-columns: repeat(4, 1fr); }

  /* --- Latest insights ---------------------------------------------------- */
  .insights { background: var(--surface-card); }

  .insights__head { margin-bottom: clamp(36px, 4.5vh, 56px); }

  .insights__title { margin-top: 18px; }

  /* --- Responsive --------------------------------------------------------- */
  @media (max-width: 1020px) {
    .metrics { grid-template-columns: repeat(2, 1fr); }
  }

  /* The shade's horizontal wash assumes the copy occupies the left of a wide
     frame. On a phone it spans the full width, so swap to a purely vertical
     gradient and drop the rule and the scroll cue, neither of which has room. */
  @media (max-width: 760px) {
    .hero-video__shade {
      background: linear-gradient(180deg, rgba(7, 10, 8, .58), rgba(7, 10, 8, .3) 28%, rgba(7, 10, 8, .82) 100%);
    }

    .hero-video__content {
      width: calc(100% - 48px);
      margin: 0 24px 72px;
    }

    .hero-video__eyebrow {
      gap: .52em;
      letter-spacing: .13em;
      white-space: nowrap;
    }

    .hero-video__eyebrow::before { display: none; }

    .hero-video__title {
      max-width: none;
      font-size: clamp(38px, 11vw, 60px);
    }

    .hero-video__lede {
      max-width: 40ch;
      font-size: 14px;
      line-height: 1.62;
    }

    .hero-video__scroll { display: none; }
  }

  /* 680px is where site-header.css shrinks its padding and logo, so the hero's
     mirror of that height has to step down on the same breakpoint. */
  @media (max-width: 680px) {
    .hero-video { --header-h: calc(var(--space-4) * 2 + 44px + 1px); }

    .metrics { grid-template-columns: 1fr; }
  }

  /* The zoom-in and the staggered copy are decoration; the hero must arrive
     finished for anyone who has asked for less motion. */
  @media (prefers-reduced-motion: reduce) {
    .hero-video__media,
    :where(.js) .hero-video__content > * {
      opacity: 1;
      transform: none;
      animation: none;
    }
  }
}
