/* nwrk: a terminal, drawn carefully. One monospace family, a character grid,
   dithered plates, and a few macOS touches: window chrome, segmented
   controls, a switch and a translucent menu bar. */

@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-display: swap; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 800; font-display: swap; src: url("../fonts/jetbrains-mono-latin-800-normal.woff2") format("woff2"); }

:root {
  --bg: #0b1220;
  --panel: #101a2e;
  --chrome: #1a2640;
  --term: #0c1424;
  --ink: #e8ebe0;
  --dim: #8793a8;
  --line: #28344f;
  --signal: #5b8cff;
  --signal-ink: #07101f;
  --ok: #5be3a0;
  --fail: #ff6b7a;
  --warn: #f2c14e;
  --win-shadow: 0 40px 80px -30px rgba(2, 6, 14, 0.8), 0 12px 24px -12px rgba(2, 6, 14, 0.6);
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text: var(--mono);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eceee6;
  --panel: #f6f8f1;
  --chrome: #dfe3d6;
  --term: #fafbf6;
  --ink: #0b1220;
  --dim: #55627a;
  --line: #c3cab9;
  --signal: #2f5be0;
  --signal-ink: #ffffff;
  --ok: #12805a;
  --fail: #c23548;
  --warn: #946a00;
  --win-shadow: 0 40px 80px -34px rgba(20, 30, 50, 0.35), 0 12px 24px -14px rgba(20, 30, 50, 0.3);
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #eceee6; --panel: #f6f8f1; --chrome: #dfe3d6; --term: #fafbf6; --ink: #0b1220; --dim: #55627a;
    --line: #c3cab9; --signal: #2f5be0; --signal-ink: #ffffff; --ok: #12805a; --fail: #c23548; --warn: #946a00;
    --win-shadow: 0 40px 80px -34px rgba(20, 30, 50, 0.35), 0 12px 24px -14px rgba(20, 30, 50, 0.3);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.75 var(--text); -webkit-font-smoothing: antialiased; font-feature-settings: "calt" 0; }
a { color: var(--signal); text-decoration: underline dotted; text-underline-offset: 0.28em; text-decoration-thickness: 1px; }
a:hover { text-decoration-style: solid; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--signal); color: var(--signal-ink); }
canvas { image-rendering: pixelated; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--signal); color: var(--signal-ink); padding: 0.5rem 1rem; z-index: 20; }
.skip:focus { inset-inline-start: 0; }
.wrap { width: min(100% - 3rem, 84rem); margin-inline: auto; }

/* ---- menu bar ---- */
.site-header { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 74%, transparent); backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4); border-block-end: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 2rem; min-height: 3.5rem; padding-block: 0.4rem; }
.brand { direction: ltr; unicode-bidi: isolate; font: 800 1.25rem/1 var(--mono); letter-spacing: -0.04em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; }
.site-header nav { display: flex; gap: 0.25rem; margin-inline-end: auto; }
.site-header nav a { color: var(--ink); text-decoration: none; padding: 0.2rem 0.7rem; border-radius: 6px; }
.site-header nav a:hover { background: var(--signal); color: var(--signal-ink); }
.tools { display: flex; gap: 1.25rem; align-items: center; color: var(--dim); }
.tools [aria-current] { color: var(--ink); }
.tools a { color: var(--dim); text-decoration: none; }
.tools a:hover { color: var(--signal); }
.switch { display: inline-flex; align-items: center; gap: 0.6rem; font: inherit; color: var(--dim); background: none; border: 0; padding: 0; cursor: pointer; }
.switch .track { width: 2.4rem; height: 1.4rem; border-radius: 999px; background: color-mix(in srgb, var(--dim) 35%, transparent); position: relative; transition: background 0.2s; }
.switch .track::after { content: ""; position: absolute; top: 0.15rem; inset-inline-start: 0.15rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: transform 0.2s; }
.switch[aria-checked="true"] .track { background: var(--signal); }
.switch[aria-checked="true"] .track::after { transform: translateX(1rem); }
.switch:hover { color: var(--ink); }
@keyframes blink { 50% { opacity: 0; } }

