/* Themes are variables. Green is the default; theme.js sets data-theme on <html>. */
:root {
  --bg: oklch(0% 0 none);
  --fg: oklch(87.2% 0.279 143);
  --dim: oklch(63.8% 0.203 143);
  --line: oklch(63.8% 0.203 143);
  --ctl: oklch(63.8% 0.203 143);
  --sel-bg: oklch(87.2% 0.279 143);
  --sel-fg: oklch(0% 0 none);
  --link: oklch(87.2% 0.279 143);
  --card: transparent;
  --well: transparent;
  --chip-fg: var(--dim);
  --on-link: var(--sel-fg);
  --font: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 0;
  --upper: uppercase;
}
[data-theme="blue"] {
  --bg: oklch(33.4% 0.231 264); --fg: oklch(100% 0 none); --dim: oklch(80.8% 0.1 284); --line: oklch(100% 0 none); --ctl: oklch(100% 0 none);
  --sel-bg: oklch(100% 0 none); --sel-fg: oklch(33.4% 0.231 264); --link: oklch(97.1% 0.183 109);
}
[data-theme="amber"] {
  --bg: oklch(0% 0 none); --fg: oklch(81.2% 0.17 76); --dim: oklch(63.2% 0.133 75); --line: oklch(63.2% 0.133 75); --ctl: oklch(63.2% 0.133 75);
  --sel-bg: oklch(81.2% 0.17 76); --sel-fg: oklch(0% 0 none); --link: oklch(81.2% 0.17 76);
}
[data-theme="light"] {
  --bg: oklch(100% 0 none); --fg: oklch(17.8% 0 none); --dim: oklch(45% 0 none); --line: oklch(17.8% 0 none); --ctl: oklch(17.8% 0 none);
  --sel-bg: oklch(17.8% 0 none); --sel-fg: oklch(100% 0 none); --link: oklch(38.6% 0.148 261);
}
[data-theme="web"] {
  --bg: oklch(97.5% 0.005 258); --fg: oklch(20.8% 0.015 262); --dim: oklch(50.3% 0.026 257); --line: oklch(88.9% 0.013 256); --ctl: oklch(62% 0.026 258);
  --sel-bg: oklch(92.4% 0.036 267); --sel-fg: oklch(39.3% 0.16 266); --link: oklch(48.8% 0.217 264); --card: oklch(100% 0 none);
  --well: oklch(95.7% 0.007 261); --chip-fg: oklch(43.2% 0.027 257); --on-link: oklch(100% 0 none);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 12px;
  --upper: none;
}

[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; min-width: 0; }
html {
  color-scheme: dark; caret-color: var(--fg); scrollbar-color: var(--ctl) var(--bg);
  scrollbar-gutter: stable; text-wrap: pretty; overflow-wrap: break-word; font-synthesis: none;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--sel-bg); color: var(--sel-fg); }
[data-theme="light"], [data-theme="web"] { color-scheme: light; }
button, a { touch-action: manipulation; }
button { user-select: none; -webkit-user-select: none; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}
/* Page container: a content grid. Children sit in the content column; the named
   lines (breakout, full-width) are there if a block ever needs to go wider. */
.wrap {
  --gutter: 1rem; --content: 60rem; --breakout: 72rem;
  display: grid;
  grid-template-columns:
    [full-width-start] minmax(var(--gutter), 1fr)
    [breakout-start] minmax(0, calc((var(--breakout) - var(--content)) / 2))
    [content-start] min(100% - var(--gutter) * 2, var(--content)) [content-end]
    minmax(0, calc((var(--breakout) - var(--content)) / 2)) [breakout-end]
    minmax(var(--gutter), 1fr) [full-width-end];
}
.wrap > * { grid-column: content; }
.top { container: head / inline-size; }
main { container: page / inline-size; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 2px;
}
[data-theme="web"] a:focus-visible, [data-theme="web"] button:focus-visible, [data-theme="web"] input:focus-visible {
  outline-color: var(--link);
}
code, pre, .n, .prompt { font-family: var(--mono); }
h1, h2, h3 { line-height: 1.25; font-weight: 700; text-wrap: balance; }
h1 { font-size: clamp(1.35rem, .9rem + 1.14vw, 1.6rem); margin-block: 1.5rem .5rem; }
h2 { font-size: 1.05rem; margin-block: 2rem .6rem; text-transform: var(--upper); letter-spacing: .04em; }
[data-theme="web"] h2 { font-size: 1.15rem; letter-spacing: 0; }
.lead { color: var(--dim); max-width: 46rem; margin-block: 0 1.25rem; }
.skip { position: absolute; inset-inline-start: -999px; inset-block-start: 0; background: var(--sel-bg); color: var(--sel-fg); padding: .4rem .8rem; }
.skip:focus { inset-inline-start: 0; z-index: 10; }

