/* ==========================================================================
   oosh brand kit v3 — "input"
   Dark stage, loud signal, and nothing moves unless you do.

   Evolved from v2 "signal": the same four colours, the same two typefaces,
   the same square corners. What changed is the stage (dark-first), the
   scale (cinematic), and the motion rule: every animation is a response to
   the player — pointer, tap or scroll. Nothing idles, loops or autoplays.

   This file is the single source of truth for tokens + primitives.
   ========================================================================== */

:root {
  /* ---- Core palette — still the only four brand colours ---- */
  --oosh-ink:    #16232A;   /* slate — surfaces, panels, ink on light      */
  --oosh-orange: #FF5804;   /* the signal — CTAs, live state, the dot      */
  --oosh-teal:   #075056;   /* depth — beta states, alt surfaces           */
  --oosh-ice:    #E4EEF0;   /* light — text on the stage, inverted panels  */

  /* ---- Derived tints — mixes of the four, never new hues ---- */
  --ink-deep:    #0E171C;   /* the stage itself: ink pushed toward black   */
  --ink-raise:   #1D2C34;   /* a raised panel on the stage                 */
  --ink-80:      #455056;
  --ink-60:      #73797d;
  --ice-dim:     #939EA2;   /* muted text on the stage — 6.6:1 on ink-deep */
  --ice-deep:    #CFDDE1;
  --ice-white:   #F4F9FA;
  --orange-deep: #D64703;

  /* Hairlines: ice at low alpha on dark, ink at low alpha on light */
  --hair-dark:   rgba(228, 238, 240, 0.13);
  --hair-light:  rgba(22, 35, 42, 0.16);

  /* ---- Semantic (dark stage is the default) ---- */
  --bg:          var(--ink-deep);
  --bg-panel:    var(--ink-raise);
  --bg-invert:   var(--oosh-ice);
  --fg:          var(--oosh-ice);
  --fg-muted:    var(--ice-dim);
  --fg-invert:   var(--oosh-ink);
  --accent:      var(--oosh-orange);
  --accent-fg:   var(--oosh-ink);   /* ink on orange — 5.3:1, never white */
  --line:        var(--hair-dark);
  --line-strong: rgba(228, 238, 240, 0.28);

  /* ---- Type ---- */
  --font-display: 'Archivo', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --font-body:    'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Display = heavy + condensed + uppercase. The bigger it gets, the
     narrower it goes — Archivo's width axis is the brand's loudest tool. */
  --wdth-mega:    66;   /* 10vw and up: signs, marquees, the footer mark */
  --wdth-display: 74;   /* h1 / h2                                        */
  --wdth-title:   80;   /* h3, card titles, buttons                       */
  --wght-display: 900;

  --fs-mega:  clamp(4.5rem, 16vw, 15rem);
  --fs-hero:  clamp(2.6rem, 6vw, 6rem);
  --fs-h1:    clamp(2.6rem, 7.4vw, 6.5rem);
  --fs-h2:    clamp(2.2rem, 5.6vw, 5rem);
  --fs-h3:    clamp(1.3rem, 2.4vw, 1.85rem);
  --fs-lede:  clamp(1.05rem, 1.45vw, 1.25rem);
  --fs-body:  1rem;
  --fs-small: 0.875rem;
  --fs-micro: 0.6875rem;

  /* ---- Structure ---- */
  --bw:        2px;     /* standard rule on light surfaces */
  --bw-heavy:  3px;     /* frames and section edges        */
  --radius:    0;       /* the brand is square. deliberately. */

  /* ---- Hard shadow — offset, never blurred ---- */
  --shadow-color: var(--oosh-teal);            /* on the dark stage */
  --shadow:       6px 6px 0 var(--shadow-color);
  --shadow-lift:  10px 10px 0 var(--shadow-color);
  --shadow-sm:    3px 3px 0 var(--shadow-color);

  /* ---- Motion ---- */
  --ease:        cubic-bezier(0.2, 0.8, 0.2, 1);    /* presses and settles         */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);     /* reveals — long tail, no overshoot */
  --ease-in-out: cubic-bezier(0.76, 0, 0.24, 1);    /* wipes and curtains          */
  --snap:   90ms;
  --settle: 220ms;
  --wipe:   520ms;
  --reveal: 950ms;

  /* ---- Layout ---- */
  --content-w: 1400px;
  --gutter:    clamp(1rem, 3.2vw, 3rem);
  --nav-h:     64px;

  /* ---- Safe area (iOS notch / gesture bar) ---- */
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (max-width: 640px) {
  :root { --nav-h: 56px; }
}

/* Light surfaces flip the semantic tokens — put .surface-ice on any panel
   that sits on ice and everything inside follows. */
.surface-ice {
  --bg: var(--oosh-ice);
  --bg-panel: var(--ice-white);
  --fg: var(--oosh-ink);
  --fg-muted: var(--ink-80);
  --line: var(--hair-light);
  --line-strong: rgba(22, 35, 42, 0.34);
  --shadow-color: var(--oosh-ink);
  background: var(--bg);
  color: var(--fg);
}

