/* Evidome language page (design preview). Builds on ../styles.css. Order: the programme with its notes, the
   instruction it runs, then the book (one chapter at a time). Token colours follow the #359 handoff palette and
   pass WCAG AA on the code background, the knowledge tint and the highlight. */

:root {
  --code-bg: #f7f9fc;
  --code-line: #dde3ec;
  --tok-control: #6d28d9;
  --tok-specialize: #0f766e;
  --tok-type: #9f1239;
  --tok-capability: #1d4ed8;
  --tok-binding: #334155;
  --tok-literal: #92400e;
  --tok-comment: #5f6b7d;
  --know-tint: #e6f4f1;
  --hl: #fff3c4;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

main h1, main h2, main h3, main h4, main h5, main p, main ul, main ol, main dl, main dd, main figure { margin: 0; }
main ul, main ol { padding: 0; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; border-radius: 4px; }
main code { font-family: var(--mono); font-size: 0.88em; }
.prose code, .notes code, .pkeys code, .sec-lede code, .runs-note code, .fam-card code, .tri-lead code, .xstep code, .spec code, .rp code {
  background: var(--code-bg); border: 1px solid var(--code-line); border-radius: 4px; padding: 1px 5px;
}

/* ── 1. hero: the programme first ── */
.lang-hero { padding: 36px 0 56px; }
.preview-badge {
  display: inline-block; margin-bottom: 14px; padding: 5px 11px; border: 1px solid var(--color-line);
  border-radius: 999px; background: var(--color-surface); font-size: 12.5px; font-weight: 600; color: var(--color-muted);
}
.lang-hero h1 { font-weight: 900; font-size: 40px; line-height: 1.08; letter-spacing: -1px; max-width: 900px; margin-bottom: 10px; }
.lang-hero .lede { font-size: 17px; line-height: 1.55; color: var(--color-muted); max-width: 820px; margin-bottom: 8px; }
.hero-note { font-size: 14.5px; line-height: 1.5; color: var(--color-ink); max-width: 820px; margin-bottom: 22px; padding-left: 10px; border-left: 3px solid var(--color-accent); }

.read { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 28px; align-items: start; }
.hero-code { margin: 0; }
.hero-code pre { position: relative; height: min(560px, calc(100vh - 290px)); min-height: 380px; }
.ln { display: inline-block; min-width: 100%; padding-left: 26px; position: relative; border-radius: 3px; transition: background 200ms ease, opacity 200ms ease; }
.ln[data-mark]::before {
  content: attr(data-mark); position: absolute; left: 0; top: 0.2em; display: grid; place-items: center; width: 17px; height: 17px;
  border-radius: 50%; background: var(--color-surface); border: 1px solid var(--color-muted); color: var(--color-muted);
  font: 600 10px/1 "Inter", sans-serif; font-style: normal;
}
.ln[data-n] { cursor: pointer; }
.read.is-active .ln { opacity: 0.6; }
.read.is-active .ln.is-hl { opacity: 1; background: var(--hl); }
.read.is-active .ln.is-hl[data-mark]::before { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }

.read-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-muted); margin-bottom: 10px; }
.notes, .pkeys { list-style: none; display: grid; gap: 6px; }
.note, .pkey {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: start; width: 100%; text-align: left;
  font: inherit; font-size: 14.5px; line-height: 1.5; color: var(--color-ink); cursor: pointer;
  padding: 10px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent;
  transition: background 200ms ease, border-color 200ms ease;
}
.note:hover, .pkey:hover { background: var(--color-surface); border-color: var(--color-line); }
.note[aria-pressed="true"], .pkey[aria-pressed="true"] { background: var(--hl); border-color: #ecd98a; }
.note-n {
  display: grid; place-items: center; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  border: 1.5px solid var(--color-ink); font-size: 12px; font-weight: 700;
}
.note[aria-pressed="true"] .note-n, .pkey[aria-pressed="true"] .note-n { background: var(--color-ink); color: #fff; }

/* ── 2. the instruction it runs ── */
.lang-sec { padding: 64px 0; border-top: 1px solid var(--color-line); }
.lang-sec h2 { font-weight: 800; font-size: 34px; line-height: 1.15; letter-spacing: -0.6px; max-width: 820px; margin: 10px 0 12px; }
.sec-lede { font-size: 17px; line-height: 1.55; max-width: 820px; margin-bottom: 24px; }
.runs { display: grid; grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1.25fr); align-items: center; }
.pane { border: 1px solid var(--code-line); border-radius: 12px; background: var(--code-bg); overflow: hidden; min-width: 0; align-self: stretch; }
.runs-arrow { position: relative; height: 2px; background: var(--color-ink); margin: 0 6px; }
.runs-arrow::after { content: ""; position: absolute; right: -2px; top: -5px; border: 6px solid transparent; border-left: 9px solid var(--color-ink); border-right: 0; }
.runs-arrow span { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); font-size: 11px; font-weight: 600; color: var(--color-muted); white-space: nowrap; }
.pair { border-radius: 3px; cursor: pointer; transition: background 200ms ease, box-shadow 200ms ease, opacity 200ms ease; }
.pair::before {
  content: attr(data-p); display: inline-grid; place-items: center; width: 15px; height: 15px; margin-right: 3px; vertical-align: 1px;
  border-radius: 50%; border: 1px solid var(--color-muted); font: 600 9.5px/1 "Inter", sans-serif; color: var(--color-muted); font-style: normal;
}
#runs.is-active .pair { opacity: 0.6; }
#runs.is-active .pair.is-on { opacity: 1; background: var(--hl); box-shadow: 0 0 0 2px var(--hl); }
#runs.is-active .pair.is-on::before { background: var(--color-ink); border-color: var(--color-ink); color: #fff; }
.pkeys { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 14px; }
.runs-note { margin-top: 16px; font-size: 15px; line-height: 1.55; color: var(--color-muted); max-width: 820px; }

