/* alporak.com: a typeset terminal.
   Layout: a sticky mono margin column (the command) beside wide editorial
   output; the prompt is a fixed bar at the bottom. Dark only; print is light. */
/* alporak.com. With JavaScript: a full-screen TUI (site/js/tui.js), three neon panes.
   Without it: the same content as one terminal page. One mono face at one size on screen.
   Dark only; print is a light CV in Archivo. */
:root {
  color-scheme: dark;
  --bg: #0A0C0E;
  --bg-bar: #0D1013;
  --bg-code: #0F1316;
  --text: #E5E8E9;
  --text-2: #C9CED0;
  --muted: #8B9398;
  /* --subtle is the quietest text colour (5.1:1 on --bg, 4.8:1 on --bg-code: WCAG AA).
     --faint is 2.6:1 and is for lines, bars and scrollbars only, never for text. */
  --subtle: #7A8388;
  --faint: #4C555B;
  /* --bar-lo is the 'before' bar in charts: 3:1 on --bg and on panels (WCAG non-text contrast) */
  --bar-lo: #5F686E;
  --rule: #1D2327;
  --rule-strong: #2C3439;
  --signal: #3ED8E6;
  --signal-dim: rgba(62, 216, 230, .16);
  --error: #FF6B6E;
  /* the TUI's neon: selection and active pane in magenta, results in amber */
  --magenta: #FF5CB4;
  --magenta-dim: rgba(255, 92, 180, .14);
  --amber: #FFB547;
  --cyan-glow: rgba(62, 216, 230, .22);

  --f-display: 'Archivo', 'Archivo fallback', 'Helvetica Neue', Arial, sans-serif;
  --f-text: 'Archivo', 'Archivo fallback', 'Helvetica Neue', Arial, sans-serif;
  --f-mono: 'JetBrains Mono', 'JetBrains Mono fallback', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --win: 1000px;  /* the terminal window */
  --pad: clamp(16px, 3vw, 32px);  /* inside the window */
  --col: 12ch;  /* a label column: dates, keys */
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-top: 20px; -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--f-mono); font-size: 15px; line-height: 1.6;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 48px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--signal); text-decoration: none; border-bottom: 1px solid var(--signal-dim); }
a:hover { border-bottom-color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
/* headings and command lines take focus when a click opens a block (tabindex=-1) */
[tabindex="-1"]:focus { outline: none; }
[tabindex="-1"]:focus-visible { outline: 2px solid var(--signal); outline-offset: 4px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap; border: 0;
}
.print-only { display: none; }
/* skip links: off screen until focused */
.skip {
  position: fixed; top: 10px; left: max(16px, env(safe-area-inset-left, 0px)); z-index: 10;
  font-family: var(--f-mono); font-size: 13px; color: var(--bg); background: var(--signal);
  padding: 8px 12px; border: 0; transform: translateY(-200%);
}
.skip:focus { transform: none; }
.skip:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.js .skip-nojs, html:not(.js) .skip-js { display: none; }
sup { line-height: 0; }
.mono { font-family: var(--f-mono); }
.dim { color: var(--muted); }
kbd { font: inherit; }

/* the window */
.wrap {
  max-width: var(--win); margin: 0 auto; min-height: calc(100dvh - 32px);
  border: 1px solid var(--rule-strong); background: var(--bg); padding: 0 var(--pad) 24px;
}

/* title bar */
.top {
  display: flex; gap: 6px 20px; align-items: baseline; flex-wrap: wrap;
  margin-inline: calc(-1 * var(--pad)); padding: 8px var(--pad);
  background: var(--bg-bar); border-bottom: 1px solid var(--rule-strong); color: var(--muted); font-size: 13px;
}
.top .sp { flex: 1; }
.top .home { color: var(--text); border: 0; }
.top .meta b { color: var(--text-2); font-weight: 400; }
.top .dl { color: var(--text-2); border-bottom-color: var(--rule-strong); white-space: nowrap; }
.top .dl:hover { color: var(--signal); border-bottom-color: var(--signal); }
#clock { display: inline-block; min-width: 8ch; white-space: pre; } /* the clock fills in after load; its width is kept from the start */

/* blocks: the command, then its output */
.block { padding-block: 24px 8px; scroll-margin-top: 20px; }
.block + .block { border-top: 1px solid var(--rule); margin-top: 16px; }
.cmdline { color: var(--muted); margin-bottom: 14px; overflow-wrap: anywhere; }
.cmdline .ps { color: var(--subtle); }
.cmdline .d { color: var(--signal); }
.cmdline .c { color: var(--text); }
.out { min-width: 0; display: grid; gap: 16px; align-content: start; }
.out > * { min-width: 0; }
/* titles are plain bold text, the size of everything else */
.h { margin: 0; font: inherit; font-weight: 700; color: var(--text); max-width: 72ch; text-wrap: balance; }
p { margin: 0; max-width: 72ch; }
.lede { max-width: 72ch; }
.label { font: inherit; color: var(--muted); margin: 0; }
.lede .fig { color: var(--signal); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* whoami: the short cv */
.name { margin: 0; font: inherit; font-weight: 700; color: var(--text); }
.role { margin: 0; color: var(--text); }
.block[data-cmd="whoami"] .out { gap: 0; }
.block[data-cmd="whoami"] .out > .dim { margin-bottom: 20px; }
.stack { display: flex; flex-wrap: wrap; gap: 0 2ch; color: var(--text-2); margin-bottom: 24px; }
.links { display: flex; flex-wrap: wrap; gap: 0 2ch; }

/* work list: one line per story, grouped */
.group { display: grid; }
.group-label { display: flex; gap: 1ch; align-items: center; padding: 18px 0 6px; font-weight: inherit; } /* an h3, set like the other labels */
.group-label::after { content: ""; flex: 1; border-top: 1px solid var(--rule-strong); }
.cases { display: grid; }
.case {
  display: grid; grid-template-columns: 22ch minmax(0, 1fr); gap: 0 2ch; align-items: baseline;
  padding: 5px 0; border: 0; color: inherit; touch-action: manipulation;
}
.case:hover { border-bottom: 0; }
.case:active { background: var(--bg-code); }
/* the unit and summary stay for screen readers (aria-describedby) and print */
.case .unit, .case .hit { display: none; }
.case .era { color: var(--muted); margin-left: 1ch; }
.num { font-weight: 600; color: var(--signal); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.num .nw { white-space: nowrap; }
.case .t { color: var(--text); }
.case:focus-visible .t { color: var(--signal); }

/* story write-up */
.hit-lede { max-width: 72ch; color: var(--text-2); }
.byline { color: var(--muted); font-size: 13px; margin-top: -10px; max-width: none; }
.big-result { display: flex; flex-wrap: wrap; gap: 0 2ch; align-items: baseline; }
/* the write-up: intro, headed sections, figures where the text cites them */
.prose { display: grid; gap: 14px; margin-top: 8px; }
.prose > p { color: var(--text-2); }
.prose > .sh { margin: 18px 0 0; font: inherit; font-weight: 700; color: var(--text); max-width: 72ch; text-wrap: balance; }
.prose > .sh::before { content: "## "; content: "## " / ""; color: var(--signal); font-weight: 400; } /* not read aloud */
.prose > figure { margin: 10px 0; }
.out code { font-family: var(--f-mono); font-size: inherit; color: var(--text); background: var(--bg-code); padding: 1px 5px; }
.chart { margin: 0; display: grid; gap: 12px; }
/* bar charts: an HTML grid of label, bar and value, so the text keeps its size on a phone */
.bars {
  display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 6px 12px; align-items: center;
  max-width: 760px; font: 13px/1.4 var(--f-mono); color: var(--muted);
}
.bars .bv { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars .bv.hi { color: var(--text); }
.bars .track { display: block; width: 100%; height: 12px; }
.bars .b-lo { fill: var(--bar-lo); }
.bars .b-hi { fill: var(--signal); }
.bars .ax { grid-column: 2; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--rule-strong); padding-top: 4px; font-size: 11px; color: var(--subtle); }
figure > .cap { margin: 0; }
/* diagrams: standalone SVGs drawn on a 640-wide grid with font-size 12; colour comes only from these classes */
.diagram { margin: 0; display: grid; gap: 10px; }
.diagram-scroll {
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; scrollbar-color: var(--faint) transparent;
  /* scroll shadows: the first two layers move with the content and cover the last two at either end,
     so an edge glows only while there is more to scroll to */
  background:
    linear-gradient(90deg, var(--bg) 40%, transparent) left / 32px 100% no-repeat local,
    linear-gradient(270deg, var(--bg) 40%, transparent) right / 32px 100% no-repeat local,
    linear-gradient(90deg, rgba(62, 216, 230, .22), transparent) left / 14px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(62, 216, 230, .22), transparent) right / 14px 100% no-repeat scroll;
}
.diagram .hint { display: none; }
/* the content fades out at an edge while there is more to scroll to that side. The fades are
   grid items in the scroller's cell; a scroll-driven animation shows each one only when it is needed
   (no support, or a diagram that fits: no fade, and the phone-only hint still says it scrolls) */
.diagram { timeline-scope: --dx; }
.diagram-scroll { grid-row: 1; grid-column: 1; scroll-timeline: --dx x; }
.diagram::before, .diagram::after {
  content: ""; grid-row: 1; grid-column: 1; width: 36px; pointer-events: none; opacity: 0; z-index: 1;
  animation: linear both; animation-timeline: --dx;
}
.diagram::before { justify-self: start; background: linear-gradient(90deg, var(--bg), transparent); animation-name: fade-in-start; }
.diagram::after { justify-self: end; background: linear-gradient(270deg, var(--bg), transparent); animation-name: fade-out-end; }
@keyframes fade-in-start { 0% { opacity: 0; } 8%, 100% { opacity: 1; } }
@keyframes fade-out-end { 0%, 92% { opacity: 1; } 100% { opacity: 0; } }
.diagram-scroll:focus-visible { outline-offset: 6px; }
/* min-width keeps 12-unit text at 11px or more; narrower screens scroll sideways */
.diagram svg { display: block; width: 100%; min-width: 587px; max-width: 760px; height: auto; overflow: visible; }
.diagram text { font-family: var(--f-mono); }
.diagram .d-sans { font-family: var(--f-text); }
.diagram .d-mono { font-family: var(--f-mono); }
.diagram :is(text, tspan).d-ink { fill: var(--text); }
.diagram :is(text, tspan).d-muted { fill: var(--muted); }
.diagram :is(text, tspan).d-faint { fill: var(--muted); }
.diagram :is(text, tspan).d-signal { fill: var(--signal); }
.diagram :is(text, tspan).d-error { fill: var(--error); }
.diagram :is(text, tspan).d-rule { fill: var(--subtle); }
.diagram :not(text, tspan).d-ink { stroke: var(--text-2); }
.diagram :not(text, tspan).d-muted { stroke: var(--muted); }
.diagram :not(text, tspan).d-faint { stroke: var(--faint); }
.diagram :not(text, tspan).d-rule { stroke: var(--rule-strong); }
/* a box's outline carries meaning, so it gets the 3:1 line colour; plain dividers stay quiet */
.diagram :is(rect, path, polygon, polyline, circle, ellipse).d-rule { stroke: var(--faint); }
.diagram :not(text, tspan).d-signal { stroke: var(--signal); }
.diagram :not(text, tspan).d-error { stroke: var(--error); }
.diagram .d-fill-panel { fill: var(--bg-code); }
.diagram .d-fill-faint { fill: color-mix(in srgb, var(--faint) 30%, transparent); }
.diagram .d-fill-signal { fill: var(--signal-dim); }
.diagram .d-fill-error { fill: color-mix(in srgb, var(--error) 16%, transparent); }
/* fills are tints, so text on them keeps its contrast; a mark meant to be solid (a bar, a block in a pool) says d-solid */
.diagram .d-fill-signal.d-solid { fill: var(--signal); }
.diagram .d-fill-error.d-solid { fill: var(--error); }
.logfig { margin: 0; }
.log {
  margin: 0; padding: 16px 18px; background: var(--bg-code); border-left: 1px solid var(--signal);
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.65; color: var(--muted);
  overflow-x: auto; white-space: pre;
}
.log b { color: var(--text); font-weight: 500; }
.log i { color: var(--error); font-style: normal; }
.cap { font-family: var(--f-mono); font-size: 11.5px; color: var(--subtle); margin-top: 8px; }
.pager { display: flex; gap: 22px; flex-wrap: wrap; }
.tags { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; color: var(--muted); }
.tags .label { margin-right: 4px; }
.tags a, .tags .lnk, .taglist a { color: var(--text-2); border-bottom-color: var(--rule-strong); }
.tags a:hover, .tags .lnk:hover, .taglist a:hover { color: var(--signal); border-bottom-color: var(--signal); }

/* cv */
.rows { display: grid; gap: 24px; }
.row { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); gap: 4px 2ch; }
.row .when { color: var(--muted); font-variant-numeric: tabular-nums; }
.row .what b { font-weight: 700; color: var(--text); }
/* a cv note's story, folded under it */
.deep summary { display: inline-block; cursor: pointer; color: var(--signal); list-style: none; padding: 2px 0; touch-action: manipulation; }
.deep summary::-webkit-details-marker { display: none; }
.deep summary::before { content: "+ "; }
.deep[open] summary::before { content: "− "; }
.deep-body { display: grid; gap: 14px; margin: 10px 0 16px; padding-left: 2ch; border-left: 1px solid var(--rule-strong); }
.deep-body .prose { margin-top: 0; gap: 10px; }
.deep-body .prose > .sh { margin-top: 8px; }
.row ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; max-width: 72ch; }
.row li { padding-left: 2ch; position: relative; color: var(--text-2); }
.row li::before { content: "-"; position: absolute; left: 0; color: var(--subtle); }
.skills { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 2ch; }
.skills ul { margin: 6px 0 0; padding: 0; list-style: none; line-height: 1.8; }
.skills .daily li { color: var(--text); }
.skills .regular li { color: #B4BBBF; }
.skills .used li { color: var(--muted); }

/* tools, contact */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; vertical-align: top; padding: 10px 2ch 10px 0; border-top: 1px solid var(--rule); }
.table th { color: var(--muted); font-weight: 400; }
.table td { color: var(--text-2); }
.table td:first-child { font-weight: 700; white-space: nowrap; color: var(--text); }
.table td.stack { color: var(--muted); min-width: 16ch; }
.kv { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); gap: 8px 2ch; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