/* ==========================================================================
   Patterns — the texture vocabulary. Compose, don't invent new ones.
   Each inherits currentColor, so set the colour on the element.
   ========================================================================== */
.p-dots {
  background-image: radial-gradient(currentColor 1.5px, transparent 1.5px);
  background-size: 12px 12px;
}
.p-hazard {
  background-image: repeating-linear-gradient(
    -45deg, currentColor 0 8px, transparent 8px 18px
  );
}
.p-grid {
  background-image:
    linear-gradient(currentColor 1px, transparent 1px),
    linear-gradient(90deg, currentColor 1px, transparent 1px);
  background-size: 26px 26px;
}
.p-check {
  background-image:
    conic-gradient(currentColor 90deg, transparent 90deg 180deg,
                   currentColor 180deg 270deg, transparent 270deg);
  background-size: 22px 22px;
}

/* ==========================================================================
   Reset
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ink-deep);
  color-scheme: dark;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-variation-settings: 'wdth' 100, 'wght' 400;
  line-height: 1.5;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg, iframe, canvas { display: block; max-width: 100%; }
a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
button, a { touch-action: manipulation; }
::selection { background: var(--oosh-orange); color: var(--oosh-ink); }

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' var(--wdth-display), 'wght' var(--wght-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.88;
  margin: 0 0 0.4em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); font-variation-settings: 'wdth' var(--wdth-title), 'wght' 800; }

p { margin: 0 0 1em; max-width: 62ch; }
p:last-child { margin-bottom: 0; }
strong { font-variation-settings: 'wdth' 100, 'wght' 700; font-weight: 700; }

/* The display recipe as a utility, for anything that isn't a heading */
.display {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' var(--wdth-display), 'wght' var(--wght-display);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 0.88;
}

/* Mono micro-label — metadata, slugs, indexes, kickers. Never body copy. */
.label, .mono {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: var(--fg-muted);
}
.label--accent { color: var(--accent); }
.surface-ice .label--accent { color: var(--orange-deep); }

/* Bracketed index — [01] — the operator's numbering */
.idx::before { content: '['; opacity: 0.55; margin-right: 0.12em; }
.idx::after  { content: ']'; opacity: 0.55; margin-left: 0.12em; }

/* Highlight — the marker swipe. Solid orange knockout, ink text. */
mark, .mark {
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 0 0 / 100% 100%;
  color: var(--accent-fg);
  padding: 0 0.1em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* The wordmark. Always lowercase, always with the orange full stop. */
.wordmark {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 78, 'wght' 900;
  font-weight: 900;
  text-transform: lowercase;
  letter-spacing: -0.045em;
  line-height: 1;
  text-decoration: none;
  color: var(--fg);
  white-space: nowrap;
}
.wordmark .dot, .dot { color: var(--accent); }

/* ==========================================================================
   Button — the split block, v3. Label panel + arrow panel, hard-joined.
   Hover wipes a fill across the label and swaps the arrow out and back in.
   Markup: <a class="btn btn--primary"><span class="btn__label">Play</span>
           <span class="btn__arrow" aria-hidden="true"><i>→</i></span></a>
   ========================================================================== */
.btn {
  --btn-bg:    var(--oosh-ice);
  --btn-fg:    var(--oosh-ink);
  --btn-wipe:  var(--oosh-orange);
  --btn-wipe-fg: var(--oosh-ink);
  --btn-arrow-bg: var(--oosh-orange);
  --btn-arrow-fg: var(--oosh-ink);
  --arrow-w: 3.4rem;
  display: inline-grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  padding: 0;
  border: 0;
  background: none;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  color: var(--btn-fg);
  transition: transform var(--snap) var(--ease);
}
.btn__label {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;                 /* not flex: inline spans in a label must stay inline */
  padding: 1.05rem 1.4rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-variation-settings: 'wdth' 88, 'wght' 800;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  line-height: 1.1;
  transition: color var(--settle) var(--ease);
}
.btn__label::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--btn-wipe);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--wipe) var(--ease-in-out);
}
.btn__arrow {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  width: var(--arrow-w);
  background: var(--btn-arrow-bg);
  color: var(--btn-arrow-fg);
  font-size: 1.15rem;
}
.btn__arrow i {
  display: block;
  font-style: normal;
  line-height: 1;
  /* The second arrow waits off-panel to the left as a hard copy of the first */
  text-shadow: calc(var(--arrow-w) * -1) 0 0 currentColor;
  transition: transform var(--wipe) var(--ease-in-out);
}
.btn--primary { --btn-bg: var(--oosh-orange); --btn-wipe: var(--oosh-ice); --btn-arrow-bg: var(--oosh-ice); }
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--fg);
  --btn-wipe: var(--fg);
  --btn-wipe-fg: var(--bg);
  --btn-arrow-bg: var(--fg);
  --btn-arrow-fg: var(--bg);
}
.btn--ghost .btn__label { box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--teal { --btn-bg: var(--oosh-teal); --btn-fg: var(--oosh-ice); --btn-wipe: var(--oosh-ice); --btn-wipe-fg: var(--oosh-ink); }

@media (hover: hover) and (pointer: fine) {
  .btn:hover .btn__label::before,
  a:hover > .btn .btn__label::before { transform: scaleX(1); }
  .btn:hover .btn__label,
  a:hover > .btn .btn__label { color: var(--btn-wipe-fg); }
  .btn:hover .btn__arrow i,
  a:hover > .btn .btn__arrow i { transform: translateX(var(--arrow-w)); }
}
.btn:focus-visible .btn__label::before { transform: scaleX(1); }
.btn:focus-visible .btn__label { color: var(--btn-wipe-fg); }
.btn:active { transform: translate(1px, 1px); }

/* ==========================================================================
   Badge — sharp status chip. The chip is the signal; no dots inside it.
   ========================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.6rem;
  background: var(--bg-panel);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.badge--live { background: var(--accent);    color: var(--accent-fg); box-shadow: none; }
.badge--beta { background: var(--oosh-teal); color: var(--oosh-ice); }
.badge--wip  { background: var(--oosh-teal); color: var(--oosh-ice); }
.badge--soon { background: transparent;      color: var(--fg-muted); }

/* ==========================================================================
   Card — the generic surface. Panels, sheets, modals descend from this.
   ========================================================================== */
.card {
  background: var(--bg-panel);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 1.25rem;
}
.card--invert { background: var(--oosh-ice); color: var(--oosh-ink); }
.card--raised { box-shadow: inset 0 0 0 1px var(--line), var(--shadow); }

/* ==========================================================================
   Form controls
   ========================================================================== */
.field { display: block; margin-bottom: 1rem; }
.field > .label { display: block; margin-bottom: 0.45rem; }

.input,
.select,
.textarea {
  width: 100%;
  padding: 0.8rem 0.9rem;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  color: var(--fg);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color var(--snap) var(--ease), box-shadow var(--snap) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23E4EEF0' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  background-size: 12px;
  padding-right: 2.4rem;
}
.surface-ice .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2316232A' stroke-width='2'/%3E%3C/svg%3E");
}

