/* lotterypuzzle atlas — 2026 design system.
   Layers, lowest to highest priority. Pages add rules in `pages` only. */
@layer reset, tokens, base, layout, components, pages, utilities;

/* ───────────────────────── fonts ───────────────────────── */
@font-face {
  font-family: "Atlas Display";
  src: url("/fonts/roboto-flex-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atlas Display";
  src: url("/fonts/roboto-flex-cyrillic-wdth-normal.woff2") format("woff2");
  font-weight: 100 1000;
  font-stretch: 25% 151%;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Atlas Sans";
  src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atlas Sans";
  src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atlas Sans";
  src: url("/fonts/ibm-plex-sans-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Atlas Sans";
  src: url("/fonts/ibm-plex-sans-cyrillic-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Atlas Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atlas Mono";
  src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atlas Mono";
  src: url("/fonts/ibm-plex-mono-cyrillic-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Atlas Mono";
  src: url("/fonts/ibm-plex-mono-cyrillic-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ───────────────────────── reset ───────────────────────── */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body, h1, h2, h3, h4, p, figure, blockquote, dl, dd, ol, ul { margin: 0; }
  ol[class], ul[class] { list-style: none; padding: 0; }
  img, svg { display: block; max-width: 100%; }
  input, button, select, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
}

/* ───────────────────────── tokens ───────────────────────── */
@layer tokens {
  :root {
    color-scheme: light dark;

    /* Palette — light (default). Meaning, not decoration:
       found = quiet slate, open/address-only = Bitcoin orange, open/public key = key blue. */
    --paper: #f4f6f8;
    --paper-2: #eaeef3;
    --surface: #ffffff;
    --ink: #0b1220;
    --ink-2: #465265;
    --ink-3: #5f6b7e; /* ≥4.6:1 on paper, paper-2, surface (WCAG AA small text) */
    --rule: #d8dee6;
    --rule-strong: #b9c2ce;
    --found: #b3bcc8;
    --open: #f7931a;
    --open-ink: #a85600;
    --key: #3446f0;
    --key-ink: #2a38c9;
    --line: #0b1220;
    --focus: #3446f0;
    --glass: rgb(244 246 248 / 0.82);

    /* Type */
    --font-display: "Atlas Display", "Roboto Flex", "Arial Narrow", system-ui, sans-serif;
    --font-sans: "Atlas Sans", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "Atlas Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --step--1: 0.8125rem;
    --step-0: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
    --step-1: clamp(1.125rem, 1.05rem + 0.4vw, 1.3rem);
    --step-2: clamp(1.4rem, 1.2rem + 0.9vw, 1.9rem);
    --step-3: clamp(1.9rem, 1.5rem + 1.8vw, 3rem);
    --step-4: clamp(2.6rem, 1.4rem + 5vw, 5.25rem);
    --step-hero: clamp(2.9rem, 0.9rem + 7.6vw, 7.75rem);

    /* Space & shape */
    --gutter: clamp(1.15rem, 4vw, 2.5rem);
    --wrap: 78rem;
    --section: clamp(3.5rem, 2rem + 6vw, 7rem);
    --radius: 14px;
    --radius-sm: 8px;
    --masthead-h: 3.75rem;
    --ease-out: cubic-bezier(0.2, 0.75, 0.1, 1);
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --paper: #0a0d12;
      --paper-2: #0f141b;
      --surface: #131a23;
      --ink: #edf0f5;
      --ink-2: #a5afbe;
      --ink-3: #808b9c; /* ≥5:1 on dark paper, paper-2, surface */
      --rule: #212a36;
      --rule-strong: #334051;
      --found: #2c3644;
      --open: #f7931a;
      --open-ink: #ffa94d;
      --key: #6f7dff;
      --key-ink: #97a2ff;
      --line: #edf0f5;
      --focus: #97a2ff;
      --glass: rgb(10 13 18 / 0.8);
    }
  }
}

/* ───────────────────────── base ───────────────────────── */
@layer base {
  html {
    background: var(--paper);
    color: var(--ink);
    scroll-padding-top: calc(var(--masthead-h) + 1rem);
  }
  body {
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  main { flex: 1; }
  main:focus { outline: none; }
  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-stretch: 62%;
    font-weight: 720;
    line-height: 1.02;
    letter-spacing: -0.012em;
    text-wrap: balance;
  }
  h2 { font-size: var(--step-3); }
  h3 { font-size: var(--step-2); }
  p { text-wrap: pretty; }
  a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
  a:hover { text-decoration-color: var(--open); }
  sup { font-size: 0.62em; line-height: 0; vertical-align: 0.62em; }
  code, kbd, samp { font-family: var(--font-mono); font-size: 0.92em; }
  ::selection { background: color-mix(in srgb, var(--open) 35%, transparent); }
  :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
}

/* ───────────────────────── layout ───────────────────────── */
@layer layout {
  .wrap,
  .container {
    width: min(100% - 2 * var(--gutter), var(--wrap));
    margin-inline: auto;
  }

  /* Masthead */
  .masthead {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--glass);
    -webkit-backdrop-filter: saturate(1.4) blur(14px);
    backdrop-filter: saturate(1.4) blur(14px);
    border-bottom: 1px solid var(--rule);
  }
  .masthead-row {
    height: var(--masthead-h);
    display: flex;
    align-items: center;
    gap: 2rem;
  }
  .brand {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    margin-right: auto;
  }
  .brand-mark { flex: none; width: 1.15rem; height: 1.15rem; fill: var(--ink); }
  .brand-mark rect:last-child { fill: var(--open); }
  .brand-name {
    font-family: var(--font-display);
    font-stretch: 80%;
    font-weight: 760;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
  }
  .brand-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--open-ink);
  }
  .primary-nav { display: flex; align-items: center; gap: 1.6rem; }
  .primary-nav > a {
    font-size: 0.94rem;
    color: var(--ink-2);
    text-decoration: none;
    padding-block: 0.35rem;
    border-bottom: 2px solid transparent;
  }
  .primary-nav > a:hover { color: var(--ink); }
  .primary-nav > a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--open); }
  .lang-switch {
    display: flex;
    gap: 0.15rem;
    padding-left: 1.2rem;
    border-left: 1px solid var(--rule);
  }
  .lang-switch a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--ink-3);
    text-decoration: none;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
  }
  .lang-switch a:hover { color: var(--ink); }
  .lang-switch a[aria-current="true"] { color: var(--ink); background: var(--paper-2); }
  .masthead-tools { display: flex; align-items: center; gap: 0.5rem; }
  .quick-search {
    position: relative;
    display: flex;
    align-items: center;
  }
  .quick-search svg {
    position: absolute;
    left: 0.7rem;
    width: 1rem;
    height: 1rem;
    fill: none;
    stroke: var(--ink-3);
    stroke-width: 2;
    pointer-events: none;
  }
  .quick-search input {
    width: 13.5rem;
    height: 2.25rem;
    padding: 0 2.2rem 0 2.1rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--surface);
    font-size: 0.9rem;
    transition: border-color 0.15s, width 0.25s var(--ease-out);
  }
  .quick-search input::placeholder { color: var(--ink-3); }
  .quick-search input:focus { outline: none; border-color: var(--focus); }
  @media (min-width: 80rem) { .quick-search input:focus { width: 17rem; } }
  .quick-search kbd {
    position: absolute;
    right: 0.6rem;
    font-size: 0.7rem;
    color: var(--ink-3);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0 0.35rem;
    line-height: 1.35;
  }
  .menu-toggle {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--surface);
    place-items: center;
  }
  .menu-toggle span,
  .menu-toggle span::before {
    display: block;
    width: 1rem;
    height: 1.5px;
    background: var(--ink);
    transition: transform 0.2s var(--ease-out);
  }
  .menu-toggle span::before { content: ""; transform: translateY(5px); }
  .menu-toggle span { transform: translateY(-2.5px); }
  .menu-toggle[aria-expanded="true"] span { transform: rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span::before { transform: rotate(-90deg); }

  /* 68rem, not 60rem: ES/RU nav + brand + search need ~1090px in one row. */
  @media (max-width: 68rem) {
    .masthead-row { gap: 0.75rem; }
    .menu-toggle { display: grid; }
    .quick-search input { width: 9.5rem; }
    .quick-search input:focus { width: 12rem; }
    .quick-search kbd { display: none; }
    /* Drawer by default; `scripting: none` (decided before first paint, no JS
       race, no layout shift) turns it into a static list for no-JS visitors. */
    .primary-nav {
      display: none;
      position: absolute;
      inset: var(--masthead-h) 0 auto 0;
      flex-direction: column;
      align-items: stretch;
      gap: 0;
      padding: 0.5rem var(--gutter) 1.25rem;
      background: var(--paper);
      border-bottom: 1px solid var(--rule);
      box-shadow: 0 24px 40px -24px rgb(11 18 32 / 0.25);
    }
    .primary-nav.is-open { display: flex; }
    @media (scripting: none) {
      .masthead { position: static; }
      .masthead-row { flex-wrap: wrap; height: auto; }
      .brand { min-height: var(--masthead-h); }
      .menu-toggle { display: none; }
      .primary-nav {
        display: flex;
        position: static;
        order: 3;
        flex-basis: 100%;
        padding: 0 0 1rem;
        box-shadow: none;
        border-bottom: 0;
      }
    }
    .primary-nav > a {
      font-family: var(--font-display);
      font-stretch: 70%;
      font-weight: 680;
      font-size: 1.6rem;
      color: var(--ink);
      padding: 0.6rem 0;
      border-bottom: 1px solid var(--rule);
    }
    .primary-nav > a[aria-current="page"] { color: var(--open-ink); border-bottom-color: var(--rule); }
    .lang-switch { border-left: 0; padding: 1rem 0 0; }
  }
  .nav-search { display: none; }
  @media (max-width: 40rem) {
    .quick-search { display: none; }
    .primary-nav > .nav-search { display: block; }
  }

  /* Breadcrumbs */
  .breadcrumbs { padding-top: 1.5rem; }
  .breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0; }
  .breadcrumbs li {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-3);
  }
  .breadcrumbs li + li::before { content: "/"; margin-right: 0.4rem; color: var(--rule-strong); }
  .breadcrumbs a { color: var(--ink-2); text-decoration: none; }
  .breadcrumbs a:hover { color: var(--ink); }

  /* Colophon */
  .colophon {
    margin-top: var(--section);
    background: var(--paper-2);
    border-top: 1px solid var(--rule);
    padding-block: 3rem 3.5rem;
    font-size: 0.92rem;
    color: var(--ink-2);
  }
  .colophon-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2.5rem; }
  .colophon-brand { display: grid; gap: 0.6rem; max-width: 30rem; }
  .colophon-brand .brand-name { color: var(--ink); }
  .colophon .fine { font-size: 0.82rem; color: var(--ink-3); }
  .colophon-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem 2rem; align-content: start; }
  .colophon-nav a { text-decoration: none; }
  .colophon-nav a:hover { color: var(--ink); }
  @media (max-width: 40rem) { .colophon-grid { grid-template-columns: 1fr; } }
}

