/* ML Weft — w3ft.org
   One stylesheet, no build step.

   Palette: deep navy-black is primary. The secondary is a liquid-metal blue
   family (abyss, petrol, steel, cerulean, aqua, ice, frost), sampled from a
   liquid-metal reference picked by the project owner. Metallic gold is a rare
   highlight.

   Roles, so that important things can be picked out at a glance:
   - headings are frost, body text is a blue-grey, never flat white;
   - links are aqua with a steel underline, distinct from body text;
   - code, maths and symbols (W₀, ≤, ‖·‖, §) are ice on a petrol chip;
   - gold marks the one primary action and anything that needs attention.
   Text is always a flat colour. Gradients appear only on surfaces (threads,
   rules, borders, button fills, dots).

   Navy is the default for every visitor. The toggle switches to a light theme
   (frost-white, with navy text); the hero and paper headers stay navy in
   both; the header and footer follow the theme. */

:root,
.navy-scope,
:root[data-theme="light"] .navy-scope {
  --bg: #090d0f;
  --bg-2: #0d1618;
  --surface: #111d1f;
  --surface-2: #162628;         /* raised: inputs, hovered rows */
  --ink: #e7f3f3;               /* headings: frost */
  --ink-2: #bfcfd1;             /* body: blue-grey */
  --muted: #91a8aa;
  --line: #1d3133;
  --line-2: #2e4d4f;
  --accent: #8abeb8;            /* eyebrows, labels, UI accents: aqua */
  --accent-strong: #b0d5d2;
  --accent-soft: rgb(90 152 146 / 0.14);
  --link: #96ccc6;
  --link-line: rgb(90 152 146 / 0.75);
  --link-hover: #d7ebea;
  --strong: #eef7f7;
  --code-bg: #13292a;
  --code-line: #26494b;
  --code-ink: #b8dbd9;          /* code, maths, symbols */
  --ok: #a3d4ce;  --ok-soft: rgb(90 152 146 / 0.16);
  --alert: #e6d6b0; --alert-soft: rgb(217.0 199.0 160.0 / 0.14); --alert-line: rgb(217.0 199.0 160.0 / 0.55);
  --no: #91a8aa;  --no-soft: rgb(145 168 170 / 0.12);
  --btn-bg: #13292a;
  --btn-bg-hover: #23514e;
  --btn-fg: #e7f3f3;
  --shadow: 0 1px 2px rgb(0.0 0.0 0.0 / 0.35), 0 10px 28px rgb(7 17 19 / 0.4);
  --thread-weft: #8abeb8;
  --thread-gold: #d9c7a0;
  --thread-warp: #15282a;
  --plate: #ffffff;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f5f9f9;                /* frost-white, not flat white */
  --bg-2: #e9f2f2;
  --surface: #fcfdfd;
  --surface-2: #f1f7f7;
  --ink: #0f2425;
  --ink-2: #274042;
  --muted: #526b6c;
  --line: #d5e3e4;
  --line-2: #b2cbcc;
  --accent: #306d68;
  --accent-strong: #153636;
  --accent-soft: rgb(48 109 104 / 0.09);
  --link: #2b6663;
  --link-line: rgb(48 109 104 / 0.55);
  --link-hover: #153636;
  --strong: #0a1b1c;
  --code-bg: #e6f2f2;
  --code-line: #c5dbdb;
  --code-ink: #1f4f4c;
  --ok: #27605d;  --ok-soft: #e2efef;
  --alert: #5f4e22; --alert-soft: #f8f2e2; --alert-line: #cdb888;
  --no: #526b6c;  --no-soft: #ebf2f2;
  --btn-bg: #fcfdfd;
  --btn-bg-hover: #e9f2f2;
  --btn-fg: #0f2425;
  --shadow: 0 1px 2px rgb(21 54 54 / 0.06), 0 8px 24px rgb(21 54 54 / 0.08);
  --thread-weft: #5a9892;
  --thread-gold: #a8935f;
  --thread-warp: #e0ecec;
  color-scheme: light;
}

