/* Haywebs prototype — base styles shared by every page: reset, type, header,
   buttons, chapters and the shutter, plate frames, the process rail, the
   accordion, reveals, the entrance and the phone menu. Load after tokens.css.

   Class protocol on <html> (see README): .no-js → .js (inline script in the
   head), .go (motion.js, starts the entrance), .still (reduced motion),
   .again (repeat visit in the session: the entrance runs at half length).
   Everything that moves sits under prefers-reduced-motion: no-preference. */

/* ---------------------------------------------------------------- reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; scroll-padding-top: var(--hdr); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 var(--fs-body) / var(--lh-body) var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p, figure, blockquote { margin: 0; }
img, canvas, svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--r); }
/* on paper the ring is ink: in a light section, and in the header over one
   (unless the phone menu's dark overlay is open) */
[data-tone="light"] :focus-visible, .hdr.on-light:not(.menu-open) :focus-visible { outline-color: var(--ink); }
.skip { position: fixed; left: 16px; top: -80px; z-index: 99; padding: 10px 16px; background: #fff; color: var(--ink); border-radius: 8px; }
.skip:focus { top: 16px; }

/* ----------------------------------------------------------------- type --- */
/* The wordmark's face (Montserrat ExtraBold Italic) in four sizes: .display
   alone is a section h2; the modifiers are the home hero, the h1 of the other
   pages, and a chapter h2 such as «Кейсы». */
.display { font: italic 800 var(--fs-h2) / 1.06 var(--brand); letter-spacing: var(--ls-display); }
.display-hero { font-size: var(--fs-hero); line-height: var(--lh-display); }
.display-title { font-size: var(--fs-title); line-height: 1.02; }
.display-chapter { font-size: var(--fs-chapter); line-height: 1.02; }

/* A headline line as a mask for the entrance; the padding keeps the accents,
   the descenders and the italic's lean inside it. --x indents the line (in em). */
.ln { display: block; width: max-content; max-width: 100%; overflow: hidden; padding: 0.1em 0.14em 0.2em 0.08em; margin: -0.1em 0 -0.2em calc(var(--x, 0em) - 0.08em); }
.ln-in { display: block; }

.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font: 600 var(--fs-label) / 1 var(--sans); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-2);
}
.eyebrow::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
/* a chapter's opener: a hairline, then a label row; the <span> is the bright part */
.kicker {
  display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: clamp(28px, 4vw, 56px); padding-top: 16px; border-top: 1px solid var(--line);
  font: 600 var(--fs-label) / 1 var(--sans); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text-2);
}
.kicker span { color: var(--text); }
.lead { font-size: var(--fs-lead); line-height: var(--lh-body); color: var(--text-2); max-width: 46ch; }

/* --------------------------------------------------------------- header --- */
.hdr {
  --fg: var(--text); --on: var(--bg);
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--hdr); padding: 0 var(--g);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  color: var(--fg); transition: color 0.45s var(--soft);
}
/* the frosted ground lives on a pseudo-element, so the fixed menu is not trapped */
.hdr::before {
  content: ""; position: absolute; inset: 0; opacity: 0; transition: opacity 0.45s var(--soft);
  background: rgb(241 239 234 / 0.84); box-shadow: 0 1px 0 var(--rule);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
/* motion.js sets .on-light while a [data-tone="light"] section is under the header */
.hdr.on-light { --fg: var(--ink); --on: var(--paper); }
.hdr.on-light::before { opacity: 1; }
/* without JS the tone cannot follow the chapters: keep a dark ground instead */
.no-js .hdr::before { opacity: 1; background: rgb(8 8 10 / 0.95); box-shadow: none; }
.brand, .hdr-end { position: relative; z-index: 2; }
.brand { display: inline-flex; align-items: center; gap: 10px; justify-self: start; }
.brand img { width: 24px; height: 24px; }
.wordmark { font: italic 800 20px/1 var(--brand); letter-spacing: -0.01em; }
.wordmark sup { font-size: 0.42em; margin-left: 1px; vertical-align: 1.1em; }
.nav { position: relative; z-index: 2; }
.nav ul { display: flex; gap: clamp(18px, 2.4vw, 36px); margin: 0; padding: 0; list-style: none; }
.nav a { font-size: 14px; font-weight: 500; opacity: 0.66; transition: opacity 0.3s; }
.nav a:hover, .nav a[aria-current] { opacity: 1; }
.hdr-end { display: flex; align-items: center; justify-content: flex-end; gap: 12px; grid-column: 3; }
.lang {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px;
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent); border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
}
.lang a:not([aria-current]), .lang span { opacity: 0.45; }
.menu-btn { display: none; }