/* ───────────────────────── components ───────────────────────── */
@layer components {
  .eyebrow {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .eyebrow-sep { width: 2rem; height: 1px; background: var(--rule-strong); }

  .text-link {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--open);
    text-decoration-thickness: 2px;
  }
  .text-link:hover { color: var(--open-ink); }

  .section-head { display: grid; gap: 0.75rem; max-width: 40rem; }
  .section-head p { color: var(--ink-2); }

  .addr {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-2);
    overflow-wrap: anywhere;
  }
  .fine { font-size: 0.82rem; color: var(--ink-3); }

  /* Staircase plot */
  .stair { width: 100%; height: auto; overflow: visible; }
  .stair:focus-visible { outline: 2px solid var(--focus); outline-offset: 6px; border-radius: 6px; }
  .stair--tall { display: none; }
  @media (max-width: 48rem) {
    .stair--wide { display: none; }
    .stair--tall { display: block; }
  }
  .stair-grid line { stroke: var(--rule); stroke-dasharray: 2 6; }
  .stair-grid text,
  .stair-rail text,
  .stair-frontier text { font-family: var(--font-mono); fill: var(--ink-3); }
  .col rect { fill: var(--found); transition: fill 0.15s, opacity 0.15s; }
  .col--open-scan rect { fill: var(--open); }
  .col--open-key rect { fill: var(--key); }
  .stair-cols:hover .col rect { opacity: 0.45; }
  .stair-cols:hover .col:hover rect,
  .col.is-active rect { opacity: 1; fill: var(--ink); }
  .frontier-line { stroke: var(--line); stroke-width: 2; stroke-dasharray: 10 6; }
  .stair--tall .frontier-line { stroke-width: 5; stroke-dasharray: 22 12; }
  .stair-frontier .frontier-label { fill: var(--ink); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
  .stair-rail line { stroke: var(--rule-strong); }
  .rail-mark path { fill: var(--found); }
  .rail-mark--open-scan path { fill: var(--open); }
  .rail-mark--open-key path { fill: var(--key); }
  .stair-rail .rail-mark text { fill: var(--ink); font-weight: 500; }

  @media (prefers-reduced-motion: no-preference) {
    .stair-band rect {
      transform-box: fill-box;
      transform-origin: 50% 100%;
      animation: stair-rise 0.75s var(--ease-out) both;
    }
    .stair-band:nth-child(2) rect { animation-delay: 30ms; }
    .stair-band:nth-child(3) rect { animation-delay: 60ms; }
    .stair-band:nth-child(4) rect { animation-delay: 90ms; }
    .stair-band:nth-child(5) rect { animation-delay: 120ms; }
    .stair-band:nth-child(6) rect { animation-delay: 150ms; }
    .stair-band:nth-child(7) rect { animation-delay: 180ms; }
    .stair-band:nth-child(8) rect { animation-delay: 210ms; }
    .stair-band:nth-child(9) rect { animation-delay: 240ms; }
    .stair-band:nth-child(10) rect { animation-delay: 270ms; }
    .stair-band:nth-child(11) rect { animation-delay: 300ms; }
    .stair-band:nth-child(12) rect { animation-delay: 330ms; }
    .stair-band:nth-child(13) rect { animation-delay: 360ms; }
    .stair-band:nth-child(14) rect { animation-delay: 390ms; }
    .stair-band:nth-child(15) rect { animation-delay: 420ms; }
    .stair-band:nth-child(16) rect { animation-delay: 450ms; }
    .frontier-line {
      transform-box: fill-box;
      transform-origin: 0 50%;
      animation: stair-draw 0.9s var(--ease-out) 0.7s both;
    }
    .stair-frontier text,
    .stair-rail .rail-mark > * { animation: stair-fade 0.5s ease 1.2s both; }
  }
  @keyframes stair-rise { from { transform: scaleY(0); } }
  @keyframes stair-draw { from { transform: scaleX(0); } }
  @keyframes stair-fade { from { opacity: 0; } }

  /* ── Shared page components (contract: docs/DESIGN_SYSTEM_2026.md) ── */

  /* Page head: eyebrow + h1 + lede. Use on every non-home page. */
  .page-head { padding-block: clamp(1.75rem, 1rem + 3vw, 3.5rem) clamp(1.5rem, 1rem + 2vw, 2.5rem); display: grid; gap: 1rem; }
  .page-head h1 { font-size: var(--step-4); font-stretch: 45%; font-weight: 780; line-height: 0.95; max-width: 20ch; }
  .page-head .lede { font-size: var(--step-1); color: var(--ink-2); max-width: 46rem; line-height: 1.5; }
  .page-head--rule { border-bottom: 1px solid var(--rule); margin-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem); }

  /* Reading measure for long-form text. */
  .prose { max-width: 42rem; font-size: var(--step-0); line-height: 1.7; }
  .prose > * + * { margin-top: 1.1em; }
  .prose h2 { font-size: var(--step-3); margin-top: 2.2em; scroll-margin-top: calc(var(--masthead-h) + 1rem); }
  .prose h3 { font-size: var(--step-2); margin-top: 1.8em; }
  .prose ul, .prose ol { padding-left: 1.25em; }
  .prose li + li { margin-top: 0.4em; }
  .prose a { text-decoration-color: var(--open); text-decoration-thickness: 1.5px; }
  .prose a:hover { color: var(--open-ink); }
  .prose blockquote { border-left: 3px solid var(--open); padding-left: 1rem; color: var(--ink-2); }
  .prose code { background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 4px; }

  /* Badges. Status: found / scan / key. Evidence: on-chain … unknown. */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1;
    padding: 0.4rem 0.55rem;
    border-radius: 999px;
    color: var(--ink-2);
    background: var(--paper-2);
    border: 1px solid var(--rule);
  }
  .badge::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
  .badge--plain::before { display: none; }
  .badge--found { color: var(--ink-2); }
  .badge--found::before { background: var(--found); outline: 1px solid var(--ink-3); outline-offset: -1px; }
  .badge--scan { color: var(--open-ink); background: color-mix(in srgb, var(--open) 12%, var(--surface)); border-color: color-mix(in srgb, var(--open) 40%, var(--rule)); }
  .badge--scan::before { background: var(--open); }
  .badge--key { color: var(--key-ink); background: color-mix(in srgb, var(--key) 10%, var(--surface)); border-color: color-mix(in srgb, var(--key) 35%, var(--rule)); }
  .badge--key::before { background: var(--key); }
  /* Evidence strength scale: strong → weak. Shape stays, tone fades. */
  .badge--onchain, .badge--verified { color: var(--ink); border-color: var(--ink-3); }
  .badge--onchain::before, .badge--verified::before { background: var(--ink); }
  .badge--forum, .badge--self, .badge--community { color: var(--ink-2); }
  .badge--forum::before, .badge--self::before, .badge--community::before { background: transparent; outline: 1.5px solid currentColor; outline-offset: -1.5px; }
  .badge--speculation, .badge--unknown { color: var(--ink-3); border-style: dashed; }
  .badge--speculation::before, .badge--unknown::before { background: transparent; outline: 1.5px dashed currentColor; outline-offset: -1.5px; }

  /* Panel: a quiet surface for grouped content. */
  .panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: clamp(1.1rem, 0.8rem + 1vw, 1.6rem); }
  .panel--flat { background: var(--paper-2); }

  /* Key–value grid: mono label over value. */
  .kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); gap: 0; border-top: 1px solid var(--rule); }
  .kv > div { padding: 1.1rem 1.25rem 1.2rem 0; border-bottom: 1px solid var(--rule); display: grid; gap: 0.35rem; align-content: start; min-width: 0; }
  .kv dt { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
  .kv dd { margin: 0; font-size: 1.02rem; overflow-wrap: anywhere; }
  .kv dd.mono, .mono { font-family: var(--font-mono); font-size: 0.9em; }
  .kv .note { font-size: 0.88rem; color: var(--ink-2); }

  /* Data table. Wrap in .table-scroll for narrow screens. */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--ink); }
  .data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
  /* Header is not sticky: inside .table-scroll the scroller, not the page,
     would be its containing block and it would cover the first row. */
  .data-table th {
    background: var(--paper);
    text-align: left;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
    padding: 0.8rem 1rem 0.7rem 0;
    border-bottom: 1px solid var(--rule);
    white-space: nowrap;
  }
  .data-table td { padding: 0.75rem 1rem 0.75rem 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
  .data-table td.num, .data-table th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  .data-table td.mono { font-family: var(--font-mono); font-size: 0.85rem; }
  .data-table tbody tr { transition: background 0.12s; }
  .data-table tbody tr:hover { background: var(--paper-2); }
  .data-table a { text-decoration: none; }
  .data-table a:hover { color: var(--open-ink); }
  .data-table .id { font-family: var(--font-display); font-stretch: 50%; font-weight: 760; font-size: 1.25rem; }

  /* Buttons, chips, fields */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 2.5rem;
    padding: 0 1.1rem;
    border-radius: 999px;
    border: 1px solid var(--rule-strong);
    background: var(--surface);
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
  }
  .btn:hover { border-color: var(--ink); }
  .btn--primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .btn--primary:hover { background: var(--open); border-color: var(--open); color: #111; }
  .btn--sm { height: 2rem; padding: 0 0.8rem; font-size: 0.8rem; }
  .btn.is-done { border-color: var(--open); color: var(--open-ink); }
  .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
  .chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    height: 2.25rem;
    padding: 0 0.95rem;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: var(--surface);
    color: var(--ink-2);
    font-size: 0.88rem;
    text-decoration: none;
    white-space: nowrap;
  }
  .chip span { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-3); }
  .chip:hover { border-color: var(--rule-strong); color: var(--ink); }
  .chip[aria-current="true"], .chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
  .chip[aria-current="true"] span, .chip.is-active span { color: color-mix(in srgb, var(--paper) 70%, transparent); }
  .field, .field-select {
    height: 2.5rem;
    padding: 0 0.9rem;
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.92rem;
    min-width: 0;
  }
  .field:focus, .field-select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
  .field::placeholder { color: var(--ink-3); }
  .field-label { display: grid; gap: 0.35rem; font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }

  /* On-this-page navigation */
  .toc { display: grid; gap: 0.6rem; }
  .toc-title { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
  .toc ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.15rem; counter-reset: toc; }
  .toc a { display: block; padding: 0.3rem 0 0.3rem 0.85rem; border-left: 2px solid var(--rule); color: var(--ink-2); text-decoration: none; font-size: 0.92rem; line-height: 1.35; }
  .toc a:hover { color: var(--ink); border-left-color: var(--rule-strong); }
  .toc a[aria-current="true"] { color: var(--ink); border-left-color: var(--open); }

  /* Callout: one honest note per context, not five. */
  .callout { display: grid; grid-template-columns: auto 1fr; gap: 0.75rem; padding: 1rem 1.15rem; border-radius: var(--radius-sm); background: var(--paper-2); border: 1px solid var(--rule); font-size: 0.9rem; color: var(--ink-2); }
  .callout::before { content: "i"; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 50%; border: 1.5px solid var(--ink-3); font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink-3); }
  .callout--warn { background: color-mix(in srgb, var(--open) 8%, var(--surface)); border-color: color-mix(in srgb, var(--open) 35%, var(--rule)); }
  .callout--warn::before { content: "!"; border-color: var(--open-ink); color: var(--open-ink); }

  /* Details / disclosure */
  .disclosure { border-top: 1px solid var(--rule); }
  .disclosure > summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; font-weight: 600; }
  .disclosure > summary::-webkit-details-marker { display: none; }
  .disclosure > summary::after { content: "+"; font-family: var(--font-mono); font-size: 1.1rem; color: var(--ink-3); transition: transform 0.2s var(--ease-out); }
  .disclosure[open] > summary::after { transform: rotate(45deg); }
  .disclosure > :not(summary) { padding-bottom: 1.25rem; }

  /* Prev / next */
  .pager { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding-block: 1.5rem; border-top: 1px solid var(--rule); margin-top: 3rem; }
  .pager a { text-decoration: none; font-family: var(--font-mono); font-size: 0.9rem; }
  .pager a:hover { color: var(--open-ink); }
  .pager .next { text-align: right; }

  /* Source list (citations) */
  .sources { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; font-size: 0.88rem; }
  .sources a { color: var(--ink-2); text-decoration-color: var(--rule-strong); }
  .sources a:hover { color: var(--ink); text-decoration-color: var(--open); }
  .sources a[rel~="noopener"]::after { content: " ↗"; color: var(--ink-3); }

  .legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; font-size: 0.88rem; color: var(--ink-2); }
  .legend li { display: inline-flex; align-items: center; gap: 0.5rem; }
  .legend b { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
  .swatch { width: 0.75rem; height: 0.75rem; border-radius: 2px; background: var(--found); }
  .swatch--open-scan { background: var(--open); }
  .swatch--open-key { background: var(--key); }
}