/* Header and footer */
.top { border-block-end: 1px solid var(--line); background: var(--bg); }
.bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding-block: .9rem .7rem; }
.subbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; color: var(--fg); text-decoration: none; }
.logo { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--line); background: var(--sel-bg); color: var(--sel-fg); font-family: var(--mono); font-weight: 700; font-size: .9rem; border-radius: var(--radius); }
[data-theme="web"] .logo { background: var(--link); color: var(--on-link); border-color: var(--link); border-radius: 9px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-name { font-weight: 700; font-size: 1.1rem; white-space: nowrap; }
.brand-sub { color: var(--dim); font-size: .8rem; }
/* Topic switcher: a tab strip, because it is navigation. Tabs are flat, divided by thin rules, and the
   current one sits on the header rule like an open window. Theme is a set of colour swatches, so the
   two controls share no shape. */
.mode { display: flex; align-items: stretch; align-self: stretch; font-size: .95rem; margin-block-end: -1px; }
.mode a { color: var(--fg); text-decoration: none; padding-block: .3rem; padding-inline: 1rem; min-height: 2.1rem; display: inline-flex; align-items: center; font-weight: 700; }
.mode a + a { border-inline-start: 1px solid var(--line); }
@media (hover: hover) and (pointer: fine) {
  .mode a:hover { text-decoration: underline; text-underline-offset: .25em; }
}
.mode a[aria-current="page"] { background: var(--sel-bg); color: var(--sel-fg); text-decoration: none; }
.mode a[aria-current="page"], .mode a[aria-current="page"] + a { border-inline-start-color: transparent; }
[data-theme="web"] .mode { gap: .25rem; align-self: center; margin-block-end: 0; }
[data-theme="web"] .mode a { border-radius: 8px; border-inline-start: 0; padding-block: .15rem; padding-inline: .9rem; min-height: 1.7rem; }
[data-theme="web"] .mode a[aria-current="page"] { background: var(--link); color: var(--on-link); }
.theme { display: flex; align-items: center; gap: .75rem; font-size: .8rem; }
.theme-label { color: var(--dim); margin-inline-end: .1rem; }
.foot p { margin: 0; }
.foot { margin-block-start: 3rem; border-block-start: 1px solid var(--line); padding-block: 1rem 2rem; color: var(--dim); font-size: .85rem; }

/* Search and chips */
.search:has(+ .keys) { margin-block-end: .5rem; }
.search { display: flex; align-items: center; gap: .6rem; margin-block: 1rem; border-block-end: 1px solid var(--line); padding-block-end: .5rem; }
.prompt { flex: none; color: var(--fg); white-space: nowrap; }
.search input {
  flex: 1; min-width: 0; font: inherit; font-family: var(--mono); color: var(--fg);
  background: transparent; border: 0; padding-block: .25rem; padding-inline: 0;
}
.search input::placeholder { color: var(--dim); opacity: 1; }
.search input:focus-visible { outline-offset: 4px; }
.cursor::after { content: "\2588"; color: var(--fg); }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) { .cursor::after { animation: blink 1s steps(1) infinite; } }
[data-theme="web"] .prompt, [data-theme="web"] .cursor { display: none; }
[data-theme="web"] .search { background: var(--card); border: 1px solid var(--ctl); border-radius: 8px; padding: .5rem .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: 0 1rem; }
.chips a {
  color: var(--dim); text-decoration: none; border: 1px solid var(--ctl);
  padding-block: .1rem; padding-inline: .7rem; border-radius: var(--radius); font-size: .9rem; min-height: 1.9rem; display: inline-flex; align-items: center;
}
[data-theme="web"] .chips a { border-radius: 14px; background: var(--card); color: var(--chip-fg); }
@media (hover: hover) and (pointer: fine) {
  .chips a:hover { border-color: var(--fg); color: var(--fg); }
}
@media (prefers-reduced-motion: no-preference) {
  .mode a, .chips a { transition: transform 160ms var(--ease-out, ease-out); }
}
.mode a:active, .chips a:active { transform: scale(.97); }
/* Small controls get a 44px hit area without growing */
.mode a, .chips a, .reboot, .theme button, .copy { position: relative; }
.mode a::after, .chips a::after, .reboot::after, .theme button::after, .copy::after {
  content: ""; position: absolute; inset: min(0px, (100% - 44px) / 2);
}
.chips a[aria-current="page"] { background: var(--sel-bg); color: var(--sel-fg); border-color: var(--sel-bg); }
.empty { color: var(--dim); }

