/* elibrody.com. One stylesheet for the homepage and the writing pages.
   Graphite ground, warm paper ink, and three status colours that mean what
   they mean on a console: green serving, amber held, red down. */

:root {
  --bg: #0c0e11;
  --bg-2: #12151a;
  --ink: #e9e4d8;
  --dim: #9aa0a8;
  --rule: #262b33;
  --ok: #8dff7a;
  --warn: #ffb23e;
  --bad: #ff5a3c;
  --deploy: #7ab8ff;
  --sys-line: #d9d4c7;
  --sys-dim: #6d7178;
  --sys-ok: var(--ok);
  --sys-warn: var(--warn);
  --sys-bad: var(--bad);
  --sys-bg: var(--bg);
  --sys-deploy: var(--deploy);
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  /* One left edge for everything, bar to footer, at any width. */
  --gut: max(clamp(20px, 5vw, 72px), calc((100vw - 1296px) / 2));
  --measure: 34rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.still { scroll-behavior: auto; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-color: color-mix(in srgb, var(--ink) 40%, transparent); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: var(--ok); }
:focus-visible { outline: 2px solid var(--ok); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--ok); color: var(--bg); }

.sr-only, .trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 30; padding: 10px 14px; background: var(--ink); color: var(--bg); font: 500 14px var(--mono); text-decoration: none; }
.skip:focus { top: 12px; }

/* Top bar */
.bar { position: fixed; inset: 0 0 auto 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 10px var(--gut); font: 500 13px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; background: var(--bg); }
.home .bar::after { content: ""; position: absolute; inset: 100% 0 auto 0; height: 28px; background: linear-gradient(var(--bg), transparent); pointer-events: none; }
.bar a { text-decoration: none; padding: 12px 0; }
.bar nav { display: flex; gap: clamp(16px, 3vw, 32px); }
.bar nav a { color: var(--dim); }
.bar nav a:hover, .bar-name:hover { color: var(--ok); }
html:not(.js) .bar { position: static; background: none; }