/* ───────────────────────── pages: home ───────────────────────── */
@layer pages {
  .hero { padding-top: clamp(1.75rem, 0.75rem + 3.5vw, 3.75rem); }
  .hero-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
    align-items: end;
    gap: 1.25rem 3rem;
  }
  .hero-head .eyebrow { grid-column: 1 / -1; }
  .hero-title {
    font-size: clamp(2.75rem, 0.9rem + 5.6vw, 6rem);
    font-stretch: 34%;
    font-weight: 800;
    line-height: 0.9;
    letter-spacing: -0.012em;
  }
  .hero-title span { display: block; }
  .hero-lede {
    font-size: var(--step-1);
    line-height: 1.5;
    color: var(--ink-2);
    padding-bottom: 0.35rem;
  }
  @media (max-width: 60rem) {
    .hero-head { grid-template-columns: 1fr; }
    .hero-lede { max-width: 40ch; }
  }
  @media (max-width: 30rem) {
    .eyebrow { flex-wrap: wrap; gap: 0.25rem 0.75rem; }
    .eyebrow-sep { display: none; }
  }
  .stair-figure { margin-top: clamp(1.75rem, 1rem + 2vw, 2.75rem); }
  .stair-caption {
    margin-top: 1.25rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem 2rem;
  }
  .readout {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--ink-3);
    text-align: right;
    min-height: 1.4em;
  }
  .readout.is-live { color: var(--ink); }
  @media (max-width: 60rem) {
    .stair-caption { grid-template-columns: 1fr; }
    .readout { text-align: left; }
  }

  .census {
    margin-top: var(--section);
    border-block: 1px solid var(--rule);
    background: var(--paper-2);
    padding-block: 2rem 1.5rem;
  }
  .census-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .census-row > div { padding: 0.25rem 1.5rem; border-left: 1px solid var(--rule); }
  .census-row > div:first-child { border-left: 0; padding-left: 0; }
  .census dt {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .census dd {
    margin-top: 0.35rem;
    font-family: var(--font-display);
    font-stretch: 45%;
    font-weight: 720;
    font-size: var(--step-4);
    line-height: 1;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  .census dd a { text-decoration: none; color: var(--open-ink); }
  .census dd a:hover { color: var(--ink); }
  .census .of { font-size: 0.42em; color: var(--ink-3); font-weight: 500; }
  .census .when { font-family: var(--font-mono); font-size: 0.8rem; font-weight: 400; color: var(--ink-2); letter-spacing: 0; }
  .census > .fine { margin-top: 1.25rem; }
  @media (max-width: 48rem) {
    .census-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 0; }
    .census-row > div:nth-child(3) { border-left: 0; padding-left: 0; }
  }

  .facts { padding-top: var(--section); }
  .facts-list {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2.5rem 1.75rem;
  }
  .fact {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
    padding-top: 1.1rem;
    border-top: 2px solid var(--ink);
  }
  .fact-num {
    font-family: var(--font-display);
    font-stretch: 38%;
    font-weight: 800;
    font-size: clamp(3.5rem, 2.5rem + 3vw, 5rem);
    line-height: 0.85;
    letter-spacing: -0.02em;
    color: var(--open-ink);
  }
  .fact-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .fact h3 { font-size: var(--step-2); line-height: 1.1; text-wrap: balance; }
  .fact > p:not([class]) { color: var(--ink-2); font-size: 0.95rem; }
  .fact-link { padding-top: 0.25rem; }
  .range-steps {
    align-self: stretch;
    display: grid;
    gap: 0.35rem;
    margin: 0.4rem 0 0.5rem;
    padding: 0.7rem 0.75rem;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-3);
  }
  .range-row { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) 1.8rem; align-items: center; gap: 0.5rem; }
  .range-mult { text-align: right; color: var(--ink-2); }
  .range-track { display: block; }
  .range-bar { display: block; height: 0.5rem; border-radius: 2px; background: var(--open); }
  .range-bar--1 { width: 12.5%; }
  .range-bar--2 { width: 25%; }
  .range-bar--4 { width: 50%; }
  .range-bar--8 { width: 100%; }
  .range-steps figcaption { margin-top: 0.25rem; font-family: var(--font-sans); font-size: 0.78rem; line-height: 1.35; color: var(--ink-3); }
  @media (max-width: 70rem) { .facts-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  @media (max-width: 36rem) {
    .facts-list { grid-template-columns: 1fr; gap: 2rem; }
    .fact > p:not([class]) { font-size: 1rem; }
  }

  .doors { padding-top: var(--section); }
  .door-pair { margin-top: 2.5rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
  .door {
    --door: var(--open);
    --door-ink: var(--open-ink);
    position: relative;
    display: grid;
    gap: 0.6rem;
    align-content: start;
    padding: clamp(1.4rem, 1rem + 1.5vw, 2.25rem);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.2s, transform 0.25s var(--ease-out), box-shadow 0.25s;
  }
  .door::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--door);
  }
  .door--key { --door: var(--key); --door-ink: var(--key-ink); }
  .door:hover { border-color: var(--door); transform: translateY(-3px); box-shadow: 0 18px 40px -24px rgb(11 18 32 / 0.35); }
  .door-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--door-ink);
  }
  .door-num {
    font-family: var(--font-display);
    font-stretch: 38%;
    font-weight: 800;
    font-size: clamp(4rem, 2.5rem + 6vw, 7.5rem);
    line-height: 0.85;
    letter-spacing: -0.02em;
    color: var(--door-ink);
  }
  .door h3 { font-size: var(--step-2); margin-top: 0.4rem; }
  .door-work { font-family: var(--font-mono); font-weight: 500; font-size: 1.05rem; }
  .door > p:not([class]) { color: var(--ink-2); max-width: 36ch; }
  .door .addr { margin-top: 0.5rem; padding-top: 0.9rem; border-top: 1px solid var(--rule); }
  .door-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-family: var(--font-mono); font-size: 0.85rem; }
  .door-cta { font-family: var(--font-sans); font-weight: 600; color: var(--ink); }
  .door:hover .door-cta { color: var(--door-ink); }
  @media (max-width: 48rem) { .door-pair { grid-template-columns: 1fr; } }

  .finds { padding-top: var(--section); }
  .finds-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 2rem 4rem; align-items: start; }
  .finds-grid .section-head { position: sticky; top: calc(var(--masthead-h) + 2rem); }
  .finds-list { border-top: 1px solid var(--ink); }
  .finds-list a {
    display: grid;
    grid-template-columns: 5.5rem 9rem 1fr auto;
    align-items: baseline;
    gap: 1rem;
    padding: 1.05rem 0;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    transition: background 0.15s, padding 0.2s var(--ease-out);
  }
  .finds-list a:hover { background: var(--paper-2); padding-inline: 0.75rem; }
  .find-num { font-family: var(--font-display); font-stretch: 45%; font-weight: 760; font-size: 1.9rem; line-height: 1; }
  .find-date { font-family: var(--font-mono); font-size: 0.85rem; color: var(--ink-2); white-space: nowrap; }
  .find-method { font-family: var(--font-mono); font-size: 0.85rem; }
  .find-method::before { content: ""; display: inline-block; margin-right: 0.5rem; vertical-align: 0.05em; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--found); outline: 1.5px solid var(--ink-3); outline-offset: -1.5px; }
  .find-method--kangaroo::before { outline-color: var(--key); }
  .find-who { font-size: 0.88rem; color: var(--ink-2); text-align: right; }
  @media (max-width: 60rem) {
    .finds-grid { grid-template-columns: 1fr; }
    .finds-grid .section-head { position: static; }
  }
  @media (max-width: 36rem) {
    .finds-list a { grid-template-columns: 4.2rem 1fr; gap: 0.15rem 1rem; }
    .find-num { grid-row: span 3; }
    .find-who { text-align: left; }
  }

  .atlas-doors { padding-top: var(--section); }
  .atlas-grid { margin-top: 2rem; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.25rem; }
  .atlas-grid a {
    display: grid;
    gap: 0.5rem;
    align-content: start;
    padding-top: 1.1rem;
    border-top: 2px solid var(--ink);
    text-decoration: none;
    transition: border-color 0.2s;
  }
  .atlas-grid a:hover { border-top-color: var(--open); }
  .atlas-grid b { font-family: var(--font-display); font-stretch: 62%; font-weight: 720; font-size: var(--step-2); line-height: 1.05; }
  .atlas-grid a:hover b { color: var(--open-ink); }
  .atlas-grid span { color: var(--ink-2); font-size: 0.95rem; }
  @media (max-width: 60rem) { .atlas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem 1.25rem; } }
  @media (max-width: 30rem) { .atlas-grid { grid-template-columns: 1fr; } }
}

