  :root {
    --ink-bg: #0c1210;          /* green-black ledger cover */
    --ink-bg-2: #101815;
    --rule: rgba(126, 231, 135, 0.07);   /* ruled-paper lines */
    --cream: #e9e4d3;           /* ledger paper */
    --cream-dim: #a8a494;
    --brass: #d9a441;           /* ledger ink */
    --phosphor: #7ee787;        /* live numbers */
    --phosphor-dim: #4a8a52;
    --line: rgba(233, 228, 211, 0.14);
    --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
    --mono: "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  html { scroll-behavior: smooth; }
  body {
    background:
      radial-gradient(1200px 600px at 75% -10%, rgba(217, 164, 65, 0.06), transparent 60%),
      linear-gradient(160deg, var(--ink-bg) 0%, var(--ink-bg-2) 100%);
    background-color: var(--ink-bg);
    color: var(--cream);
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.55;
    overflow-x: hidden;
  }

  /* Base link colour. The stylesheet only ever styled links by class
     (nav a, .tutorial-link, footer .fine a), so every unclassed anchor fell
     through to the browser's washed-out default blue — which has no business
     in an ink-and-brass palette. Class-scoped rules still win on specificity. */
  a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 3px;
      text-decoration-color: rgba(217, 164, 65, 0.35); }
  a:hover { text-decoration-color: var(--brass); }
  body::after { /* grain — a suggestion of paper tooth, not visible static */
    content: "";
    position: fixed; inset: 0; pointer-events: none; z-index: 999;
    opacity: 0.13;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='1'/%3E%3CfeColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.03 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  .frame { max-width: 1180px; margin: 0 auto; padding: 0 32px; position: relative; z-index: 1; }

  /* ── the lounge scene (hero backdrop) ───────────────────── */
  .scene {
    position: absolute; top: 0; left: 0; right: 0; height: 1150px;
    z-index: 0; pointer-events: none; overflow: hidden;
    /* The source photo is near-black noir: simply lowering opacity merges it
       into the dark page and reads as a heavy flat slab. Lifting it instead —
       contrast down (blacks become greys), brightness up — makes it recede as
       an airy wash you can see through. */
    opacity: 0.34;
    filter: grayscale(1) contrast(0.58) brightness(1.3);
    -webkit-mask-image: linear-gradient(to bottom, black 0%, black 48%, transparent 92%);
    mask-image: linear-gradient(to bottom, black 0%, black 48%, transparent 92%);
  }
  .scene svg { width: 100%; height: 100%; display: block; }
  .scene-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; display: block; }
  .scene-photo img.defocus {
    position: absolute; inset: 0;
    filter: blur(4px);
    -webkit-mask-image: radial-gradient(ellipse 36% 34% at 80% 64%, black 45%, transparent 80%);
    mask-image: radial-gradient(ellipse 36% 34% at 80% 64%, black 45%, transparent 80%);
  }

  /* ── header ─────────────────────────────────────────────── */
  header {
    display: flex; align-items: baseline; justify-content: space-between;
    padding: 28px 0 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; gap: 12px 0;
  }
  .wordmark { font-family: var(--mono); font-size: 20px; letter-spacing: 0.04em; color: var(--cream); text-decoration: none; }
  .wordmark b { color: var(--brass); font-weight: 700; }
  .byline { font-family: var(--mono); font-size: 11.5px; color: var(--cream-dim); letter-spacing: 0.14em; text-transform: uppercase; }
  nav a { font-family: var(--mono); font-size: 12.5px; color: var(--cream-dim); text-decoration: none; margin-left: 24px; letter-spacing: 0.06em; }
  nav a:hover { color: var(--phosphor); }
  nav a.ext::after { content: " ↗"; color: var(--brass); font-size: 0.85em; }

  /* ── ledger margin rail ─────────────────────────────────── */
  section { position: relative; padding: 84px 0 20px; }
  .rail {
    position: absolute; left: -64px; top: 96px;
    font-family: var(--mono); font-size: 12px; color: var(--brass);
    letter-spacing: 0.12em; writing-mode: vertical-rl; text-orientation: mixed;
    opacity: 0.85;
  }
  @media (max-width: 1310px) { .rail { display: none; } }
  .rail::before { content: ""; display: block; width: 1px; height: 46px; background: var(--brass); margin: 0 auto 12px; opacity: 0.5; }

  /* ── hero ───────────────────────────────────────────────── */
  .hero { display: grid; grid-template-columns: 1.02fr 1fr; gap: 52px; align-items: center; padding: 92px 0 68px; }
  .hero h1 {
    font-size: clamp(38px, 4.9vw, 58px); line-height: 1.06; font-weight: 500;
    letter-spacing: -0.015em;
  }
  .hero h1 em { font-style: italic; color: var(--brass); }
  .hero p.lede { margin: 26px 0 20px; font-size: 19px; color: var(--cream-dim); max-width: 31em; }
  .hero p.lede b { color: var(--cream); font-weight: 600; }
  .hero p.sublede { margin-bottom: 34px; font-size: 16.5px; color: var(--cream-dim); max-width: 31em; }
  .cta-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
  .cta {
    font-family: var(--mono); font-size: 13.5px; letter-spacing: 0.04em;
    padding: 13px 24px; text-decoration: none; border-radius: 2px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  .cta.primary { background: var(--brass); color: #14100a; font-weight: 700; box-shadow: 0 0 0 1px var(--brass), 0 6px 24px rgba(217,164,65,0.25); }
  .cta.primary:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--brass), 0 10px 32px rgba(217,164,65,0.35); }
  .cta.ghost { color: var(--phosphor); border: 1px solid var(--phosphor-dim); }
  .cta.ghost:hover { border-color: var(--phosphor); transform: translateY(-2px); }

  /* ── the flow map (hero visual) ─────────────────────────── */
  .mapcard {
    background: rgba(10, 16, 13, 0.88);
    border: 1px solid var(--line); border-left: 3px solid var(--brass);
    border-radius: 3px; padding: 22px 24px 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.5);
  }
  .mapcard .cap {
    color: var(--cream-dim); font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.14em; text-transform: uppercase; display: block; margin-bottom: 6px;
  }
  .mapcard .capnote { color: var(--cream-dim); font-size: 13px; font-style: italic; display: block; margin-bottom: 14px; }
  .mapcard svg { width: 100%; height: auto; display: block; }
  .n-box { fill: rgba(233,228,211,0.04); stroke: var(--line); }
  .n-box.task { stroke: rgba(233,228,211,0.22); }
  .n-box.route { stroke: rgba(217,164,65,0.55); fill: rgba(217,164,65,0.05); }
  .n-box.query { stroke: rgba(126,231,135,0.5); fill: rgba(126,231,135,0.05); }
  .n-label { font-family: var(--mono); font-size: 11px; fill: var(--cream); }
  .n-kind  { font-family: var(--mono); font-size: 8.5px; fill: var(--cream-dim); letter-spacing: 0.08em; }
  .n-edge  { stroke: rgba(233,228,211,0.3); fill: none; }
  .n-edge.accent { stroke: rgba(126,231,135,0.55); }
  .n-in    { font-family: var(--mono); font-size: 9.5px; fill: var(--brass); letter-spacing: 0.1em; }

  /* staggered reveal */
  .up { opacity: 0; transform: translateY(18px); animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
  @keyframes rise { to { opacity: 1; transform: translateY(0); } }
  .d1 { animation-delay: 0.05s; } .d2 { animation-delay: 0.18s; } .d3 { animation-delay: 0.32s; }
  .d4 { animation-delay: 0.48s; }
  @media (prefers-reduced-motion: reduce) {
    .up { animation: none; opacity: 1; transform: none; }
  }

  /* ── section headings ───────────────────────────────────── */
  h2 { font-size: clamp(27px, 3.2vw, 38px); font-weight: 500; letter-spacing: -0.01em; margin-bottom: 14px; }
  h2 .no { font-family: var(--mono); font-size: 0.55em; color: var(--brass); vertical-align: super; margin-right: 10px; letter-spacing: 0.08em; }
  .sub { color: var(--cream-dim); max-width: 46em; margin-bottom: 42px; font-size: 17.5px; }
  .sub b { color: var(--cream); }

  /* ── principles ─────────────────────────────────────────── */
  .principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
  .principle { background: var(--ink-bg); padding: 30px 26px 34px; transition: background 0.2s; }
  .principle:hover { background: var(--ink-bg-2); }
  .principle h3 { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); margin-bottom: 14px; }
  .principle p { font-size: 15.5px; color: var(--cream-dim); }
  .principle p b { color: var(--cream); }

  /* ── spec + map pairing ─────────────────────────────────── */
  .pairing { display: grid; grid-template-columns: 1.25fr 1fr; gap: 26px; align-items: start; }
  .speccard {
    background: rgba(10, 16, 13, 0.92);
    border: 1px solid var(--line); border-left: 3px solid var(--brass);
    border-radius: 3px; padding: 24px 26px;
    font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
    box-shadow: 0 18px 48px rgba(0,0,0,0.4);
    overflow-x: auto;
  }
  .speccard .cap { color: var(--cream-dim); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; display: block; margin-bottom: 14px; }
  .speccard .k { color: var(--brass); }
  .speccard .v { color: var(--cream); }
  .speccard .c { color: var(--phosphor-dim); font-style: italic; }
  .speccard .hl { color: var(--phosphor); }

  /* the file reveals itself on hover and folds back when the cursor leaves */
  .spec-body { max-height: 322px; overflow: hidden; position: relative; transition: max-height 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
  .speccard:hover .spec-body, .speccard:focus-visible .spec-body { max-height: 2100px; }
  .spec-body::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 92px;
    pointer-events: none; transition: opacity 0.3s ease;
    background: linear-gradient(to bottom, rgba(10,16,13,0) 0%, rgba(10,16,13,0.86) 62%, rgba(10,16,13,0.97) 100%);
  }
  .speccard:hover .spec-body::after, .speccard:focus-visible .spec-body::after { opacity: 0; }
  .spec-more {
    display: block; margin-top: 10px; font-family: var(--mono); font-size: 11px;
    letter-spacing: 0.12em; text-transform: uppercase; color: var(--cream-dim);
    opacity: 0.72; transition: opacity 0.3s ease;
  }
  .spec-more::after { content: " ⌄"; color: var(--brass); }
  .speccard:hover .spec-more, .speccard:focus-visible .spec-more { opacity: 0; }
  @media (hover: none) {  /* touch: no hover to reveal with — just show it all */
    .spec-body { max-height: none; }
    .spec-body::after, .spec-more { display: none; }
  }
  @media (prefers-reduced-motion: reduce) {
    .spec-body { transition: none; }
  }
  .tutorial-link { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; letter-spacing: 0.06em; color: var(--phosphor); text-decoration: none; border-bottom: 1px solid var(--phosphor-dim); padding-bottom: 2px; }
  .tutorial-link:hover { border-color: var(--phosphor); }
  .tutorial-link::after { content: " ↗"; color: var(--brass); }
  .aside-note { border: 1px solid var(--line); border-radius: 3px; padding: 24px 26px; background: rgba(10,16,13,0.55); }
  .aside-note h3 { font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); margin-bottom: 12px; }
  .aside-note p { font-size: 15.5px; color: var(--cream-dim); margin-bottom: 14px; }
  .aside-note p b { color: var(--cream); }
  .aside-note p:last-child { margin-bottom: 0; }

  /* ── quality strip (no figures) ─────────────────────────── */
  .quality { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 40px 0; margin-top: 64px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
  .quality h3 { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--phosphor); margin-bottom: 12px; }
  .quality p { font-size: 16px; color: var(--cream-dim); }
  .quality p b { color: var(--cream); }

  /* ── pricing ────────────────────────────────────────────── */
  .tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
  .tier {
    border: 1px solid var(--line); border-radius: 3px; padding: 34px 30px 30px;
    background: rgba(10, 16, 13, 0.6); display: flex; flex-direction: column;
    transition: transform 0.2s ease, border-color 0.2s ease;
  }
  .tier:hover { transform: translateY(-4px); }
  .tier.pro { border-color: var(--brass); box-shadow: 0 18px 50px rgba(217,164,65,0.12); position: relative; }
  .tier.pro::before {
    content: "MOST CHOSEN FOR PRODUCTION"; position: absolute; top: -9px; left: 26px;
    font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
    background: var(--brass); color: #14100a; padding: 2px 10px; border-radius: 2px; font-weight: 700;
  }
  .tier h3 { font-family: var(--mono); font-size: 15px; letter-spacing: 0.12em; }
  .tier .contract { font-style: italic; color: var(--cream-dim); font-size: 14.5px; margin: 4px 0 22px; }
  .tier .price { font-family: var(--mono); font-size: 38px; color: var(--cream); margin-bottom: 2px; }
  /* Brass, not phosphor: green is reserved for query text and live
     numbers. A one-time price is a fixed fact on a ledger, and at
     $-figure width the green read as a terminal readout. */
  .tier .price b { color: var(--brass); font-weight: 400; }
  .tier .per { font-family: var(--mono); font-size: 11.5px; color: var(--cream-dim); letter-spacing: 0.08em; margin-bottom: 24px; }
  .tier ul { list-style: none; flex: 1; }
  .tier li { font-size: 14.5px; color: var(--cream-dim); padding: 7px 0 7px 22px; position: relative; border-top: 1px dashed rgba(233,228,211,0.08); }
  .tier li::before { content: "▹"; position: absolute; left: 2px; color: var(--brass); }
  .tier li b { color: var(--cream); font-weight: 600; }
  .tier li.na { opacity: 0.4; }
  .tier li.na::before { content: "—"; color: var(--cream-dim); }
  .tier .line { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; color: var(--brass); margin-top: 22px; text-transform: uppercase; }

  /* Buttons INSIDE a tier card (the download page). The hero CTAs are sized
     for a photo backdrop and the ghost variant borrows phosphor — both wrong
     in a card: green is query text, and a price card is not a hero. Scoped so
     the hero keeps its own treatment. */
  .tier .cta-row { gap: 10px; margin-top: 22px; }
  .tier .cta { padding: 9px 15px; font-size: 11.5px; letter-spacing: 0.08em; }
  .tier .cta.primary { box-shadow: 0 0 0 1px var(--brass); }
  .tier .cta.primary:hover { transform: none; box-shadow: 0 0 0 1px var(--brass), 0 4px 14px rgba(217,164,65,0.25); }
  .tier .cta.ghost { color: var(--cream-dim); border-color: rgba(233,228,211,0.22); }
  .tier .cta.ghost:hover { color: var(--brass); border-color: var(--brass); transform: none; }
  .tier .cta-row + .line { margin-top: 18px; }
  .rateguard { margin-top: 26px; font-size: 14px; color: var(--cream-dim); font-style: italic; }
  .rateguard b { color: var(--brass); font-style: normal; }

  /* ── duality ────────────────────────────────────────────── */
  .duality { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
  .duo {
    border: 1px solid var(--line); border-radius: 3px; padding: 30px;
    background: rgba(10, 16, 13, 0.6);
  }
  .duo h3 { font-family: var(--mono); font-size: 14px; letter-spacing: 0.1em; color: var(--phosphor); margin-bottom: 6px; }
  .duo .tierof { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; color: var(--brass); margin-bottom: 16px; }
  .duo p { font-size: 15px; color: var(--cream-dim); }
  .duo p b { color: var(--cream); }

  /* ── explore / next steps ───────────────────────────────── */
  .explore { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
  .card {
    border: 1px solid var(--line); border-radius: 3px; padding: 28px 26px 26px;
    background: rgba(10,16,13,0.6); text-decoration: none; display: block;
    transition: transform 0.2s ease, border-color 0.2s ease;
  }
  .card:hover { transform: translateY(-4px); border-color: var(--brass); }
  .card h3 { font-family: var(--mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--brass); margin-bottom: 12px; }
  .card p { font-size: 15px; color: var(--cream-dim); }
  .card .go { font-family: var(--mono); font-size: 11.5px; color: var(--phosphor); letter-spacing: 0.1em; margin-top: 16px; display: block; }

  /* ── footer ─────────────────────────────────────────────── */
  footer { margin-top: 100px; border-top: 1px solid var(--line); padding: 36px 0 48px;
    display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 18px; }
  footer .fine { font-family: var(--mono); font-size: 11.5px; color: var(--cream-dim); letter-spacing: 0.05em; line-height: 2; }
  footer .fine a { color: var(--cream-dim); }
  footer .fine a:hover { color: var(--phosphor); }
  footer .stamp { font-family: var(--mono); font-size: 11px; color: var(--brass); border: 1px solid var(--brass); border-radius: 2px; padding: 4px 10px; letter-spacing: 0.12em; opacity: 0.8; }

  @media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; padding-top: 64px; }
    .principles, .tiers, .duality, .quality, .pairing, .explore { grid-template-columns: 1fr; }
    .rail { display: none; }
    nav a { margin-left: 0; margin-right: 20px; }
  }

  /* Reading list (§6): the wiki pages, in order. */
  .readlist { margin-top: 38px; }
  .readlist h3 {
    font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
    text-transform: uppercase; color: var(--brass); margin-bottom: 14px;
  }
  .readlist ol { list-style: none; counter-reset: rl; margin: 0; padding: 0; }
  .readlist li { counter-increment: rl; border-top: 1px solid var(--rule); }
  .readlist li:last-child { border-bottom: 1px solid var(--rule); }
  .readlist a {
    display: grid; grid-template-columns: 2.2em 1fr auto; align-items: baseline;
    gap: 14px; padding: 13px 4px; text-decoration: none; transition: background 0.15s;
  }
  .readlist a::before {
    content: counter(rl); font-family: var(--mono); font-size: 11.5px;
    color: var(--phosphor); opacity: 0.75;
  }
  .readlist a:hover { background: rgba(255,255,255,0.03); }
  .readlist a b { font-weight: 600; color: var(--cream); }
  .readlist a:hover b { color: var(--brass); }
  .readlist a span { font-size: 14px; color: var(--cream-dim); text-align: right; }
  @media (max-width: 760px) {
    .readlist a { grid-template-columns: 2em 1fr; }
    .readlist a span { grid-column: 2; text-align: left; font-size: 13px; }
  }

  /* Spec card holding a rendered figure rather than source text. The
     collapse/expand behaviour is unchanged: the head of the tree is visible,
     hovering reveals the whole description. */
  .spec-figure img { width: 100%; height: auto; display: block; border-radius: 6px; }

/* Small screens: commands scroll inside their cards, labels and links wrap. */
.speccard { min-width: 0; max-width: 100%; }
.speccard pre { max-width: 100%; overflow-x: auto; }
p code, li code { overflow-wrap: anywhere; }
.cta-row { flex-wrap: wrap; }
@media (max-width: 600px) {
  .hero > div, section, .card { min-width: 0; }
  .cta { white-space: normal; text-align: center; }
}

.copy-code { display: block; margin: .4rem 0 .4rem auto; padding: .4rem .7rem; background: transparent; color: var(--gold, #d5a444); border: 1px solid currentColor; border-radius: 4px; cursor: pointer; }
.copy-code:focus-visible { outline: 2px solid #7ee787; outline-offset: 3px; }

.spec-body.starter-spec { max-height: none; overflow: visible; }
.spec-body.starter-spec::after { display: none; }
.tutorial-link { white-space: normal; }