@font-face {
  /* Symbols only (‖ ₀ ≤ → ∈ ⟨⟩): a subset of STIX Two Math, OFL 1.1, see assets/fonts/OFL.txt.
     Listed first in every stack; unicode-range keeps it off ordinary letters. */
  font-family: "Weft Symbols";
  src: url(/weft/assets/fonts/weft-symbols-stix-two-math.woff2) format("woff2");
  font-display: swap;
  unicode-range: U+2016, U+2032-2034, U+2070-209F, U+2190-21FF, U+2200-22FF, U+2308-230B, U+27E8-27E9, U+27F5-27FF;
}

:root {
  /* Liquid-metal finishes: surfaces only, never text. */
  --chrome: linear-gradient(135deg, #d7ebea 0%, #5a9892 22%, #b0d5d2 42%, #306d68 62%, #8abeb8 82%, #487775 100%);
  --chrome-line: linear-gradient(90deg, transparent, #306d68 15%, #b0d5d2 50%, #306d68 85%, transparent);
  --gold: linear-gradient(135deg, #efe3c8 0%, #d9c7a0 28%, #f7efdc 48%, #bfa97c 70%, #e6d6b0 100%);
  --gold-flat: #d9c7a0;

  --font-display: "Weft Symbols", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "URW Palladio L", Georgia, serif;
  --font-body: "Weft Symbols", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Weft Symbols", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 17px/1.6 var(--font-body);
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--link); text-decoration-color: var(--link-line); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--link-hover); text-decoration-color: currentColor; text-decoration-thickness: 2px; }
strong, b { color: var(--strong); font-weight: 650; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.88em; }
:not(pre) > code { background: var(--code-bg); border: 1px solid var(--code-line); color: var(--code-ink); padding: 0.08em 0.38em; border-radius: 4px; overflow-wrap: anywhere; }
a code, a:hover code { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
h2 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--ink); color: var(--bg); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.site-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--chrome-line); opacity: 0.45; }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; margin-right: auto; }
.brand svg { width: 26px; height: 26px; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; }
.brand-org { font-size: 0.78rem; color: var(--muted); border-left: 1px solid var(--line-2); padding-left: 10px; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: 0.93rem; padding: 6px 10px; border-radius: var(--radius-sm); }
.nav a:hover { background: var(--surface-2); color: var(--accent-strong); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; min-width: 36px; padding: 0 10px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: linear-gradient(var(--btn-bg), var(--btn-bg)) padding-box, var(--chrome) border-box;
  color: var(--btn-fg); font: 500 0.9rem var(--font-body);
  text-decoration: none; cursor: pointer;
}
.icon-btn:hover { background: linear-gradient(var(--btn-bg-hover), var(--btn-bg-hover)) padding-box, var(--chrome) border-box; }
.icon-btn svg { width: 18px; height: 18px; }
.menu { display: none; position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; display: grid;
}
.menu-panel a { padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; }
.menu-panel a:hover { background: var(--surface-2); color: var(--accent-strong); }
@media (max-width: 860px) {
  .nav { display: none; }
  .menu { display: block; }
  .brand-org { display: none; }
}
.theme-toggle .moon { display: none; }
:root[data-theme="light"] .theme-toggle .sun { display: none; }
:root[data-theme="light"] .theme-toggle .moon { display: block; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0.85;
  -webkit-mask-image: linear-gradient(90deg, transparent 0 42%, rgb(0.0 0.0 0.0 / 0.5) 62%, #000000 88%);
          mask-image: linear-gradient(90deg, transparent 0 42%, rgb(0.0 0.0 0.0 / 0.5) 62%, #000000 88%);
}
.hero .wrap { position: relative; padding-top: clamp(56px, 10vw, 120px); padding-bottom: clamp(56px, 9vw, 112px); }
.kicker { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.kicker .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 3px rgb(217.0 199.0 160.0 / 0.15); }
.hero h1 { font-size: clamp(3rem, 2rem + 6vw, 6rem); letter-spacing: -0.025em; line-height: 0.95; }
.hero h1 .thin { color: var(--muted); font-weight: 400; }
.tagline { font-family: var(--font-display); font-style: italic; font-size: clamp(1.3rem, 1rem + 1.4vw, 1.9rem); color: var(--accent); margin: 12px 0 22px; }
.lede { font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem); max-width: 40rem; color: var(--ink-2); }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font: 600 0.98rem var(--font-body); text-decoration: none; color: var(--btn-fg);
  background: linear-gradient(var(--btn-bg), var(--btn-bg)) padding-box, var(--chrome) border-box;
  cursor: pointer;
}
/* Glisten: metallic surfaces slowly drift, and a soft highlight sweeps across the primary button. */
.btn { background-size: 100% 100%, 320% 320%; background-position: 0 0, 0% 50%; animation: chrome-drift 8s ease-in-out infinite; }
@keyframes chrome-drift { 0%, 100% { background-position: 0 0, 0% 50%; } 50% { background-position: 0 0, 100% 50%; } }
.btn-primary { position: relative; overflow: hidden; isolation: isolate; background-size: 240% 100% !important; animation: metal-drift 7s ease-in-out infinite; }
@keyframes metal-drift { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.btn-primary::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: 0; width: 38%; z-index: -1; pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, rgb(255 255 255 / 0.0) 20%, rgb(255 255 255 / 0.75) 50%, rgb(255 255 255 / 0.0) 80%, transparent 100%);
  transform: translateX(-160%) skewX(-18deg); animation: glisten 5.5s cubic-bezier(.4,.0,.2,1) infinite;
}
.btn-primary:hover::after { animation-duration: 1.6s; }
@keyframes glisten { 0%, 62% { transform: translateX(-160%) skewX(-18deg); opacity: 0; } 66% { opacity: 1; } 92% { transform: translateX(380%) skewX(-18deg); opacity: 1; } 100% { transform: translateX(380%) skewX(-18deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .btn, .btn-primary, .btn-primary::after { animation: none; } }
.btn:hover { color: var(--btn-fg); background: linear-gradient(var(--btn-bg-hover), var(--btn-bg-hover)) padding-box, var(--chrome) border-box; }
.btn svg { width: 18px; height: 18px; }
.btn-primary, .btn-primary:hover { background: var(--gold); color: #090d0f; border: 1px solid #bfa97c; text-shadow: 0 1px 0 rgb(255 255 255 / 0.35); }
.btn-primary:hover { filter: brightness(1.06) saturate(1.05); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 28px; font-size: 0.88rem; color: var(--muted); }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Sections ---------- */
section.block { position: relative; padding: clamp(56px, 8vw, 104px) 0; }
section.block::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--chrome-line); opacity: 0.35; }
section.alt { background: radial-gradient(80% 60% at 85% 0%, rgb(35 81 78 / 0.22), transparent 70%), var(--bg-2); }
:root[data-theme="light"] section.alt { background: radial-gradient(80% 60% at 85% 0%, rgb(90 152 146 / 0.10), transparent 70%), var(--bg-2); }
.section-head { max-width: 44rem; margin-bottom: clamp(28px, 4vw, 44px); }
.eyebrow { font: 600 0.78rem var(--font-mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; display: block; }
.section-head p { color: var(--ink-2); font-size: 1.08rem; margin-top: 14px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-3, .grid-2, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.card {
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 140px); border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(18px, 2.4vw, 26px); box-shadow: var(--shadow); min-width: 0;
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--ink-2); }
.card .path { font: 0.82rem var(--font-mono); color: var(--muted); }
.card .glyph { width: 40px; height: 40px; margin-bottom: 14px; color: var(--accent); }

/* ---------- Demos ---------- */
.demo { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: clamp(18px, 3vw, 32px); align-items: start; }
@media (max-width: 860px) { .demo { grid-template-columns: minmax(0, 1fr); } }
.demo + .demo { margin-top: clamp(40px, 6vw, 72px); }
.demo-copy h3 { font-size: 1.5rem; margin-bottom: 10px; }
.demo-copy p { color: var(--ink-2); }
.demo-copy .source { font-size: 0.88rem; color: var(--muted); }
.panel { background: linear-gradient(180deg, var(--surface-2), var(--surface) 160px); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 2.2vw, 22px); min-width: 0; }

