/* cages: the site's one stylesheet.
 *
 * A paper field with the cages' own pictures as its only dark masses: each picture is shown at
 * the size it is, with its sides measured, because a cage is the size it is asked to be.
 * Three roles carry colour and nothing else does: what keeps a cage (ink), what looks at
 * it (blue), what drives it (orange, the cursor's own colour in the pictures).
 */

@font-face { font-family: "Atkinson Hyperlegible Next"; src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }
@font-face { font-family: "Commit Mono"; src: url("fonts/commit-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #f3f0e8;
  --band: #eae6da;
  --ink: #15171c;
  --ink-2: #454a57;
  --ink-3: #5d6270;
  --rule: #cbc6b7;
  --rule-2: #dcd8ca;
  --field: #e7e3d6;
  --keep: #15171c;
  --look: #2445ad;
  --drive: #b0390a;
  --screen: #14161b;
  --screen-ink: #f1eee6;
  --spot: #8aa5ff;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --sans: "Atkinson Hyperlegible Next", ui-sans-serif, system-ui, sans-serif;
  --mono: "Commit Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0f1115; --band: #14171c; --ink: #f1eee6; --ink-2: #c3c6ce; --ink-3: #9197a5;
  --rule: #303541; --rule-2: #23272f; --field: #1a1d24; --keep: #f1eee6; --look: #8aa5ff; --drive: #ff7a3d;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0f1115; --band: #14171c; --ink: #f1eee6; --ink-2: #c3c6ce; --ink-3: #9197a5;
    --rule: #303541; --rule-2: #23272f; --field: #1a1d24; --keep: #f1eee6; --look: #8aa5ff; --drive: #ff7a3d;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: 4.25rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.55 var(--sans); font-synthesis: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; }
::selection { background: color-mix(in srgb, var(--drive) 28%, transparent); }
:focus-visible { outline: 2px solid var(--look); outline-offset: 2px; }
a { color: inherit; text-decoration: underline; text-decoration-color: var(--ink-3); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--drive); text-decoration-thickness: 2px; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--mono); font-variant-ligatures: none; }
code { font-size: 0.86em; background: var(--field); padding: 0.08em 0.32em; overflow-wrap: anywhere; }
code.w { white-space: nowrap; }
.wrap { width: min(100% - 2 * var(--gutter), 80rem); margin-inline: auto; }
.skip { position: absolute; left: var(--gutter); top: -4rem; z-index: 20; background: var(--ink); color: var(--paper); padding: 0.5rem 0.8rem; }
.skip:focus { top: 0.5rem; }

/* ---- the roles ------------------------------------------------------------------------ */
.r-keep { --role: var(--keep); }
.r-look { --role: var(--look); }
.r-drive { --role: var(--drive); }

/* ---- the bar --------------------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 10; background: var(--paper); border-bottom: 1px solid var(--rule-2); }
.top-in { display: flex; align-items: center; gap: clamp(0.75rem, 3vw, 2rem); height: 3.25rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; font-weight: 720; font-size: 1.05rem; letter-spacing: -0.01em; text-decoration: none; flex: none; }
.brand img { display: block; }
.ver { font: 400 0.72rem var(--mono); color: var(--ink-3); letter-spacing: 0; margin-left: 0.1rem; }
.top nav { display: flex; gap: clamp(0.9rem, 2.2vw, 1.6rem); margin-left: auto; overflow-x: auto; scrollbar-width: none; align-self: stretch; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { display: flex; align-items: center; white-space: nowrap; font-size: 0.92rem; color: var(--ink-2); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--drive); }
.theme { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; padding: 0; border: 1px solid var(--rule); background: none; color: var(--ink-2); cursor: pointer; }
.theme:hover { color: var(--ink); border-color: var(--ink-3); }
.theme svg { width: 1rem; height: 1rem; display: block; }

/* ---- the first screen ------------------------------------------------------------------ */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); gap: clamp(2rem, 4vw, 3.5rem); align-items: end; padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(3rem, 7vw, 5rem); }
.hero-say > :last-child { margin-bottom: 1.6rem; }
h1 { margin: 0 0 0.44em; font-size: clamp(4.25rem, 10vw, 8rem); font-weight: 760; line-height: 0.86; letter-spacing: -0.05em; }
.lede { font-size: clamp(1.18rem, 1.5vw, 1.32rem); line-height: 1.42; max-width: 34em; }
.hero-say > p:not(.lede) { color: var(--ink-2); max-width: 36em; }
.uses { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(1.5rem, 3vw, 2.5rem); margin: 0; }
.uses div { padding: 0.8rem 0 0; border-top: 1px solid var(--ink); }
.uses dt { font-weight: 660; }
.uses dd { margin: 0.1rem 0 0; color: var(--ink-2); font-size: 0.96rem; }