/* ── code panels ── */
.code { margin: 20px 0 0; border: 1px solid var(--code-line); border-radius: 12px; background: var(--code-bg); overflow: hidden; max-width: 100%; }
.code figcaption, .pane figcaption {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--code-line);
  font-size: 13px; font-weight: 600; color: var(--color-ink); background: var(--color-surface);
}
.code-lang { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--color-muted); border: 1px solid var(--code-line); border-radius: 4px; padding: 1px 6px; }
.code-act { margin-left: auto; display: flex; gap: 8px; }
.code-copy, .code-dl {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--color-ink); background: var(--color-surface);
  border: 1px solid var(--code-line); border-radius: 6px; padding: 4px 10px; cursor: pointer; display: inline-block;
}
.code-copy:hover, .code-dl:hover { border-color: var(--color-muted); }
.code pre, .pane pre { margin: 0; padding: 14px 16px; overflow: auto; }
.code code, .pane code { font-variant-ligatures: none; font-family: var(--mono); font-size: 13px; line-height: 1.6; color: var(--tok-binding); white-space: pre; }
.pane code { font-size: 12.5px; }
.code-note { padding: 10px 14px; border-top: 1px solid var(--code-line); font-size: 13px; color: var(--color-muted); }

.tok-control { color: var(--tok-control); font-weight: 500; }
.tok-specialize { color: var(--tok-specialize); font-weight: 600; }
.tok-type { color: var(--tok-type); }
.tok-capability { color: var(--tok-capability); }
.tok-binding, .tok-field { color: var(--tok-binding); }
.tok-field { font-style: italic; }
.tok-literal { color: var(--tok-literal); }
.tok-operator, .tok-comment { color: var(--tok-comment); }
.tok-comment { font-style: italic; }