.gate-viz { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 420px) { .gate-viz { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
#gateMatrix { width: 168px; height: 168px; border-radius: var(--radius-sm); border: 1px solid var(--line); image-rendering: pixelated; }
.meter { margin-bottom: 12px; }
.meter-label { display: flex; justify-content: space-between; gap: 8px; font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
.meter-label b { font: 600 0.85rem var(--font-mono); color: var(--ink); }
.meter-track { position: relative; height: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--chrome); border-radius: 999px; transition: width 0.25s ease, background 0.25s ease; }
.meter-fill.over { background: var(--gold); }
.meter-mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); box-shadow: 0 0 0 1px var(--bg); }
.controls { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 14px; }
.controls .btn { min-height: 38px; padding: 0 12px; font-size: 0.9rem; }
.range { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 0.88rem; color: var(--muted); }
.range input { width: 100%; accent-color: var(--gold-flat); }
.range output { font: 600 0.88rem var(--font-mono); color: var(--ink); min-width: 3.5ch; text-align: right; }
.verdicts { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-top: 14px; }
@media (max-width: 480px) { .verdicts { grid-template-columns: minmax(0, 1fr); } }
.verdict { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg); }
.verdict .who { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.verdict .what { font: 0.78rem var(--font-mono); color: var(--muted); margin: 2px 0 6px; overflow-wrap: anywhere; }
.verdict .result { font-weight: 700; color: var(--ink); }
.verdict.pass .result { color: var(--ok); }
.verdict.fail .result { color: var(--alert); }
.verdict.pass { border-color: var(--line-2); }
.verdict.fail { border-color: var(--alert-line); background: var(--alert-soft); }
.log { margin-top: 12px; font: 0.82rem/1.5 var(--font-mono); color: var(--muted); min-height: 1.5em; }

.packet-input {
  width: 100%; min-height: 96px; resize: vertical; padding: 12px;
  font: 0.86rem/1.5 var(--font-mono); color: var(--code-ink); background: var(--code-bg);
  border: 1px solid var(--code-line); border-radius: var(--radius-sm); overflow-wrap: anywhere; word-break: break-all;
}
.packet-status { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-weight: 600; }
.packet-status .badge { font: 600 0.78rem var(--font-mono); padding: 3px 8px; border-radius: 999px; }
.badge.ok { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px var(--line-2); }
.badge.bad { background: var(--alert-soft); color: var(--alert); box-shadow: inset 0 0 0 1px var(--alert-line); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; font-size: 0.88rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--font-mono); color: var(--code-ink); overflow-wrap: anywhere; }