/* ───────────────────────── print ───────────────────────── */
/* Any page prints as a clean reference: no chrome, black on white, external
   source URLs spelled out. Page CSS (e.g. the data sheet) may refine this. */
@layer utilities {
  @media print {
    :root {
      --paper: #fff; --paper-2: #fff; --surface: #fff;
      --ink: #000; --ink-2: #222; --ink-3: #444;
      --rule: #bbb; --rule-strong: #888; --found: #999;
    }
    .masthead, .colophon, .skip-link, .breadcrumbs, .pager, .menu-toggle,
    .quick-search, .lang-switch, .btn, .readout, .ref-toc, .search-form { display: none !important; }
    html, body { background: #fff; color: #000; }
    main { padding: 0; }
    .wrap, .container { width: 100%; }
    .panel, .door, .callout { box-shadow: none; break-inside: avoid; }
    h1, h2, h3 { break-after: avoid; }
    .sources a[href^="http"]::after,
    .prose a[href^="http"]::after { content: " <" attr(href) ">"; font-family: var(--font-mono); font-size: 0.75em; word-break: break-all; }
    .stair-band rect, .frontier-line, .stair-frontier text, .rail-mark > * { animation: none !important; }
  }
}

/* ───────────────────────── utilities ───────────────────────── */
@layer utilities {
  .sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0);
    white-space: nowrap; border: 0;
  }
  .skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 100;
    padding: 0.6rem 1rem;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius-sm);
  }
  .skip-link:focus { top: 1rem; }
}
