/* milkflow documentation site, in the family of the tsorder and foresight
   pages: navy ground, two soft glows, cards, dark code. No external fonts,
   no network. Brand pair: metro red (the corridors' accent) and teal. */
:root {
  --bg: #0b1020;
  --bg-soft: #121a33;
  --card: #16203f;
  --border: #263457;
  --fg: #e8edf7;
  --muted: #9fb0d0;
  --brand: #ff5a4f;      /* metro red, large marks and gradients */
  --brand-ink: #ff6b5e;  /* red for small text: 5.7:1 on --card */
  --brand-2: #2ec4b6;    /* teal, links: 7.4:1 on --card */
  --accent: #ffb14e;
  --code-bg: #0d1428;
  --code-fg: #d7e0f5;
  --inline-code: #1d2a50;
  --shadow: 0 12px 40px rgba(0,0,0,.35);
  --glow-1: rgba(255,90,79,.17);
  --glow-2: rgba(46,196,182,.14);
  --focus: #8ab4f8;
  --btn-1: #d63c31;      /* white on it: 4.6:1 */
  --btn-2: #b02c24;      /* white on it: 6.5:1 */
  --radius: 16px;
  --maxw: 1080px;
  --max: 46rem;          /* reading width of prose */
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  /* Names the hand-drawn concept diagrams use. */
  --paper: var(--card);
  --land: #1f2b52;
  --ink: var(--fg);
  --ink-soft: var(--muted);
  --rule: var(--border);
  --accent-ink: var(--brand-ink);
  --cat1: #56B4E9;
  --cat2: #E69F00;
  --cat3: #00B486;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f8fe;
    --bg-soft: #eef2fb;
    --card: #ffffff;
    --border: #dbe3f4;
    --fg: #10192e;
    --muted: #56648a;   /* 5.2:1 on --bg-soft */
    --brand: #c8352b;   /* 5.3:1 on white */
    --brand-ink: #b02c24;
    --brand-2: #0a7268; /* 5.2:1 on --bg-soft */
    --accent: #a35f00;
    --code-bg: #0d1428;
    --inline-code: #e6ebf7;
    --shadow: 0 12px 36px rgba(30,45,90,.12);
    --glow-1: rgba(200,53,43,.10);
    --glow-2: rgba(10,114,104,.10);
    --focus: #1f5aa6;
    --land: #eef0f4;
    --cat1: #0072B2;
    --cat2: #D55E00;
    --cat3: #009E73;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
body {
  margin: 0;
  font: 16px/1.65 var(--sans);
  color: var(--fg);
  background:
    radial-gradient(1100px 600px at 12% -8%, var(--glow-1), transparent 60%),
    radial-gradient(900px 500px at 96% 4%, var(--glow-2), transparent 55%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
p a, li a, td a, figcaption a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--brand-2) 45%, transparent); }
p a:hover, li a:hover, td a:hover { text-decoration-color: currentColor; }
nav.main li a, .toc li a, .foot-links li a, p.links a, .lang a { text-decoration: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[id] { scroll-margin-top: 120px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--card); color: var(--fg); padding: .5rem 1rem; z-index: 30; border-radius: 0 0 10px 10px; }
.skip:focus { left: 1rem; }