.mixer { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 560px) { .mixer { grid-template-columns: minmax(0, 1fr); justify-items: center; } }
.simplex-pad { width: 220px; height: 220px; touch-action: none; cursor: crosshair; }
.simplex-guide { stroke: var(--line-2); stroke-width: 0.6; }
.simplex-edge { fill: color-mix(in srgb, var(--accent) 6%, transparent); stroke: var(--ink-2); stroke-width: 1.2; }
.simplex-vertex { fill: var(--accent); stroke: var(--bg); stroke-width: 1; }
.simplex-label { fill: var(--muted); font: 11px var(--font-mono); }
.simplex-spoke { stroke: var(--accent); stroke-width: 1.2; }
.simplex-knob { fill: var(--surface); stroke: var(--gold-flat); stroke-width: 3; }
.preview {
  --p-hue: 40; --p-round: 10px; --p-pad: 18px; --p-contrast: 0.1;
  width: 100%; border: 1px solid hsl(var(--p-hue) 45% 50% / 0.45); border-radius: var(--p-round);
  padding: var(--p-pad); background: hsl(var(--p-hue) 60% 50% / calc(0.06 + var(--p-contrast)));
  transition: border-radius 0.2s ease, padding 0.2s ease, background 0.2s ease;
}
.preview h4 { margin: 0 0 6px; font: 600 1.1rem var(--font-display); color: hsl(var(--p-hue) 80% 74%); }
:root[data-theme="light"] .preview h4 { color: hsl(var(--p-hue) 55% 38%); }
.preview p { font-size: 0.92rem; color: var(--ink-2); margin-bottom: 10px; }
.preview .chip { display: inline-block; padding: 4px 10px; border-radius: calc(var(--p-round) * 0.8 + 2px); background: hsl(var(--p-hue) 70% 50%); color: #ffffff; font-size: 0.82rem; font-weight: 600; }
.mix-readout { margin-top: 12px; font: 0.8rem var(--font-mono); color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Status table ---------- */
.status-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.status-table th, .status-table td { text-align: left; vertical-align: top; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.status-table tr:last-child td { border-bottom: 0; }
.status-table th { font: 600 0.78rem var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); }
.status-table td:first-child { white-space: nowrap; }
.status-table .name { font-weight: 600; color: var(--ink); }
.status-table .path { display: block; font: 0.78rem var(--font-mono); color: var(--muted); }
.status-table .note { display: block; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.pill { display: inline-block; white-space: nowrap; font: 600 0.76rem var(--font-mono); padding: 3px 9px; border-radius: 999px; }
.pill.run { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px var(--line-2); }
.pill.sim { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.pill.draft { background: var(--alert-soft); color: var(--alert); box-shadow: inset 0 0 0 1px var(--alert-line); }
.pill.idea { background: var(--no-soft); color: var(--no); }
@media (max-width: 720px) {
  .status-table thead { display: none; }
  .status-table, .status-table tbody, .status-table tr, .status-table td { display: block; width: 100%; }
  .status-table tr { border-bottom: 1px solid var(--line); padding: 10px 0; }
  .status-table td { border: 0; padding: 4px 16px; white-space: normal !important; }
}
.legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 16px; font-size: 0.86rem; color: var(--muted); }
.not-built { margin-top: 18px; font-size: 0.95rem; color: var(--ink-2); }

/* ---------- Horizons ---------- */
.horizon { position: relative; padding-top: 22px; }
.horizon::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 3px; background: var(--line-2); }
.horizon.h-now::before { background: var(--chrome); }
.horizon.h-wip::before { background: linear-gradient(90deg, transparent 45%, var(--line-2) 45%), var(--chrome); }
.horizon .num { font: 600 0.78rem var(--font-mono); color: var(--muted); letter-spacing: 0.08em; }
.horizon h3 { margin: 6px 0 8px; }
.horizon p { font-size: 0.95rem; color: var(--ink-2); }
.horizon .pill { margin-top: 4px; }

/* ---------- Callout ---------- */
.callout {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start;
  border: 1px solid var(--alert-line); background: var(--alert-soft);
  border-radius: var(--radius); padding: clamp(18px, 2.4vw, 24px);
}
.callout svg { width: 28px; height: 28px; color: var(--gold-flat); }
.callout h3 { margin-bottom: 6px; }
.callout p { margin: 0; color: var(--ink-2); }

/* ---------- Code ---------- */
.codeblock { position: relative; background: var(--code-bg); border: 1px solid var(--code-line); color: var(--code-ink); border-radius: var(--radius); }
.codeblock pre { margin: 0; padding: 18px 20px; overflow-x: auto; line-height: 1.7; }
.codeblock .copy { position: absolute; top: 10px; right: 10px; }
.codeblock .c { color: var(--muted); }

/* ---------- Lists of links ---------- */
.linklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.linklist a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); text-decoration: none; }
.linklist a:hover { border-color: var(--accent); }
.linklist .meta { color: var(--muted); font-size: 0.86rem; text-align: right; }
.linklist .t { font-weight: 600; }
.linklist .d { display: block; color: var(--muted); font-size: 0.88rem; font-weight: 400; }

