/* ============================================================
   THE STREAMS HERO (.hero--streams)
   Loaded after v3-sections.css and scoped to the modifier, so the previous
   hero's rules stay in place untouched for the day it is brought back.

   One centred column of copy, and under it a drawing that takes whatever
   height is left in the pinned 100svh stage: four streams of a case file
   run into the mark and leave as one stream of answers. The moving text
   and the linework are a canvas (assets/v3/hero-streams.js); the labels,
   the mark and the question chip are ordinary elements placed by that
   script from the same geometry.

   EVERY COLOUR IS A TOKEN. The hero is dark because the page tone is dark
   while it is on stage (.opening-tone, below), not because anything here
   says navy. Remove that marker and the same rules draw it on paper.
   ============================================================ */

/* ---- the tone marker ----
   v3.js keeps html.tone-page-dark on while this element's foot is below 78%
   of the viewport. It scrolls with the page (it is not on the sticky stage),
   so its height is a scroll distance: 180svh puts the flip to paper at
   ~102svh of scroll, which is --exit ~0.87 - the form, last of the copy to
   leave, lands at 0.88 - and the reveal sentence begins arriving at 110svh. */
.opening-tone {
  position: absolute;
  inset: 0 0 auto 0;
  height: 180svh;
  pointer-events: none;
}

/* ---- the section ----
   A column at every width: the two-column grid the previous hero switches
   to at 1000px is overridden here, along with the cqi sizing that went
   with its half-width copy column. */
.hero.hero--streams {
  display: flex;
  flex-direction: column;
  /* Centred, which only shows where the drawing hits its max-height (a
     portrait tablet): everywhere else it grows to fill the stage. */
  justify-content: center;
  /* The grid's place-items: center would otherwise shrink the drawing to
     the width of its content, which is nothing. */
  place-items: normal;
  align-items: stretch;
  gap: 0;
  padding: calc(var(--nav-h) + clamp(14px, 4.4svh, 56px)) 0 0;
  text-align: center;
}
/* WHERE THINGS SIT, on a screen wide enough for it. Measured against the
   reference at the same window: its copy starts a fifth of the way down and
   its drawing ends a tenth short of the foot, where the first pass here had
   the copy at 15% and the lowest stream at 96%. Two moves get there:
   the copy comes down (more clearance under the nav), and the drawing comes
   UP - its box starts level with the form rather than under it, so the two
   corner captions flank the form and the streams begin just below it. That
   overlap needs the form to be clear of the captions, hence the width.
   The clearance gives way on short windows (22svh - 100px is 98px at 900
   tall, 43px at 650): the drawing needs the height more than the nav does. */
@media (min-width: 1000px) {
  .hero.hero--streams { padding-top: calc(var(--nav-h) + clamp(26px, 22svh - 100px, 132px)); }
  /* The form is 60px tall; -37px puts the captions' line on its centre. */
  .hero--streams .hero-streams { margin-top: -37px; }
}
.hero--streams .hero-copy {
  flex: 0 0 auto;
  width: auto;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--gutter);
  container-type: normal;
}

/* THE GROUND. One radial gradient, built the way the reference builds its
   hero (radial-gradient(120% 90% at 50% 0%, ...) with stops at 0 / 45% /
   100%): an ellipse anchored at the top centre, lightest where it starts,
   a mid tone at 45%, the page colour at its edge - so the hero is a little
   lighter at the top and settles into the plain page by the bottom corners,
   with no seam where the next section begins.

   The tones are the mark's blue mixed into the page colour, so it is the
   same gradient on either tone: a navy from #1B2E45 to the page on dark
   (the reference's three greens differ by about the same steps), and the
   faintest blue-white to white on paper. No second light behind the node -
   the reference has none. Leaves with the hero. */
.hero-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: calc(1 - var(--exit, 0) * 1.3);
  background: radial-gradient(120% 90% at 50% 0%,
    color-mix(in srgb, var(--brand-mark) 13%, var(--paper)) 0%,
    color-mix(in srgb, var(--brand-mark) 6%, var(--paper)) 45%,
    var(--paper) 100%);
}

/* ---- the copy ---- */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  vertical-align: top;                     /* no descender gap inside the slot */
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: color-mix(in srgb, var(--ink) 4%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .1em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
  text-decoration: none;
  transition: color .25s, border-color .25s, background-color .25s;
}
.hero-badge .arr { width: 13px; height: 13px; margin-left: -2px; transition: transform .4s var(--ease-out); }
a.hero-badge:hover { color: var(--ink); border-color: var(--line-strong); }
a.hero-badge:hover .arr { transform: translateX(3px); }
.hero-badge-tag {
  padding: 5px 7px 4px;
  border-radius: 2px;
  background: var(--brand-mark);
  color: #0D1826;
  letter-spacing: .12em;
}
/* One line at every width that can hold it. Sized against the viewport's
   height as well as its width: the stage is exactly 100svh and the drawing
   below needs what the copy does not take. */