/* ---- macOS window ---- */
.mac { background: var(--term); border-radius: 14px; box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.06), var(--win-shadow); overflow: hidden; }
.mac-bar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 2.9rem; padding: 0 1rem; background: var(--chrome); border-block-end: 1px solid color-mix(in srgb, var(--line) 80%, transparent); font-size: 0.78rem; color: var(--dim); }
.dots { position: absolute; inset-inline-start: 1rem; display: flex; gap: 0.5rem; }
.dots i { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: #ff5f57; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18); }
.dots i:nth-child(2) { background: #febc2e; }
.dots i:nth-child(3) { background: #28c840; }
.mac-title { direction: ltr; unicode-bidi: isolate; }
.caption { margin: 2.1rem 0 0; font-size: 0.78rem; color: var(--dim); text-align: center; }
.mac-body { padding: 1.25rem 1.5rem 1.5rem; }

/* ---- segmented control ---- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: color-mix(in srgb, var(--dim) 22%, transparent); max-width: 100%; overflow-x: auto; }
.seg button { font: 500 0.78rem/1 var(--text); color: var(--dim); background: none; border: 0; border-radius: 8px; padding: 0.5rem 1rem; cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 0 0 0.5px rgba(255, 255, 255, 0.06); }
:root[data-theme="light"] .seg button[aria-selected="true"] { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }

/* ---- home: hero: one centered column, 52rem wide ---- */
.hero { --col: 52rem; padding-block: clamp(2.75rem, 6vw, 5.5rem) clamp(3.5rem, 7vw, 6rem); text-align: center; }
.hero h1 { font: 800 clamp(2.5rem, 5.6vw, 4.6rem)/1.04 var(--mono); letter-spacing: -0.058em; margin: 0 auto 1.5rem; max-width: 19ch; text-wrap: balance; }
.intro { display: block; }
.lead { max-width: 64ch; margin: 0 auto; color: var(--dim); font-size: 1.06rem; line-height: 1.8; text-wrap: pretty; }
.getit { max-width: var(--col); margin: clamp(2rem, 4vw, 3rem) auto 0; text-align: center; }
.install { margin: 0 0 1.25rem; display: flex; flex-direction: column; align-items: center; }
.install .field { display: flex; align-items: center; gap: 1rem; width: 100%; margin-block-start: 1rem; padding: 0.95rem 1.1rem; background: var(--term); border-radius: 12px; text-align: left; box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 36px -24px rgba(2, 6, 14, 0.7); }
.install .field[hidden] { display: none; }
.install code { flex: 1; min-width: 0; direction: ltr; unicode-bidi: isolate; white-space: pre-wrap; overflow-wrap: anywhere; background: none; padding: 0; font-size: 0.88rem; line-height: 1.5; }
.prompt { color: var(--dim); user-select: none; }
.copy { font: 500 0.75rem/1 var(--text); color: var(--ink); background: color-mix(in srgb, var(--dim) 22%, transparent); border: 0; border-radius: 6px; padding: 0.4rem 0.7rem; cursor: pointer; flex: none; }
.copy:hover { background: var(--signal); color: var(--signal-ink); }
.note { color: var(--dim); font-size: 0.82rem; max-width: 52ch; margin: 1.1rem auto 2rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; margin: 0; }
.btn { display: inline-block; padding: 0.7rem 1.35rem; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; background: transparent; box-shadow: 0 0 0 1px color-mix(in srgb, var(--dim) 45%, transparent); transition: box-shadow 0.15s, background 0.15s; }
.btn:hover { background: color-mix(in srgb, var(--dim) 14%, transparent); box-shadow: 0 0 0 1px var(--dim); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--signal); color: var(--signal-ink); font-weight: 800; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 10px 24px -12px var(--signal); }
.btn.primary:hover { filter: brightness(1.08); background: var(--signal); }

.stage-wrap { margin-block-start: clamp(1.75rem, 3.5vw, 2.5rem); }
.stage { position: relative; isolation: isolate; max-width: var(--col, 52rem); margin-inline: auto; text-align: left; }
/* A dot grid on the character grid, fading out toward the edges. */
.stage::before { content: ""; position: absolute; inset: -4rem -7rem; z-index: -1; background-image: radial-gradient(color-mix(in srgb, var(--dim) 55%, transparent) 1px, transparent 1.2px); background-size: 24px 24px; -webkit-mask-image: radial-gradient(ellipse 60% 58% at 50% 50%, #000 35%, transparent 80%); mask-image: radial-gradient(ellipse 60% 58% at 50% 50%, #000 35%, transparent 80%); opacity: 0.7; }
/* The one light in the scene: a pool under the window, as if the screen glowed. */
.stage::after { content: ""; position: absolute; z-index: -1; inset-inline: 8% ; bottom: -2.2rem; height: 5rem; border-radius: 50%; background: var(--signal); opacity: 0.16; filter: blur(46px); }
:root[data-theme="light"] .stage::after { opacity: 0.2; }
.stage .mac { width: 100%; }
.mac-body { padding: 1.5rem 1.9rem 2rem; }
.demo-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
/* The tab band runs edge to edge, like a terminal tab bar: the active tab joins the window body. */
.demo-head { margin: -1.5rem -1.9rem 0; }
.demo-head .seg { display: flex; width: 100%; padding: 0; gap: 0; border-radius: 0; background: var(--chrome); overflow-x: auto; scrollbar-width: none; }
.demo-head .seg button { position: relative; flex: 1 1 0; display: flex; align-items: center; justify-content: center; gap: 0.5rem; min-width: max-content; border-radius: 0; padding: 0.7rem 1rem; font-size: 0.76rem; color: var(--dim); box-shadow: none; border-block-end: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-inline-end: 1px solid color-mix(in srgb, var(--line) 80%, transparent); }
.demo-head .seg button:last-child { border-inline-end: 0; }
.demo-head .seg button:hover { color: var(--ink); background: color-mix(in srgb, var(--dim) 10%, transparent); }
.demo-head .seg button[aria-selected="true"], :root[data-theme="light"] .demo-head .seg button[aria-selected="true"] { background: var(--term); color: var(--ink); box-shadow: none; border-block-end-color: var(--term); }
.demo-head .seg button[aria-selected="true"]::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: var(--signal); }
.demo-head .seg kbd { margin: 0; background: none; padding: 0; opacity: 0.7; }
.demo-head .seg kbd::before { content: "\2318"; }
.demo-head .seg button[aria-selected="true"] kbd { background: none; }
.seg kbd { margin-inline-start: 0.55rem; font: 500 0.66rem/1 var(--mono); color: var(--dim); background: color-mix(in srgb, var(--dim) 18%, transparent); border-radius: 4px; padding: 0.18rem 0.35rem; }
.seg button[aria-selected="true"] kbd { color: var(--signal); background: color-mix(in srgb, var(--signal) 16%, transparent); }
.replay { position: absolute; inset-inline-end: 1rem; font: 500 0.75rem/1 var(--text); color: var(--dim); background: none; border: 0; padding: 0.4rem 0.2rem; cursor: pointer; display: none; }
.js .replay { display: inline-block; }
.replay::before { content: "↻ "; }
.replay:hover { color: var(--signal); }
/* All runs share one cell, so the window keeps the height of the tallest. */
.screen { display: grid; margin-block-start: 1.25rem; }
.screen [role="tabpanel"] { grid-area: 1 / 1; min-width: 0; }
.screen { direction: ltr; text-align: left; }
.screen pre { margin: 0; padding: 0; background: none; box-shadow: none; font: 400 0.92rem/1.7 var(--mono); white-space: pre; overflow-x: auto; direction: ltr; text-align: left; color: var(--ink); }
.screen [role="tabpanel"][hidden] { display: block; visibility: hidden; }
.screen .ok { color: var(--ok); } .screen .fail { color: var(--fail); } .screen .warn { color: var(--warn); } .screen .dim { color: var(--dim); } .screen .sig { color: var(--signal); }
.screen .cur::after { content: ""; display: inline-block; width: 0.6em; height: 1.1em; background: var(--signal); vertical-align: -0.2em; animation: blink 1s steps(1) infinite; }
.js .screen [data-line] { display: none; }
.js .screen [data-line].on { display: inline; }

/* ---- status bar: the facts, in a tmux-style line ---- */
.statusbar { display: flex; flex-wrap: wrap; align-items: stretch; max-width: var(--col, 52rem); margin: clamp(3.5rem, 7vw, 6rem) auto 0; text-align: left; background: color-mix(in srgb, var(--dim) 14%, transparent); border-radius: 8px; overflow: hidden; font-size: 0.8rem; line-height: 1; }
.statusbar span { padding: 0.8rem 1.1rem; color: var(--dim); }
.statusbar span + span { border-inline-start: 1px solid color-mix(in srgb, var(--line) 90%, transparent); }
.statusbar .sb-name { background: var(--signal); color: var(--signal-ink); font-weight: 800; border-inline-start: 0; }
.statusbar .sb-end { margin-inline-start: auto; color: var(--ink); }

/* ---- home: sections ---- */
.block { padding-block: clamp(4.5rem, 10vw, 9rem); }
.split { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: clamp(2rem, 7vw, 7rem); align-items: start; }
.split-head { position: sticky; top: 6rem; }
.split-body { min-width: 0; }
.block h2 { margin: 0 0 1.25rem; }
h1, h2, h3, h4 { font-family: var(--mono); letter-spacing: -0.03em; }
h2 { font-weight: 800; font-size: clamp(1.6rem, 2.8vw, 2.3rem); line-height: 1.15; }
h2::before { content: "## "; color: var(--dim); font-weight: 400; }
h3::before { content: "### "; color: var(--dim); font-weight: 400; }
h4::before { content: "#### "; color: var(--dim); font-weight: 400; }
.no-mark::before { content: none; }
.split-head .sub { max-width: 34ch; margin: 0; color: var(--dim); font-size: 0.92rem; line-height: 1.75; }
.more { margin: 3rem 0 0; }

/* Trace: nw walks down the layers like a probe on a rail. Green is reached, red is where it stopped, dashed is never reached. */
.trace { margin: 0; --rail: 2.4rem; --step: 0.65s; }
.hops { margin: 0; padding: 1.9rem 1.9rem 1.6rem; list-style: none; direction: ltr; text-align: left; }
.hop { position: relative; display: grid; grid-template-columns: var(--rail) minmax(0, 1fr) auto; column-gap: 0.4rem; padding-block-end: 1.9rem; }
.hop:last-child { padding-block-end: 0; }
.hop .node { grid-column: 1; justify-self: start; width: 1.05rem; height: 1.05rem; margin-block-start: 0.2rem; border-radius: 50%; background: var(--term); box-shadow: 0 0 0 2px var(--ok); position: relative; z-index: 1; }
.hop.ok .node::after, .hop.fail .node::after { content: ""; position: absolute; inset: 0.27rem; border-radius: 50%; background: var(--ok); }
.hop.fail .node { box-shadow: 0 0 0 2px var(--fail), 0 0 0 6px color-mix(in srgb, var(--fail) 22%, transparent); }
.hop.fail .node::after { background: var(--fail); }
.hop.off .node, .hop.dest .node { box-shadow: 0 0 0 2px color-mix(in srgb, var(--dim) 60%, transparent); }
.hop.origin .node { box-shadow: 0 0 0 2px var(--ok), 0 0 0 6px color-mix(in srgb, var(--ok) 20%, transparent); background: var(--ok); }
/* The rail to the next stage. */
.hop::after { content: ""; position: absolute; inset-inline-start: calc(0.525rem - 1px); top: 1.55rem; bottom: -0.15rem; width: 2px; background: var(--ok); transform-origin: top; }
.hop:last-child::after { display: none; }
.hop.fail::after, .hop.off::after { background: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--dim) 60%, transparent) 0 5px, transparent 5px 10px); }
.hop-main { grid-column: 2; min-width: 0; }
.hop-name { display: flex; align-items: baseline; gap: 0.7rem; font: 800 1.3rem/1.2 var(--mono); letter-spacing: -0.03em; color: var(--signal); }
.hop.origin .hop-name { color: var(--ok); }
.hop.end .hop-name { color: var(--ink); font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.hop.dest .hop-name { color: var(--dim); }
.hop-name em { font: 700 0.72rem/1 var(--mono); letter-spacing: 0; padding: 0.28rem 0.5rem; border-radius: 5px; }
.hop.ok em { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.hop.fail em { color: var(--fail); background: color-mix(in srgb, var(--fail) 16%, transparent); }
.hop.off em { color: var(--dim); background: color-mix(in srgb, var(--dim) 16%, transparent); }
.hop p { margin: 0.45rem 0 0; max-width: 52ch; color: var(--dim); font-size: 0.88rem; line-height: 1.7; }
.hop.fail .hop-name { color: var(--fail); }
.hop.off .hop-name, .hop.off p { opacity: 0.6; }
.hop-out { display: inline-block; margin-block-start: 0.7rem; font: 600 0.8rem/1 var(--mono); color: var(--fail); background: color-mix(in srgb, var(--fail) 10%, transparent); box-shadow: inset 2px 0 0 var(--fail); padding: 0.5rem 0.75rem; border-radius: 0 6px 6px 0; }
.hop-t { grid-column: 3; padding-block-start: 0.3rem; font: 500 0.76rem/1 var(--mono); color: var(--dim); font-variant-numeric: tabular-nums; }
/* One reveal: when the window scrolls into view, the probe runs down the rail and stops at the failure. */
.js .trace:not(.run) .hop::after { transform: scaleY(0); }
.js .trace:not(.run) .hop:not(.origin) > * { opacity: 0.18; }
.js .trace.run .hop::after { transition: transform var(--step) linear; transition-delay: calc(var(--i) * var(--step)); }
.js .trace.run .hop > * { transition: opacity 0.4s; transition-delay: calc(var(--i) * var(--step) - 0.15s); }
.js .trace.run .hop.fail .node { animation: trip 0.5s calc(var(--i) * var(--step) - 0.15s) both; }
@keyframes trip { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.5); } }
@media (prefers-reduced-motion: reduce) { .js .trace .hop::after, .js .trace .hop > * { transition: none !important; animation: none !important; transform: none !important; opacity: 1 !important; } }
@media (max-width: 40rem) { .hops { padding: 1.25rem 1rem; } .hop { grid-template-columns: 1.9rem minmax(0, 1fr); } .hop-t { display: none; } .hop-name { font-size: 1.15rem; } }