/* ---------- Footer ---------- */
.site-footer { padding: 48px 0 56px; color: var(--muted); font-size: 0.92rem; }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 28px; }
@media (max-width: 720px) { .site-footer .wrap { grid-template-columns: minmax(0, 1fr); } }
.site-footer h4 { margin: 0 0 10px; font: 600 0.78rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--link); }
.site-footer a:hover { color: var(--link-hover); }
.site-footer .brand { margin-bottom: 10px; }

/* ---------- Simple pages (404, widgets) ---------- */
.simple { min-height: 70vh; display: grid; align-content: center; padding: 64px 0; }
.simple h1 { font-size: clamp(2.4rem, 1.6rem + 4vw, 4rem); margin-bottom: 12px; }
.widget-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 18px; }
.widget-card { padding: 0; overflow: hidden; }
.widget-card iframe { width: 100%; aspect-ratio: 16 / 10; border: 0; display: block; background: #000000; }
.widget-card .body { padding: 16px 18px 18px; }
.widget-card h3 { font-size: 1.1rem; margin-bottom: 6px; }
.widget-card p { font-size: 0.92rem; margin: 0 0 8px; }
@media (max-width: 700px) {
  .hero canvas { opacity: 0.22; -webkit-mask-image: none; mask-image: none; }
}
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold-flat); }