/* ------------------------------------------------------------ nav */
header.nav {
  position: sticky; top: 0; z-index: 20;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--border);
}
/* Three metro lines along the top edge. */
header.nav::before {
  content: ""; display: block; height: 3px;
  background: linear-gradient(90deg, var(--brand) 0 46%, var(--accent) 46% 62%, var(--brand-2) 62% 100%);
}
.nav-inner { display: flex; align-items: center; gap: 10px 22px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.1rem; color: var(--fg); flex: none; }
.brand:hover { text-decoration: none; }
.brand .logo { display: block; width: 28px; height: 28px; border-radius: 7px; }
.brand .dot { color: var(--brand); }
nav.main { flex: 1 1 auto; min-width: 0; }
nav.main ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px 2px; align-items: center; justify-content: flex-end; }
nav.main a { display: block; color: var(--muted); font-weight: 600; font-size: .92rem; padding: 6px 9px; border-radius: 9px; white-space: nowrap; }
nav.main a:hover { color: var(--fg); text-decoration: none; background: color-mix(in srgb, var(--fg) 6%, transparent); }
nav.main a[aria-current="page"] { color: var(--fg); background: color-mix(in srgb, var(--brand) 16%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 38%, transparent); }
.lang { display: flex; margin: 0; flex: none; font-size: .8rem; font-weight: 700; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }
.lang > span > a, .lang > span[aria-current] { display: block; padding: 5px 9px; letter-spacing: .04em; }
.lang a { color: var(--muted); }
.lang a:hover { color: var(--fg); text-decoration: none; }
.lang [aria-current] { color: var(--fg); background: color-mix(in srgb, var(--brand-2) 18%, transparent); }
.lang .sep { display: none; }
@media (max-width: 1020px) {
  .nav-inner { flex-wrap: wrap; padding-top: 8px; }
  .lang { margin-left: auto; }
  nav.main { order: 3; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; margin: 0 -22px; padding: 0 16px 6px; }
  nav.main::-webkit-scrollbar { display: none; }
  nav.main ul { justify-content: flex-start; }
}

.notice { border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); font-size: .86rem; color: var(--muted); }
.notice p { max-width: var(--maxw); margin: 0 auto; padding: 7px 22px; }
.notice p::before { content: "●"; color: var(--accent); margin-right: .5rem; font-size: .7rem; vertical-align: .08rem; }

/* ------------------------------------------------------------ buttons, pills */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; font-weight: 700; font-size: .95rem;
  border: 1px solid var(--border); color: var(--fg); background: var(--card);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn.primary { background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); color: #fff; border-color: transparent; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 26px; padding: 0; list-style: none; }
.pill { display: inline-block; font: 600 .8rem/1.3 var(--mono); padding: 5px 11px; border-radius: 999px; color: var(--fg);
  background: color-mix(in srgb, var(--brand) 11%, transparent); border: 1px solid color-mix(in srgb, var(--brand) 30%, transparent); }
.pill.alt2 { background: color-mix(in srgb, var(--brand-2) 11%, transparent); border-color: color-mix(in srgb, var(--brand-2) 32%, transparent); }
.pill.alt3 { background: color-mix(in srgb, var(--accent) 11%, transparent); border-color: color-mix(in srgb, var(--accent) 34%, transparent); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand-2); background: color-mix(in srgb, var(--brand-2) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand-2) 30%, transparent);
  padding: 5px 12px; border-radius: 999px; margin: 0;
}