/* -------------------------------------------------------------- buttons --- */
/* Colours come from the tone tokens, so a button reads on either ground; the
   hover only dims toward the ground (the accent is kept for focus and markers). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 52px; padding: 0 26px;
  border: 0; border-radius: var(--r-pill); background: transparent; color: inherit;
  font: 600 15px/1 var(--sans); white-space: nowrap; cursor: pointer;
  transition: background-color var(--t-fast) var(--soft), color var(--t-fast) var(--soft), box-shadow var(--t-fast) var(--soft);
}
.btn-sm { height: 38px; padding: 0 18px; font-size: 14px; background: var(--fg); color: var(--on); }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--text) 86%, var(--bg)); }
.btn-ghost { box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent); }
.btn-ghost:hover { box-shadow: inset 0 0 0 1px currentColor; }

/* ------------------------------------------------- chapters and tone --- */
/* a chapter's content keeps to --measure, centred; its ground spans the page */
.chapter { position: relative; padding: clamp(96px, 11vw, 160px) max(var(--g), (100% - var(--measure)) / 2); }
/* the one light chapter: paper and ink, with the tone tokens remapped locally
   so text, lines and buttons inside follow without their own rules */
[data-tone="light"] {
  --bg: var(--paper); --surface: var(--paper-2); --surface-2: var(--paper-2);
  --text: var(--ink); --text-2: var(--ink-2); --text-3: var(--ink-2);
  --line: var(--rule); --line-strong: rgb(0 0 0 / 0.2);
  background: var(--paper); color: var(--ink);
}
/* The pinned hero stays put while the .shutter chapter slides over it;
   motion.js writes the shutter's progress to [data-pinned] as --p (0 → 1).
   Everything after it (chapters, a footer) is opaque and above it, or the
   pinned hero would show through; in a light section --bg is the paper. */
[data-pinned] { position: sticky; top: 0; z-index: 1; }
[data-pinned] ~ * { position: relative; z-index: 2; background: var(--bg); }
.shutter { position: relative; z-index: 2; }
/* the shutter's soft rule: a lit 2 px edge */
.shutter::before {
  content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 2px;
  background: linear-gradient(90deg, rgb(255 255 255 / 0.2), #fff 30%, #fff 70%, rgb(255 255 255 / 0.2));
  box-shadow: 0 0 14px rgb(255 255 255 / 0.35);
}

/* --------------------------------------------------- plates and grain --- */
/* A plate's frame. Without JS or canvas it shows its hue (--c, "r g b") as
   two soft lights; with them, art.js paints the canvas over it. */
.media {
  position: relative; overflow: hidden; aspect-ratio: 4 / 3; border-radius: var(--r);
  background:
    radial-gradient(55% 70% at 68% 38%, rgb(var(--c, var(--c-cyan)) / 0.55), transparent 70%),
    radial-gradient(45% 55% at 22% 78%, rgb(var(--c, var(--c-cyan)) / 0.28), transparent 70%),
    #07080a;
}
.media canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.media::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: 0.16; mix-blend-mode: overlay; pointer-events: none; }
/* static film grain over a dark scene; :where keeps a host's own position */
:where(.grain) { position: relative; }
.grain::after { content: ""; position: absolute; inset: 0; background: var(--grain); opacity: 0.05; pointer-events: none; }

/* ---------------------------------------------------- process rail --- */
/* Steps share one grid (subgrid rows), so every dot sits on the same line:
   head (number, title) / dot / body (text, term). The line is the rail's
   ::before, absolutely placed in the dot row (both lines given: for an
   absolute grid child an `auto` end means the container's edge). Vertical on phones. */