/* ── 3. the book ── */
.book { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; margin-top: 16px; align-items: start; }
.book-nav { position: sticky; top: 16px; }
.book-nav ol { list-style: none; display: grid; gap: 2px; border-left: 1px solid var(--color-line); }
.book-nav a {
  display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; margin-left: -1px; border-left: 2px solid transparent;
  font-size: 15px; font-weight: 500; color: var(--color-muted);
}
.book-nav a:hover { color: var(--color-ink); }
.book-nav a[aria-current="true"] { color: var(--color-ink); font-weight: 600; border-left-color: var(--color-accent); }
.bn-n { font-size: 12px; font-weight: 600; color: var(--color-muted); min-width: 14px; }
.chapter { min-width: 0; }
.js-book .chapter { display: none; }
.js-book .chapter.is-open { display: block; animation: ch-in 220ms ease; }
@keyframes ch-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.chapter + .chapter { margin-top: 64px; }
.js-book .chapter + .chapter { margin-top: 0; }
.chapter > h3 { font-weight: 800; font-size: 30px; line-height: 1.15; letter-spacing: -0.5px; margin: 8px 0 20px; }
.chapter > h3 + .code { margin-top: 0; }
.prose { max-width: 760px; }
.prose p { font-size: 16.5px; line-height: 1.6; color: var(--color-ink); }
.prose p + p { margin-top: 14px; }
.chapter > * + .prose, .chapter > .prose + * { margin-top: 20px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--color-line); }
.pager a { font-size: 15px; font-weight: 600; padding: 10px 14px; border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-surface); }
.pager a:hover { border-color: var(--color-muted); }
.pg-next { margin-left: auto; }

/* roles */
.rp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(140px, 200px) minmax(0, 1fr); gap: 14px; align-items: center; }
.rp-card { padding: 20px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 12px; height: 100%; }
.rp-cap { border-top: 3px solid var(--tok-capability); }
.rp-ver { border-top: 3px solid var(--tok-type); }
.rp-tag { font-size: 12px; font-weight: 600; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.rp-card h4 { font-size: 19px; font-weight: 800; margin: 6px 0 10px; font-family: "Archivo", "Inter", sans-serif; }
.rp-card ul { list-style: none; display: grid; gap: 6px; font-size: 14.5px; line-height: 1.45; }
.rp-card li { padding-left: 16px; position: relative; }
.rp-card li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--color-muted); }
.rp-link { display: grid; justify-items: center; gap: 8px; text-align: center; }
.rp-op code { color: var(--tok-capability); }
.rp-sub { font-size: 12.5px; color: var(--color-muted); }
.rp-wire { position: relative; width: 100%; height: 2px; background: var(--color-ink); }
.rp-wire::after { content: ""; position: absolute; right: -2px; top: -5px; border: 6px solid transparent; border-left: 9px solid var(--color-ink); border-right: 0; }
.rp-bundle { position: absolute; top: -8px; left: 0; width: 18px; height: 18px; border-radius: 4px; background: var(--color-surface); border: 2px solid var(--color-ink); }
.rp-bundle::after { content: ""; position: absolute; inset: 4px; border-radius: 1px; background: var(--color-ink); }
.rp.is-sent .rp-bundle { left: calc(100% - 26px); transition: left 1100ms cubic-bezier(.4, 0, .2, 1); }
.scopebox {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 32px;
  margin-top: 20px; padding: 16px 20px; max-width: 900px; border: 1px solid var(--color-line); border-radius: 12px; background: var(--color-surface);
}
.scopebox p, .scopebox li { font-size: 15px; line-height: 1.5; }
.scopebox-h { margin-bottom: 6px !important; font-weight: 700; font-size: 12px !important; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
.scopebox ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.scopebox li { padding: 2px 10px; border: 1px dashed var(--color-muted); border-radius: 999px; font-size: 14px; }

/* knowledge */
.spec { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.spec-row { display: grid; gap: 6px; align-content: start; padding: 14px; border-top: 3px solid var(--tok-specialize); background: var(--know-tint); border-radius: 0 0 10px 10px; }
.spec-instr { font-weight: 600; font-size: 15px; }
.spec-dep { color: var(--tok-specialize); }
.spec-know { font-size: 14px; color: var(--color-muted); }
.spec-know::before { content: "knowledge: "; font-weight: 600; color: var(--tok-specialize); }

/* execution */
.xsteps { list-style: none; display: grid; gap: 0; max-width: 820px; }
.xstep { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; position: relative; padding-bottom: 22px; }
.xstep:not(:last-child)::after { content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px; width: 2px; background: var(--color-line); }
.xstep-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--color-ink); font-weight: 700; font-size: 14px; background: var(--color-bg); }
.xstep h4 { font-size: 17px; font-weight: 700; margin: 4px 0 4px; }
.xstep p { font-size: 15.5px; line-height: 1.55; }
.xstep-gate .xstep-n { border-color: var(--tok-specialize); color: var(--tok-specialize); }