/* Hero and paper header stay navy in both themes; header and footer follow the theme. */
.site-footer { position: relative; }
.site-footer::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--chrome-line); opacity: 0.4; }
.hero.navy-scope, .paper-hero.navy-scope { background-color: var(--bg); color: var(--ink-2); }

/* ---------- Reading weave: rewards reading, resists skimming (attention.js) ---------- */
.attn-w { display: inline-block; }
.card h3 a.attn-nav, .site-footer a.attn-nav { display: inline-block; }
html.attn-blurry .attn-block { filter: blur(var(--attn-blur, 0px)); }
.attn-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 40; pointer-events: none; }
/* A thread woven beside each paragraph that was actually read. */
.attn-block.attn-read { position: relative; }
.attn-block.attn-read::before {
  content: ""; position: absolute; left: -14px; top: 0.2em; bottom: 0.2em; width: 2px; border-radius: 2px;
  background: linear-gradient(180deg, transparent, var(--gold-flat) 18%, var(--gold-flat) 82%, transparent);
  opacity: 0.75; transform-origin: top; animation: attn-weave 1.4s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes attn-weave { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 0.75; } }
@media (prefers-reduced-motion: reduce) { .attn-block.attn-read::before { animation: none; } }
/* The reading panel: bottom right, above the page and its waves. */
.attn-ui {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  width: min(300px, calc(100vw - 32px)); pointer-events: none;
  font: 0.86rem/1.45 var(--font-body); color: var(--ink-2);
}
.attn-ui > * { pointer-events: auto; }
.attn-ui [hidden] { display: none !important; }
.attn-panel, .attn-pop {
  width: 100%; box-sizing: border-box; background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.28);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.attn-panel { padding: 10px 12px 12px; }