.rail {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-rows: auto auto auto;
  column-gap: clamp(16px, 2vw, 32px); margin: 0; padding: 0; list-style: none;
}
.rail::before { content: ""; position: absolute; grid-row: 2 / 3; left: 0; right: 0; top: 50%; height: 1px; background: var(--line-strong); transform-origin: left; }
.rail-step { display: grid; grid-row: span 3; grid-template-rows: subgrid; }
.rail-head { align-self: end; padding-bottom: 22px; font: 600 var(--fs-h3) / 1.3 var(--sans); letter-spacing: -0.012em; }
.rail-n { display: block; margin-bottom: 12px; font-size: var(--fs-label); letter-spacing: var(--ls-label); color: var(--text-3); }
/* lit by default; motion.js dims the dots until the rail is revealed */
.rail-dot {
  position: relative; z-index: 1; align-self: center; width: 11px; height: 11px; border-radius: 50%;
  border: 1px solid var(--text); background: var(--text); box-shadow: 0 0 0 5px rgb(255 255 255 / 0.06), 0 0 18px rgb(255 255 255 / 0.4);
}
.rail-body { padding-top: 22px; font-size: var(--fs-small); line-height: 1.55; color: var(--text-2); }
.rail-body p { max-width: 28ch; }
.rail-term { margin-top: 14px; font: 600 var(--fs-label) / 1 var(--sans); letter-spacing: var(--ls-label); text-transform: uppercase; color: var(--text); }

@media (max-width: 760px) {
  .rail { grid-auto-flow: row; grid-template-columns: 11px minmax(0, 1fr); grid-template-rows: none; column-gap: 22px; row-gap: 40px; }
  .rail::before { grid-row: auto; grid-column: 1 / 2; top: 0; bottom: 0; left: 5px; right: auto; width: 1px; height: auto; transform-origin: top; }
  .rail-step { grid-row: auto; grid-column: 1 / -1; grid-template-rows: none; grid-template-columns: subgrid; }
  .rail-dot { grid-column: 1; grid-row: 1; align-self: start; margin-top: 4px; }
  .rail-head { grid-column: 2; grid-row: 1; padding-bottom: 10px; }
  .rail-body { grid-column: 2; padding-top: 0; }
}

/* ------------------------------------------------------------ accordion --- */
/* [data-accordion] > .acc-item > h3.acc-q > button[aria-expanded][aria-controls]
   + .acc-a[role=region] > div. Without JS every answer is open. */
.acc-item { border-top: 1px solid var(--line); }
.acc-item:last-child { border-bottom: 1px solid var(--line); }
.acc-q button {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; padding: 24px 0;
  border: 0; background: none; color: inherit; font: 600 17px/1.4 var(--sans); text-align: left; cursor: pointer;
}
/* a plus of two hairlines; turned 45° it is the close cross */
.acc-icon { position: relative; flex: none; width: 14px; height: 14px; }
.acc-icon::before, .acc-icon::after { content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.5px; margin-top: -0.75px; background: currentColor; }
.acc-icon::after { transform: rotate(90deg); }
[aria-expanded="true"] > .acc-icon { transform: rotate(45deg); }
.acc-a { display: grid; grid-template-rows: 1fr; }
.acc-a > * { min-height: 0; overflow: hidden; }
.acc-a p { max-width: 62ch; padding-bottom: 24px; color: var(--text-2); }
.js .acc-a { grid-template-rows: 0fr; visibility: hidden; } /* hidden: nothing inside takes focus */
.js .acc-a.open { grid-template-rows: 1fr; visibility: visible; }

/* ---------------------------------------- seal → header mark (home) --- */
/* motion.js flies [data-seal] into [data-mark] while the shutter rises:
   --fx/--fy/--fs on the seal (translate, scale), --fo its fade, --mo the
   mark's. Phones keep the seal in the flow and the mark always visible. */
@media (min-width: 861px) and (prefers-reduced-motion: no-preference) {
  .js [data-seal] { transform-origin: 0 0; transform: translate(var(--fx, 0px), var(--fy, 0px)) scale(var(--fs, 1)); opacity: var(--fo, 1); }
  .js:has([data-seal]) [data-mark] { opacity: var(--mo, 0); }
}