/* instructions */
.fam + .fam { margin-top: 32px; }
.fam h4 { font-size: 18px; font-weight: 800; margin-bottom: 12px; font-family: "Archivo", "Inter", sans-serif; }
.fam-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.fam-card { padding: 18px; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: 12px; }
.fam-card h5 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.fam-card dl { display: grid; gap: 8px; }
.fam-card dt { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); }
.fam-card dd { font-size: 14px; line-height: 1.5; }

/* lowering */
.tri { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.tri-lead { font-size: 15.5px; line-height: 1.55; max-width: 760px; }
.tri .code { margin-top: 10px; }
.tri .code pre { max-height: 340px; }
.tri .code code { font-size: 12.5px; }

/* claims, reference */
.closing-links { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.closing-links a { display: inline-block; padding: 10px 16px; border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-surface); font-size: 15px; font-weight: 500; }
.closing-links a:hover { border-color: var(--color-muted); }
#full-reference pre { max-height: 640px; }
.ref-dl { margin-top: 14px; }

@media (max-width: 1000px) {
  .read { grid-template-columns: minmax(0, 1fr); }
  .hero-code pre { height: 420px; min-height: 0; }
  .runs { grid-template-columns: minmax(0, 1fr); }
  .runs-arrow { width: 2px; height: 40px; margin: 6px 0 6px 28px; }
  .runs-arrow::after { right: -5px; top: auto; bottom: -2px; border: 6px solid transparent; border-top: 9px solid var(--color-ink); border-bottom: 0; }
  .runs-arrow span { left: 14px; bottom: auto; top: 50%; transform: translateY(-50%); }
  .pkeys { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .book { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .book-nav { position: sticky; top: 0; z-index: 2; background: var(--color-bg); margin: 0 -16px; padding: 8px 16px; border-bottom: 1px solid var(--color-line); }
  .book-nav ol { display: flex; gap: 4px; overflow-x: auto; border-left: 0; scrollbar-width: none; }
  .book-nav a { white-space: nowrap; border-left: 0; border-bottom: 2px solid transparent; margin: 0; padding: 8px 10px; }
  .book-nav a[aria-current="true"] { border-bottom-color: var(--color-accent); }
  .spec { grid-template-columns: minmax(0, 1fr); }
  .rp { grid-template-columns: minmax(0, 1fr); }
  .rp-wire { width: 2px; height: 48px; }
  .rp-wire::after { right: -5px; top: auto; bottom: -2px; border: 6px solid transparent; border-top: 9px solid var(--color-ink); border-bottom: 0; }
  .rp-bundle { left: -8px; top: 0; }
  .rp.is-sent .rp-bundle { left: -8px; top: calc(100% - 26px); transition: top 1100ms cubic-bezier(.4, 0, .2, 1); }
  .scopebox { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px) {
  .lang-hero { padding: 20px 0 40px; }
  .lang-hero h1 { font-size: 30px; letter-spacing: -0.6px; }
  .lang-hero .lede { font-size: 16px; }
  .hero-code pre { height: 380px; }
  .code code { font-size: 12px; }
  .lang-sec { padding: 44px 0; }
  .lang-sec h2 { font-size: 26px; }
  .chapter > h3 { font-size: 24px; }
  .pkeys { grid-template-columns: minmax(0, 1fr); }
  .pager { flex-direction: column; }
  .pager span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rp-bundle, .rp.is-sent .rp-bundle, .ln, .pair, .note, .pkey { transition: none !important; }
  .js-book .chapter.is-open { animation: none; }
}

/* ── 2. how it runs: the VM run (the projectneutrino.net idiom) and the instruction table ── */
.vmrun { border: 1px solid var(--color-line); border-radius: 14px; background: var(--color-surface); padding: 14px 16px 10px; }
.vm-bar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 8px; }
.gbadge { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; padding: 4px 10px; border-radius: 999px; border: 1px dashed var(--color-muted); color: var(--color-muted); }
.gscen { display: flex; flex-wrap: wrap; gap: 6px; }
.gscen button, .vm-replay {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--color-ink); background: var(--color-surface);
  border: 1px solid var(--color-line); border-radius: 8px; padding: 6px 11px; cursor: pointer;
}
.gscen button[aria-pressed="true"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-bg); }
.vm-replay { margin-left: auto; }
.vm-scroll { overflow-x: auto; }
.vm-svg { display: block; width: 100%; min-width: 900px; height: auto; }
.vm-nojs { font-size: 14px; color: var(--color-muted); padding: 12px 0; }
.vm-status { font-family: var(--mono); font-size: 12.5px; color: var(--color-ink); min-height: 1.6em; padding: 6px 2px 0; border-top: 1px solid var(--color-line); margin-top: 6px; }
.vm-pad { fill: none; stroke: var(--color-line); }
.vm-grp { font: 700 9px "Inter", sans-serif; fill: var(--color-muted); letter-spacing: 0.06em; }
.vm-sub { font-size: 7.5px; }
.vm-row { font: 500 9px "JetBrains Mono", ui-monospace, monospace; fill: var(--color-muted); }
.vm-row.end { fill: var(--color-ink); }
.vm-row.hl { fill: var(--color-ink); font-weight: 700; }
.vm-rowbg { fill: transparent; }
.vm-rowbg.hl { fill: var(--hl); }
.vm-pc, .vm-token { fill: var(--color-accent); }
.vm-jump { fill: none; stroke: var(--color-accent); stroke-width: 1.3; }
.vm-ah { fill: var(--color-muted); }
.vm-wire { stroke: #9aa1ab; stroke-width: 1; fill: none; }
.vm-rule { stroke: var(--color-line); stroke-width: 1; }
.vm-ball { fill: var(--color-surface); stroke: #9aa1ab; }
.vm-frag { font: 500 9px "JetBrains Mono", ui-monospace, monospace; fill: var(--color-ink); }
.vm-dim { fill: var(--color-muted); }
.vm-tick { stroke: var(--color-ink); stroke-width: 1; }
.vm-dot { fill: var(--color-ink); }
.vm-box { fill: var(--color-surface); stroke: var(--color-ink); stroke-width: 1; }
.vm-msg { stroke: var(--color-accent); stroke-width: 1.3; stroke-dasharray: 4 3; }
.vm-wait { stroke: var(--color-accent); stroke-width: 2.5; opacity: 0.35; }
.vm-svg g > * { transition: opacity 160ms ease; }
.vm-pc { transition: cy 220ms ease; }

.it-lede { font-size: 15px; line-height: 1.55; color: var(--color-muted); max-width: 820px; margin-bottom: 8px; }
.it-group { font-size: 15px; font-weight: 700; margin: 22px 0 8px; }
.it-h { font-size: 20px; font-weight: 800; margin: 36px 0 8px; font-family: "Archivo", "Inter", sans-serif; }
.it-scroll { overflow-x: auto; border: 1px solid var(--color-line); border-radius: 12px; background: var(--color-surface); }
.itable { width: 100%; min-width: 720px; table-layout: fixed; border-collapse: collapse; font-size: 13.5px; }
.itable th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); padding: 10px 12px; border-bottom: 1px solid var(--color-line); background: var(--color-bg); }
.itable td { padding: 10px 12px; border-bottom: 1px solid var(--color-line); vertical-align: top; line-height: 1.45; }
.itable tr:last-child td { border-bottom: 0; }
.itable td:first-child code { font-weight: 600; font-size: 13px; }
.it-sub { display: block; font-size: 12.5px; color: var(--color-muted); }
.it-fam { display: block; font-family: var(--mono); font-size: 11px; color: var(--color-muted); margin-top: 2px; }
.it-res { list-style: none; display: grid; gap: 3px; }
.it-res li { font-size: 13px; }
.it-res li:first-child { font-weight: 600; }
.gnotes { margin-top: 20px; }
.gnotes p { font-size: 15px; color: var(--color-muted); }
.gnotes strong { color: var(--color-ink); }
.ch-sub { font-size: 18px; font-weight: 800; margin: 28px 0 12px; font-family: "Archivo", "Inter", sans-serif; }
.spec-table { border: 1px solid var(--color-line); border-radius: 10px; overflow: hidden; display: block; overflow-x: auto; }
.spec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--color-surface); }
.spec-table th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); padding: 8px 12px; border-bottom: 1px solid var(--color-line); background: var(--color-bg); }
.spec-table td { padding: 8px 12px; border-bottom: 1px solid var(--color-line); vertical-align: top; line-height: 1.45; }


