/* How the Internet works. One theme: ink on drafting film, one ink per layer. */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-standard-normal.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-latin-standard-italic.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("/assets/fonts/commit-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("/assets/fonts/commit-mono-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --film: #e7ebf0;
  --sheet: #f6f8fa;
  --ink: #131c2b;
  --soft: #4d5a6c;
  --rule: #bcc5d1;
  --l0: #6b7280; /* physical: graphite */
  --l1: #b45309; /* link: copper */
  --l2: #1f4fd8; /* internet: blue */
  --l3: #b0276b; /* transport: magenta */
  --l4: #0b7a6e; /* application: teal */
  --l0t: #dfe2e6;
  --l1t: #f1dcc8;
  --l2t: #d3dcf6;
  --l3t: #f0d3e1;
  --l4t: #cde6e2;
  --accent: var(--ink);
  --text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Commit Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --col: 43rem;
  --strip-h: 4.6rem;
  --bar-h: 3rem;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--bar-h) + 1rem); }
body {
  margin: 0;
  overflow-anchor: none; /* app.js keeps the reader's place when a chapter loads above */
  background: var(--film);
  color: var(--ink);
  font: 400 1.0625rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration-color: var(--rule); text-underline-offset: 0.18em; text-decoration-thickness: 0.09em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--l2); outline-offset: 2px; border-radius: 2px; }
code, kbd, samp { font: 0.92em var(--mono); }
p code, li code, dd code, dt code { background: var(--sheet); padding: 0.05em 0.3em; border-radius: 3px; }
button, input, select { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; z-index: 50; background: var(--sheet); padding: 0.5rem 1rem; }

/* ---------------------------------------------------------------- top bar */
.bar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 clamp(1rem, 4vw, 3.5rem);
  background: color-mix(in srgb, var(--film) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  font-size: 0.9rem;
}
.bar a, .bar button { white-space: nowrap; }
.bar-home { font-weight: 750; font-stretch: 112%; text-decoration: none; letter-spacing: -0.01em; }
.bar nav { display: flex; align-items: center; gap: clamp(0.6rem, 2vw, 1.5rem); }
.bar nav a, .bar nav button { background: none; border: 0; padding: 0.4rem 0; cursor: pointer; text-decoration: none; }
.bar nav a:hover, .bar nav button:hover { text-decoration: underline; }
.bar nav .bar-book { background: var(--ink); color: var(--film); padding: 0.3rem 0.8rem; border-radius: 3px; }

.toc {
  position: fixed; z-index: 30; top: 0; right: 0; bottom: 0; width: min(30rem, 100vw);
  overflow: auto; background: var(--sheet); border-left: 1px solid var(--ink);
  padding: 1rem 1.5rem 6rem;
}
.toc h3 { font-size: 0.85rem; font-weight: 600; color: var(--soft); margin: 1.4rem 0 0.3rem; }
.toc ol { margin: 0; padding-left: 2rem; }
.toc li { padding: 0.12rem 0; }
.toc li::marker { font: 0.8rem var(--mono); color: var(--soft); }
.toc a { text-decoration: none; }
.toc a:hover, .toc a[aria-current] { text-decoration: underline; }
.toc a[aria-current] { font-weight: 700; }
.toc-top { display: flex; gap: 0.6rem; position: sticky; top: -1rem; background: var(--sheet); padding: 0.4rem 0; z-index: 1; }
.toc-top input { flex: 1 1 auto; min-width: 0; background: var(--film); border: 1px solid var(--ink); border-radius: 3px; padding: 0.3rem 0.6rem; }
.toc li[hidden], .toc ol[hidden], .toc h3[hidden] { display: none; }
.toc-none { color: var(--soft); }
#toc-close { background: none; border: 1px solid var(--ink); border-radius: 3px; padding: 0.2rem 0.7rem; cursor: pointer; }