.txt { white-space: pre-wrap; color: var(--text-2); margin: 0; overflow-wrap: anywhere; }
.err { color: var(--error); }

/* 404 */
/* article pages: the way back to the TUI */
.back { margin: 20px 0 0; }
.nf { margin-top: clamp(40px, 8vw, 96px); }
.nf h1 { font-weight: 400; }
.nf-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.nf-links li { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: baseline; }

/* ---------------------------------------------------------------- ALP-OS (JS, home only) */
/* One screen: a CRT glass with a header, a menu, a preview and a footer. Nothing scrolls. */
.js body { padding: 0; overflow: hidden; }
.js .wrap { display: none; }
.tui {
  height: 100dvh; padding: max(8px, env(safe-area-inset-top, 0px)) max(8px, env(safe-area-inset-right, 0px))
    max(8px, env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
}
.crt {
  position: relative; height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px;
  padding: 14px clamp(12px, 2vw, 24px); border: 1px solid rgba(62, 216, 230, .5); border-radius: 14px;
  background: radial-gradient(ellipse at 50% 40%, #0C1418 0%, var(--bg) 70%);
  box-shadow: 0 0 0 1px rgba(62, 216, 230, .08), 0 0 28px -6px var(--cyan-glow), inset 0 0 60px -20px var(--cyan-glow);
  overflow: hidden; animation: flicker 4s steps(2) infinite;
}
/* glass: scanlines and a vignette; they take no input */
.crt::before, .crt::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5; border-radius: inherit; }
.crt::before { background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px); }
.crt::after { background: radial-gradient(ellipse at 50% 50%, transparent 60%, rgba(0, 0, 0, .45) 100%); }
@keyframes flicker { 0% { opacity: 1; } 50% { opacity: .975; } } /* 0.5 Hz, far under the 3 Hz flash limit */