.hero--streams h1 {
  font-size: clamp(40px, min(6.6vw, 11.5svh), 98px);
  line-height: 1.05;
  text-wrap: balance;
}
.hero--streams .hero-sub {
  width: auto;
  min-width: 0;
  max-width: 62ch;
  margin: clamp(14px, 2.4svh, 26px) auto 0;
  text-wrap: balance;
}
.hero--streams .hero-form { margin-top: clamp(20px, 3.6svh, 38px); }
/* The validation nudge and the submit result float under the form instead
   of taking a row: a row would push the drawing down and rebuild it every
   time someone mistypes an address. Opaque, because they sit over it. */
.hero--streams .hero-input-tip,
.hero--streams .hero-form-msg {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  z-index: 3;
  width: min(520px, 100% - 2 * var(--gutter));
  margin-top: 12px;
  text-align: left;
  background: color-mix(in srgb, var(--warn) 9%, var(--paper));
}
.hero--streams .hero-form-msg.is-success { background: color-mix(in srgb, var(--ember) 9%, var(--paper)); }
/* The whole heading in one ink. .hero-key marks the word for later. */
.hero--streams h1 .hero-key { color: inherit; }

/* The copy's drops (see .sink in v3-sections.css). Four lines in reading
   order - badge, heading, sub, form - on --y1..--y4. The heading is one
   line now, so it moves from --y1 to --y2 and the badge takes the first. */
.sink > .hero-badge { translate: 0 calc(var(--y1, 0) * 100%); will-change: translate; }
/* The space under the badge belongs to its slot, not to the badge: inside
   the slot it would be 26px of extra floor the badge has to cross before
   it is cut off, and a drop of its own height would leave it half showing. */
.hero--streams .hero-copy > .sink:first-child { margin-bottom: clamp(14px, 2.6svh, 26px); }
.hero--streams h1 .sink:nth-child(1) .sink-in { translate: 0 calc(var(--y2, 0) * 100%); }

/* ---- the drawing ----
   Takes the rest of the stage. Fades on the first 40% of the exit, ahead
   of the copy: the streams thin out, then the lines of copy drop. */
.hero-streams {
  position: relative;
  z-index: 1;
  flex: 1 1 0;
  min-height: 230px;
  /* A tall, narrow stage would stretch the fan into a tangle; past this
     the drawing stops growing and the column centres instead. */
  max-height: max(440px, 64vw);
  margin-top: clamp(10px, 2.6svh, 34px);
  color: var(--ink);                       /* the canvas reads this as its ink */
  --hs-accent: var(--brand-mark);          /* the mark, its ring and the chip */
  /* The outgoing line and the outcome marks. --brand-blue re-tones with the
     page: the deep heading blue on paper, a light blue (within a shade of
     the mark's) on the dark tone. The mark's own #82bfff is 1.9:1 on paper
     and all but vanishes as a 1.5px line. */
  --hs-line: var(--brand-blue);
  /* Strength of every line, in and out alike. Set per tone: a faint line
     reads as grey whatever its hue, and the deep blue needs more of itself
     on paper than the light blue does on navy. */
  --hs-line-a: .72;
  --hs-d: 76px;
  opacity: calc(1 - var(--exit, 0) * 2.5);
}
.hs-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
html.js-fx .hs-canvas { opacity: 0; transition: opacity 1.1s var(--ease-out) .15s; }
html.js-fx .hero-streams.is-ready .hs-canvas { opacity: 1; }

/* Corner captions and the four stream names: the site's eyebrow voice. */
.hs-side,
.hs-label {
  position: absolute;
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .14em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink-3);
}
.hs-side { top: 0; display: inline-flex; align-items: center; gap: 9px; color: var(--ink-2); }
.hs-side--in  { left:  var(--hs-pad, 48px); }
.hs-side--out { right: var(--hs-pad, 48px); }
.hs-side i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.hs-side--out i { background: var(--hs-line); }
.hs-label { translate: 0 -100%; }
/* When the stage is too narrow for the streams to start inside it they
   start just off its left edge instead, and their names have nowhere to
   stand: on a short run the upper streams cross the lower ones' captions.
   The two corner captions stay - they name the two sides. */
.hero-streams.is-cropped .hs-label { display: none; }