/* Command lists: terminal rows by default, cards in the web theme.
   The name is the only link; its ::after stretches over the whole row or card. */
.group h2 { margin-block-start: 1.5rem; }
.cmds { list-style: none; margin: 0; padding: 0; }
.cmds li { position: relative; display: flex; gap: 1.5ch; padding-block: .2rem; padding-inline: .6ch; color: var(--fg); --d: var(--dim); }
.cmds .n { min-width: 9ch; font-weight: 700; color: inherit; text-decoration: none; }
.cmds .n::after { content: ""; position: absolute; inset: 0; }
.cmds .n:focus-visible { outline: 2px solid transparent; }
.cmds .d { color: var(--d); }
.cmds li.on, .cmds li:has(.n:focus-visible), .cmds li:has(.n:active) { background: var(--sel-bg); color: var(--sel-fg); --d: var(--sel-fg); }
.cmds li:has(.n:focus-visible) { outline: 3px solid var(--fg); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .cmds li:hover { background: var(--sel-bg); color: var(--sel-fg); --d: var(--sel-fg); }
}
[data-section="github"] .cmds .n { min-width: 19ch; }
[data-section="ssh"] .cmds .n { min-width: 14ch; }
[data-theme="web"] .cmds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr)); gap: .75rem; }
[data-theme="web"] .cmds li { flex-direction: column; gap: .15rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding-block: .8rem; padding-inline: 1rem; }
[data-theme="web"] .cmds .n { min-width: 0; font-size: 1.05rem; }
[data-theme="web"] .cmds li.on, [data-theme="web"] .cmds li:has(.n:focus-visible), [data-theme="web"] .cmds li:has(.n:active) { background: var(--card); color: var(--fg); --d: var(--dim); border-color: var(--link); }
[data-theme="web"] .cmds li:has(.n:focus-visible) { outline-color: var(--link); }
[data-theme="web"] .cmds li.on { box-shadow: 0 0 0 1px var(--link); }
@media (hover: hover) and (pointer: fine) {
  [data-theme="web"] .cmds li:hover { background: var(--card); color: var(--fg); --d: var(--dim); border-color: var(--link); }
}

/* Command page */
.crumbs { margin-block: 1rem 0; color: var(--dim); font-size: .9rem; }
.sub { font-weight: 400; color: var(--dim); font-size: 1rem; margin-inline-start: .4rem; }
article h1 code { font-size: 1.9rem; }
pre { margin: 0; overflow-x: auto; }
.syn, .cmd, .out { border: 1px solid var(--line); padding: .6rem .9rem; border-radius: var(--radius); background: var(--card); }
[data-theme="web"] .syn, [data-theme="web"] .cmd, [data-theme="web"] .out { background: var(--well); border-color: var(--well); border-radius: 8px; }
.cmd code::before { content: "$ "; color: var(--dim); user-select: none; }
.out { border-block-start: 0; color: var(--dim); }
.ex { margin-block: 0 1.2rem; display: grid; grid-template-columns: 1fr auto; align-items: start; }
.ex figcaption { margin-block-end: .3rem; }
.ex pre { grid-column: 1 / -1; }
.ex .copy { grid-column: 2; grid-row: 1; margin-block-start: -.35rem; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: start; vertical-align: top; padding-block: .4rem; padding-inline: 0 .8rem; border-block-start: 1px solid var(--line); }
thead th { border-block-start: 0; color: var(--dim); font-weight: 400; font-size: .85rem; }
td:first-child { white-space: nowrap; padding-inline-end: 1.5rem; }
.notes, .related { padding-inline-start: 1.2rem; }
.related { list-style: none; padding-inline-start: 0; }
.related .d { color: var(--dim); margin-inline-start: .5ch; }
.updated { color: var(--dim); font-size: .85rem; margin-block-start: 2rem; }