@media (prefers-reduced-motion: reduce) {
  .vm-svg g > *, .vm-pc { transition: none !important; }
}
.itable th:nth-child(1) { width: 22%; } .itable th:nth-child(2) { width: 26%; } .itable th:nth-child(3) { width: 26%; }

/* ── specialization: programme → selected knowledge → specialized instructions ── */
.shape { border: 1px solid var(--color-line); border-radius: 14px; background: var(--color-surface); padding: 14px 16px; }
.sh-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 12px; }
.sh-note { font-size: 12.5px; color: var(--color-muted); }
.sh-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) 22px minmax(0, 1.05fr) 22px minmax(0, 1fr); align-items: start; }
.sh-col { min-width: 0; }
.sh-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-ink); margin-bottom: 8px; }
.sh-h span { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--color-muted); margin-left: 4px; }
.sh-arrow { align-self: start; margin-top: 120px !important; height: 2px; background: #9aa1ab; position: relative; margin: 0 3px; }
.sh-arrow::after { content: ""; position: absolute; right: -2px; top: -4px; border: 5px solid transparent; border-left: 7px solid #9aa1ab; border-right: 0; }
.sh-src { margin: 0; padding: 10px 12px; border: 1px solid var(--code-line); border-radius: 10px; background: var(--code-bg); overflow-x: auto; }
.sh-src code { font-family: var(--mono); font-variant-ligatures: none; font-size: 10.8px; line-height: 1.65; color: var(--tok-binding); white-space: pre; }
.sl { display: inline-block; min-width: 100%; border-radius: 3px; transition: background 200ms ease, opacity 200ms ease; }
.sl[data-i] { cursor: pointer; }
.shape.is-on .sl[data-i] { opacity: 0.55; }
.shape.is-on .sl.is-on { opacity: 1; background: var(--hl); }

.kgraph { display: block; width: 100%; height: auto; }
.shape:not([data-domain="lamp"]) .kd-lamp, .shape[data-domain="lamp"] .kd-guitar { display: none !important; }
.kn rect { fill: var(--color-surface); stroke: #9aa1ab; stroke-width: 1; transition: stroke 200ms ease, fill 200ms ease; }
.kn text { font: 500 10px "Inter", sans-serif; fill: var(--color-ink); text-anchor: middle; }
.kn-object rect { fill: var(--color-ink); stroke: var(--color-ink); }
.kn-object text { fill: var(--color-bg); font-weight: 600; }
.kn-field rect, .kn-method rect { stroke-dasharray: 3 2; }
.kcatbox { fill: none; stroke: var(--color-line); stroke-dasharray: 4 3; }
.kcat { font: 600 9px "Inter", sans-serif; fill: var(--color-muted); letter-spacing: 0.04em; }
.ke path { fill: none; stroke: #b9bec6; stroke-width: 1.2; transition: stroke 200ms ease, stroke-width 200ms ease, opacity 200ms ease; }
.ke-adv path { stroke-dasharray: 3 3; }
.ke circle { fill: var(--color-surface); stroke: #b9bec6; transition: fill 200ms ease, stroke 200ms ease; }
.ke text { font: 700 8px "Inter", sans-serif; fill: var(--color-muted); text-anchor: middle; }
.shape.is-on .ke { opacity: 0.35; }
.shape.is-on .ke.is-kept { opacity: 0.8; }
.shape.is-on .ke.is-kept path { stroke: var(--tok-specialize); }
.shape.is-on .ke.is-on { opacity: 1; }
.shape.is-on .ke.is-on path { stroke: var(--tok-specialize); stroke-width: 2.2; }
.shape.is-on .ke.is-on circle { fill: var(--tok-specialize); stroke: var(--tok-specialize); }
.shape.is-on .ke.is-on text { fill: #fff; }
.shape.is-on .kn.is-on rect { stroke: var(--tok-specialize); stroke-width: 1.8; }
.shape.is-on .kn-object.is-on rect { fill: var(--tok-specialize); }

.sc-list { display: grid; gap: 8px; }
.sc { border: 1px solid var(--color-line); border-radius: 10px; padding: 8px 10px; background: var(--color-surface); cursor: pointer; transition: border-color 200ms ease, box-shadow 200ms ease; position: relative; }
.sc header { display: flex; align-items: center; gap: 8px; }
.sc header code { font-family: var(--mono); font-size: 12.5px; font-weight: 600; }
.sc-n { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.3px solid var(--color-ink); font-size: 10.5px; font-weight: 700; }
.sc-state { margin-left: auto; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); }
.sc-h { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--tok-specialize); margin: 6px 0 2px; }
.sc-h-b { color: var(--color-muted); }
.sc-know { list-style: none; display: grid; gap: 1px; font-size: 12.5px; line-height: 1.4; padding: 3px 0 3px 8px; border-left: 3px solid var(--tok-specialize); background: var(--know-tint); border-radius: 0 6px 6px 0; }
.sc-bound { font-family: var(--mono); font-size: 11.5px; color: var(--color-ink); padding-left: 8px; border-left: 3px solid #9aa1ab; }
/* while the pass runs: a card is empty until it is specialized */
.shape.is-on .sc .sc-know { opacity: 0.18; }
.shape.is-on .sc.is-filled .sc-know { opacity: 1; transition: opacity 300ms ease; }
.shape.is-on .sc.is-on { border-color: var(--tok-specialize); box-shadow: 0 0 0 1px var(--tok-specialize); }
.sc.is-filled .sc-state::before { content: "specialized"; color: var(--tok-specialize); }
.sc.is-run .sc-state::before { content: "▶ VM runs"; color: var(--color-accent); }
.sc.is-ran .sc-state::before { content: "ran"; color: var(--color-muted); }
.sh-found { margin-top: 12px; padding: 8px 12px; font-size: 13.5px; line-height: 1.5; border-radius: 8px; background: var(--color-bg); border: 1px solid var(--color-line); }
.sh-found code { font-size: 12px; }
.sh-status { font-family: var(--mono); font-size: 12.5px; min-height: 1.6em; padding-top: 8px; color: var(--color-ink); }

@media (max-width: 1000px) {
  .sh-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .sh-arrow { width: 2px; height: 18px; margin: 2px 0 6px 20px !important; justify-self: start; }
  .sh-arrow::after { right: -4px; top: auto; bottom: -2px; border: 5px solid transparent; border-top: 7px solid #9aa1ab; border-bottom: 0; }
  .kgraph { max-width: 440px; }
}
@media (prefers-reduced-motion: reduce) {
  .sl, .kn rect, .ke path, .ke circle, .sc, .shape.is-on .sc.is-filled .sc-know { transition: none !important; }
}

/* ── the Language section: sub-navigation and the three pages ── */
.nav { padding-bottom: 0; }
.subnav { display: flex; gap: 4px; margin-top: 14px; border-bottom: 1px solid var(--color-line); overflow-x: auto; }
.subnav a { padding: 8px 12px; font-size: 14px; font-weight: 500; color: var(--color-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subnav a:hover { color: var(--color-ink); }
.subnav a[aria-current="page"] { color: var(--color-ink); font-weight: 600; border-bottom-color: var(--color-accent); }
.lang-first { border-top: 0; padding-top: 36px; }
.page-h { font-weight: 900; font-size: 40px; line-height: 1.08; letter-spacing: -1px; margin: 8px 0 12px; max-width: 900px; }

.next-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 8px; }
.next-card { display: grid; gap: 6px; padding: 20px; border: 1px solid var(--color-line); border-radius: 12px; background: var(--color-surface); color: var(--color-ink); transition: border-color 200ms ease; }
.next-card:hover { border-color: var(--color-muted); }
.next-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-accent); }
.next-card strong { font-family: "Archivo", "Inter", sans-serif; font-size: 20px; font-weight: 800; }
.next-card span:not(.next-k):not(.next-go) { font-size: 15px; line-height: 1.5; color: var(--color-muted); }
.next-go { font-size: 14px; font-weight: 600; margin-top: 4px; }
.bounded { margin-top: 28px; }

.it-draft { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); border: 1px dashed var(--color-muted); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px; }
#instructions .fullref { margin-top: 32px; }
#instructions .fullref summary { font-size: 20px; }

.ex-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 24px; }
.ex-tabs a { font-size: 14px; font-weight: 600; padding: 8px 14px; border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-surface); color: var(--color-ink); }
.ex-tabs a[aria-current="true"] { background: var(--color-ink); border-color: var(--color-ink); color: var(--color-bg); }
.ex-list.is-tabbed .ex { display: none; }
.ex-list.is-tabbed .ex.is-open { display: block; }
.ex + .ex { margin-top: 56px; padding-top: 40px; border-top: 1px solid var(--color-line); }
.ex-list.is-tabbed .ex + .ex { margin-top: 0; padding-top: 0; border-top: 0; }
.ex h2 { font-weight: 800; font-size: 32px; line-height: 1.15; letter-spacing: -0.6px; margin: 6px 0 6px; }
.ex-name { font-size: 15px; color: var(--color-muted); margin-bottom: 20px; max-width: 860px; }
.ex-grid { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); gap: 28px; align-items: start; }
.ex-facts { display: grid; gap: 16px; }
.ex-h { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-muted); margin-bottom: 4px !important; }
.ex-facts p, .ex-facts li { font-size: 15px; line-height: 1.5; }
.ex-facts ul { list-style: none; display: grid; gap: 4px; }
.ex-facts li { padding-left: 14px; position: relative; }
.ex-facts li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--color-muted); }
.ex-finding { padding: 10px 12px; border-left: 3px solid var(--tok-specialize); background: var(--know-tint); border-radius: 0 8px 8px 0; }
.ex-run { display: inline-block; font-size: 15px; font-weight: 600; padding: 9px 14px; border: 1px solid var(--color-line); border-radius: 8px; background: var(--color-surface); }
.ex-run:hover { border-color: var(--color-muted); }
.ex-code .code { margin-top: 0; }
.ex-code pre { max-height: 560px; }
.ex-draft { font-size: 13px; color: var(--color-muted); margin-top: 8px; }
.ex .fullref { margin-top: 24px; }
.ex .fullref summary { font-size: 18px; }

@media (max-width: 1000px) {
  .next-grid, .ex-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .page-h { font-size: 30px; }
  .ex h2 { font-size: 24px; }
}