/* The mark. A disc in the logo's own blue with the glyph in navy, and a
   ring that leaves it every few seconds.

   It is also the tone switch - an easter egg, so it says nothing about it:
   no label, no icon. On hover the disc lifts by 5% and the cursor changes,
   which is just enough to say there is something there; a press sinks it
   back. A button, so it is reachable by keyboard, with a focus ring that
   only shows for keyboard focus. */
.hs-node {
  position: absolute;
  z-index: 2;
  left: var(--hs-cx, 50%);
  top: var(--hs-cy, 62%);
  width: var(--hs-d);
  height: var(--hs-d);
  margin: calc(var(--hs-d) / -2) 0 0 calc(var(--hs-d) / -2);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hs-node:focus-visible { outline: 1px solid var(--hs-line); outline-offset: 5px; }
/* Gone from under the pointer once the drawing has faded on scroll. */
.hero-streams.is-faded .hs-node { pointer-events: none; }
.hs-disc {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  /* Flat, as the reference's is: no glow under it, no soft ring round it.
     The pulse (.hs-halo) is the only thing that leaves it. */
  background: var(--hs-accent);
  transition: scale .45s var(--ease-out);
}
.hs-node:hover .hs-disc { scale: 1.05; }
.hs-node:active .hs-disc { scale: .97; transition-duration: .12s; }
.hs-disc svg { width: 50%; height: auto; display: block; fill: #0D1826; }
.hs-halo {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 1px solid var(--hs-accent);
  opacity: 0;
}

/* The question. One chip at a time, swapped by the script as each answer
   starts to leave the mark. */
.hs-ask {
  position: absolute;
  pointer-events: none;
  left: var(--hs-cx, 50%);
  /* Clear of the ring at its widest: the halo stands 16px off the disc and
     grows to 1.45x, so its reach is (d/2 + 16) * 1.45; 12px beyond that. */
  top: calc(var(--hs-cy, 62%) - (var(--hs-d) / 2 + 16px) * 1.45 - 12px);
  width: 0;
  height: 0;
}
.hs-chip {
  position: absolute;
  left: 0;
  bottom: 0;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  /* Its box (.hs-ask) is 0 wide, so the chip must size itself: an explicit
     max-content width, and the space after the icon as a margin, not a flex
     gap. Safari on iPhone left the gap out of the width it worked out and
     the words ran into the right-hand padding. */
  width: -webkit-max-content;
  width: max-content;
  padding: 10px 14px 10px 12px;
  /* Quiet: the mark's blue belongs to the mark. The chip is a label in the
     page's own colours - a step off the ground, a hairline, ink text - and
     only its small outcome icon carries the blue. Tokens, so it is near-white
     on paper and a lifted navy on the dark tone. */
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: color-mix(in srgb, var(--ink) 4%, var(--paper));
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 10px 28px -18px rgba(var(--shadow-rgb), .45);
}
.hs-chip svg { width: 14px; height: 14px; flex: 0 0 auto; margin-right: 9px; color: var(--hs-line); }

@keyframes hs-halo     { from { opacity: .55; scale: 1; } to { opacity: 0; scale: 1.45; } }
@keyframes hs-chip-in  { from { opacity: 0; translate: -50% 10px; filter: blur(2px); } to { opacity: 1; translate: -50% 0; filter: blur(0); } }
@keyframes hs-chip-out { from { opacity: 1; translate: -50% 0; } to { opacity: 0; translate: -50% -10px; } }

@media (prefers-reduced-motion: no-preference) {
  .hs-halo { animation: hs-halo 3s var(--ease-out) infinite; }
  .hs-chip.is-in  { animation: hs-chip-in .55s var(--ease-out) both; }
  .hs-chip.is-out { animation: hs-chip-out .35s var(--ease) both; }
}
@media (prefers-reduced-motion: reduce) {
  .hs-chip.is-out { display: none; }
  html.js-fx .hs-canvas { transition: none; }
}

@media (max-width: 760px) {
  .hero-streams { --hs-d: 60px; }
  .hs-chip { font-size: 13px; padding: 9px 12px 9px 10px; }
  .hs-halo { inset: -12px; }
  .hs-side { font-size: 10px; letter-spacing: .08em; gap: 7px; }
}

/* Without JS there is no canvas to draw and no script to place the mark;
   the copy stands on its own and the drawing's box is simply not there. */
html:not(.js-fx) .hero-streams { display: none; }

html.tone-page-dark .hero-streams { --hs-line-a: .62; }

/* ---- the form's button ----
   In the button voice the nav uses (sans, sentence weight, no tracking),
   not the mono capitals the form had: spaced capitals beside a
   placeholder in the sans read as two controls set in two languages. */
.hero--streams .hero-form button {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -.005em;
  text-transform: none;
  gap: 10px;
  padding: 0 22px;
}
.hero--streams .hero-form button .arr { width: 16px; height: 16px; }