.t-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 2ch; font-size: 13px; }
.t-os { color: var(--signal); }
.glow { text-shadow: 0 0 10px var(--cyan-glow); }
.t-meta b { color: var(--text-2); font-weight: 400; }
.t-name { grid-column: 1 / -1; margin: 0; font: inherit; font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: .04em; text-shadow: 0 0 12px var(--cyan-glow); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.t-main { display: grid; grid-template-columns: minmax(30ch, min(54ch, 40%)) minmax(0, 1fr); gap: 0 18px; min-height: 0; }
.t-menu, .t-prev { display: flex; flex-direction: column; min-height: 0; border: 1px solid rgba(62, 216, 230, .35); padding: 10px 12px; }
.t-menu:focus-within, .t-prev:focus-within { border-color: var(--magenta); }
.t-crumb { color: var(--signal); font-size: 12.5px; margin: 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .04em; }
.t-menu:focus-within .t-crumb { color: var(--magenta); }

/* menu: one line per entry */
.t-list { list-style: none; margin: 0; padding: 0; min-height: 0; overflow: hidden; outline: none; }
.m-it {
  display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto; gap: 0 1.5ch; align-items: baseline;
  padding: 3px 6px; font-size: 14px; color: var(--text-2); cursor: pointer; touch-action: manipulation; white-space: nowrap;
}
.m-k { color: var(--subtle); }
.m-l { overflow: hidden; text-overflow: ellipsis; }
.m-m { color: var(--amber); font-weight: 600; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; }
.m-it[aria-selected="true"] { background: var(--magenta); color: var(--bg); box-shadow: 0 0 14px -2px rgba(255, 92, 180, .55); }
.m-it[aria-selected="true"] .m-k, .m-it[aria-selected="true"] .m-m { color: var(--bg); }
.m-it[aria-selected="true"] .m-k::before { content: ">"; position: absolute; margin-left: -1.6ch; color: var(--magenta); }
.t-list:focus-visible .m-it[aria-selected="true"] { outline: 2px solid var(--text); outline-offset: 1px; }
.m-it:active { background: var(--magenta-dim); }

/* preview: a measured box that never scrolls, and a footer with the way on */
.p-box { position: relative; flex: 1; min-height: 0; overflow: hidden; display: grid; gap: 12px; align-content: start; font-size: 14px; outline: none; }
.p-box > * { min-width: 0; margin: 0; }
.p-box { overflow-wrap: anywhere; }
.p-box.scan { animation: scan .26s steps(10) both; }
@keyframes scan { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.p-foot { display: flex; flex-wrap: wrap; gap: 8px 12px; padding-top: 10px; border-top: 1px solid var(--rule-strong); margin-top: 10px; }
.p-foot:empty { display: none; }
.t-act {
  font: inherit; font-size: 13px; color: var(--bg); background: var(--signal); border: 0; padding: 5px 12px; cursor: pointer;
  text-shadow: none; box-shadow: 0 0 12px -2px var(--cyan-glow); touch-action: manipulation;
}
.t-act:active { background: var(--magenta); }
@media (hover: hover) and (pointer: fine) { .t-act:hover { background: var(--magenta); } .m-it:hover:not([aria-selected="true"]) { color: var(--text); background: rgba(255, 255, 255, .04); } }
.clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: var(--lines, 2); overflow: hidden; }
.p-title { font: inherit; font-weight: 700; font-size: 15px; color: var(--text); }
.p-hit { color: var(--text-2); }
.p-sec-h { color: var(--signal); }
.p-role { color: var(--text); }
.p-box .big-result .num { color: var(--amber); font-weight: 700; text-shadow: 0 0 12px rgba(255, 181, 71, .3); }
.p-box .bars rect { transform-box: fill-box; transform-origin: left; animation: grow .5s ease-out both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.p-jobs, .p-tools, .p-help, .p-matrix { display: grid; gap: 4px; margin: 0; }
.p-jobs > div, .p-matrix > div { display: grid; grid-template-columns: 11ch minmax(0, 1fr); gap: 0 2ch; }
.p-tools > div { display: grid; }
.p-jobs dd, .p-tools dd, .p-matrix dd, .p-help dd { margin: 0; }
.p-jobs dd.dim { grid-column: 2; }
.p-jobs dt { color: var(--muted); }
.p-tools dt { color: var(--text); }
.p-matrix > div { grid-template-columns: 22ch minmax(0, 1fr); }
.p-matrix dt { color: var(--signal); }
.m-marks { color: var(--magenta); letter-spacing: .1em; }
.p-matrix dd { color: var(--text-2); }
.p-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.p-rows li { display: grid; grid-template-columns: 20ch minmax(0, 1fr); gap: 0 2ch; }
.p-rows .num { color: var(--amber); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-notes { margin: 0; padding-left: 2ch; display: grid; gap: 4px; }
.p-notes li::marker { content: "- "; color: var(--magenta); }
.p-help { grid-template-columns: 12ch minmax(0, 1fr); gap: 4px 2ch; }
.p-help dt { color: var(--signal); }
.p-kv { grid-template-columns: 10ch minmax(0, 1fr); }

/* footer */
.t-foot { display: flex; align-items: center; gap: 6px 1.5ch; flex-wrap: wrap; font-size: 13px; }
.t-sp { flex: 1; }
.t-btn {
  font: 13px/1.5 var(--f-mono); color: var(--text); background: var(--signal-dim); border: 0; padding: 2px 1ch 2px 0;
  cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.t-btn kbd { background: var(--bg); color: var(--signal); padding: 2px 1ch; margin-right: 1ch; }
a.t-btn { border: 0; }
.t-btn:active { background: var(--signal); color: var(--bg); }
@media (hover: hover) and (pointer: fine) { .t-btn:hover { color: var(--signal); } }
.t-back { visibility: hidden; }
.tui.deep .t-back { visibility: visible; }

/* the command line */
.t-cmd { display: flex; align-items: center; gap: 1ch; flex: 0 1 32ch; min-width: 0; }
.t-ps { color: var(--magenta); }
#tui-cmd {
  flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px solid var(--faint); border-radius: 0; padding: 2px 0;
  font: 16px var(--f-mono); color: var(--text); caret-color: var(--magenta);
}
#tui-cmd:focus { outline: none; border-bottom-color: var(--magenta); box-shadow: 0 1px 0 var(--magenta); }
#tui-cmd::placeholder { color: var(--subtle); opacity: 1; }
.t-cmd-open { display: none; }
/* rows for a menu that would not fit; then two columns */
.tui.tight .m-it { padding-block: 1px; font-size: 12.5px; line-height: 1.45; }
.tui.cols .t-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(7, auto); gap: 0 12px; align-content: start; }
.o-line { color: var(--text-2); }
.o-line.err { color: var(--error); }
.o-line b { color: var(--text); }

/* COMMS handshake */
.p-box { container-type: inline-size; }
.hs-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 2ch; }
.hs-last { flex-basis: 100%; color: var(--magenta); }
.hs-last.dim { color: var(--muted); }
.hs-tries { color: var(--amber); }
.dump { display: grid; font: 13px/1.6 var(--f-mono); white-space: pre; font-variant-ligatures: none; }
.d-row { display: flex; gap: 2ch; }
.d-a { color: var(--subtle); }
.d-x { color: var(--muted); }
.d-s { color: var(--subtle); }
.hs-w {
  font: inherit; color: var(--signal); background: transparent; border: 0; padding: 0; cursor: pointer;
  text-shadow: 0 0 8px var(--cyan-glow); touch-action: manipulation;
}
.hs-w:focus-visible { outline: none; background: var(--magenta); color: var(--bg); text-shadow: none; }
.hs-w:active { background: var(--magenta); color: var(--bg); }
.hs-w.tried { color: var(--subtle); text-decoration: line-through; text-shadow: none; cursor: default; }
@media (hover: hover) and (pointer: fine) { .hs-w:not(.tried):hover { background: var(--magenta); color: var(--bg); text-shadow: none; } }
@container (max-width: 600px) { .d-x { display: none; } }
@container (max-width: 300px) { .d-a { display: none; } }
.hs-log { margin: 0; font: 13px/1.5 var(--f-mono); color: var(--text-2); white-space: pre-wrap; display: grid; }
.t-btn[aria-pressed="true"] { background: var(--magenta-dim); color: var(--magenta); }
/* hack: the glyph rain */
.t-prev { position: relative; }
.rain, .confetti { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
/* sudo: xkcd 838 */
.xkcd { margin: 12px 0 0; }
.xkcd img { display: block; width: 100%; max-width: 695px; height: auto; background: #fff; border-radius: 4px; }
.xkcd figcaption { margin-top: 6px; font-size: 12.5px; color: var(--muted); }
/* ping: pong */
.pong { display: block; width: 100%; margin: 10px 0 6px; border: 1px solid var(--rule-strong); touch-action: none; cursor: none; }
.pong:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
/* the konami code: rainbow until reload. Hues turn at a fixed lightness (75%), so
   text keeps over 6:1 on the dark panels at every hue. Slow turn: no flashes. */
@property --hue { syntax: '<number>'; inherits: true; initial-value: 0; }
@property --spin { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
@keyframes hue { to { --hue: 360; } }
@keyframes spin { to { --spin: 360deg; } }
@keyframes shake {
  0%, 100% { transform: none; } 15% { transform: translate(-7px, 2px) rotate(-.5deg); } 30% { transform: translate(6px, -3px) rotate(.5deg); }
  45% { transform: translate(-5px, 3px) rotate(-.3deg); } 60% { transform: translate(4px, -2px) rotate(.3deg); } 80% { transform: translate(-2px, 1px); }
}
.tui.overclock {
  --signal: hsl(var(--hue) 100% 75%); --magenta: hsl(calc(var(--hue) + 180) 100% 75%);
  --signal-dim: hsl(var(--hue) 100% 75% / .16); --magenta-dim: hsl(calc(var(--hue) + 180) 100% 75% / .16);
  --cyan-glow: hsl(var(--hue) 100% 60% / .5);
  animation: hue 4s linear infinite;
}
.tui.overclock .crt {
  border: 2px solid transparent;
  background: radial-gradient(ellipse at 50% 40%, #0C1418 0%, var(--bg) 70%) padding-box,
    conic-gradient(from var(--spin), #f33, #f93, #fe3, #3f6, #3ef, #36f, #c3f, #f33) border-box;
  box-shadow: 0 0 46px -4px hsl(var(--hue) 100% 60% / .65), 0 0 110px -10px hsl(calc(var(--hue) + 120) 100% 60% / .5),
    inset 0 0 80px -20px hsl(calc(var(--hue) + 240) 100% 60% / .45);
  animation: flicker 4s steps(2) infinite, spin 2.5s linear infinite, shake .6s ease-out 1;
}
.tui.overclock .crt::before {
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px),
    linear-gradient(115deg, hsl(var(--hue) 100% 60% / .07), hsl(calc(var(--hue) + 120) 100% 60% / .07), hsl(calc(var(--hue) + 240) 100% 60% / .07));
}
.tui.overclock .t-name { text-shadow: 1px 0 hsl(var(--hue) 100% 60%), -1px 0 hsl(calc(var(--hue) + 120) 100% 60%), 0 0 16px hsl(calc(var(--hue) + 240) 100% 60%); }
.tui.overclock .m-it:nth-child(6n+1) { color: hsl(var(--hue) 100% 80%); }
.tui.overclock .m-it:nth-child(6n+2) { color: hsl(calc(var(--hue) + 60) 100% 80%); }
.tui.overclock .m-it:nth-child(6n+3) { color: hsl(calc(var(--hue) + 120) 100% 80%); }
.tui.overclock .m-it:nth-child(6n+4) { color: hsl(calc(var(--hue) + 180) 100% 80%); }
.tui.overclock .m-it:nth-child(6n+5) { color: hsl(calc(var(--hue) + 240) 100% 80%); }
.tui.overclock .m-it:nth-child(6n+6) { color: hsl(calc(var(--hue) + 300) 100% 80%); }
.tui.overclock .m-it[aria-selected="true"] { color: var(--bg); box-shadow: 0 0 22px 0 var(--magenta); }

/* boot log: the first visit of a session */
.boot { position: fixed; inset: 0; z-index: 30; background: var(--bg); padding: 24px; transition: opacity .2s ease-out; }
.boot pre { margin: 0; font: 14px/1.7 var(--f-mono); color: var(--signal); text-shadow: 0 0 10px var(--cyan-glow); white-space: pre-wrap; }
.boot.out { opacity: 0; }

@media (max-width: 1100px) { .t-hint { display: none; } }
/* one pane: a phone, or any screen 480 px tall or less. The menu, or the preview with back. */
@media (max-width: 900px), (max-height: 480px) {
  .crt { padding: 10px 10px; gap: 8px; border-radius: 10px; }
  .t-main { grid-template-columns: minmax(0, 1fr); }
  .t-prev { display: none; }
  .tui.reading .t-menu { display: none; }
  .tui.reading .t-prev { display: flex; }
  .t-meta { display: none; }
  .m-it { padding: 6px 6px; }
  /* the command line opens on demand, over the footer */
  .t-cmd { display: none; flex: 1 1 100%; order: -1; }
  .tui.cmd-on .t-cmd { display: flex; }
  .t-cmd-open { display: inline; }
}
@media (max-height: 480px) {
  .dump { font-size: 12px; line-height: 1.3; }
  .hs-last { flex-basis: auto; } /* one head line: tries and the result */
  .t-head { grid-template-columns: auto minmax(0, 1fr); }
  .t-name { grid-column: auto; font-size: 13px; }
  .crt { gap: 4px; padding-block: 6px; }
  .m-it { padding: 1px 6px; font-size: 12.5px; line-height: 1.45; } /* 13 rows fit 390 px */
  .t-crumb { margin-bottom: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .crt { animation: none; }
  .crt::before { display: none; }
}

@media (max-width: 860px) {
  .skills { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
@media (max-width: 560px) {
  /* a phone: the window is the screen */
  body { padding-inline: 0; padding-top: 0; font-size: 14px; }
  .wrap { border-inline: 0; border-top: 0; min-height: 100dvh; }
  .top .meta { display: none; }
  .case, .row, .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .case { padding: 8px 0; }
  /* bar charts: the label on its own line above its bar */
  .bars { grid-template-columns: minmax(0, 1fr) max-content; gap: 2px 12px; }
  .bars .bl { grid-column: 1 / -1; margin-top: 6px; }
  .bars .ax { grid-column: 1; margin-top: 4px; }
  .diagram .hint { display: block; }
  /* tools: each row becomes a stacked entry */
  .table thead { position: absolute; clip-path: inset(50%); }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { border-top: 1px solid var(--rule); padding: 12px 0; }
  .table td { border: 0; padding: 2px 0; }
  .table td:first-child { white-space: normal; }
  .table td.stack { min-width: 0; margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tui::after { display: none; }
}

/* print: a light, one-column CV on A4. tools/pdf.mjs prints site/cv.pdf with this.
   Order: intro, cv (roles, education, skills), then the six featured write-ups as
   one line each with their address. Everything else stays on the site. */
@media print {
  :root {
    --bg: #fff; --text: #111; --text-2: #2B2B2B; --muted: #555; --subtle: #5E5E5E; --faint: #999;
    --rule: #D9D9D9; --rule-strong: #B5B5B5; --signal: #0B6E78; --signal-dim: rgba(11, 110, 120, .14);
    --error: #B3261E; --bg-code: #F3F3F3;
  }
  :root { color-scheme: light; }
  @page { size: A4; margin: 14mm 16mm 16mm; }
  html, body { background: #fff; }
  body { padding: 0; font-family: var(--f-text); font-size: 9.5pt; line-height: 1.42; color: var(--text); }
  .wrap { border: 0; padding: 0; min-height: 0; }
  .wrap { max-width: none; }
  a { color: inherit; border: 0; }
  .out a:not(.case) { color: var(--signal); } /* links stay clickable in the PDF */
  .print-only { display: revert !important; }
  .screen-only, .skip, .top, .tui, .boot, #announce, .hint,
  .home #transcript > section[id^="work-"], .home #work, .home #tools, .home #contact, .pager, .tags, .back { display: none !important; }
  .js body { overflow: visible; }
  .js .wrap { display: block; }

  .js #transcript, #transcript { display: flex; flex-direction: column; }
  #whoami { order: 1; } #cv { order: 2; }

  #whoami { padding: 0 0 10pt; border-bottom: 1.2pt solid var(--text); }
  #whoami .cmdline { display: none; }
  .name { font-family: var(--f-display); font-variation-settings: "wdth" 112; font-stretch: 112%; font-weight: 700; font-size: 26pt; line-height: 1; }
  .role { margin-top: 6pt; font-size: 11pt; max-width: none; color: var(--text-2); }
  .print-contact { margin-top: 6pt; font-size: 8.5pt; color: var(--muted); }
  .print-contact a { color: var(--text); }

  .block { display: block; border-top: 0; padding: 14pt 0 0; }
  .cmdline { position: static; margin: 0 0 5pt; font-size: 8pt; color: var(--muted); border-bottom: .6pt solid var(--rule); padding-bottom: 2pt; }
  .cmdline .ps { display: none; }
  .cmdline .d { color: var(--signal); }
  .out { display: block; }
  .out > * + * { margin-top: 7pt; }
  .h { font-family: var(--f-display); font-size: 13pt; max-width: none; break-after: avoid; }
  .h.sr-only { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none; white-space: normal; }
  p, .row ul, .case .hit { max-width: none; }
  .lede { font-size: 10pt; max-width: none; }
  .label, .group-label { font-size: 7pt; color: var(--muted); }


  .rows { display: block; }
  .row { display: block; margin-top: 9pt; }
  .row li { break-inside: avoid; }
  .row .when { display: block; font-size: 8pt; padding: 0; }
  .row ul { margin-top: 3pt; gap: 2pt; }
  .row li { padding-left: 11pt; color: var(--text-2); }
  .skills { display: block; margin-top: 10pt; }
  .skills > div { margin-top: 4pt; }
  .skills .label { display: inline; margin-right: 6pt; }
  .skills ul { display: inline; margin: 0; font-size: 8.5pt; line-height: 1.5; }
  .skills li { display: inline; color: var(--text-2) !important; }
  .skills li + li::before { content: " · "; color: var(--muted); }

  .selected { margin-top: 12pt; break-inside: avoid; }
  .selected .h { margin-bottom: 4pt; }
  .sel { list-style: none; margin: 0; padding: 0; }
  .sel li { padding: 3pt 0; border-top: .6pt solid var(--rule); font-size: 9pt; }
  .sel .num { font-size: 9.5pt; letter-spacing: 0; margin-right: 6pt; }
  .sel a { font-family: var(--f-mono); font-size: 7.5pt; margin-left: 6pt; }
  .selected > p { margin-top: 5pt; font-size: 8.5pt; color: var(--muted); }

  .group { display: block; margin-top: 8pt; }
  .group-label { padding: 0 0 2pt; }
  .cases { display: block; }
  .case { display: block; padding: 4pt 0 5pt; border-top: .6pt solid var(--rule); break-inside: avoid; }
  .case .num { display: inline; font-size: 11pt; line-height: 1.2; letter-spacing: -.01em; }
  .case .unit { display: inline; margin-left: 6pt; font-size: 7.5pt; color: var(--muted); }
  .case .t { display: block; font-size: 10pt; margin-top: 1pt; }
  .case .hit { display: block; font-size: 9pt; line-height: 1.38; color: var(--text-2); margin-top: 1pt; }

  .table-wrap { overflow: visible; }
  .table th, .table td { padding: 4pt 10pt 4pt 0; font-size: 8.5pt; }
  .table th { font-size: 7pt; }
  .table td.stack { font-size: 7.5pt; }
  .table tr { break-inside: avoid; }


  .kv { grid-template-columns: 7em minmax(0, 1fr); gap: 2pt 12pt; font-size: 8.5pt; }
  .kv a { color: var(--text); }
}