@container head (width < 40rem) {
  .brand-sub { display: none; }
}
@container head (width < 30rem) {
  .theme-label { display: none; }
  .theme { gap: .7rem; }
}
@container page (width < 40rem) {
  td:first-child { white-space: normal; overflow-wrap: anywhere; width: 38%; padding-inline-end: .8rem; }
  .syn, .cmd, .out { white-space: pre-wrap; overflow-wrap: anywhere; }
  .cmds li { flex-direction: column; gap: 0; padding-block: .4rem; }
  .search { flex-wrap: wrap; }
}

/* Buttons: bevelled like DOS and Windows 3.1. Raised at rest, pressed when selected.
   Each palette is written once and shared by the page theme and its theme button. */
:root, .theme button[data-theme-set="green"] { --btn-face: oklch(25.3% 0.067 143); --btn-fg: oklch(87.2% 0.279 143); --btn-hi: oklch(87.2% 0.279 143); --btn-lo: oklch(15.5% 0.038 143); --btn-edge: oklch(63.8% 0.203 143); }
[data-theme="blue"], .theme button[data-theme-set="blue"] { --btn-face: oklch(33.4% 0.231 264); --btn-fg: oklch(100% 0 none); --btn-hi: oklch(68.2% 0.172 281); --btn-lo: oklch(23.1% 0.16 264); --btn-edge: oklch(100% 0 none); }
[data-theme="amber"], .theme button[data-theme-set="amber"] { --btn-face: oklch(23.8% 0.049 82); --btn-fg: oklch(81.2% 0.17 76); --btn-hi: oklch(81.2% 0.17 76); --btn-lo: oklch(14.1% 0.029 95); --btn-edge: oklch(63.2% 0.133 75); }
[data-theme="light"], .theme button[data-theme-set="light"] { --btn-face: oklch(80.8% 0 none); --btn-fg: oklch(0% 0 none); --btn-hi: oklch(100% 0 none); --btn-lo: oklch(60% 0 none); --btn-edge: oklch(0% 0 none); }
[data-theme="web"] { --btn-face: oklch(100% 0 none); --btn-fg: oklch(20.8% 0.015 262); --btn-hi: transparent; --btn-lo: transparent; --btn-edge: oklch(62% 0.026 258); }
.theme button, .reboot, .copy {
  font: inherit; font-size: .85rem; color: var(--btn-fg); background: var(--btn-face);
  border: 1px solid var(--btn-edge); border-radius: var(--radius); cursor: pointer;
  padding-block: .1rem; padding-inline: .7rem; min-height: 1.9rem;
  box-shadow: inset 2px 2px 0 var(--btn-hi), inset -2px -2px 0 var(--btn-lo);
}
.theme button:active, .theme button[aria-pressed="true"] {
  box-shadow: inset 2px 2px 0 var(--btn-lo), inset -1px -1px 0 var(--btn-hi);
  padding-block: calc(.1rem + 1px) calc(.1rem - 1px);
  padding-inline: calc(.7rem + 1px) calc(.7rem - 1px);
}
.theme button::before { content: "\25CB"; content: "\25CB" / ""; margin-inline-end: .45em; }
.theme button[aria-pressed="false"] { filter: brightness(.78); }
.theme button[aria-pressed="true"] { font-weight: 700; }
.theme button[aria-pressed="true"]::before { content: "\25CF"; content: "\25CF" / ""; }
.reboot:active, .copy:active { box-shadow: inset 2px 2px 0 var(--btn-lo), inset -1px -1px 0 var(--btn-hi); }
@media (hover: hover) and (pointer: fine) {
  .theme button[aria-pressed="false"]:hover { filter: brightness(1); }
  .reboot:hover, .copy:hover { border-color: var(--btn-edge); filter: brightness(1.12); }
}
[data-theme="web"] .theme button, [data-theme="web"] .reboot, [data-theme="web"] .copy { border-radius: 8px; }
/* The web button always shows the web screen's blue */
.theme button[data-theme-set="web"] {
  --btn-face: oklch(48.8% 0.217 264); --btn-fg: oklch(100% 0 none); --btn-hi: transparent; --btn-lo: transparent; --btn-edge: oklch(48.8% 0.217 264);
  border-radius: 14px; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.theme button[data-theme-set="web"][aria-pressed="true"] { --btn-face: oklch(39.2% 0.161 265); box-shadow: inset 0 2px 4px oklch(0% 0 none / .35); }
.theme button[data-theme-set]:focus-visible { outline-color: var(--fg); }
/* Theme buttons are swatches: the colour is the label (the name stays for screen readers and the tooltip). */
.theme button, .theme button:active, .theme button[aria-pressed="true"] {
  font-size: 0; width: 1.5rem; height: 1.5rem; min-height: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.theme button::before { content: ""; margin: 0; width: .5rem; height: .5rem; border-radius: 50%; background: currentColor; opacity: 0; }
.theme button[aria-pressed="true"]::before { opacity: 1; }
/* Reboot: a round hardware-style key with the power symbol (line in an open circle), label beside it */
.reboot, .reboot:active {
  display: inline-flex; align-items: center; gap: .55rem; background: none; border: 0; box-shadow: none; filter: none;
  color: var(--dim); padding: 0; min-height: 2.1rem; font-size: .85rem;
}
.rb-key {
  display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%;
  color: var(--btn-fg); background: var(--btn-face); border: 1px solid var(--btn-edge);
  box-shadow: inset 2px 2px 0 var(--btn-hi), inset -2px -2px 0 var(--btn-lo);
}
.rb-key svg { width: .95rem; height: .95rem; }
.reboot:active .rb-key { box-shadow: inset 2px 2px 0 var(--btn-lo), inset -1px -1px 0 var(--btn-hi); }
@media (hover: hover) and (pointer: fine) {
  .reboot:hover { color: var(--fg); }
  .reboot:hover .rb-key { filter: brightness(1.15); }
}

/* Keyboard palette over the command list */
.keys { color: var(--dim); font-size: .85rem; margin-block: 0 1rem; }
.keys kbd { font: inherit; border: 1px solid var(--ctl); padding-inline: .35rem; border-radius: var(--radius); }
@media (hover: none) { .keys { display: none; } }

/* First visit: a short boot sequence over the home page */
html.boot::before { content: ""; position: fixed; inset: 0; z-index: 99; background: var(--bg); animation: boot-failsafe 0s 4s forwards; }
@keyframes boot-failsafe { to { visibility: hidden; } }
#boot { position: fixed; inset: 0; z-index: 100; background: var(--bg); color: var(--fg); display: flex; align-items: center; cursor: pointer; }
#boot pre { margin-block: 0; margin-inline: auto; padding-inline: 1rem; max-inline-size: 62rem; font: inherit; font-size: 1.1rem; line-height: 1.8; white-space: pre-wrap; }
#boot .skip-hint { position: absolute; inset-block-end: 1.2rem; inset-inline: 0; padding-inline: max(1rem, (100% - 62rem) / 2 + 1rem); color: var(--dim); font-size: .85rem; }
#boot.out { opacity: 0; transition: opacity .25s ease-out; }

/* Explainer: one collapsible card, so the command list stays near the top */
.explain { max-width: 46rem; margin-block: 0 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); }
[data-theme="web"] .explain { background: var(--card); border-radius: 12px; }
.explain summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 1.5ch; padding: .6rem 1rem; cursor: pointer; list-style: none; }
.explain summary::-webkit-details-marker { display: none; }
.explain summary::before { content: "[+]"; content: "[+]" / ""; color: var(--dim); font-family: var(--mono); }
.explain[open] summary::before { content: "[\2212]"; content: "[\2212]" / ""; }
.explain summary .n { font-weight: 700; }
.explain summary .d { color: var(--dim); }
@media (hover: hover) and (pointer: fine) {
  .explain summary:hover .n { text-decoration: underline; text-underline-offset: .25em; }
}
.explain summary:focus-visible { outline-offset: -3px; }
.explain .body { padding: 0 1rem 1rem; border-block-start: 1px solid var(--line); }
.explain h2:first-child { margin-block-start: 1rem; }
.explain ol, .explain ul { padding-inline-start: 1.4rem; }
.explain li { margin-block: .3rem; }
.explain p, .explain li { color: var(--dim); }
.explain strong, .explain code { color: var(--fg); }