/* The system: a sticky diagram with the text scrolling over it */
.system { position: relative; }
.stage { display: none; }
.js .stage { display: block; position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.stage canvas { display: block; width: 100%; height: 100%; cursor: crosshair; touch-action: pan-y; }
.overlay { display: none; }
.js .overlay { display: block; position: sticky; top: 0; height: 100vh; height: 100svh; margin-top: -100vh; margin-top: -100svh; z-index: 3; pointer-events: none; }
.js .steps { z-index: 2; }
.readout { position: absolute; right: var(--gut); bottom: 22px; display: flex; gap: 18px; font: 400 12px/1 var(--mono); letter-spacing: 0.04em; color: var(--dim); text-transform: uppercase; pointer-events: none; }
.readout b { font-weight: 500; color: var(--ok); font-variant-numeric: tabular-nums; }
.readout .r-drop b { color: var(--bad); }
.readout #r-stage { color: var(--ink); }
.readout #r-stage::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

.steps { position: relative; padding: 0 var(--gut); }
.js .steps { margin-top: -100vh; margin-top: -100svh; pointer-events: none; }
.step { max-width: var(--measure); padding: 56px 0; }
.js .step { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; justify-content: center; padding: 96px 0; }
.js .step > * { pointer-events: auto; }
.step + .step { border-top: 1px solid var(--rule); }
.js .step + .step { border-top: 0; }

.eyebrow { font: 500 12.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-bottom: 22px; }
.eyebrow span { color: var(--ok); margin-right: 10px; }
h1 { font: 600 clamp(2.4rem, 5.4vw, 4.6rem)/1.02 var(--serif); letter-spacing: -0.025em; text-wrap: balance; }
.step h2 { font: 600 clamp(1.8rem, 3.4vw, 2.9rem)/1.08 var(--serif); letter-spacing: -0.02em; text-wrap: balance; }
.lede, .step h2 + p { margin-top: 24px; font-size: clamp(1.02rem, 1.25vw, 1.2rem); color: color-mix(in srgb, var(--ink) 82%, var(--bg)); max-width: 30rem; text-wrap: pretty; }
.try { display: none; }
.js .try { display: block; margin-top: 28px; padding-left: 14px; border-left: 2px solid var(--ok); font: 400 13.5px/1.55 var(--mono); color: var(--dim); max-width: 26rem; }
.can-click { color: var(--ok); }
button.can-click { display: inline; padding: 0; background: none; border: 0; border-radius: 0; text-decoration: underline dashed; text-underline-offset: 5px; font: inherit; letter-spacing: 0; text-transform: none; cursor: pointer; }
button.can-click:hover { background: none; text-decoration-style: solid; }
button.can-click { position: relative; }
button.can-click::after { content: ""; position: absolute; inset: -12px -8px; }

/* Bands below the system */
.band, .foot { position: relative; background: var(--bg); border-top: 1px solid var(--rule); padding: clamp(64px, 10vw, 128px) var(--gut); }
.band-quiet { background: var(--bg-2); }
.wrap { margin: 0; }
.two { display: grid; gap: 28px clamp(32px, 6vw, 96px); }
@media (min-width: 860px) { .two { grid-template-columns: minmax(180px, 1fr) minmax(0, 2.6fr); } #contact .two, .foot .two { grid-template-columns: 1fr 1fr; } }
.label { font: 500 12.5px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.label::before { content: "// "; color: var(--ok); }
.wrap > .label { margin-bottom: 40px; }

.prose-lg p { font: 400 clamp(1.15rem, 1.7vw, 1.5rem)/1.5 var(--serif); max-width: 44rem; text-wrap: pretty; }
.prose-lg p + p { margin-top: 1.1em; font: 400 1.05rem/1.65 var(--sans); color: color-mix(in srgb, var(--ink) 80%, var(--bg)); max-width: 38rem; }
.statement { font: 400 clamp(1.15rem, 1.7vw, 1.5rem)/1.5 var(--serif); max-width: 44rem; text-wrap: pretty; }

.work li { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 0 16px; padding: 28px 0; border-top: 1px solid var(--rule); }
.work li:last-child { border-bottom: 1px solid var(--rule); }
.work .n { font: 500 13px/2.1 var(--mono); color: var(--ok); }
.work div { display: grid; gap: 8px 48px; }
@media (min-width: 860px) { .work div { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
.work h3 { font: 600 clamp(1.2rem, 1.9vw, 1.55rem)/1.2 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.work p { color: var(--dim); font-size: 1rem; }

.stack { display: grid; gap: 36px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack h3 { font: 500 13px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding-bottom: 14px; border-bottom: 1px solid var(--rule); margin-bottom: 8px; }
.stack li { padding: 9px 0; border-bottom: 1px dashed var(--rule); color: color-mix(in srgb, var(--ink) 85%, var(--bg)); }

.principles { margin-top: 36px; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 32px; font: 400 14px/1.4 var(--mono); }
.principles li { padding: 12px 0; border-top: 1px solid var(--rule); color: var(--dim); }
.principles li::before { content: "✓ "; color: var(--ok); }

.posts { display: grid; gap: 0; }
.posts a { display: grid; gap: 6px 48px; padding: 26px 0; border-top: 1px solid var(--rule); text-decoration: none; }
@media (min-width: 860px) { .posts a { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); } }
.posts h3 { font: 600 clamp(1.2rem, 1.9vw, 1.55rem)/1.2 var(--serif); }
.posts p { color: var(--dim); font-size: 1rem; }
.posts a:hover h3 { color: var(--ok); }
.more { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--rule); font: 500 13px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.more a { text-decoration: none; color: var(--ok); }

.links { margin-top: 28px; display: flex; flex-wrap: wrap; gap: 8px 24px; font: 500 13px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; }
.links a { color: var(--dim); display: inline-block; padding: 8px 0; }
.links a:hover { color: var(--ok); }

/* Forms */
.field { margin-bottom: 18px; }
label { display: block; font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
input, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=search], textarea { width: 100%; padding: 13px 14px; background: var(--bg-2); border: 1px solid var(--rule); border-radius: 2px; }
input::placeholder, textarea::placeholder { color: #6a7078; }
input:focus-visible, textarea:focus-visible { outline: 0; border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok); }
textarea { resize: vertical; min-height: 8rem; }
button { cursor: pointer; padding: 13px 22px; background: var(--ink); color: var(--bg); border: 0; border-radius: 2px; font: 500 13px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; }
button:hover { background: var(--ok); }
button[disabled] { opacity: 0.55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 6px; }
[role=status] { font: 400 13.5px/1.4 var(--mono); min-height: 1.4em; }
[role=status].ok { color: var(--ok); }
[role=status].bad { color: var(--bad); }
[role=status].wait { color: var(--warn); }
.check:not(:empty) { margin: 6px 0 14px; }
.foot p { color: var(--dim); }
.foot .row { display: flex; gap: 8px; margin: 16px 0 10px; max-width: 30rem; }
.foot .row input { flex: 1; min-width: 0; }
.legal a { color: inherit; }
.legal { align-self: end; justify-self: end; font: 400 12.5px var(--mono); letter-spacing: 0.04em; }

/* Phones: the diagram takes the upper part of the screen, the words the lower. */
@media (max-width: 760px) {
  body { font-size: 16px; }
  /* The first step starts under the diagram; the rest follow on, and each line fades as it reaches the diagram's edge (site.js). */
  .js .step { justify-content: flex-start; min-height: 0; padding: 14svh 0 0; }
  .js .step-hero { padding-top: 0; }
  .js .step-hero > :first-child { margin-top: 42svh; }
  .js .step:last-child { padding-bottom: 22svh; }
  .js .step { position: relative; z-index: 1; }
  .js .steps::before { content: ""; position: sticky; display: block; top: 0; height: 100svh; margin-bottom: -100svh; background: linear-gradient(transparent calc(var(--edge, 36%) - 7%), var(--bg) calc(var(--edge, 36%) + 5%)); transition: none; pointer-events: none; }
  .home .bar::after { display: none; }
  /* On a phone the counters sit under the bar, on a ground that hides the words scrolling up behind them. */
  .readout { left: 0; right: 0; top: 0; bottom: auto; margin: 0; padding: 62px var(--gut) 26px; gap: 12px; font-size: 11px; background: linear-gradient(var(--bg) 84%, transparent); }
  .legal { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
@media print { .stage, .bar, .try, form { display: none !important; } .js .steps { margin-top: 0; } .js .step { min-height: 0; padding: 24px 0; } body { background: #fff; color: #000; } }

/* ── Writing: the index and the articles ─────────────────────────────────
   The Worker makes these pages (src/components/pages.ts) with almost no class
   names, so the rules below go by structure and ids. */
.page .bar { position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 30; padding: 10px 14px; background: var(--ink); color: var(--bg); font: 500 14px var(--mono); text-decoration: none; }
.skip-link:focus { top: 12px; }
.page main { padding: clamp(48px, 8vw, 104px) var(--gut) clamp(64px, 9vw, 120px); }
.page main > header h1 { font: 600 clamp(2.2rem, 5vw, 4rem)/1.04 var(--serif); letter-spacing: -0.025em; text-wrap: balance; max-width: 18ch; }

/* index */
.blog-index main > header { display: grid; gap: 18px; margin-bottom: 48px; }
.blog-index main > header > p:first-of-type { color: var(--dim); max-width: 34rem; font-size: 1.1rem; }
.blog-index main > header > div { max-width: 30rem; margin-top: 10px; }
#search-count { font: 400 13px var(--mono); color: var(--dim); }
#articles-list { counter-reset: post; border-bottom: 1px solid var(--rule); }
.article-card { border-top: 1px solid var(--rule); }
.article-card.hidden-search { display: none; }
.article-card > a { display: grid; grid-template-columns: 1fr; gap: 6px 48px; padding: 26px 0; text-decoration: none; }
.article-card img { display: none; }
.article-card a > div { display: grid; gap: 8px 48px; }
.article-card a > div > div:first-child { display: flex; gap: 14px; font: 400 12.5px/1.6 var(--mono); letter-spacing: 0.04em; color: var(--dim); }
.article-card h2 { font: 600 clamp(1.25rem, 2vw, 1.65rem)/1.2 var(--serif); letter-spacing: -0.01em; text-wrap: balance; }
.article-card p { color: var(--dim); font-size: 1rem; max-width: 40rem; }
.article-card a > div > div:last-child { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 400 12px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--sys-dim); }
.article-card a:hover h2 { color: var(--ok); }
@media (min-width: 900px) {
  .article-card a > div { grid-template-columns: 9.5rem minmax(0, 1fr) minmax(0, 1.25fr); align-items: baseline; }
  .article-card a > div > div:first-child { flex-direction: column; gap: 0; }
  .article-card a > div > div:last-child { grid-column: 3; }
}

/* article */
.post main { max-width: calc(46rem + 2 * var(--gut)); margin: 0 auto; }
.post main > header { display: grid; gap: 18px; margin-bottom: 36px; }
.post main > header > a, .post main > footer a { font: 500 12.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; color: var(--dim); }
.post main > header > a:hover, .post main > footer a:hover { color: var(--ok); }
.post main > header h1 { max-width: none; font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
.post main > header > div { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 400 12.5px var(--mono); letter-spacing: 0.04em; color: var(--dim); }
#tag-row { text-transform: uppercase; color: var(--sys-dim); }
/* The picture is a line drawing on black; drained of colour and screened onto the page it reads as part of it. */
.post main > div.no-picture { display: none; }
.post main > div:has(> img) { margin: 0 0 28px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.post main > div > img { display: block; width: 100%; height: auto; aspect-ratio: 21 / 9; object-fit: cover; filter: grayscale(1) contrast(1.15) brightness(1.1); mix-blend-mode: screen; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 40px; }
.tools button { background: none; color: var(--ink); border: 1px solid var(--rule); padding: 10px 14px; }
.tools button:hover { background: none; border-color: var(--ok); color: var(--ok); }
.tools [role=status] { min-height: 0; color: var(--dim); }
.tools audio { flex-basis: 100%; width: 100%; height: 40px; color-scheme: dark; }
.summary { flex-basis: 100%; padding: 20px 22px; border-left: 2px solid var(--ok); background: var(--bg-2); }
.summary .label { margin-bottom: 10px; }
.summary p + p { margin-top: 0.8em; }

.prose { font: 400 1.1rem/1.75 var(--serif); color: color-mix(in srgb, var(--ink) 92%, var(--bg)); }
.prose > * + * { margin-top: 1.25em; }
.prose > p:first-of-type { font-size: clamp(1.14rem, 2vw, 1.28rem); line-height: 1.6; color: var(--ink); }
.prose h2 { font: 600 1.75rem/1.2 var(--serif); letter-spacing: -0.015em; margin-top: 2.4em; text-wrap: balance; color: var(--ink); }
.prose h3 { font: 600 1.25rem/1.3 var(--serif); margin-top: 2em; color: var(--ink); }
.prose h2 + *, .prose h3 + * { margin-top: 0.8em; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose ul { list-style: none; }
.prose ul > li { position: relative; }
.prose ul > li::before { content: ""; position: absolute; left: -1.15em; top: 0.72em; width: 6px; height: 6px; background: var(--ok); }
.prose ol { list-style: decimal; }
.prose ol > li::marker { font: 500 0.85em var(--mono); color: var(--ok); }
.prose li + li { margin-top: 0.5em; }
.prose strong { font-weight: 600; color: var(--ink); }
.prose a { text-decoration-color: var(--ok); }
.prose blockquote { margin-left: 0; margin-right: 0; padding: 4px 0 4px 22px; border-left: 2px solid var(--ok); font-style: italic; font-size: 1.2rem; color: var(--ink); }
.prose code { font: 400 0.86em var(--mono); background: var(--bg-2); border: 1px solid var(--rule); padding: 0.1em 0.35em; border-radius: 2px; }
.prose pre { overflow-x: auto; padding: 18px 20px; background: var(--bg-2); border: 1px solid var(--rule); font: 400 0.9rem/1.6 var(--mono); }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4em 0; }
.prose table { width: 100%; border-collapse: collapse; font: 400 0.95rem/1.5 var(--sans); display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--rule); }
.prose th { font: 500 12px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.prose img { max-width: 100%; height: auto; }

.post main > section { margin-top: 72px; padding-top: 32px; border-top: 1px solid var(--rule); }
.post main > section > h2 { font: 500 12.5px/1.4 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 20px; }
.post main > section > h2::before { content: "// "; color: var(--ok); }
.post main > footer { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--rule); }
.post main > footer > div { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.progress { position: fixed; left: 0; top: 0; z-index: 25; height: 2px; width: 100%; background: var(--ok); transform-origin: 0 50%; transform: scaleX(0); }

/* 404 */
.lost main { min-height: 72vh; display: grid; align-content: center; gap: 20px; }
.lost .code { font: 500 13px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--bad); }
.lost .code::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.lost p { color: var(--dim); max-width: 32rem; }
.lost .links { margin-top: 8px; }

@media print { .tools, .progress, .foot, .post main > section { display: none !important; } .prose { color: #000; } }
.still .readout span:not(#r-stage) { display: none; }

/* Without the diagram (no scripts, or /?plain) the stages are set as a page of their own, not a column beside nothing. */
@media (min-width: 900px) {
  html:not(.js) .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(32px, 4vw, 64px); padding-bottom: 72px; }
  html:not(.js) .step { max-width: none; border-top: 1px solid var(--rule); }
  html:not(.js) .step-hero { grid-column: 1 / -1; max-width: 60rem; border-top: 0; padding: 72px 0 88px; }
  html:not(.js) .step h2 { font-size: 1.6rem; }
}
@media (max-width: 760px) {
  .legal a, .links a { display: inline-block; padding: 12px 0; }
}

/* Excerpts of the diagram elsewhere on the site. Shown only once a script has drawn them. */
canvas[data-system] { display: none; }
canvas[data-system].on { display: block; width: 100%; }
.work li:has(canvas.on) { grid-template-columns: 3rem minmax(0, 1fr); }
.work canvas.on { grid-column: 2; height: 150px; margin-top: 18px; border: 1px solid var(--rule); cursor: default; }
@media (min-width: 1100px) {
  .work li:has(canvas.on) { grid-template-columns: 3rem minmax(0, 1fr) 340px; column-gap: 40px; align-items: start; }
  .work li:has(canvas.on) > div { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.2fr); }
  .work canvas.on { grid-column: 3; margin-top: 0; height: 164px; }
}
.lost main > div { display: grid; gap: 20px; align-content: center; }
.lost canvas.on { height: 220px; max-width: 520px; cursor: default; }
@media (min-width: 900px) { .lost main { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: center; gap: 48px; } }
/* Under the words on the homepage the diagram is masked, so a close-up can run off that side cleanly. */
/* Three layers over the canvas. Beside the words the diagram is masked exactly as far as they reach;
   on the two full-width stages that mask lifts and a ground rises under the caption instead. */
.mask { display: none; }
@media (min-width: 761px) {
  .js .mask { display: block; position: absolute; inset: 0; pointer-events: none; transition: opacity 0.6s ease; }
  .mask-side { background: linear-gradient(to right, var(--bg) calc(var(--gut) + min(34rem, 44vw) + 16px), transparent calc(var(--gut) + min(34rem, 44vw) + 5vw + 16px)); }
  .mask-wide { opacity: 0; background: linear-gradient(to top, var(--bg) 30%, transparent 46%); }
  .mask-edges { background:
    linear-gradient(to bottom, var(--bg) 64px, transparent clamp(104px, 17vh, 180px)),
    linear-gradient(to left, var(--bg) 0, transparent 130px),
    linear-gradient(to top, var(--bg) 0, transparent 110px); }
  .system[data-layout="wide"] .mask-side { opacity: 0; }
  .system[data-layout="wide"] .mask-wide { opacity: 1; }
}
.still .mask { transition: none; }

/* ── One column grid for everything below the diagram ────────────────────
   Twelve columns from the shared left edge. Section labels and titles take
   the first four, text starts on the fifth, pictures on the ninth, so every
   section lines up with the one above it. */
.plain-opt { display: none; }
.js .plain-opt, .plain-opt.on { display: inline; }
.two > div > .label { margin-bottom: 28px; }
.more a { display: inline-block; padding: 12px 0; }
.bar nav a { padding: 14px 4px; }
form button[type=submit] { padding: 16px 24px; }
.stack canvas.on { height: 120px; margin-bottom: 20px; border: 1px solid var(--rule); cursor: default; }
@media (min-width: 1000px) {
  .two, .work li, .work li:has(canvas.on), .posts a, .stack, #contact .two, .foot .two { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(20px, 2.4vw, 40px); }
  .two > :first-child { grid-column: 1 / span 4; }
  .two > :last-child { grid-column: 5 / -1; }
  .work li { position: relative; align-items: start; }
  .work .n { position: absolute; left: 0; top: 28px; }
  .work li > div, .work li:has(canvas.on) > div { grid-column: 1 / span 8; display: grid; grid-template-columns: subgrid; }
  .work h3 { grid-column: 1 / span 4; padding-left: 3rem; }
  .work p { grid-column: 5 / span 4; }
  .work canvas.on { grid-column: 9 / -1; margin-top: 0; height: 150px; }
  .posts h3 { grid-column: 1 / span 4; }
  .posts p { grid-column: 5 / -1; max-width: 44rem; }
  .stack > div { grid-column: span 4; }
  #contact form { max-width: 40rem; }
  .foot form { grid-column: 1 / span 6; }
  .foot .legal { grid-column: 9 / -1; align-self: start; justify-self: start; padding-top: 2px; }
}
.bar-name { white-space: nowrap; }
@media (max-width: 380px) { .bar nav { gap: 10px; } .bar { font-size: 12px; letter-spacing: 0.02em; } }

/* The words do not sit in the same place for seven screens: they ride high for the close-ups of the
   pipeline and the instruments, low for the gate and the two sites, and centre for the first and last. */
@media (min-width: 761px) and (min-height: 620px) {
  .js .step:nth-of-type(3), .js .step:nth-of-type(5) { justify-content: flex-start; padding-top: 22vh; }
  .js .step:nth-of-type(4), .js .step:nth-of-type(6) { justify-content: flex-end; padding-bottom: 20vh; }
}
/* The whole system once more, small, where the approach is stated. */
canvas.whole.on { height: 250px; max-width: none; border: 0; cursor: default; }

/* Between a phone and a laptop (a folding phone opened sideways, a small tablet) the words take
   less of the width, so the diagram keeps room beside them. site.js measures the same way. */
@media (min-width: 761px) { .js .step { max-width: min(var(--measure), 44vw); } }
/* A tall narrow screen (a folding phone opened upright): one step in the reading area at a time,
   and the whole system rather than a close-up, since there is room for it. */
@media (max-width: 760px) and (min-height: 760px) { .js .step:not(.step-hero) { min-height: 42svh; } }

/* The phone veil is sticky with no height of its own, so it would follow the reader one screen past
   the diagram and paint over the next section. Nothing of the system may show outside the system. */
.system { overflow: clip; }
@media (max-width: 760px) {
  .js .step:last-child { padding-bottom: 14svh; }
  .work canvas.on { grid-column: 1 / -1; }
}
/* Small diagrams fade at their edges, so a neighbour half in frame reads as depth, not as a cut. */
.work canvas.on, .stack canvas.on { -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent), linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent); mask-composite: intersect; border: 0; }
.stack canvas.on { height: 140px; }
@media (min-width: 1000px) { .work li > div, .work li:has(canvas.on) > div { column-gap: clamp(20px, 2.4vw, 40px); } }
/* The system's own status line, carried to the foot of the page. */
.status { font: 400 12.5px var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--dim); margin-bottom: 10px; }
.status:empty { display: none; }
.status b { font-weight: 500; color: var(--ok); font-variant-numeric: tabular-nums; }
.status b.bad { color: var(--bad); }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }

/* Two stages are set differently: the diagram takes the full width and the words become a caption
   along the foot of the screen, on the same twelve columns as the sections below. */
@media (min-width: 1000px) and (min-height: 620px) {
  .js .step.wide { max-width: none; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(20px, 2.4vw, 40px); align-content: end; row-gap: 0; padding: 0 0 8vh; }
  .js .step.wide > .eyebrow { grid-column: 1 / -1; margin-bottom: 16px; }
  .js .step.wide > h2 { grid-column: 1 / span 4; font-size: clamp(1.7rem, 2.6vw, 2.4rem); }
  .js .step.wide > h2 + p { grid-column: 5 / span 4; margin-top: 6px; max-width: none; }
  .js .step.wide > .try { grid-column: 9 / -1; margin-top: 6px; max-width: none; align-self: start; }
}

/* Writing and Contact carry the system too: the pipeline that publishes, and a request coming in. */
.head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 40px; }
.head canvas.on { width: 300px; height: 84px; flex: none; }
#contact canvas.on { height: 96px; max-width: 340px; margin-top: 24px; }
.head canvas.on, #contact canvas.on { cursor: default; -webkit-mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent); }
@media (max-width: 600px) { .head canvas.on { width: 180px; height: 64px; } }
/* An article opens with the part of the system it is about. */
canvas.opener.on { display: block; width: 100%; height: auto; aspect-ratio: 21 / 9; cursor: default; }

/* Excerpts now draw only their own boxes, so they need no fade at the sides. */
.work canvas.on, .stack canvas.on, .head canvas.on, #contact canvas.on { -webkit-mask-image: none; mask-image: none; }
@media (min-width: 601px) { .head canvas.on { width: 340px; height: 110px; } }
@media (min-width: 1000px) {
  .blog-index main > header { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(20px, 2.4vw, 40px); align-items: end; }
  .blog-index main > header > * { grid-column: 1 / span 6; }
  .blog-index main > header > canvas.lead { grid-column: 8 / -1; grid-row: 1 / span 4; align-self: center; }
}
@media (max-width: 999px) { canvas.lead.on { display: none; } }
.stack canvas.on { height: 176px; }

/* About opens where every system starts, one box; Approach, further down, shows where it ends. */
canvas.whole.first.on { height: 150px; max-width: 320px; cursor: pointer; }
/* Section headings of a long article, beside it on screens with the margin to spare. */
.contents { display: none; }
@media (min-width: 1280px) {
  .contents { display: block; position: sticky; top: 110px; height: 0; margin-left: calc(-1 * min(17rem, (100vw - 46rem) / 2 - 2rem)); width: 13rem; font: 400 12.5px/1.45 var(--mono); }
  .contents ol { display: grid; gap: 12px; padding-left: 14px; border-left: 1px solid var(--rule); }
  .contents a { color: var(--sys-dim); text-decoration: none; }
  .contents a:hover { color: var(--ink); }
  .contents a.here { color: var(--ok); }
}

/* The light in the readout goes red while nothing can be served. */
.readout.down #r-stage::before { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

/* Phones. A close-up runs past the edges of the screen and up under the counters; it fades there
   instead of being cut. The last stage is held until its words have come up beside it. */
@media (max-width: 760px) {
  .js .stage canvas { -webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent 66px, #000 98px); -webkit-mask-composite: source-in; mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent 66px, #000 98px); mask-composite: intersect; }
  .js .step:not(.step-hero):last-child { min-height: 58svh; padding-bottom: 8svh; }
}
/* Between a phone and a laptop the words give up some width to the diagram (site.js measures the same). */
@media (min-width: 761px) and (max-width: 999px) { .js .step { max-width: min(var(--measure), 38vw); } }

/* The contents list leaves with the article. */
.contents { transition: opacity 0.2s ease; }
.contents.done { opacity: 0; pointer-events: none; visibility: hidden; }

/* Contact and Approach: large enough to read as the system, not as a mark. */
#contact canvas.on { height: 132px; max-width: 420px; }
canvas.whole.on:not(.first) { height: clamp(300px, 34vw, 430px); }
@media (min-width: 761px) and (max-width: 999px) { .mask-side { background: linear-gradient(to right, var(--bg) calc(var(--gut) + min(34rem, 38vw) + 4px), transparent calc(var(--gut) + min(34rem, 38vw) + 5vw + 4px)); } }