/* A cage's picture, with its sides measured. */
.plate { --edge: 1.75rem; width: min(100%, calc(var(--w) * 1px + var(--edge))); margin: 0; }
.pane { display: grid; grid-template-columns: var(--edge) minmax(0, 1fr); grid-template-rows: var(--edge) auto; }
.plate img { grid-area: 2 / 2; display: block; width: 100%; height: auto; background: var(--screen); outline: 1px solid var(--rule); }
.dim { display: flex; align-items: center; gap: 0.45rem; font: 0.72rem var(--mono); color: var(--ink-3); }
.dim b { font-weight: 400; }
.dim::before, .dim::after { content: ""; flex: 1; }
.dim-w { grid-area: 1 / 2; }
.dim-w::before, .dim-w::after { height: 0.6rem; background: linear-gradient(var(--ink-3), var(--ink-3)) center / 100% 1px no-repeat; }
.dim-w::before { border-left: 1px solid var(--ink-3); }
.dim-w::after { border-right: 1px solid var(--ink-3); }
.dim-h { grid-area: 2 / 1; writing-mode: vertical-rl; transform: rotate(180deg); justify-self: start; }
.dim-h::before, .dim-h::after { width: 0.6rem; background: linear-gradient(var(--ink-3), var(--ink-3)) center / 1px 100% no-repeat; }
.dim-h::before { border-top: 1px solid var(--ink-3); }
.dim-h::after { border-bottom: 1px solid var(--ink-3); }
.plate figcaption { display: flex; flex-wrap: wrap; gap: 0 0.4rem; margin-left: var(--edge); padding-top: 0.55rem; font-size: 0.86rem; color: var(--ink-2); }
.plate figcaption > b { font: 400 0.8rem var(--mono); color: var(--ink); align-self: center; }
.plate figcaption .by { margin-left: auto; font: 0.74rem var(--mono); color: var(--ink-3); align-self: center; }

/* ---- sections -------------------------------------------------------------------------- */
.sec, .band { padding-block: clamp(3rem, 7vw, 5.5rem); }
.sec + .sec { padding-top: 0; }
.band { background: var(--band); border-block: 1px solid var(--rule-2); }
.sh { margin-bottom: clamp(1.8rem, 4vw, 2.8rem); }
h2 { margin: 0 0 0.5em; font-size: clamp(1.9rem, 3.4vw, 2.6rem); font-weight: 720; line-height: 1.05; letter-spacing: -0.025em; }
.sh p { max-width: 44em; color: var(--ink-2); }
.sh p:last-child { margin-bottom: 0; }
h3 { margin: 0; font-size: 1.2rem; font-weight: 680; letter-spacing: -0.01em; line-height: 1.25; }
h3.minor { font-size: 1rem; margin: 2.2rem 0 0.8rem; }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; margin: 1.1rem 0 0; font: 0.78rem var(--mono); }
.legend span::before, .cmds .g span::before { content: ""; display: inline-block; width: 0.62em; height: 0.62em; margin-right: 0.5em; background: var(--role); }