/* ------------------------------------------------------------------ stage */
.stage {
  position: fixed; z-index: 1; top: var(--bar-h); right: 0; bottom: var(--strip-h);
  width: calc(100vw - var(--col) - clamp(2rem, 9vw, 9rem));
  pointer-events: none;
}
.stage { display: flex; flex-direction: column; }
.stage-view { position: relative; flex: 1 1 auto; min-height: 9rem; pointer-events: auto; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage-devs { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dev {
  position: absolute; top: 0; left: 0; pointer-events: auto; cursor: pointer;
  background: none; border: 0; border-radius: 3px; padding: 1px 4px; margin: 0;
  font-size: 0.78rem; line-height: 1.15; text-align: center; white-space: nowrap; color: var(--soft);
}
.dev b { display: block; font-weight: 600; }
.dev span { display: block; font-size: 0.7rem; }
.dev.on { color: var(--ink); }
.dev.on b { font-weight: 750; }
.dev:hover b { text-decoration: underline; }
.dev.sel { background: var(--ink); color: var(--film); }
.dev[hidden] { display: none; }
.stage-devs.narrow .dev { font-size: 0.66rem; padding: 0 2px; }
.stage-devs.narrow .dev span { display: none; }
.stage-panel { flex: 0 0 auto; pointer-events: auto; padding: 0.4rem 1.5rem 0.7rem 1rem; font-size: 0.88rem; line-height: 1.35; }
.stage-note { margin: 0 0 0.6rem; font-weight: 600; }
.stage-info { min-height: 11.5rem; }
.stage-legend { list-style: none; margin: 0; padding: 0; }
.stage-legend li { display: grid; grid-template-columns: 0.7rem 6.2rem 1fr; gap: 0 0.5rem; align-items: baseline; padding: 0.12rem 0; color: var(--soft); }
.stage-legend li::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 2px; background: var(--c); align-self: center; }
.stage-legend b { font-weight: 600; color: var(--c); }
.stage-legend li.now { color: var(--ink); }
.stage-legend li.now b { font-weight: 800; }
.stage-legend li[data-l="0"], .stage-card[data-l="0"] { --c: var(--l0); }
.stage-legend li[data-l="1"], .stage-card[data-l="1"] { --c: var(--l1); }
.stage-legend li[data-l="2"], .stage-card[data-l="2"] { --c: var(--l2); }
.stage-legend li[data-l="3"], .stage-card[data-l="3"] { --c: var(--l3); }
.stage-legend li[data-l="4"], .stage-card[data-l="4"] { --c: var(--l4); }
.stage-hint { margin: 0.6rem 0 0; color: var(--soft); font-size: 0.82rem; }
.stage-card { position: relative; background: var(--sheet); border: 1px solid var(--ink); border-top: 4px solid var(--c); border-radius: 3px; padding: 0.6rem 0.9rem 0.7rem; }
.stage-card h3 { margin: 0 4rem 0.2rem 0; font-size: 1rem; font-weight: 750; }
.stage-card p { margin: 0 0 0.35rem; }
.stage-card .stage-reads { margin: 0; color: var(--soft); }
.stage-card .stage-reads b { color: var(--c); }
.stage-close { position: absolute; top: 0.45rem; right: 0.6rem; background: none; border: 1px solid var(--ink); border-radius: 3px; padding: 0.05rem 0.5rem; font-size: 0.8rem; cursor: pointer; }
.stage-motion { margin-top: 0.5rem; background: none; border: 0; padding: 0; font-size: 0.82rem; color: var(--soft); text-decoration: underline; cursor: pointer; }
.stage-motion[hidden] { display: none; }

main { position: relative; z-index: 2; padding: var(--bar-h) 0 calc(var(--strip-h) + 4rem) clamp(1rem, 4vw, 3.5rem); width: min(100%, calc(var(--col) + clamp(1rem, 4vw, 3.5rem))); }

@media (max-width: 68rem) {
  .stage { position: sticky; top: var(--bar-h); width: 100%; background: var(--film); border-bottom: 1px solid var(--rule); z-index: 5; pointer-events: auto; }
  .stage-view { flex: 0 0 auto; height: clamp(10.5rem, 28vh, 15rem); }
  .stage-panel { padding: 0 clamp(1rem, 4vw, 3.5rem) 0.35rem; font-size: 0.8rem; display: flex; gap: 1rem; align-items: baseline; justify-content: space-between; }
  .stage-note { margin: 0; font-weight: 500; }
  .stage-info { min-height: 0; position: absolute; top: 100%; left: 0; right: 0; }
  .stage-legend, .stage-hint { display: none; }
  .stage-card { border-width: 0 0 1px; border-top: 4px solid var(--c); border-radius: 0; padding: 0.6rem clamp(1rem, 4vw, 3.5rem) 0.7rem; }
  .stage-close { right: clamp(1rem, 4vw, 3.5rem); }
  .stage-motion { margin: 0; white-space: nowrap; }
  main { padding-right: clamp(1rem, 4vw, 3.5rem); width: min(100%, calc(var(--col) + 2 * clamp(1rem, 4vw, 3.5rem))); margin: 0 auto; padding-top: 0; }
  body { padding-top: var(--bar-h); }
}

/* ------------------------------------------------------------------- hero */
.hero { min-height: calc(100vh - var(--bar-h) - var(--strip-h)); display: flex; flex-direction: column; justify-content: center; padding: 3rem 0 2rem; }
.hero h1, .srcpage h1 {
  font-size: clamp(2.6rem, 7.2vw, 5.4rem); line-height: 0.95; margin: 0 0 1.5rem;
  font-weight: 800; font-stretch: 125%; letter-spacing: -0.035em; max-width: 9ch;
}
.srcpage h1 { max-width: 12ch; margin-top: 3rem; }
.hero-lede { font-size: 1.2rem; line-height: 1.5; max-width: 38rem; margin: 0 0 2rem; }
.hero-how { color: var(--soft); max-width: 34rem; margin: 1.2rem 0 0; }

.dump { font: 400 clamp(0.72rem, 2.1vw, 1.02rem)/1 var(--mono); }
.dump-rows { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px 0; max-width: 36rem; }
.dump-rows i, .strip-bytes i {
  font-style: normal; text-align: center; cursor: pointer; user-select: none;
}
.dump, .strip { --c: var(--l0); --t: var(--l0t); }
[data-l="1"] { --c: var(--l1); --t: var(--l1t); }
[data-l="2"] { --c: var(--l2); --t: var(--l2t); }
[data-l="3"] { --c: var(--l3); --t: var(--l3t); }
[data-l="4"] { --c: var(--l4); --t: var(--l4t); }
.dump-rows i { padding: 0.55em 0; background: var(--t); color: var(--ink); border-left: 1px solid transparent; }
.dump-rows i.fs { border-left-color: var(--film); }
.dump-rows i.on { background: var(--c); color: #fff; }
.dump-read { min-height: 3.4em; margin: 0.9rem 0 0; font: 400 1rem/1.4 var(--text); max-width: 36rem; }
.dump-read b { font-weight: 700; }
.dump-key { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0.8rem 0 0; padding: 0; list-style: none; font-size: 0.9rem; }
.dump-key li::before { content: ""; display: inline-block; width: 0.8em; height: 0.8em; background: var(--c); margin-right: 0.4em; vertical-align: -0.05em; }

/* --------------------------------------------------------------- stations */
.station, .slot { padding: 5.5rem 0 3rem; border-top: 1px solid var(--ink); margin-top: 3rem; --lc: var(--ink); --lt: var(--sheet); }
.slot { min-height: 70vh; color: var(--soft); }
.station[data-layer="physical"] { --lc: var(--l0); --lt: var(--l0t); }
.station[data-layer="link"] { --lc: var(--l1); --lt: var(--l1t); }
.station[data-layer="internet"] { --lc: var(--l2); --lt: var(--l2t); }
.station[data-layer="transport"] { --lc: var(--l3); --lt: var(--l3t); }
.station[data-layer="application"] { --lc: var(--l4); --lt: var(--l4t); }
.station-part { margin: 0 0 0.6rem; font-size: 0.95rem; color: var(--lc); font-weight: 600; }
.station-title {
  font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1; margin: 0 0 1.2rem;
  font-weight: 800; font-stretch: 122%; letter-spacing: -0.03em; text-wrap: balance;
}
.station-title a { text-decoration: none; }
.station-kicker { font-size: 1.3rem; line-height: 1.35; font-weight: 500; margin: 0 0 2rem; max-width: 34rem; text-wrap: pretty; }
.scene { font-size: 1.12rem; margin: 0 0 2rem; }
.above { padding: 2rem 0 0; font-size: 0.95rem; }
.above a::before { content: "Before this: "; color: var(--soft); }

.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0 1.5rem; margin: 0 0 2.5rem; border-top: 3px solid var(--lc); }
.figures div { padding: 0.8rem 0 0; }
.figures dt { font: 700 1.9rem/1.1 var(--mono); letter-spacing: -0.04em; color: var(--lc); }
.figures dt code { background: none; padding: 0; font-size: 1em; }
.figures dd { margin: 0.3rem 0 0; font-size: 0.95rem; line-height: 1.4; }

.talk { margin: 3rem 0; }
.qa { margin: 0 0 2.6rem; }
.qa h3 {
  font-size: 1.65rem; line-height: 1.12; margin: 0 0 0.7rem; font-weight: 650; font-stretch: 78%;
  letter-spacing: -0.005em; text-wrap: balance; max-width: 26ch;
}
.qa p { margin: 0 0 0.9rem; }
.qa p:last-child { margin-bottom: 0; }
.qlist { padding-left: 1.2rem; }

.cite { white-space: nowrap; text-decoration-color: var(--lc); text-decoration-thickness: 0.12em; }
.cite[data-key] { font-size: 0.92em; }

.specwire { display: grid; grid-template-columns: 1fr 1fr; margin: 3rem 0; background: var(--sheet); border: 1px solid var(--ink); }
.specwire h3 { grid-column: 1 / -1; margin: 0; padding: 0.5rem 1.1rem; font-size: 1rem; font-weight: 700; background: var(--ink); color: var(--film); }
.specwire h4 { margin: 0 0 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--soft); }
.specwire div { padding: 1rem 1.1rem; }
.specwire p { margin: 0; font-size: 0.98rem; line-height: 1.5; }
.sw-wire { border-left: 1px dashed var(--ink); }
@media (max-width: 34rem) { .specwire { grid-template-columns: 1fr; } .sw-wire { border-left: 0; border-top: 1px dashed var(--ink); } }