/* ------------------------------------------------------------ hero (home) */
.hero { padding: 64px 0 48px; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 32px; } .hero { padding-top: 40px; } }
.hero h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); line-height: 1.06; letter-spacing: -.03em; margin: 18px 0 14px; }
.grad { background: linear-gradient(120deg, var(--brand) 10%, var(--accent) 50%, var(--brand-2) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead, .lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; }
.lede { max-width: var(--max); }
.lead b, .lede b { color: var(--fg); }

/* Terminal card */
.term { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.term-bar { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid rgba(255,255,255,.07); }
.term-bar .d { width: 12px; height: 12px; border-radius: 50%; }
.term-bar .d.r { background: #ff5f57; } .term-bar .d.y { background: #febc2e; } .term-bar .d.g { background: #28c840; }
.term-title { margin-left: 8px; color: #8792b8; font: 600 .82rem var(--mono); }
.term pre { margin: 0; border: 0; border-radius: 0; box-shadow: none; padding: 16px 18px 14px; max-width: none; }
.term figure.term-fig { margin: 0 14px 14px; padding: 0; border: 0; background: none; box-shadow: none; }
.term figure.term-fig img { border-radius: 10px; border: 1px solid rgba(255,255,255,.08); }
.c-prompt { color: #6ee7c8; } .c-flag { color: #ffb14e; } .c-cmd { color: #8ea2ff; } .c-cmt { color: #8792b8; } .c-ok { color: #59d99a; } .c-str { color: #ffb14e; }

/* ------------------------------------------------------------ sections */
main { display: block; }
section.band { padding: 56px 0; }
section.alt { background: var(--bg-soft); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.band h2 { margin-top: 0; }
.sub { color: var(--muted); margin: 0 0 26px; max-width: 62ch; }

.grid { display: grid; gap: 18px; }
.grid.f4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.f3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.f2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: start; gap: 28px; }
@media (max-width: 900px) { .grid.f4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .grid.f3, .grid.f2, .grid.split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .grid.f4 { grid-template-columns: minmax(0, 1fr); } }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.card h3 { margin: 10px 0 6px; font-size: 1.1rem; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
.card .n { font: 800 .8rem var(--mono); color: var(--brand-2); }
a.card { display: block; color: var(--fg); }
a.card:hover { text-decoration: none; }
a.card h3 { color: var(--fg); margin-top: 0; }
a.card h3::after { content: " →"; color: var(--brand-2); }
ol.cards3 { list-style: none; padding: 0; margin: 0; counter-reset: s; }
ol.cards3 > li { counter-increment: s; max-width: none; }
ol.cards3 > li::before { content: "0" counter(s); display: block; font: 800 .8rem var(--mono); color: var(--brand-2); margin-bottom: 8px; }
ol.cards3 > li p { margin: 0; color: var(--muted); }
ol.cards3 > li { color: var(--muted); }
ol.cards3 > li b { color: var(--fg); }

/* ------------------------------------------------------------ inner pages */
.page { padding-top: 40px; padding-bottom: 64px; }
.page-head { margin-bottom: 4px; }
.prose { max-width: var(--max); }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 4.2vw, 2.8rem); letter-spacing: -.03em; line-height: 1.08; margin: 16px 0 12px; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); letter-spacing: -.02em; margin: 3rem 0 .7rem; }
.page h2 { display: flex; align-items: baseline; gap: .6rem; }
/* A station on the line: the mark before each section heading. */
.page h2::before {
  content: ""; flex: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--brand); transform: translateY(-.08em);
}
h3 { font-size: 1.15rem; margin: 2rem 0 .45rem; }
h4 { font-size: 1rem; margin: 1.4rem 0 .35rem; }
h2 .step { color: var(--brand-ink); font: 800 .9em var(--mono); margin-right: .1rem; }
p, li { max-width: var(--max); }
small, .small { font-size: .9rem; color: var(--muted); }
.small b, .small code { color: var(--fg); }
nav.prose .small a { white-space: nowrap; }

/* Code */
code, pre, kbd { font-family: var(--mono); }
code { font-size: .87em; background: var(--inline-code); color: var(--fg); padding: .05em .3em; border-radius: 5px; }
pre {
  background: var(--code-bg); color: var(--code-fg); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; overflow-x: auto; line-height: 1.5; max-width: var(--max); margin: 1rem 0;
}
pre code { background: none; color: inherit; padding: 0; font-size: .85rem; border-radius: 0; }
.wide pre, pre.wide { max-width: none; }
pre .c-cmt, pre .cmt { color: #8792b8; }

.callout {
  background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 16px 20px; margin: 1.4rem 0; max-width: var(--max);
}
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout strong.k { color: var(--fg); }
.callout pre { max-width: none; }

/* ------------------------------------------------------------ figures */
/* Every figure sits in a card; the image keeps its own paper (the light
   #FBFAF7 or the dark #16181B the library paints), framed and rounded. */
figure {
  margin: 1.4rem 0; padding: 10px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); min-width: 0;
}
figure img, figure svg.fig { display: block; width: 100%; height: auto; border-radius: 10px; }
figure .paper { background: #FBFAF7; box-shadow: 0 0 0 1px rgba(16,25,46,.10); }
.dark-paper { background: #16181B !important; box-shadow: 0 0 0 1px rgba(255,255,255,.08) !important; }
.checker { background-color: #DCDAD4; background-image: linear-gradient(45deg, #CFCCC5 25%, transparent 25%, transparent 75%, #CFCCC5 75%), linear-gradient(45deg, #CFCCC5 25%, transparent 25%, transparent 75%, #CFCCC5 75%); background-size: 16px 16px; background-position: 0 0, 8px 8px; }
figcaption { font-size: .9rem; color: var(--muted); margin: .6rem .3rem .15rem; max-width: var(--max); line-height: 1.5; }
figcaption b { color: var(--fg); }
.row { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); align-items: start; margin: 1.2rem 0; }
.row.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr)); }
.row figure { margin: 0; }
.row figcaption { max-width: none; }
figure:has(> svg.concept) { padding: 14px; }

.three { padding-left: 1.2rem; }
.three li { margin: .35rem 0; }

/* ------------------------------------------------------------ tables */
.table { overflow-x: auto; max-width: 100%; margin: 1rem 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.table table { margin: 0; width: 100%; }
table { border-collapse: collapse; font-size: .9rem; margin: 1rem 0; min-width: 20rem; }
th, td { text-align: left; vertical-align: top; padding: .55rem .8rem; border-bottom: 1px solid var(--border); }
tbody tr:last-child td { border-bottom: 0; }
th { font-weight: 700; color: var(--muted); }
.table caption { padding: .6rem .8rem 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
td code { white-space: nowrap; }
td code.sig { white-space: normal; display: inline-block; max-width: 22rem; }
tr.kept td { font-weight: 700; color: var(--fg); }
.yes { color: var(--brand-ink); font-weight: 700; }
table caption.small { caption-side: top; text-align: left; color: var(--muted); padding-bottom: .3rem; }

/* ------------------------------------------------------------ tabs */
/* Progressive: without script every panel shows with its own heading. */
.tabs { margin: 1rem 0; max-width: var(--max); }
.tabs [role="tablist"] { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.tabs [role="tab"] {
  font: 700 .88rem var(--sans); background: none; border: 0; color: var(--muted);
  padding: 6px 13px; cursor: pointer; border-radius: 9px;
}
.tabs [role="tab"]:hover { color: var(--fg); }
.tabs [role="tab"][aria-selected="true"] { color: #fff; background: linear-gradient(135deg, var(--btn-1), var(--btn-2)); }
.tabs [role="tabpanel"] { padding: .2rem 0 .3rem; }
.tabs [role="tabpanel"] h3 { margin-top: .9rem; }
.tabs [role="tabpanel"] pre { max-width: none; }
.js .tabs [role="tabpanel"][hidden] { display: none; }
.nojs-title { display: none; }
html:not(.js) .tabs [role="tablist"] { display: none; }
html:not(.js) .nojs-title { display: block; }

/* ------------------------------------------------------------ accounting bar */
.acc { margin: 1rem 0 1.6rem; font-size: .88rem; max-width: var(--max); background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.acc .label { font-weight: 700; margin-bottom: .35rem; }
.acc svg { display: block; width: 100%; height: auto; border-radius: 4px; }
.acc ul { list-style: none; padding: 0; margin: .45rem 0 0; display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; color: var(--muted); }
.acc .sw { display: inline-block; width: .8rem; height: .8rem; vertical-align: -.08rem; margin-right: .3rem; border: 1px solid var(--muted); border-radius: 2px; }

/* ------------------------------------------------------------ concept diagrams */
/* Drawn by hand as inline SVG; they follow the scheme. */
svg.concept { display: block; width: 100%; height: auto; max-width: 22rem; font-family: var(--sans); }
svg.concept.star { max-width: 30rem; }
svg.concept .ink { stroke: var(--ink); }
svg.concept .soft { stroke: var(--ink-soft); }
svg.concept .acc { stroke: var(--brand); }
svg.concept text { fill: var(--ink); font-size: 12px; }
svg.concept text.soft { fill: var(--ink-soft); stroke: none; }
svg.concept text.acc { fill: var(--brand-ink); stroke: none; }
svg.concept .fill-paper { fill: var(--paper); }
svg.concept .fill-ink { fill: var(--ink); }
svg.concept .fill-acc { fill: var(--brand); }
svg.concept .fill-land { fill: var(--land); }
svg.concept.wide-concept { max-width: 34rem; }
svg.concept .cat1 { stroke: var(--cat1); }
svg.concept .cat2 { stroke: var(--cat2); }
svg.concept .cat3 { stroke: var(--cat3); }
.rules { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); margin: 1rem 0; }
.rules figure { margin: 0; }
.rules h4 { margin: 0 0 .5rem; font-size: .95rem; }

/* ------------------------------------------------------------ figure cards */
/* A figure, its numbers and the options that make it. */
.cards { display: grid; gap: 18px; margin: 1.2rem 0 1.6rem; align-items: start; }
.cards.c3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); }
.cards.c2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 26rem), 1fr)); }
.cards figure { margin: 0; transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease; }
.cards figure:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--brand) 40%, var(--border)); }
.cards figcaption { max-width: none; }
figcaption .nums { display: block; margin-top: .2rem; font-variant-numeric: tabular-nums; }
pre.opts {
  margin: .55rem 0 0; padding: .55rem .7rem; max-width: none; border-radius: 9px;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: .78rem; line-height: 1.45;
}
pre.opts code { font-size: inherit; }
pre.opts .cli { color: #6ee7c8; }
pre.opts .cli::before { content: "$ "; color: #8792b8; }
.swatch { display: inline-block; width: .9rem; height: .9rem; vertical-align: -.12rem; margin-right: .35rem; border-radius: 3px; background: var(--c); box-shadow: 0 0 0 1px rgba(127,127,127,.35); }
.swatch.on-dark { box-shadow: 0 0 0 3px #16181B; margin: 0 .5rem 0 .2rem; }
table.palette td { white-space: nowrap; padding-right: .9rem; }

/* ------------------------------------------------------------ gallery */
.toc { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 1.2rem 0 0; max-width: none; }
.toc li { max-width: none; }
.toc a { display: inline-block; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--card); color: var(--fg); font-size: .9rem; font-weight: 600; text-decoration: none; }
.toc a:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--border)); text-decoration: none; }
.example { background: var(--bg-soft); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 6px 24px 18px; margin-top: 28px; }
.example h2 { margin-top: 1.1rem; }
.example .row figure { background: var(--card); }
.example pre { max-width: none; }
.honesty { font-size: .95rem; border-left: 3px solid var(--brand); padding: .1rem 0 .1rem .8rem; max-width: var(--max); }
.source { font-size: .86rem; color: var(--muted); }
.links { font-size: .9rem; display: flex; flex-wrap: wrap; gap: 8px; }
.links a { display: inline-block; padding: 5px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--card); text-decoration: none; font-weight: 600; }
.links a:hover { border-color: color-mix(in srgb, var(--brand-2) 50%, var(--border)); text-decoration: none; }
section.tikz-pair { margin: 1.2rem 0 2rem; }