/* ---- the session ----------------------------------------------------------------------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(2.6rem, 5vw, 4.2rem); }
.step { display: grid; grid-template-columns: minmax(0, 27rem) minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
.step h3 { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: 0.9rem; }
.n { flex: none; font: 400 0.74rem/1 var(--mono); padding: 0.32rem 0.42rem 0.28rem; background: var(--role); color: var(--paper); transform: translateY(-0.12rem); }
.say p { color: var(--ink-2); font-size: 0.98rem; }
.say > :last-child { margin-bottom: 0; }
.step .plate { margin-top: calc(-1 * var(--edge)); }
.term, .src { margin: 0 0 1rem; padding: 0.85rem 1rem; background: var(--field); font-size: 0.82rem; line-height: 1.62; tab-size: 12; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.band .term, .band .src, .band code { background: color-mix(in srgb, var(--paper) 70%, var(--band)); }
.term, .src { white-space: pre-wrap; overflow-wrap: anywhere; }
.term > span { display: block; }
.term .w { font-weight: inherit; white-space: nowrap; }
.term .c { padding-left: 2ch; text-indent: -2ch; }
.term .c::before { content: "$ "; color: var(--ink-3); }
.term .o { color: var(--ink-2); }
.term .x { width: fit-content; margin: 0.15rem 0 0.2rem; padding: 0 0.4rem; border: 1px solid currentColor; color: var(--drive); font-size: 0.74rem; line-height: 1.5; }
.out .term { margin: 0; }
.codes { border-collapse: collapse; font-size: 0.95rem; margin-top: 0.4rem; }
.codes th { text-align: left; font-weight: 400; white-space: nowrap; padding: 0.3rem 0.9rem 0.3rem 0; vertical-align: top; }
.codes td { padding: 0.3rem 0; color: var(--ink-2); }

/* ---- tables ---------------------------------------------------------------------------- */
.scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
table.cmds, table.facts { width: 100%; border-collapse: collapse; font-size: 0.96rem; }
.cmds th, .facts th { text-align: left; }
.cmds thead th, .facts thead th { font: 400 0.74rem var(--mono); color: var(--ink-3); padding: 0 1.2rem 0.5rem 0; border-bottom: 1px solid var(--ink); }
.cmds td, .facts td, .facts tbody th { padding: 0.62rem 1.2rem 0.62rem 0; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
.cmds td:first-child { width: 48%; }
.cmds td:last-child, .facts td:last-child { color: var(--ink-2); padding-right: 0; }
.cmds .g th { padding: 1.6rem 0 0.45rem; border-bottom: 1px solid var(--rule); font: 400 0.78rem var(--mono); }
.cmds code, .opts td:first-child code { background: none; padding: 0; }
.facts tbody th { font-weight: 620; width: 30%; }
.facts.two tbody th { width: 34%; }
.facts td code { white-space: nowrap; }
.facts.two td code, .opts td:last-child code { white-space: normal; }
.opts td:first-child, .opts td:nth-child(2) { white-space: nowrap; width: 1%; }
.after { margin: 0 0 0.8rem; max-width: 46em; color: var(--ink-2); }

/* ---- the drawing of the parts ---------------------------------------------------------- */
.plan { margin: 0 0 2.6rem; font-size: 0.95rem; }
.askers { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; padding-inline: 1.25rem; }
.asker { display: grid; gap: 0.2rem; padding: 0.85rem 1rem 0; border: 1px solid var(--rule); border-bottom: 0; }
.asker b { font-weight: 660; }
.asker > span { color: var(--ink-2); }
.asker code { background: none; padding: 0; }
.wire { display: block; margin: 0.7rem 0 0 0.4rem; padding: 0.55rem 0 0.8rem 1.1rem; font: normal 0.75rem/1.45 var(--mono); color: var(--ink-3); background: linear-gradient(var(--keep), var(--keep)) left / 2px 100% no-repeat; }
.a-view .wire { background: linear-gradient(to right, var(--look) 0 2px, transparent 2px 6px, var(--drive) 6px 8px, transparent 8px) left / 8px 100% no-repeat; }
.wire em { font-style: normal; color: var(--role); }
.daemon { position: relative; border: 2px solid var(--ink); padding: 2.6rem 1.25rem 1.25rem; }
.tag { position: absolute; top: 0; left: 0; font: 400 0.75rem/1 var(--mono); padding: 0.4rem 0.6rem; background: var(--ink); color: var(--paper); }
.held { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
/* (The bars: a cage holds its program.) */
.cage { position: relative; border: 1px solid var(--ink); padding: 2.4rem 1rem 1rem; background: repeating-linear-gradient(90deg, transparent 0 27px, var(--rule-2) 27px 28px); }
.cage .tag { background: var(--paper); color: var(--ink); border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.how { position: absolute; top: 0.38rem; right: 0.7rem; font: 0.72rem var(--mono); color: var(--ink-3); }
.prog { background: var(--screen); color: var(--screen-ink); font: 0.84rem var(--mono); padding: 1.3rem 1rem; outline: 1px solid var(--rule); }
.prog::after { content: ""; display: inline-block; width: 0.55em; height: 1.05em; margin-left: 0.5em; vertical-align: -0.18em; background: #ff6a2b; }

/* ---- the stream ------------------------------------------------------------------------ */
.cols { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4.5rem); align-items: start; }
.cols.even { grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.6rem; }
.cols.even .src { margin: 0; }
.lanes { display: flex; justify-content: space-between; margin-top: 1.5rem; padding-bottom: 0.45rem; border-bottom: 1px solid var(--ink); font: 0.74rem var(--mono); color: var(--ink-3); }
.seq { list-style: none; margin: 0; padding: 0.9rem 0 0; display: grid; gap: 0.45rem; font: 0.78rem/1.5 var(--mono); }
.seq li { max-width: 88%; padding: 0.42rem 0.7rem; background: var(--paper); overflow-wrap: anywhere; }
.seq code { font-size: 1em; background: none; padding: 0; }
.seq .up { justify-self: start; border-left: 2px solid var(--ink-3); }
.seq .down { justify-self: end; border-right: 2px solid var(--ink-3); }
.seq .pic { display: flex; align-items: center; gap: 0.75rem; border-right-color: var(--look); }
.seq .drive { border-left-color: var(--drive); }
.seq .note { justify-self: center; max-width: 100%; background: none; color: var(--ink-3); text-align: center; padding-block: 0.25rem; }
.seq .note code { color: var(--ink-2); }
.spot { flex: none; position: relative; width: 4.75rem; background: var(--screen); outline: 1px solid var(--rule); overflow: hidden; }
.spot i { position: absolute; min-width: 3px; min-height: 3px; background: var(--spot); }
.rules h3.minor:first-child { margin-top: 0; }
.header { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 0 3px; }
.f { grid-column: span var(--n); min-width: 0; display: grid; gap: 0.3rem; font: 0.72rem/1.2 var(--mono); white-space: nowrap; }
.f code { display: block; font-size: 1em; text-align: center; padding: 0.55rem 0; background: var(--paper); border-bottom: 2px solid var(--ink); }
.f b { font-weight: 400; color: var(--ink); }
.f span { color: var(--ink-3); }
.cap { margin: 0.7rem 0 0; font-size: 0.86rem; color: var(--ink-3); }
.pts { list-style: none; margin: 1.6rem 0 0; padding: 0; font-size: 0.97rem; }
.pts li { padding: 0.7rem 0; border-top: 1px solid var(--rule); color: var(--ink-2); }
.pts b { color: var(--ink); font-weight: 660; }

/* ---- what it does not do --------------------------------------------------------------- */
.rough { margin: 0; border-bottom: 1px solid var(--rule); }
.rough div { display: grid; grid-template-columns: minmax(0, 17rem) minmax(0, 46em); gap: 0.2rem clamp(1.5rem, 4vw, 3rem); padding: 0.85rem 0; border-top: 1px solid var(--rule); }
.rough dt { font-weight: 660; }
.rough dd { margin: 0; color: var(--ink-2); }

/* ---- the foot -------------------------------------------------------------------------- */
.foot { border-top: 1px solid var(--rule-2); background: var(--band); padding-block: 2.4rem 3rem; }
.foot-in { display: flex; gap: 1.8rem; align-items: flex-start; }
.foot .skh-made { flex: none; }
.foot .txt { font-size: 0.9rem; color: var(--ink-2); max-width: 50em; }
.foot .txt p { margin-bottom: 0.45em; }

.none { padding-block: clamp(3rem, 10vw, 7rem); }
.none h1 { font-size: clamp(2.6rem, 7vw, 4.5rem); line-height: 1; margin-bottom: 0.6em; }
.none .term { max-width: 30rem; }

/* ---- narrower windows: each a composition of its own ------------------------------------- */
@media (max-width: 68rem) {
  .hero { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .hero-say > :last-child { margin-bottom: 0; }
  .step { grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
  .step .plate { margin-top: 0; }
  .say { max-width: 44rem; }
  .cols, .cols.even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 44rem) {
  body { font-size: 1rem; }
  .ver { display: none; }
  .plate { --edge: 1.25rem; }
  .plate figcaption .by { margin-left: 0; flex-basis: 100%; }
  /* A terminal's picture keeps its size and is moved about: shrunk to a phone's width its text could not be read.
     It runs off the window's edge, which is how it says there is more of it. */
  .plate.pan { width: auto; margin-right: calc(-1 * var(--gutter)); }
  .plate.pan .pane { grid-template-columns: var(--edge) calc(var(--w) * 1px); overflow-x: auto; padding-bottom: 1px; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
  .plate.pan figcaption { margin-right: var(--gutter); }
  .held, .cols.even, .uses { grid-template-columns: 1fr; }
  .uses div { padding-bottom: 0.9rem; }
  .how { position: static; display: block; margin: -0.3rem 0 0.7rem; }
  .opts td:first-child, .opts td:nth-child(2) { white-space: normal; }
  /* (Still side by side: each asker's line goes down into the daemon.) */
  .askers { gap: 0.6rem; padding-inline: 0.6rem; }
  .asker { padding: 0.7rem 0.7rem 0; font-size: 0.9rem; }
  .wire { margin-left: 0; padding-left: 0.75rem; }
  .daemon { padding-inline: 0.75rem; }
  /* A table's row is a small block: the command, then what it does. */
  .cmds thead, .facts thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .cmds tr, .facts tr { display: block; padding: 0.6rem 0; border-bottom: 1px solid var(--rule-2); }
  .cmds td, .facts td, .facts tbody th { display: block; width: auto !important; padding: 0.1rem 0; border: 0; }
  .cmds tr.g { padding: 1.2rem 0 0.4rem; border-bottom-color: var(--rule); }
  .cmds .g th { display: block; padding: 0; border: 0; }
  .facts td code { white-space: normal; }
  .rough div { grid-template-columns: 1fr; }
  /* The header's fields, one to a row: its bytes, its name, what they say. */
  .header { grid-template-columns: 1fr; gap: 2px; }
  .f { grid-column: auto; grid-template-columns: 8.5rem 5rem 1fr; align-items: center; gap: 0 0.9rem; }
  .f code { text-align: left; padding: 0.45rem 0.6rem; border-bottom: 0; border-left: 2px solid var(--ink); }
  .seq li { max-width: 94%; }
  .foot-in { flex-direction: column; gap: 1.2rem; }
}

@media print {
  .top, .theme { display: none; }
  .band, .foot { background: none; }
  .prog, .plate img { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
