/* Refraction: an ASCII poster, in Klein blue, black and paper white. */
.hero {
  /* The poster's foot line: the headline block and the scroll button both
     stand on it; the aside sits one button's height above. */
  --hero-foot: clamp(140px, 17svh, 180px);
  position: relative; display: block; height: max(760px, 110svh); min-height: 0;
  padding: 0; isolation: isolate; text-align: left;
  /* `clip` keeps the hero unscrollable while the margin lets the canvas hang
     below it; `hidden` would cut the wave off at the section edge. The margin
     must stay a literal length and match --ref-wave-bleed: it rejects calc(). */
  overflow: clip; overflow-clip-margin: 170px;
  /* Black, the canvas's own ground: whatever the canvas has not painted yet —
     no JS, a failed context, the frame before the first — still reads as the
     poster, and the headline never sits on its own colour. */
  background: var(--ref-black); color: var(--ref-text);
}
.prism-matrix { position: absolute; inset: 0 0 calc(var(--ref-wave-bleed) * -1px); width: 100%; pointer-events: none; }
/* Annotations are facts, set small but never below reading size. */
.hero__edition {
  position: absolute; z-index: 2; left: var(--ref-gutter); right: var(--ref-gutter);
  display: flex; justify-content: space-between; gap: var(--ref-space-3);
  font: var(--label-weight) 11px/1.5 var(--ref-font-label); letter-spacing: .1em; text-transform: uppercase; color: var(--label-ink);
}
.hero__edition { top: 112px; }
.hero__clock:not(:empty)::before { content: '·'; margin: 0 .6em; }
/* Anchored from the foot of the poster, not from a percentage of its top:
   Vietnamese sets the headline in more lines than English, and copy hung
   from the top ran off the first screen. Hung from the bottom it grows
   upwards, into the artwork, which is where overlap is wanted. */
.hero__inner { display: block; position: absolute; z-index: 2; left: var(--ref-gutter); bottom: var(--hero-foot); width: 61%; max-width: none; }
/* A printed tag on the poster: black under the label, so it reads wherever
   the prism's lit rows happen to cross it. */
.hero__kicker { display: table; margin: 0 0 var(--ref-space-4) -8px; padding: 5px 8px; background: var(--ref-black); color: var(--label-ink); font: var(--label-weight) 11px/1.4 var(--ref-font-label); letter-spacing: .1em; text-transform: uppercase; }
.hero__plain {
  --glyph-ink: var(--ref-paper);
  margin: 0; font-family: var(--ref-font-display); font-size: var(--ref-display-size);
  font-weight: var(--ref-display-weight); line-height: var(--ref-display-leading); letter-spacing: var(--ref-heading-tracking); text-transform: uppercase;
  color: var(--ref-paper); max-width: 11ch; text-wrap: initial;
}
/* The claim in paper, then its second half on a slab of the poster's Klein:
   a solid block, so the white on it measures 8.6:1 where Klein type on the
   black measured 2.2. The slab hugs every line it breaks onto (clone), and
   the first line keeps enough air under it that the slab's top — which rides
   above its own line box at this leading — never reaches the letters. */