/* Selectable option — fills orange when checked */
.option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem;
  background: var(--bg-panel);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  cursor: pointer;
}
.option[aria-checked="true"],
.option:has(input:checked) {
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Stat — big number, mono caption. For scores, totals, results.
   ========================================================================== */
.stat { display: flex; flex-direction: column; gap: 0.6rem; }
.stat__value {
  font-family: var(--font-display);
  font-variation-settings: 'wdth' var(--wdth-mega), 'wght' 900;
  font-weight: 900;
  font-size: clamp(3.5rem, 9vw, 8rem);
  line-height: 0.8;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.stat__unit {
  display: inline-grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;          /* the one deliberate circle in the system */
  background: var(--oosh-ink);
  color: var(--oosh-ice);
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  font-weight: 700;
}

/* ==========================================================================
   Motifs
   ========================================================================== */

/* Square cluster — the favicon, the corner motif, the brand in two blocks */
.squares {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
  width: 22px;
  flex: none;
}
.squares i { aspect-ratio: 1; display: block; }
.squares i:nth-child(1) { background: var(--fg); }
.squares i:nth-child(4) { background: var(--accent); }

/* Registration mark — a crop-mark crosshair for framing corners.
   Position it with .reg--tl / --tr / --bl / --br inside a positioned box. */
.reg {
  position: absolute;
  width: 15px;
  height: 15px;
  pointer-events: none;
  color: var(--line-strong);
}
.reg::before, .reg::after {
  content: '';
  position: absolute;
  background: currentColor;
}
.reg::before { left: 0; right: 0; top: 50%; height: 1px; transform: translateY(-50%); }
.reg::after  { top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); }
.reg--tl { top: -8px;    left: -8px; }
.reg--tr { top: -8px;    right: -8px; }
.reg--bl { bottom: -8px; left: -8px; }
.reg--br { bottom: -8px; right: -8px; }

/* ==========================================================================
   Focus — thick, offset, unmissable
   ========================================================================== */
:focus-visible {
  outline: 3px solid var(--oosh-orange);
  outline-offset: 3px;
}

/* ==========================================================================
   Utility
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--content-w);
  margin-inline: auto;
  padding-left:  calc(var(--gutter) + var(--safe-l));
  padding-right: calc(var(--gutter) + var(--safe-r));
}
.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  background: var(--oosh-orange);
  color: var(--oosh-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip-link:focus { transform: none; }

/* 0s, not the popular 0.01ms: with the default `transition-property: all`,
   a 0.01ms duration turns every style change on every element into a
   transition, so script that sets a size and then measures (the footer
   sign fit) reads the stale value. Nothing here relies on transitionend. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
}