.attn-head { display: flex; align-items: center; gap: 2px; margin-bottom: 6px; }
.attn-title { flex: 1; font-weight: 600; color: var(--ink); letter-spacing: 0.01em; }
.attn-icon {
  display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer;
}
.attn-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.attn-icon:hover, .attn-icon:focus-visible { background: var(--surface-2); color: var(--ink); }
.attn-x-wrap { position: relative; display: inline-grid; }
.attn-tip {
  position: absolute; right: 0; bottom: calc(100% + 8px); white-space: nowrap;
  padding: 5px 9px; border-radius: var(--radius-sm); font-size: 0.78rem;
  background: var(--ink); color: var(--bg); opacity: 0; transform: translateY(3px);
  transition: opacity 0.15s, transform 0.15s; pointer-events: none;
}
.attn-x-wrap:hover .attn-tip, .attn-x:focus-visible + .attn-tip { opacity: 1; transform: none; }
.attn-x:hover { color: #e08f7a; }
.attn-status { margin: 0 0 8px; color: var(--ink-2); }
.attn-meter { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.attn-meter span {
  display: block; height: 100%; transform-origin: left; transform: scaleX(0); transition: transform 0.3s;
  background: linear-gradient(90deg, #5a9892, var(--gold-flat) 55%, #e08f7a);
  background-size: 300px 100%;
}
.attn-stats { display: flex; gap: 18px; margin: 9px 0 0; font-size: 0.8rem; }
.attn-stats div { display: flex; gap: 6px; }
.attn-stats dt { color: var(--muted); }
.attn-stats dd { margin: 0; color: var(--ink-2); }
.attn-on {
  margin-top: 10px; width: 100%; min-height: 32px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font: inherit;
}
.attn-on:hover { border-color: var(--gold-flat); }
.attn-debug { margin: 10px 0 0; font: 10.5px/1.5 ui-monospace, monospace; color: var(--muted); white-space: pre; }
.attn-dock {
  width: 42px; height: 42px; border-radius: 50%; padding: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--gold-flat);
  border: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.25);
}
.attn-dock svg { width: 22px; height: 22px; }
.attn-dock:hover { border-color: var(--gold-flat); }
html.attn-off .attn-dock { color: var(--muted); }
/* The warning: a ? that rises once the effects get in the way. */
.attn-warn {
  width: 38px; height: 38px; border-radius: 50%; padding: 0; cursor: pointer;
  font: 700 1.1rem/1 var(--font-body); color: #1a1408;
  border: 0; background: var(--gold-flat); box-shadow: 0 0 0 0 rgb(217 199 160 / 0.6);
  animation: attn-rise 0.35s ease-out, attn-pulse 1.8s ease-out 0.35s infinite;
}
@keyframes attn-rise { from { transform: translateY(8px) scale(0.8); opacity: 0; } }
@keyframes attn-pulse { 0% { box-shadow: 0 0 0 0 rgb(217 199 160 / 0.55); } 100% { box-shadow: 0 0 0 14px rgb(217 199 160 / 0); } }
.attn-pop { position: relative; padding: 14px 16px 14px; max-height: min(70vh, 520px); overflow: auto; }
.attn-pop h2 { font-size: 1rem; margin: 0 30px 8px 0; color: var(--ink); }
.attn-pop h3 { font-size: 0.84rem; margin: 12px 0 2px; color: var(--ink); letter-spacing: 0.02em; }
.attn-pop p { margin: 0 0 8px; }
.attn-pop-foot { color: var(--ink); }
.attn-pop-close { position: absolute; top: 8px; right: 8px; }
.attn-kbd {
  display: inline-grid; place-items: center; min-width: 1.4em; height: 1.4em; border-radius: 4px;
  border: 1px solid var(--line); background: var(--surface-2); font-weight: 600; line-height: 1;
}
/* While the warning is open, point at the × that switches the effects off. */
.attn-point-x .attn-x { color: #e08f7a; animation: attn-point 1.2s ease-in-out infinite; }
@keyframes attn-point { 50% { background: rgb(224 143 122 / 0.18); } }
html.attn-off .attn-block.attn-read::before { display: none; }
@media (prefers-reduced-motion: reduce) {
  .attn-warn, .attn-point-x .attn-x { animation: none; }
  .attn-tip, .attn-meter span { transition: none; }
}
@media print {
  .attn-ui, .attn-overlay { display: none !important; }
  .attn-w, .attn-nav { transform: none !important; opacity: 1 !important; }
  .attn-block { filter: none !important; }
  .attn-block.attn-read::before { display: none; }
}

/* ---------- Condensing prose: skimming a paper squeezes its writing (condense.js) ---------- */
.cx-w { transition: color 0.35s, opacity 0.35s, max-width 0.5s cubic-bezier(.4, 0, .2, 1); }
.cx-strike { color: #e08f7a; text-decoration: line-through; text-decoration-thickness: 1.5px; }
.cx-box { display: inline-block; white-space: pre; overflow: hidden; vertical-align: top; }
.cx-gone { max-width: 0 !important; opacity: 0; }
.cx-new { color: var(--gold-flat); }
.cx-new.cx-inked { color: inherit; transition: color 1.1s; }
.cx-ladder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; margin: 2px 0 9px; }
.cx-rung {
  min-height: 28px; padding: 0 4px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted); font: inherit; font-size: 0.78rem;
}
.cx-rung:hover, .cx-rung:focus-visible { color: var(--ink); border-color: var(--gold-flat); }
.cx-rung.cx-past { color: var(--ink-2); background: var(--surface-2); }
.cx-rung[aria-pressed="true"] { color: #1a1408; background: var(--gold-flat); border-color: var(--gold-flat); font-weight: 600; }
.cx-ui .attn-dock { position: relative; }
.cx-badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; border-radius: 9px;
  display: grid; place-items: center; font: 700 0.68rem/1 var(--font-body); color: #1a1408; background: var(--gold-flat);
}
.cx-squeezed .attn-panel, .cx-squeezed .attn-dock { animation: cx-squeeze 0.7s cubic-bezier(.3, .7, .3, 1); }
@keyframes cx-squeeze { 30% { transform: scaleX(0.94); box-shadow: 0 0 0 3px rgb(217 199 160 / 0.45); } }
html.cx-off .attn-dock { color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .cx-w, .cx-new.cx-inked { transition: none; }
  .cx-squeezed .attn-panel, .cx-squeezed .attn-dock { animation: none; }
}
/* Honest marker: a condensed passage ends with ≈ (press and hold it to read it as written). */
.cx-condensed { -webkit-touch-callout: none; }
.cx-condensed::after {
  content: "≈"; margin-left: 0.3em; font-size: 0.78em; vertical-align: 0.25em;
  color: var(--gold-flat); opacity: 0.85; font-weight: 600;
}
.cx-peeking { background: color-mix(in srgb, var(--gold-flat) 10%, transparent); border-radius: 4px; user-select: none; }
.cx-peek {
  position: fixed; z-index: 70; box-sizing: border-box; max-height: 60vh; overflow: auto; pointer-events: none;
  padding: 10px 12px; border-radius: 10px; border: 1px solid var(--gold-flat);
  background: color-mix(in srgb, var(--surface) 97%, transparent); box-shadow: 0 12px 34px rgb(0 0 0 / 0.32);
  color: var(--ink); font-size: 0.95rem; line-height: 1.55; animation: cx-peek-in 0.16s ease-out;
}
.cx-peek[hidden] { display: none; }
.cx-peek-label { display: block; margin-bottom: 4px; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold-flat); }
@keyframes cx-peek-in { from { opacity: 0; transform: translateY(4px); } }
/* TL;DR and ELI5: each section folds to its heading and one summary line. */
.cx-sum { display: none; }
html.cx-folded article.paper section:has(> .cx-sum) > :not(h2, .cx-sum) { display: none; }
html.cx-folded .cx-sum { display: block; font-size: 1.08em; line-height: 1.6; color: var(--ink); }
html[data-condense="5"] .cx-sum { max-width: 60ch; }
html.cx-unfolding article.paper section > * { animation: cx-fade-in 0.6s ease-out both; }
@keyframes cx-fade-in { from { opacity: 0; transform: translateY(6px); } }
.cx-map { margin: 8px 0 0; font-size: 0.78rem; color: var(--muted); }
/* ELI5: at the end of the TL;DR version, and in a floating copy that follows a skimmer around. */
.cx-eli5-slot { display: flex; justify-content: center; margin: 2.2rem 0 1rem; }
html:not([data-condense="4"]) .cx-eli5-slot { display: none; }
.cx-eli5-wrap { position: relative; display: inline-grid; }
.cx-eli5, .cx-eli5-f {
  min-height: 40px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font: 700 0.95rem/1 var(--font-body); letter-spacing: 0.06em;
  color: var(--gold-flat); border: 1px solid var(--gold-flat);
  background: color-mix(in srgb, var(--gold-flat) 10%, transparent);
}
.cx-eli5:hover, .cx-eli5:focus-visible, .cx-eli5-f:hover, .cx-eli5-f:focus-visible { color: #1a1408; background: var(--gold-flat); }
.cx-eli5-tip {
  position: absolute; left: 50%; bottom: calc(100% + 9px); width: max-content; max-width: 240px;
  padding: 6px 10px; border-radius: var(--radius-sm); font-size: 0.8rem; line-height: 1.35; text-align: center;
  background: var(--ink); color: var(--bg); opacity: 0; transform: translate(-50%, 3px);
  transition: opacity 0.15s, transform 0.15s; pointer-events: none;
}
.cx-eli5-wrap:hover .cx-eli5-tip, .cx-eli5:focus-visible + .cx-eli5-tip, .cx-eli5-f:focus-visible + .cx-eli5-tip { opacity: 1; transform: translate(-50%, 0); }
.cx-eli5-float { position: fixed; left: 0; top: 0; z-index: 65; will-change: transform; }
.cx-eli5-float[hidden] { display: none; }
.cx-eli5-f {
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  box-shadow: 0 8px 26px rgb(0 0 0 / 0.3); animation: cx-float-in 0.4s ease-out;
}
@keyframes cx-float-in { from { opacity: 0; transform: scale(0.6); } }
.cx-rung-eli5 { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .cx-peek, .cx-eli5-f, html.cx-unfolding article.paper section > * { animation: none; }
}
@media print {
  .cx-ui, .cx-peek, .cx-eli5-slot, .cx-eli5-float { display: none !important; }
  .cx-condensed::after { content: none; }
}

/* §5.3 wayfinding (build-time only; Weft tokens) */
.brand { margin-right: 0; }
.brand-family {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
}
a.brand-org { text-decoration: none; }
a.brand-org:hover {
  color: var(--link-hover);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.menu-family-sep {
  height: 1px;
  background: var(--line);
  margin: 6px 4px;
}
.menu-family-label {
  padding: 6px 12px 2px;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.menu-family-link { color: var(--ink-2); }
@media (max-width: 860px) {
  .brand-family { display: none; }
}