/* ------------------------------------------------- entrance, reveals --- */
/* .ln-in: headline lines rise from their masks, 120 ms apart (--i);
   .a-2 / .a-3: the second and third stages, from 0.8 s and 1.2 s;
   .hdr.a-3: the header joins the third stage, opacity only (a transform
   would trap the fixed menu). All of it × --tempo. */
@media (prefers-reduced-motion: no-preference) {
  .js:not(.go) .ln-in { transform: translateY(112%); }
  .js:not(.go) :is(.a-2, .a-3) { opacity: 0; }
  .js.go .ln-in { animation: rise calc(0.96s * var(--tempo)) var(--ease) calc(var(--i, 0) * 120ms * var(--tempo)) both; }
  .js.go .a-2 { animation: fade calc(0.8s * var(--tempo)) var(--soft) calc(0.8s * var(--tempo)) both; }
  .js.go .a-3 { animation: fade calc(0.8s * var(--tempo)) var(--soft) calc(1.2s * var(--tempo)) both; }
  .js.go .hdr.a-3 { animation-name: show; }

  /* scroll reveals: hidden until motion.js adds .in; [data-stagger] parents
     give their revealed children --d, 90 ms apart */
  .js [data-reveal] { opacity: 0; transform: translateY(56px) scale(0.96); transition: opacity 0.9s var(--soft), transform 1.2s var(--ease); transition-delay: calc(var(--d, 0) * 90ms); }
  .js [data-reveal].in { opacity: 1; transform: none; }

  /* the rail draws left to right, then its dots light 120 ms apart (--i) */
  .js .rail::before { transform: scaleX(0); transition: transform 0.9s var(--ease); }
  .js .rail:not(.in) .rail-dot { border-color: var(--line-strong); background: var(--bg); box-shadow: none; }
  .js .rail.in::before { transform: none; }
  .js .rail-dot { transition: background-color 0.4s var(--soft), border-color 0.4s var(--soft), box-shadow 0.6s var(--soft); transition-delay: calc(var(--i, 0) * 120ms); }

  .js .acc-a { transition: grid-template-rows 0.5s var(--ease), visibility 0s 0.5s; }
  .js .acc-a.open { transition: grid-template-rows 0.5s var(--ease); }
  .acc-icon { transition: transform var(--t-fast) var(--ease); }
  .media { transition: transform 0.9s var(--ease); }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 760px) {
  .js .rail::before { transform: scaleY(0); }
  .js .rail.in::before { transform: none; }
}
/* only the start is given: each ends on the element's own resting style */
@keyframes rise { from { transform: translateY(112%); letter-spacing: 0.06em; } }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }
@keyframes show { from { opacity: 0; } }

/* ---------------------------------------------------- phone: the menu --- */
@media (max-width: 860px) {
  .hdr { display: flex; justify-content: space-between; }
  .hdr .btn-sm { display: none; }
  .js .menu-btn {
    display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border: 0; border-radius: var(--r-pill);
    background: var(--fg); color: var(--on); font: 600 14px/1 var(--sans); cursor: pointer;
  }
  .js .nav {
    position: fixed; inset: 0; z-index: 1; display: flex; align-items: flex-end; padding: 0 var(--g) 12vh;
    background: var(--surface); color: var(--text); visibility: hidden; opacity: 0;
  }
  .js .nav ul { flex-direction: column; gap: 6px; }
  .js .nav a { font: 400 clamp(36px, 11vw, 56px) / 1.15 var(--serif); opacity: 1; }
  /* the open menu covers everything: the header drops the light tone */
  .hdr.menu-open { --fg: var(--text); --on: var(--bg); }
  .hdr.menu-open::before { opacity: 0; }
  .hdr.menu-open .nav { visibility: visible; opacity: 1; }
  /* without JS the header wraps onto rows: it stays in the flow, never over the page */
  .no-js .hdr { position: relative; height: auto; flex-wrap: wrap; gap: 10px; padding-block: 14px; }
  .no-js .nav ul { flex-wrap: wrap; gap: 4px 16px; }
}
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .js .nav { transition: opacity 0.4s var(--soft), visibility 0s 0.4s; }
  .hdr.menu-open .nav { transition: opacity 0.4s var(--soft); }
}

