/*
  The Capsule theme's design tokens (design/capsule/README.md). The material is light on black: lines of light you
  can see through, type that glows on the scene, and colour only from the decades, as the capsule's own bands glow.
  Loaded on the Capsule pages after the site's own tokens (scripts/home-pages.mjs), and on system/capsule.html.
  Everything is scoped to :root[data-home="capsule"], so Paper never sees it.
*/
@layer tokens {
  :root[data-home="capsule"] {
    /* ── Ground and ink ─────────────────────────────────────────────────────────────────────────────────── */
    --cap-ground: #000000; /* print black, the capsule's night */
    --cap-ink: #edede8; /* stock: 17.9:1 on black. Names, figures, what you type */
    /* (the ink 72% and 62% of the way from black in oklab, written out as colours so every tool reads them) */
    --cap-ink-soft: #989895; /* 7.3:1: labels, controls at rest */
    --cap-ink-faint: #7c7c79; /* 5.0:1: small print, the floor */

    /* ── The decades' light: each decade's most vivid colour (themes.js), as its band glows in the capsule ── */
    --cap-1950s: #bf2a2d;
    --cap-1960s: #f05a22;
    --cap-1970s: #e2a21b;
    --cap-1980s: #ffe500;
    --cap-1990s: #00b7eb;
    --cap-2000s: #f2a900;
    --cap-2010s: #d33a31;
    --cap-2020s: #c8f31d;
    /* the whole capsule, left to right: the light the start screen's lines carry when they are lit */
    --cap-spectrum: linear-gradient(90deg, var(--cap-1950s), var(--cap-1960s), var(--cap-1970s), var(--cap-1980s), var(--cap-1990s), var(--cap-2000s), var(--cap-2010s), var(--cap-2020s));

    /* ── Light: the only material ───────────────────────────────────────────────────────────────────────── */
    /* an edge: a line of light. At rest it is the dimmest that still marks a control (3:1 on black, WCAG 1.4.11) */
    --cap-edge: color-mix(in oklab, var(--cap-ink) 50%, transparent); /* 3.1:1 on black */
    --cap-edge-lit: color-mix(in oklab, var(--cap-ink) 88%, transparent); /* under the pointer, in focus, typed in */
    --cap-edge-faint: color-mix(in oklab, var(--cap-ink) 18%, transparent); /* a rule between things, never a control */
    /* a line of light passing through: brightest in the middle, gone at the ends (rules, the bar's foot, underlines) */
    --cap-pass: linear-gradient(90deg, transparent, var(--cap-edge) 18%, var(--cap-edge) 82%, transparent);
    --cap-pass-lit: linear-gradient(90deg, transparent, var(--cap-edge-lit) 14%, var(--cap-edge-lit) 86%, transparent);
    /* a ring of light round a box: brighter where the light comes in (the top left), the rest at --cap-edge */
    --cap-ring: linear-gradient(160deg, var(--cap-edge-lit), var(--cap-edge) 38%, var(--cap-edge) 70%, color-mix(in oklab, var(--cap-ink) 64%, transparent));
    /* the bloom round anything lit */
    --cap-bloom: 0 0 0.75rem color-mix(in oklab, var(--cap-ink) 28%, transparent);
    /* type on the scene: a black halo round the letters, so they read at 4.5:1 over the brightest splats with no box */
    --cap-halo: 0 0 2px var(--cap-ground), 0 0 6px var(--cap-ground), 0 0 14px color-mix(in oklab, var(--cap-ground) 85%, transparent), 0 0 28px color-mix(in oklab, var(--cap-ground) 60%, transparent);
    /* haze: only where running text has to be read over the scene (a decade's moments, the credits, the open sheet,
       the bar over a wall). It darkens and blurs what is behind; it is not tinted and has no fill of its own */
    --cap-haze: color-mix(in oklab, var(--cap-ground) 80%, transparent);
    --cap-haze-blur: blur(1.5rem) saturate(1.4);

    /* ── Space: the site's own 4 px grid (--space-1 to --space-9: 4, 8, 12, 16, 24, 32, 48, 64, 96) ────────── */
    --cap-margin: var(--margin); /* the page's edge, the site's own steps (16, 24 from 600, 32 from 1600): every phase uses it */
    --cap-gap: var(--space-5); /* between groups (the bar's groups, the field and On this day) */
    --cap-gap-tight: var(--space-2); /* between things in a group (cards, segments) */
    --cap-pad: var(--space-4); /* inside a control or a card */
    --cap-bar: 4rem; /* the bar's height, 64 */
    --cap-measure: 46rem; /* the command bar, and what lines up with it (On this day) */

    /* ── Radius: one scale ──────────────────────────────────────────────────────────────────────────────── */
    --cap-r1: 0.5rem; /* 8: keys, tooltips, a control's focus ring */
    --cap-r2: 1rem; /* 16: cards, tiles, segments */
    --cap-r3: 1.5rem; /* 24: the command bar, panels, the open sheet */

    /* ── Type: Instrument Sans for the interface; a decade's own face only for its name ──────────────────── */
    --cap-type-meta: 500 var(--text-1) / 1.35 var(--now); /* 13: captions, counts, dates, credits */
    --cap-type-control: 600 var(--text-2) / 1 var(--now); /* 14: buttons, links in the bar */
    --cap-type-body: 500 var(--text-3) / 1.4 var(--now); /* 16: a decade's moments, choices */
    --cap-type-figure: 700 var(--text-5) / 1 var(--now); /* 24: Walls ready */
    --cap-type-mark: 700 condensed var(--text-3) / 1 var(--now); /* 16: the wordmark, on the bar's baseline */
    --cap-type-field: 600 clamp(1.75rem, 1rem + 2.1vw, 2.75rem) / 1.05 var(--now); /* 28 to 44: the command bar */
    --cap-track-meta: 0.01em;
  }
}