.bookfig { margin: 3rem 0; }
.bookfig-svg { background: var(--sheet); border: 1px solid var(--rule); padding: 1rem; overflow-x: auto; }
.bookfig-svg svg { max-width: 100%; max-height: 26rem; width: auto; height: auto; display: block; margin: 0 auto; }
.bookfig figcaption, .viz figcaption p { font-size: 0.92rem; color: var(--soft); margin-top: 0.5rem; }

.rest { margin: 3rem 0; padding: 1.2rem 1.4rem 1.4rem; background: var(--lt); }
.rest h3, .sources h3 { margin: 0 0 0.4rem; font-size: 1.15rem; font-weight: 700; }
.rest p { margin: 0 0 0.8rem; font-size: 0.98rem; }
.rest ul { margin: 0; padding-left: 1.1rem; columns: 2 15rem; column-gap: 2rem; font-stretch: 85%; font-weight: 550; }
.rest li { break-inside: avoid; padding: 0.15rem 0; line-height: 1.3; }

.sources { margin: 3rem 0 0; }
.sources ul { list-style: none; margin: 0.6rem 0; padding: 0; border-top: 1px solid var(--rule); }
.sources li { padding: 0.45rem 0; border-bottom: 1px solid var(--rule); line-height: 1.35; font-size: 0.98rem; }
.sources li .cite { font-family: var(--mono); font-size: 0.86em; margin-right: 0.5em; }
.src-meta { display: block; color: var(--soft); font-size: 0.86rem; }
.sources-more { font-size: 0.95rem; }