/* ------------------------------------------------------- footer scene --- */
/* One grid: the phrase and the email, the links row, then the giant word
   with the base line (© and the place) laid over its foot. Paint order,
   inside the footer's own stacking context: the sphere (0), the word (1),
   the content (2). The word is wider than a phone and than 1440 px: it is
   centred and clipped by the footer (overflow: clip), never scrolled. The
   sphere sits centred on the word and drifts on a 20 s loop. */
.foot {
  --word: clamp(80px, 22vw, 340px);
  --sun: clamp(600px, 78vw, 1180px);
  position: relative; isolation: isolate; overflow: hidden; overflow: clip;
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "row" "word";
  padding: clamp(96px, 11vw, 160px) max(var(--g), (100% - var(--measure)) / 2) 0;
  background: var(--bg);
}
.foot-sun {
  position: absolute; z-index: 0; left: 50%; bottom: calc(var(--word) * 0.42 - var(--sun) / 2);
  width: var(--sun); aspect-ratio: 1; margin-left: calc(var(--sun) / -2); pointer-events: none;
}
.foot-sun canvas { width: 100%; height: 100%; }
.foot-word {
  grid-area: word; position: relative; z-index: 1; display: flex; justify-content: center;
  margin-top: clamp(56px, 7vw, 120px); font: 400 var(--word) / 0.84 var(--serif); letter-spacing: -0.04em;
  color: #14151a; white-space: nowrap; user-select: none; pointer-events: none;
}
.foot-main, .foot-row, .foot-base { position: relative; z-index: 2; }
.foot-main { grid-area: main; }
.foot-phrase { max-width: 18ch; }
.foot-mail { margin-top: clamp(28px, 3vw, 44px); font: 400 clamp(30px, 9vw, 56px) / 1.1 var(--serif); letter-spacing: -0.01em; }
.foot-mail a { text-decoration: underline 1px var(--line-strong); text-underline-offset: 0.16em; }
.foot-row {
  grid-area: row; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 20px 48px;
  margin-top: clamp(64px, 7vw, 112px); padding-top: 24px; border-top: 1px solid var(--line);
}
.foot-nav ul, .foot-social { display: flex; flex-wrap: wrap; gap: 10px clamp(20px, 2.4vw, 36px); margin: 0; padding: 0; list-style: none; }
.foot-nav a { font: 500 15px / 1.4 var(--sans); }
.foot-social li { font: 500 14px / 1.4 var(--sans); color: var(--text); }
.foot-row a { text-decoration: underline 1px transparent; text-underline-offset: 5px; }
.foot-base {
  grid-area: word; align-self: end; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px;
  padding-bottom: clamp(20px, 2.4vw, 32px); font: 500 clamp(13px, 1.1vw, 14px) / 1.4 var(--sans); color: var(--text);
}
@media (hover: hover) {
  .foot-mail a:hover, .foot-row a:hover { text-decoration-color: currentColor; }
}
@media (prefers-reduced-motion: no-preference) {
  .foot-mail a, .foot-row a { transition: text-decoration-color var(--t-fast) var(--soft), color var(--t-fast) var(--soft); }
  .foot-sun { animation: foot-drift 20s ease-in-out infinite; }
}
/* a slow loop around the resting place: a few per cent of the sphere's size */
@keyframes foot-drift {
  25% { transform: translate(1.6%, -1.2%); }
  50% { transform: translate(0, -2.2%); }
  75% { transform: translate(-1.6%, -1%); }
}

/* phones: the word is too low to carry the base line, which moves under it */
@media (max-width: 760px) {
  .foot { grid-template-areas: "main" "row" "word" "base"; }
  .foot-row { flex-direction: column; gap: 24px; }
  .foot-base { grid-area: base; flex-direction: column; padding-top: 20px; }
}


/* ======================================================================
   The motion layer (world.js, overlay.js, fx.js). Class protocol on <html>,
   set in each page's head: .gl (WebGL2 and motion allowed), .loading (the
   loader runs: first page of the session), .arriving (reached through the
   overlay); world.js adds .holding and .dragging.
   ====================================================================== */

/* -------------------------------------------------------------- Lenis --- */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ------------------------------------------ the header's ground on dark --- */
/* Past the first screen the header gets a dark frosted ground over the dark
   chapters (on paper .on-light gives it the light one). */