.cmds { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.cmd { padding-block: 1.6rem; border-block-end: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.cmd:first-child { padding-block-start: 0; }
.cmd code { display: block; direction: ltr; unicode-bidi: isolate; white-space: normal; overflow-wrap: anywhere; color: var(--ink); background: none; padding: 0; font-weight: 500; font-size: 0.92rem; }
.cmd p { margin: 0.5rem 0 0; color: var(--dim); max-width: 46ch; font-size: 0.9rem; }

.checks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
.checks li { display: grid; grid-template-columns: 4ch 1fr; max-width: 48ch; }
.checks li::before { content: "[x]"; color: var(--ok); }


/* ---- footer ---- */
.site-footer { margin-block-start: 2rem; border-block-start: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.site-footer .wrap { padding-block: 4rem 4.5rem; display: flex; flex-wrap: wrap; gap: 2rem 4rem; align-items: flex-end; justify-content: space-between; }
.footer-logo { display: inline-block; text-decoration: none; }
.ascii { margin: 0; padding: 0; background: none; box-shadow: none; overflow: visible; font: 800 0.62rem/0.95 var(--mono); color: var(--signal); direction: ltr; white-space: pre; }
.site-footer p { margin: 0 0 0.25rem; color: var(--dim); }

/* ---- prose and docs ---- */
.prose, .docs-main { max-width: 74ch; }
article.wrap.prose { padding-block: 4rem 5rem; }
.prose h1, .docs-main h1 { font-weight: 800; font-size: clamp(1.9rem, 3.6vw, 2.7rem); line-height: 1.12; letter-spacing: -0.045em; margin: 0 0 2rem; text-wrap: balance; }
.prose h2, .docs-main h2 { margin-block: 3.25rem 1rem; }
.prose h3, .docs-main h3 { font-weight: 800; font-size: 1.05rem; line-height: 1.3; margin-block: 2.25rem 0.6rem; }
.prose p, .docs-main p, .docs-main li { max-width: 72ch; }
.prose ul, .docs-main ul, .prose ol, .docs-main ol { padding-inline-start: 2.2ch; }
.prose li, .docs-main li { margin-block: 0.3rem; }
code { font: 500 0.9em var(--mono); background: color-mix(in srgb, var(--signal) 14%, transparent); padding: 0.08em 0.4em; border-radius: 4px; direction: ltr; unicode-bidi: isolate; }
pre { margin: 1.5rem 0; padding: 1.1rem 1.3rem; background: var(--term); border-radius: 10px; box-shadow: 0 0 0 1px var(--line); overflow-x: auto; direction: ltr; text-align: left; font: 400 0.86rem/1.6 var(--mono); position: relative; }
pre code { background: none; padding: 0; font: inherit; }
pre .copy { position: absolute; inset-block-start: 0.6rem; inset-inline-end: 0.6rem; opacity: 0; }
pre:hover .copy, pre .copy:focus-visible { opacity: 1; }
table { border-collapse: collapse; margin: 1.5rem 0; width: 100%; font-size: 0.88rem; display: block; overflow-x: auto; }
th, td { text-align: start; vertical-align: top; padding: 0.6rem 1.1rem 0.6rem 0; border-block-end: 1px dashed var(--line); }
th { color: var(--dim); font-weight: 500; border-block-end: 1px solid var(--line); white-space: nowrap; }
blockquote { margin: 1.25rem 0; padding-inline-start: 1.5ch; border-inline-start: 3px solid var(--signal); color: var(--dim); }
hr { border: 0; height: 8px; background-image: radial-gradient(var(--line) 1px, transparent 1.4px); background-size: 4px 4px; margin: 3rem 0; }

.notice { border-radius: 10px; background: color-mix(in srgb, var(--warn) 12%, transparent); box-shadow: 0 0 0 1px color-mix(in srgb, var(--warn) 55%, transparent); color: var(--ink); padding: 0.8rem 1.1rem; margin: 0 0 2rem; font-size: 0.88rem; }
.notice::before { content: "! "; color: var(--warn); font-weight: 800; }
.notice strong { font-weight: 800; margin-inline-end: 0.5ch; }

.docs { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 5rem; padding-block: 4rem 5rem; }
.tree { position: sticky; top: 5.5rem; align-self: start; font-size: 0.88rem; }
.tree p { margin: 0 0 0.75rem; color: var(--dim); direction: ltr; text-align: start; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree li { margin: 0; line-height: 2; direction: ltr; text-align: left; }
.tree li::before { content: "├─ "; color: var(--line); white-space: pre; }
.tree li:last-child::before { content: "└─ "; }
.tree a { color: var(--ink); text-decoration: none; }
.tree a:hover { color: var(--signal); }
.tree a[aria-current] { color: var(--signal); font-weight: 800; }
.docs-main .cards { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.cards li { margin: 0; }
.cards a { display: grid; grid-template-columns: minmax(12rem, 16rem) 1fr; gap: 2rem; padding: 0.9rem 0; text-decoration: none; color: var(--ink); border-block-end: 1px dashed var(--line); }
.cards a strong { color: var(--signal); font-weight: 500; }
.cards a span { color: var(--dim); }
.cards a:hover strong { text-decoration: underline; }

@media (max-width: 80rem) { .seg kbd { display: none; } }
@media (max-width: 62rem) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split-head { position: static; }
  .docs { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
  .stage::before { inset: -1.5rem -1rem; }
  .tree { position: static; padding-block-end: 1.5rem; border-block-end: 1px dashed var(--line); }
  .tree ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); column-gap: 1rem; }
}
@media (max-width: 40rem) {
  body { font-size: 14.5px; }
  .wrap { width: min(100% - 2rem, 84rem); }
  .cards a { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .mac-body { padding: 1rem; }
  .screen pre { font-size: 0.74rem; }
  .replay { display: none !important; }
  .statusbar span { flex: 1 1 auto; padding: 0.65rem 0.8rem; }
  .statusbar .sb-end { margin-inline-start: 0; flex-basis: 100%; border-block-start: 1px solid color-mix(in srgb, var(--line) 90%, transparent); }
  .seg kbd { display: none; }
  .screen pre { font-size: 0.74rem; }
  .ascii { font-size: 0.5rem; }
}
@media (prefers-reduced-motion: reduce) {
  .screen .cur::after { animation: none; }
  .switch .track, .switch .track::after { transition: none; }
}
@media print {
  .site-header, .site-footer, .tree, .plate canvas, .strip { display: none; }
  body { background: #fff; color: #000; }
}

/* ---- hero, wide screens: text and install on one side, the terminal on the other ---- */
@media (min-width: 62rem) {
  .hero { text-align: start; padding-block: clamp(2.5rem, 5vw, 4.5rem) clamp(2.5rem, 5vw, 4rem); }
  .hero-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); grid-template-areas: "copy stage" "cta stage"; grid-template-rows: auto 1fr; column-gap: clamp(2.5rem, 5vw, 5rem); align-items: start; }
  .hero-copy:not(.hero-cta) { grid-area: copy; }
  .hero-cta { grid-area: cta; align-self: start; }
  .stage-wrap { grid-area: stage; margin: 0; align-self: center; }
  .hero h1 { font-size: clamp(2.4rem, 4.2vw, 3.6rem); margin: 0 0 1.5rem; max-width: 12ch; }
  .lead { margin: 0; max-width: 44ch; font-size: 1rem; }
  .hero .getit { margin: 2rem 0 0; max-width: none; text-align: start; }
  .hero .install { align-items: flex-start; margin-bottom: 1rem; }
  .hero .note { margin: 0 0 1.5rem; }
  .hero .actions { justify-content: flex-start; }
  .hero .stage { max-width: none; }
  .hero .mac-body { padding: 1.25rem 1.5rem 1.6rem; }
  .hero .screen pre { font-size: 0.82rem; }
  .hero .statusbar { max-width: none; margin-top: clamp(2.5rem, 5vw, 4rem); }
}
.hero .install .seg { display: flex; width: 100%; }
.hero .install .seg button { flex: 1; }

/* ---- hero polish: fewer line breaks, one shared vertical center, quieter backdrop ---- */
@media (min-width: 62rem) {
  .hero-grid { grid-template-columns: minmax(0, 6fr) minmax(0, 7fr); grid-template-rows: auto auto; align-content: center; min-height: min(34rem, calc(100svh - 12rem)); column-gap: clamp(2.5rem, 4.5vw, 4.5rem); }
  .hero h1 { font-size: clamp(2.2rem, 3.6vw, 3.2rem); max-width: 14ch; margin-bottom: 1.25rem; line-height: 1.08; }
  .lead { max-width: 42ch; font-size: 0.95rem; line-height: 1.75; }
  .hero .getit { margin-top: 1.75rem; }
  .hero .install .field { margin-top: 0.6rem; padding: 0.8rem 1rem; box-shadow: 0 0 0 1px var(--line); }
  .hero .install code { white-space: nowrap; overflow-x: auto; font-size: 0.82rem; }
  .hero .install { margin-bottom: 0.9rem; }
  .hero .note { margin-bottom: 1.25rem; font-size: 0.78rem; }
  .hero .btn { padding: 0.62rem 1.2rem; font-size: 0.88rem; }
  .hero .stage::before { display: none; }
  .hero .stage::after { opacity: 0.1; }
  .hero .stage-wrap { grid-row: 1 / span 2; }
  .hero .caption { margin-top: 1rem; }
}
@media (min-width: 62rem) {
  .hero-grid { grid-template-rows: auto 1fr; align-content: start; min-height: 0; }
  .hero .install code { font-size: clamp(0.68rem, 1.02vw, 0.82rem); overflow: hidden; text-overflow: clip; }
  .hero .stage-wrap { align-self: start; }
}
/* Center the text column against the terminal: both halves meet at the midline. */
@media (min-width: 62rem) {
  .hero-grid { grid-template-rows: 1fr 1fr; }
  .hero-copy:not(.hero-cta) { align-self: end; }
  .hero-cta { align-self: start; }
}
/* The hero fills the first screen, and its content sits in the vertical middle of it. */
@media (min-width: 62rem) {
  .hero { display: flex; align-items: center; min-height: calc(100svh - 3.6rem); padding-block: 2.5rem; box-sizing: border-box; }
  .hero > .wrap { flex: none; }
}
/* Final layout: the text column is two rows between two equal spacers, the terminal spans all four. */
@media (min-width: 62rem) {
  .hero-grid { grid-template-areas: none; grid-template-rows: 1fr auto auto 1fr; align-content: normal; }
  .hero-copy:not(.hero-cta) { grid-area: 2 / 1; align-self: auto; }
  .hero-cta { grid-area: 3 / 1; align-self: auto; }
  .hero .stage-wrap { grid-area: 1 / 2 / 5 / 3; align-self: center; }
}
/* The text column starts at the top edge of the terminal. */
@media (min-width: 62rem) {
  .hero-grid { grid-template-rows: auto auto 1fr; }
  .hero-copy:not(.hero-cta) { grid-area: 1 / 1; }
  .hero-cta { grid-area: 2 / 1; }
  .hero .stage-wrap { grid-area: 1 / 2 / 4 / 3; }
}
@media (min-width: 62rem) {
  .hero-grid { align-content: start; }
  .hero-copy:not(.hero-cta), .hero-cta { align-self: start; }
  .hero .stage-wrap { align-self: start; }
}
/* Text column starts at the top of the hero; the terminal stays centered in it. */
@media (min-width: 62rem) {
  .hero { align-items: stretch; }
  .hero > .wrap { flex: 1; }
  .hero-grid { min-height: calc(100svh - 3.6rem - 5rem); padding-top: clamp(0rem, 4vh, 3rem); box-sizing: border-box; }
  .hero .stage-wrap { align-self: center; }
}
.hero > .wrap { flex: 0 1 auto; align-self: stretch; }
/* Final: text column and terminal share one top edge; the pair is centered in the hero. */
@media (min-width: 62rem) {
  .hero { align-items: center; }
  .hero > .wrap { align-self: center; }
  .hero-grid { min-height: 0; padding-top: 0; }
  .hero .stage-wrap { align-self: start; }
}

/* Keep the hero heading on one line: size it from the width of its column. */
.hero-copy:not(.hero-cta) { container-type: inline-size; }
.hero h1 { white-space: nowrap; max-width: none; font-size: min(clamp(2.4rem, 4.2vw, 3.6rem), 8.3cqw); }

/* More room around the landing text. */
.hero h1 { margin-block-end: 2rem; }
.lead { line-height: 1.95; }
.hero .getit { margin-block-start: 2.75rem; }

/* Every home section uses the hero's 6fr / 7fr split, so the page reads as one even grid. */
@media (min-width: 62rem) {
  .split { grid-template-columns: minmax(0, 6fr) minmax(0, 7fr); column-gap: clamp(2.5rem, 4.5vw, 4.5rem); }
}

/* Signal: a packet runs down the rail, turns red at tls and the rail above tls pulses. Driven by site.js. */
.hops { position: relative; }
.hops > .signal { position: absolute; inset: 0; margin: 0; padding: 0; display: block; pointer-events: none; z-index: 2; }
.signal .probe { position: absolute; left: 0; top: 0; width: 0.7rem; height: 0.7rem; margin: -0.35rem 0 0 -0.35rem; border-radius: 50%; color: var(--ok); background: currentColor; box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 24%, transparent), 0 0 16px 3px currentColor; opacity: 0; }
.signal .probe::before { content: ""; position: absolute; left: calc(50% - 1px); bottom: 50%; width: 2px; height: 2.6rem; background: linear-gradient(to top, currentColor, transparent); }
.signal .beam { position: absolute; left: 0; top: 0; width: 4px; margin-left: -2px; border-radius: 2px; background: linear-gradient(to bottom, transparent, var(--fail)); box-shadow: 0 0 14px 2px var(--fail); opacity: 0; }
.no-signal .signal { display: none; }
@media (prefers-reduced-motion: reduce) { .signal { display: none !important; } }

/* Home: command rows lead with the question, the evidence list uses the same voice as the layer names. */
.cmd .q { margin: 0 0 0.6rem; color: var(--ink); font-weight: 600; font-size: 0.98rem; max-width: none; }
.cmd .q + code + p { margin-top: 0.6rem; }
.ev { display: grid; gap: 1.8rem; margin: 0; }
.ev dt { font: 800 1.05rem var(--mono); letter-spacing: -0.02em; color: var(--signal); }
.ev dd { margin: 0.45rem 0 0; max-width: 52ch; color: var(--dim); font-size: 0.9rem; line-height: 1.7; }

/* Command rows reuse the install field: a boxed, copyable command. */
.cmd .field { display: flex; align-items: center; gap: 1rem; margin: 0; padding: 0.7rem 0.9rem; background: var(--term); border-radius: 10px; text-align: left; box-shadow: 0 0 0 1px var(--line), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.cmd .field code { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.86rem; line-height: 1.5; }
.cmd .field + p { margin-top: 0.75rem; }

/* ---- small screens: behave like an app ---- */
html { overflow-x: clip; }
body { overflow-x: clip; -webkit-tap-highlight-color: transparent; padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }
button, .btn, .seg button { touch-action: manipulation; }
.site-footer .wrap { padding-block-end: calc(4.5rem + env(safe-area-inset-bottom)); }

/* Touch screens have no hover: always show the copy button on code blocks. */
@media (hover: none) {
  pre .copy { opacity: 1; }
  .btn:hover, .site-header nav a:hover { background: none; color: inherit; }
  .btn.primary:hover { background: var(--signal); }
}

/* Tablet */
@media (max-width: 62rem) {
  .hero { padding-block: 2.5rem 3rem; }
  .stage { max-width: 44rem; }
  .getit { max-width: 44rem; }
  .block { padding-block: clamp(3rem, 8vw, 5rem); }
  .site-footer .wrap { padding-block-start: 3rem; }
}

/* Phone: one compact header row, large touch targets, nothing wider than the screen. */
@media (max-width: 40rem) {
  .site-header { padding-top: env(safe-area-inset-top); }
  .bar { flex-wrap: nowrap; gap: 0.5rem; min-height: 3.25rem; padding-block: 0; }
  .brand { font-size: 1.15rem; padding-inline-end: 0.25rem; }
  .site-header nav { flex: 1; min-width: 0; justify-content: flex-end; gap: 0; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .site-header nav::-webkit-scrollbar { display: none; }
  .site-header nav a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.6rem; border-radius: 8px; font-size: 0.86rem; white-space: nowrap; }
  .site-header nav a:active { background: color-mix(in srgb, var(--signal) 22%, transparent); }
  .tools { width: auto; gap: 0; flex: none; }
  .switch { min-width: 2.75rem; min-height: 2.75rem; justify-content: center; }
  .switch [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

  .hero { padding-block: 2rem 2.5rem; }
  .hero h1 { margin-block-end: 1.25rem; }
  .lead { font-size: 0.98rem; line-height: 1.8; }
  .hero .getit { margin-block-start: 1.75rem; }
  .stage-wrap { margin-block-start: 2rem; }
  .stage::before, .stage::after { display: none; }
  .mac { border-radius: 12px; }
  .mac-bar { min-height: 2.6rem; padding-inline: 0.75rem; }
  .dots { inset-inline-start: 0.75rem; }
  .mac-title { max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.72rem; }
  .mac-body { padding: 1rem; }
  .demo-head { margin: -1rem -1rem 0; }
  .demo-head .seg button { padding: 0.85rem 0.9rem; min-height: 2.75rem; }
  .screen { margin-block-start: 1rem; }

  .install .field { padding: 0.75rem; gap: 0.6rem; }
  .install code { font-size: 0.8rem; }
  .hero .install .seg button { min-height: 2.5rem; }
  .copy { min-height: 2.25rem; padding-inline: 0.8rem; }
  .actions { flex-direction: column; align-items: stretch; }
  .btn { text-align: center; padding: 0.85rem 1.2rem; min-height: 2.75rem; }
  .note { margin-block-end: 1.5rem; }

  .statusbar { margin-block-start: 2.5rem; }
  .block { padding-block: 2.75rem; }
  .split { gap: 1.5rem; }
  .cmd .field { padding: 0.65rem 0.75rem; gap: 0.6rem; }
  .cmd .field code { font-size: 0.8rem; }
  .cmd { padding-block: 1.25rem; }
  .hop-name { flex-wrap: wrap; }
  .hop-out { max-width: 100%; overflow-wrap: anywhere; }

  article.wrap.prose, .docs { padding-block: 2rem 3rem; }
  pre { margin-inline: -0.25rem; padding: 0.9rem; font-size: 0.8rem; }
  .tree ul { grid-template-columns: minmax(0, 1fr); }
  .tree li { line-height: 2.4; }
  .site-footer .wrap { padding-block-start: 2.5rem; gap: 1.5rem; flex-direction: column; align-items: flex-start; }
  .ascii { font-size: clamp(0.4rem, 1.9vw + 0.12rem, 0.62rem); }
}

/* Very narrow phones */
@media (max-width: 23rem) {
  .mac-title { display: none; }
  .brand { font-size: 1.05rem; }
  .site-header nav a { padding: 0 0.45rem; font-size: 0.8rem; }
  .wrap { width: min(100% - 1.5rem, 84rem); }
}