/* ------------------------------------------------------------ playground */
.pg { display: grid; gap: 22px; grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr); align-items: start; margin-top: 1.4rem; }
@media (max-width: 52rem) { .pg { grid-template-columns: minmax(0, 1fr); } }
.pg fieldset { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: .7rem 1rem 1rem; margin: 0 0 14px; font-size: .9rem; min-width: 0; }
.pg legend { font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--bg-soft); border: 1px solid var(--border); font-size: .82rem; letter-spacing: .02em; }
.pg label { display: block; margin: .55rem 0 .2rem; color: var(--fg); }
.pg label.inline { display: block; }
.pg label.inline input { vertical-align: -.15rem; margin: 0 .45rem 0 0; }
.pg input[type="number"], .pg select, .pg textarea {
  font: inherit; width: 100%; background: var(--bg); color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--muted) 60%, var(--border)); border-radius: 9px; padding: .35rem .5rem;
}
.pg input[type="range"] { width: 100%; accent-color: var(--brand); }
.pg input[type="checkbox"] { accent-color: var(--brand); width: 1rem; height: 1rem; }
.pg textarea { min-height: 16rem; font: .8rem/1.45 var(--mono); background: var(--code-bg); color: var(--code-fg); padding: .6rem; }
.pg button {
  font: 700 .9rem var(--sans); padding: 8px 15px; border-radius: 11px; cursor: pointer; margin: .5rem .35rem 0 0;
  color: #fff; border: 1px solid transparent; background: linear-gradient(135deg, var(--btn-1), var(--btn-2));
  transition: transform .12s ease, box-shadow .12s ease;
}
.pg button:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.pg button.secondary { background: var(--bg-soft); color: var(--fg); border-color: var(--border); }
.pg [hidden] { display: none !important; }
.pg .pg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .7rem; }
.pg .pg-pair > div { min-width: 0; }
.pg input:disabled, .pg select:disabled { opacity: .45; }
.pg fieldset a { font-weight: 400; }
.pg fieldset pre { margin: .3rem 0 0; max-width: none; font-size: .9em; }
.pg .small { margin: .35rem 0 0; }
.out { min-width: 0; position: sticky; top: 130px; }
@media (max-width: 52rem) { .out { position: static; } }
.out iframe { display: block; width: 100%; height: min(80vh, 46rem); border: 0; border-radius: 10px; background: #FBFAF7; }
.status { font-size: .9rem; min-height: 1.4rem; margin: 0 0 .6rem; color: var(--muted); }
.status.error { color: var(--brand-ink); font-weight: 700; }
.out figure { margin: 0 0 14px; }
.out img { background: #FBFAF7; }

/* ------------------------------------------------------------ footer */
footer.site { margin-top: 0; padding: 36px 0 52px; color: var(--muted); border-top: 1px solid var(--border); font-size: .9rem; background: color-mix(in srgb, var(--bg-soft) 60%, transparent); }
.foot-inner { display: flex; flex-wrap: wrap; gap: 18px 32px; justify-content: space-between; align-items: flex-start; }
.foot-inner p { margin: .2rem 0; max-width: 60ch; }
.foot-inner strong { color: var(--fg); }
.foot-links { display: flex; gap: 8px 18px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.foot-links li { max-width: none; }
.foot-links a { color: var(--muted); font-weight: 600; }
.foot-links a:hover { color: var(--fg); }

@media (max-width: 40rem) {
  .wrap { padding: 0 16px; }
  nav.main { margin: 0 -16px; padding: 0 10px 6px; }
  .notice p { padding: 7px 16px; }
  .page { padding-top: 26px; }
  .example { padding: 4px 14px 14px; }
  figure { padding: 7px; }
  pre { padding: 12px 14px; }
  .hero h1 { font-size: 2rem; }
  .notice { font-size: .8rem; }
  .term pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .8rem; }
  nav.main { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
}
@media print {
  header.nav, footer.site, .skip, .notice { display: none; }
  body { background: #fff; color: #000; }
}
.lang abbr { text-decoration: none; }

/* Long identifiers in headings (max_stretch, frame_on_boundary) wrap on phones. */
h1 code, h2 code, h3 code { overflow-wrap: anywhere; }

/* Maps over MapLibre GL (the pages of tools/maplibre.py, in an iframe). */
figure.map { margin: 1.2rem 0 0; }
figure.map iframe { display: block; width: 100%; height: min(70vh, 34rem); border: 1px solid var(--border); border-radius: 12px; background: #F2F1EE; }
figure.map figcaption { margin-top: 0.5rem; }

/* ------------------------------------------------------------ home: real examples */
.hero figure.hero-fig { margin: 40px 0 0; }
.hero figure.hero-fig figcaption { max-width: none; }
.showcase { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; margin: 1.2rem 0 1.4rem; }
.showcase figure { margin: 0; }
.showcase figure.wide { grid-column: 1 / -1; }
.showcase figcaption { max-width: none; }
@media (max-width: 760px) { .showcase { grid-template-columns: minmax(0, 1fr); } }

/* Styles: the whole catalogue of themes and palettes, closed by default. */
details.catalogue { margin: 1.2rem 0 1.6rem; border: 1px solid var(--border); border-radius: var(--radius); padding: .7rem 1rem; background: var(--card); }
details.catalogue > summary { cursor: pointer; font-weight: 600; }
details.catalogue[open] > summary { margin-bottom: .6rem; }