.hdr.scrolled:not(.on-light)::before { opacity: 1; background: rgb(8 8 10 / 0.62); box-shadow: 0 1px 0 var(--line); }

/* ---------------------------------------------------- the WebGL world --- */
/* The canvas sits above the pinned hero (z 1) and under everything after it
   (z 3): the light chapter's paper, drawn on it, covers the hero as it rises.
   Grounds that the canvas now paints are cleared. */
.world { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }
.gl [data-pinned] ~ * { z-index: 3; background: transparent; }
.gl .foot { z-index: 3; background: transparent; }
.gl body:not(:has([data-pinned])) main { position: relative; z-index: 3; }
.gl [data-world-paper] { background: transparent; }
.gl .shutter::before { display: none; }
/* a plate's own CSS light would cover the canvas under it */
.gl [data-gl-plane] { background: none !important; }
.gl [data-gl-plane] canvas, .gl [data-gl-plane]::after, .gl [data-gl-skip] canvas { visibility: hidden; }
.gl [data-gl-caption], .gl [data-gl-caption] * { -webkit-text-fill-color: transparent; }
.gl [data-world-word] { color: transparent; }
/* the wall's plates enter with the paper, not with a reveal of their own */
.gl [data-gl-wall] [data-reveal] { opacity: 1; transform: none; }
/* the dots draw the rail's line and its stations */
.gl [data-world-rail]::before, .gl [data-world-rail] .rail-dot { opacity: 0; }

/* film grain over everything, shifting five times a second (unseen.co) */
.gl body::after {
  content: ""; position: fixed; inset: -50%; z-index: 55; pointer-events: none;
  background: var(--grain); background-size: 180px; opacity: 0.055;
  animation: grain 0.9s steps(5) infinite;
}
@keyframes grain {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-7%, 4%); }
  40% { transform: translate(5%, -6%); }
  60% { transform: translate(-3%, 8%); }
  80% { transform: translate(8%, 2%); }
}

/* ------------------------------------------------ loader, transitions --- */
/* A plain black cover until overlay.js draws; it lifts by itself after
   2.6 s if no script ever does. */
html.loading body::before, html.arriving body::before, html.leaving body::before {
  content: ""; position: fixed; inset: 0; z-index: 8999; background: var(--bg); pointer-events: none;
}
html.loading body::before, html.arriving body::before { animation: cover-out 0.3s 2.6s forwards; }
html.leaving body::before { animation: show 0.35s both; }
@keyframes cover-out { to { opacity: 0; visibility: hidden; } }
.overlay { position: fixed; inset: 0; z-index: 9000; display: none; width: 100%; height: 100%; pointer-events: none; }
.loader-word {
  position: fixed; inset: 0; z-index: 9001; display: flex; align-items: center; justify-content: center;
  margin: 0; font: italic 800 clamp(40px, 6vw, 84px) / 1 var(--brand); letter-spacing: -0.03em;
  color: #fff; pointer-events: none;
}
.loader-word span { display: inline-block; min-width: 0.5em; text-align: center; opacity: 0; transform: translateY(0.3em); transition: opacity 0.18s, transform 0.4s var(--ease); }
.loader-word span.on { opacity: 1; transform: none; }

/* --------------------------------------------- letters of the title --- */
/* fx.js splits [data-world-text] into words (.w) and letters (.ch, --ci);
   they arrive upright out of a slant, 15 ms apart (makemepulse). The line
   masks (.ln) clip their rise. */
.js [data-world-text] .w { display: inline-block; white-space: nowrap; }
.js [data-world-text] .ch { display: inline-block; }
@media (prefers-reduced-motion: no-preference) {
  html.js:not(.go) [data-world-text] .ch { opacity: 0; }
  html.js.go [data-world-text] .ch { animation: ch-in calc(0.62s * var(--tempo)) var(--ease) min(calc(var(--ci, 0) * 7ms * var(--tempo)), 0.32s) both; }
  /* the world's entrance is shorter: everything has landed by about 2 s */
  html.gl.js.go .a-2 { animation-duration: 0.6s; animation-delay: 0.1s; }
  html.gl.js.go .a-3 { animation-duration: 0.6s; animation-delay: 0.22s; }
  /* the letters carry the entrance now: the lines no longer rise */
  html.js [data-world-text] .ln-in { transform: none !important; animation: none !important; }
}
@keyframes ch-in { from { opacity: 0; transform: translateY(0.34em) skewX(-14deg) scaleX(1.12); } }