/* -------------------------------------------------------------------- viz */
.viz { margin: 2.5rem 0 3rem; }
.viz figcaption h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.viz figcaption p { margin: 0.2rem 0 0.8rem; }
.viz-mount { background: var(--sheet); border: 1px solid var(--ink); padding: 1rem; min-height: 14rem; position: relative; overflow-x: auto; }
.viz-mount svg { display: block; width: 100%; min-width: 30rem; height: auto; }
/* fill is inherited from the svg root, so a fill attribute on a text element still wins */
.viz-mount svg { fill: var(--ink); font-family: var(--text); }
.viz-mount svg text.mono { font-family: var(--mono); }
.vz-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.8rem; margin: 0.8rem 0 0; }
.vz-btn {
  background: var(--sheet); border: 1px solid var(--ink); border-radius: 3px; padding: 0.3rem 0.8rem;
  cursor: pointer; font-size: 0.92rem; line-height: 1.3;
}
.vz-btn:hover { background: var(--film); }
.vz-btn[aria-pressed="true"], .vz-btn.primary { background: var(--ink); color: var(--film); }
.vz-btn:disabled { opacity: 0.4; cursor: default; }
.vz-count { font: 0.85rem var(--mono); color: var(--soft); }
.vz-note { margin: 0.8rem 0 0; min-height: 4.4em; font-size: 0.98rem; line-height: 1.45; }
.vz-note b { font-weight: 700; }
.vz-field { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.7rem; font-size: 0.92rem; }
.vz-field input[type="range"] { accent-color: var(--ink); width: min(16rem, 100%); }
.vz-field output { font: 0.9rem var(--mono); min-width: 5ch; }
.vz-readout { font: 0.9rem/1.5 var(--mono); white-space: pre-wrap; margin: 0.8rem 0 0; }
.vz-legend { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; margin: 0.6rem 0 0; padding: 0; list-style: none; font-size: 0.88rem; }
.vz-legend li::before { content: ""; display: inline-block; width: 0.8em; height: 0.8em; margin-right: 0.4em; background: var(--sw, var(--ink)); vertical-align: -0.05em; }
.vz-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.vz-table th, .vz-table td { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.vz-table td.mono, .vz-table th.mono { font-family: var(--mono); font-size: 0.86rem; }

/* ------------------------------------------------------------------ strip */
.strip {
  position: fixed; z-index: 15; inset: auto 0 0 0; height: var(--strip-h);
  background: var(--ink); color: var(--film);
  padding: 0.45rem clamp(1rem, 4vw, 3.5rem) 0.5rem;
  display: flex; flex-direction: column; justify-content: center; gap: 0.35rem;
}
.strip-read { margin: 0; font-size: 0.86rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.strip-read b { font-weight: 700; }
.strip-bytes { display: grid; grid-template-columns: repeat(74, minmax(0, 1fr)); font: 400 0.68rem/1 var(--mono); max-width: 82rem; }
.strip-bytes i { padding: 0.5em 0; background: color-mix(in srgb, var(--c) 34%, var(--ink)); color: color-mix(in srgb, var(--film) 55%, transparent); overflow: hidden; }
.strip-bytes i.fs { box-shadow: inset 1px 0 0 var(--ink); }
.strip-bytes i.lit { background: var(--c); color: #fff; }
.strip-bytes i.on { background: var(--film); color: var(--ink); }
@media (max-width: 68rem) { .strip-bytes { font-size: 0; } .strip-bytes i { padding: 0.55rem 0; } }

/* -------------------------------------------------------------------- pop */
.pop {
  position: absolute; z-index: 40; width: min(24rem, calc(100vw - 2rem));
  background: var(--ink); color: var(--film); padding: 0.8rem 1rem; border-radius: 3px;
  font-size: 0.9rem; line-height: 1.4;
}
.pop b { display: block; font-weight: 700; }
.pop span { display: block; color: color-mix(in srgb, var(--film) 72%, transparent); margin: 0.15rem 0 0.4rem; }
.pop a { margin-right: 1rem; text-decoration-color: currentColor; }

/* ------------------------------------------------------------------ outro */
.outro { border-top: 6px solid var(--ink); margin-top: 6rem; padding-top: 3rem; }
.outro h2 { font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1; font-weight: 800; font-stretch: 122%; letter-spacing: -0.03em; margin: 0 0 1.2rem; text-wrap: balance; }
.outro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin: 1.6rem 0; }
.button { background: var(--ink); color: var(--film); padding: 0.7rem 1.2rem; border-radius: 3px; text-decoration: none; font-weight: 650; }
.button:hover { background: var(--l2); }
.outro-fine { font-size: 0.88rem; color: var(--soft); }
.outro-cols { display: grid; grid-template-columns: minmax(0, 1fr) clamp(8rem, 26%, 12rem); gap: 2rem; align-items: start; }
.outro-cover img { display: block; width: 100%; height: auto; border-radius: 2px; box-shadow: 0.5rem 0.5rem 0 var(--rule); }
.outro-listen { margin: 1.4rem 0; }
.outro-news { border-top: 1px solid var(--rule); margin-top: 2.4rem; padding-top: 1.6rem; }
.outro-news label { display: block; font-weight: 650; margin-bottom: 0.7rem; }
.outro-news-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.outro-news input[type="email"] { flex: 1 1 14rem; min-width: 0; max-width: 24rem; font: inherit; color: var(--ink); background: var(--sheet); border: 1px solid var(--ink); border-radius: 3px; padding: 0.7rem 0.8rem; }
.outro-news .button { border: 0; font: inherit; font-weight: 650; cursor: pointer; }
.legal { font-size: 0.88rem; color: var(--soft); margin-top: 2.5rem; }
.outro-listen figcaption { font-size: 0.92rem; color: var(--soft); margin-bottom: 0.4rem; }
.outro-listen audio { display: block; width: 100%; max-width: 30rem; }
.outro-listen details { margin-top: 0.6rem; font-size: 0.95rem; color: var(--soft); }
.outro-listen summary { cursor: pointer; text-decoration: underline; }
@media (max-width: 34rem) { .outro-cols { grid-template-columns: 1fr; } .outro-cover { max-width: 11rem; } }

/* ----------------------------------------------------------------- sample */
.plainpage { width: min(var(--col), calc(100vw - 2 * clamp(1rem, 4vw, 3.5rem))); padding-top: 2.5rem; }
body:has(.plainpage) .stage, body:has(.plainpage) .strip { display: none; }
body:has(.plainpage) main { width: auto; padding-bottom: 4rem; }
.sample h1 { font-size: clamp(2.1rem, 5.4vw, 3.6rem); line-height: 0.98; font-weight: 800; font-stretch: 122%; letter-spacing: -0.03em; margin: 0.3rem 0 1.5rem; text-wrap: balance; }
.sample h2 { font-size: 1.45rem; line-height: 1.15; font-weight: 750; margin: 2.4rem 0 0.8rem; }
.sample pre { background: var(--sheet); border: 1px solid var(--rule); border-radius: 3px; padding: 0.8rem 1rem; overflow-x: auto; font: 0.8rem/1.5 var(--mono); }
.sample blockquote { margin: 1.2rem 0; padding-left: 1rem; border-left: 4px solid var(--rule); color: var(--soft); }
.sample table { border-collapse: collapse; font-size: 0.92rem; }
.sample th, .sample td { text-align: left; padding: 0.3rem 0.9rem 0.3rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.sample-end { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- sources */
.srcpage { width: min(72rem, calc(100vw - 2 * clamp(1rem, 4vw, 3.5rem))); }
body:has(.srcpage) .stage, body:has(.srcpage) .strip { display: none; }
body:has(.srcpage) main { width: auto; padding-bottom: 4rem; }
.srcfilter { position: sticky; top: var(--bar-h); z-index: 6; background: var(--film); display: flex; flex-wrap: wrap; gap: 0.5rem 0.8rem; align-items: center; padding: 0.8rem 0; border-bottom: 1px solid var(--ink); }
.srcfilter input, .srcfilter select { background: var(--sheet); border: 1px solid var(--ink); border-radius: 3px; padding: 0.35rem 0.6rem; }
.srcfilter input { flex: 1 1 14rem; }
.srcfilter output { font: 0.85rem var(--mono); color: var(--soft); }
.srctable { width: 100%; border-collapse: collapse; font-size: 0.93rem; line-height: 1.35; }
.srctable th, .srctable td { text-align: left; vertical-align: top; padding: 0.5rem 0.8rem 0.5rem 0; border-bottom: 1px solid var(--rule); }
.srctable thead th { font-weight: 600; color: var(--soft); font-size: 0.85rem; }
.srctable tbody th { font: 400 0.85rem var(--mono); white-space: nowrap; }
.srctable .chs a { font: 0.8rem var(--mono); margin-right: 0.3rem; }
.srctable tr[hidden] { display: none; }
@media (max-width: 48rem) {
  .srctable thead { display: none; }
  .srctable tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--rule); }
  .srctable th, .srctable td { display: block; border: 0; padding: 0.1rem 0; }
}

@media (prefers-reduced-motion: no-preference) {
  .dump-rows i, .strip-bytes i { transition: background-color 0.15s; }
}
@media (max-width: 30rem) { .bar { font-size: 0.8rem; padding: 0 0.7rem; } .bar nav { gap: 0.6rem; } .bar nav .bar-book { padding: 0.25rem 0.5rem; } }
@media (max-width: 34rem) { .viz figcaption::after { content: "On a small screen, swipe the figure sideways to see all of it."; display: block; font-size: 0.85rem; color: var(--soft); margin-bottom: 0.6rem; } }
@media print {
  .bar, .stage, .strip, .toc { display: none; }
  main { width: auto; padding: 0; }
}

/* German: long compounds must break on a narrow screen. */
/* Only on a narrow screen: the German hyphenation also splits English terms (Upst-ream), so wide columns do without it. */
@media (max-width: 34rem) { :lang(de) .station, :lang(de) .hero, :lang(de) .outro, :lang(de) .stage-panel, :lang(de) .srcpage { hyphens: auto; } }
/* Figure notes are full of identifiers (LOCAL_PREF), which must not be split. */
:lang(de) code, :lang(de) .viz-mount { hyphens: manual; }
:lang(de) h1, :lang(de) h2, :lang(de) h3, :lang(de) .station-kicker { hyphens: manual; }
:lang(de) .hero h1 { font-size: clamp(2.2rem, 5.4vw, 4.4rem); }
:lang(de) .above a::before { content: "Davor: "; }
@media (max-width: 34rem) { :lang(de) .viz figcaption::after { content: "Wisch die Grafik auf einem kleinen Bildschirm seitwärts, um sie ganz zu sehen."; } }
/* Narrow header: the language link shrinks to its code, so the book button stays on the screen. */
@media (max-width: 34rem) {
  .bar-home { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .bar nav .bar-lang { font-size: 0; }
  .bar nav .bar-lang::after { content: attr(hreflang); font-size: 0.8rem; text-transform: uppercase; }
}