.hero__plain > span:first-child { display: block; margin-bottom: .2em; }
.hero__plain-dim {
  --glyph-ink: var(--ref-white);
  display: inline; padding: .02em .09em 0;
  background-color: var(--ref-klein); color: var(--ref-white);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.scramble-word { display: inline-block; white-space: nowrap; }
/* Positioned, so every letter paints after every slab behind it. */
.scramble-char { position: relative; display: inline-block; }
.scramble-char[data-glyph] { color: transparent; }
.scramble-char[data-glyph]::after { content: attr(data-glyph); position: absolute; inset: 0; color: var(--glyph-ink); text-align: center; }
html[lang="vi"] .hero__plain { font-size: clamp(50px, 6vw, 94px); line-height: 1.02; max-width: 14ch; }
.hero__note { display: flex; align-items: center; width: auto; min-height: 44px; max-width: 100%; margin: var(--ref-space-5) 0 0; letter-spacing: .06em; transition: color var(--ref-note-duration) ease; padding: 0; gap: var(--ref-space-2); color: var(--label-ink); font: var(--label-weight) 11px/1.5 var(--ref-font-label); text-transform: uppercase; }
.hero__note-mark { color: var(--ref-white); }
.hero__note > span[aria-hidden] { transition: transform var(--ref-hover-duration) ease; }
.hero__note:hover, .hero__note:focus-visible { color: var(--ref-white); }
.hero__note:hover > span[aria-hidden] { transform: translateX(4px); }
/* No rule down its side: the black ground under the text is enough to lift
   it off the artwork. */
.hero__aside { position: absolute; z-index: 2; bottom: calc(var(--hero-foot) + 96px); right: var(--ref-gutter-mobile); width: 23%; max-width: 320px; padding: var(--ref-space-3); background: var(--ref-black); }
.hero__sub { max-width: 36ch; color: var(--ref-text-support); margin: 0; padding: 0; border: 0; font: 400 15px/1.55 var(--font-sans); letter-spacing: -.005em; text-align: left; }
.hero__scroll { position: absolute; z-index: 2; right: 4.5%; bottom: var(--hero-foot); display: flex; gap: var(--ref-space-4); align-items: center; color: var(--label-ink); font: var(--label-weight) 11px/1.5 var(--ref-font-label); letter-spacing: .06em; text-transform: uppercase; }
.hero__scroll-circle { display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid var(--ref-line-control); border-radius: 50%; font: 34px/1 var(--ref-font-display); background: var(--ref-control-surface); transition: background var(--ref-hover-duration), transform var(--ref-hover-duration); }
.hero__scroll:hover .hero__scroll-circle { background: var(--ref-klein); transform: translateY(4px); }
@media (prefers-reduced-motion: reduce) { .hero__note > span[aria-hidden] { transition: none; } }
/* ---- the bar, and the grounds that pass under it ----
   The bar's backdrop is a scrim, so it has to be painted in the colour of
   whatever section is beneath it — otherwise it reads as a band laid over the
   page, which is what a black bar over Klein Works was. This page paints its
   full-bleed sections in three colours: black (the hero, the lab, the finale),
   Klein (Works and the closing step) and paper (the first step).
   CSS cannot tell which one a fixed bar sits on, so buildNavGround in acts.js
   supplies the answer and these rules key off it. Anything that declares no
   ground of its own falls to black — the hero included.

   Whether there is a scrim at all is a separate question from its colour, and
   it has a separate answer: at rest at the top of the page nothing has passed
   under the bar yet, so the bar floats on the poster and the scrim fades in on
   the first scroll. Not for the whole hero — it is 110svh, and the headline,
   the aside and the edition line all travel under the bar inside it. */
body:has(.hero) .mainnav:not(.is-scrolled) { --nav-scrim-opacity: 0; }
/* The fade is deliberately one-way. A transition is taken from the state being
   entered, so hanging it on the scrim-less state dissolves the bar on the way
   back to the top and leaves it arriving hard — which is the only correct way
   round for a mask: an anchor jump into Works lands instantly, and a scrim
   still easing in is a scrim an eyebrow can be read through. */
body:has(.hero) .mainnav:not(.is-scrolled)::before { transition: opacity .25s ease; }
@media (prefers-reduced-motion: reduce) {
  body:has(.hero) .mainnav:not(.is-scrolled)::before { transition: none; }
}
body:has(.hero) .mainnav {
  --nav-scrim-rgb: var(--ref-black-rgb);
  --fg: var(--ref-paper); --fg-dim: var(--ref-text-nav);
  --muted: var(--ref-text-nav); --muted-2: var(--ref-text-nav);
  --line: var(--ref-line-nav);
  color: var(--ref-paper);
  font-family: var(--ref-font-display);
}
body:has(.hero) .mainnav[data-ground="klein"] {
  --nav-scrim-rgb: var(--ref-klein-rgb);
  --line: var(--ref-line-on-klein);
}
/* Paper is the one ground the light bar cannot be read on, so the ink flips
   with it. Values are the case study's ink on paper (project-refraction.css). */
body:has(.hero) .mainnav[data-ground="paper"] {
  --nav-scrim-rgb: var(--ref-paper-rgb);
  --fg: var(--ref-black); --fg-dim: #555850;
  --muted: #555850; --muted-2: #555850;
  --line: #05060633;
  color: var(--ref-black);
}
/* .is-ondark hardcodes paper ink on the bar's labels, and it is raised by the
   stack's own timeline — a few pixels of scroll away from where the ground
   changes. Over paper the ground is the one that is right, so it also has to
   win over the flag rather than wait for it. */
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .brand__text,
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .mainnav__crumb,
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .mainnav__menu,
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .mainnav__lang-cell.is-on { color: var(--ref-black); }
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .mainnav__cv-btn { color: #555850; }
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .mainnav__lang-sep { background: #05060633; }
body:has(.hero) .mainnav.is-ondark[data-ground="paper"] .mainnav__avail { color: var(--ref-black); border-color: #05060633; }
/* The CTA's colours per ground (the rules that paint them are in chrome.css).
   A Klein box on a Klein ground is invisible, so over Works and the closing
   step the box turns white and the hover fill turns it back to Klein. */
body:has(.hero) .mainnav[data-ground="klein"] .mainnav__cta {
  --cta-box: var(--ref-white);
  --cta-arrow: var(--ref-klein);
  --cta-fill-ink: var(--ref-klein);
}
/* Over paper the label is black ink, and the hover fill is black. */
body:has(.hero) .mainnav[data-ground="paper"] .mainnav__cta {
  --cta-ink: var(--ref-black);
  --cta-fill: var(--ref-black);
  --cta-fill-ink: var(--ref-paper);
}
/* Below 900 the poster stops being a composition of corners and becomes a
   column read from the foot: the copy, then the aside beside the scroll
   button. In flow, so nothing can land on anything else in either
   language — the absolute layout overlapped the About button and the aside
   by 32px at 375px. The canvas and the edition line stay absolute. */
@media (max-width: 900px) {
  .hero {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "inner inner" "aside scroll";
    align-content: end; column-gap: var(--ref-space-3); row-gap: var(--ref-space-5);
    padding: 0 var(--ref-gutter-mobile) 104px;
  }
  .hero__edition { top: 96px; left: var(--ref-gutter-mobile); right: var(--ref-gutter-mobile); }
  .hero__inner, .hero__aside, .hero__scroll { position: relative; inset: auto; }
  .hero__inner { grid-area: inner; width: auto; }
  .hero__aside { grid-area: aside; align-self: end; width: auto; max-width: 420px; }
  .hero__scroll { grid-area: scroll; align-self: end; }
  .hero__scroll > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
}
@media (max-width: 760px) {
  :root { --ref-wave-bleed: 120; --ref-wave-tile: 12; }
  .hero { height: max(880px, 112svh); overflow-clip-margin: 120px; }
  .hero__edition { font-size: 10px; letter-spacing: .06em; }
  .hero__plain { font-size: clamp(44px, 13.8vw, 54px); max-width: 12ch; }
  html[lang="vi"] .hero__plain { font-size: clamp(34px, 10.4vw, 64px); max-width: none; }
  .hero__kicker { font-size: 10px; margin-bottom: 14px; }
  .hero__note { margin-top: var(--ref-space-2); font-size: 10px; }
  .hero__aside { padding: var(--ref-space-2) var(--ref-space-2) var(--ref-space-2) 0; }
  .hero__sub { font-size: 14px; }
  .hero__scroll-circle { width: 54px; height: 54px; }
}
@media (prefers-reduced-motion: reduce) { .hero__scroll-circle { transition: none; } }

/* main.js reveals these together; content is visible without JS or motion. */
.hero__sub, .hero__note { opacity: 0; }
body.reduced .hero__sub, body.reduced .hero__note,
html:not(.js) .hero__sub, html:not(.js) .hero__note { opacity: 1; }