/* --------------------------------------------------- statement words --- */
.lit-by-words .sw { transition: opacity 0.25s linear; }

/* ------------------------------------------- the phone menu: a curtain --- */
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  /* it opens in 0.7 s and closes in 0.4 s */
  .js .nav { clip-path: inset(0 0 100% 0); transition: clip-path 0.4s var(--soft), visibility 0s 0.4s; opacity: 1; }
  .hdr.menu-open .nav { clip-path: inset(0); transition: clip-path 0.7s var(--ease); }
  .js .nav li { transform: translateY(40px); opacity: 0; transition: transform 0.7s var(--ease), opacity 0.4s; }
  .hdr.menu-open .nav li { transform: none; opacity: 1; }
  .hdr.menu-open .nav li:nth-child(2) { transition-delay: 0.05s; }
  .hdr.menu-open .nav li:nth-child(3) { transition-delay: 0.1s; }
  .hdr.menu-open .nav li:nth-child(4) { transition-delay: 0.15s; }
  .hdr.menu-open .nav li:nth-child(5) { transition-delay: 0.2s; }
  .hdr.menu-open .nav li:nth-child(6) { transition-delay: 0.25s; }
  .hdr.menu-open .nav li:nth-child(7) { transition-delay: 0.3s; }
}

/* ------------------------------------------------- shared helpers --- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* the footer: the dots write the wordmark; the base line moves under it */
.gl .foot { grid-template-areas: "main" "row" "word" "base"; }
.gl .foot-word { margin-top: clamp(40px, 5vw, 80px); }
.gl .foot-base { grid-area: base; align-self: auto; flex-direction: row; padding-top: 18px; }

/* ------------------------------------------------------- liquid glass --- */
/* .lg: the material, on every page. Without the world it is CSS (a frosted
   backdrop and lit rims). Under html.gl a [data-glass] panel outside the hero
   is drawn by world.js — refraction at the rim, frost, a colour split, the
   pointer's light — and keeps only a hairline of its own. */
.lg {
  position: relative; border-radius: var(--lg-r, 22px);
  background: linear-gradient(160deg, rgb(255 255 255 / 0.13), rgb(255 255 255 / 0.06) 42%, rgb(255 255 255 / 0.04));
  -webkit-backdrop-filter: blur(18px) saturate(1.8) brightness(1.05); backdrop-filter: blur(18px) saturate(1.8) brightness(1.05);
  box-shadow:
    inset 0 1px 0.5px rgb(255 255 255 / 0.5), inset 0 -1px 0.5px rgb(255 255 255 / 0.12),
    inset 1px 0 0.5px rgb(255 255 255 / 0.14), inset -1px 0 0.5px rgb(255 255 255 / 0.08),
    0 14px 40px -10px rgb(0 0 0 / 0.5);
}
.gl .lg[data-glass] {
  background: none; -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: inset 0 0 0 0.5px rgb(255 255 255 / 0.14);
}
/* glass buttons: a clear pill, and a white one for the main action */
.btn.lg { --lg-r: 999px; height: 52px; padding: 0 26px; font-size: 15px; color: var(--text); }
.btn-primary.lg { background: linear-gradient(180deg, rgb(255 255 255 / 0.96), rgb(255 255 255 / 0.86)); color: var(--ink); }
.btn-primary.lg:hover { background: #fff; }
.btn-ghost.lg:hover { box-shadow: inset 0 1px 0.5px rgb(255 255 255 / 0.7), inset 0 0 0 1px rgb(255 255 255 / 0.3), 0 14px 40px -10px rgb(0 0 0 / 0.5); }

/* -------------------------------------------- touch targets (phone) --- */
/* 44 px where a finger presses (WCAG 2.2 asks 24 at least; the platforms
   ask 44): padding reaches past the visible shape, so the look stays */
@media (max-width: 760px) {
  .brand { min-height: 44px; }
  .lang a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; margin: 0 -6px; }
  .js .menu-btn { height: 44px; }
}
