/* E-Ink / Calm Tech — antjanus.com redesign 051
   Every color below is one of the sixteen grey levels a 4-bit E Ink panel can show
   (#000, #111 … #eee, #fff). Nothing moves: state changes are instant, like a panel refresh. */

:root {
  --level-0: #000; --level-1: #111; --level-2: #222; --level-3: #333; --level-4: #444;
  --level-5: #555; --level-6: #666; --level-7: #777; --level-8: #888; --level-9: #999;
  --level-10: #aaa; --level-11: #bbb; --level-12: #ccc; --level-13: #ddd; --level-14: #eee; --level-15: #fff;

  --bezel: var(--level-2);
  --bezel-text: var(--level-10);
  --paper: var(--level-14);
  --paper-sunk: var(--level-13);
  --paper-raised: var(--level-15);
  --ink: var(--level-1);
  --ink-soft: var(--level-4);
  --rule: var(--level-1);
  --rule-faint: var(--level-11);
  --image-dim: 1;

  --font-read: "Literata", Georgia, "Times New Roman", serif;
  --font-ui: "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
  --font-code: "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1.125rem;
  --step-1: 1.3125rem;
  --step-2: 1.625rem;
  --step-3: 2.125rem;
  --step-4: 2.875rem;
  --step-5: 3.75rem;

  --space-1: 0.25rem; --space-2: 0.5rem; --space-3: 0.75rem; --space-4: 1rem;
  --space-5: 1.5rem; --space-6: 2rem; --space-7: 3rem; --space-8: 4.5rem;

  --radius: 6px;
  --screen-max: 1240px;
  --measure: 66ch;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bezel: var(--level-0);
  --bezel-text: var(--level-9);
  --paper: var(--level-1);
  --paper-sunk: var(--level-2);
  --paper-raised: var(--level-0);
  --ink: var(--level-14);
  --ink-soft: var(--level-11);
  --rule: var(--level-13);
  --rule-faint: var(--level-4);
  --image-dim: 0.82;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bezel: var(--level-0);
    --bezel-text: var(--level-9);
    --paper: var(--level-1);
    --paper-sunk: var(--level-2);
    --paper-raised: var(--level-0);
    --ink: var(--level-14);
    --ink-soft: var(--level-11);
    --rule: var(--level-13);
    --rule-faint: var(--level-4);
    --image-dim: 0.82;
    color-scheme: dark;
  }
}

/* The panel cannot animate. Neither does the page. */
*, *::before, *::after { box-sizing: border-box; transition: none !important; animation: none !important; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bezel);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
p { margin: 0 0 var(--space-4); }
h1, h2, h3, h4 { font-family: var(--font-read); font-weight: 650; line-height: 1.2; margin: 0 0 var(--space-3); text-wrap: balance; }
h1 { font-size: var(--step-4); line-height: 1.08; letter-spacing: -0.01em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-1); line-height: 1.3; }
ul, ol { margin: 0; padding: 0; }
code { font-family: var(--font-code); font-size: 0.9em; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.skip { position: absolute; left: -9999px; top: 0; }
.skip:focus { left: var(--space-4); top: var(--space-4); z-index: 50; background: var(--ink); color: var(--paper); padding: var(--space-3) var(--space-4); border-radius: var(--radius); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Device: bezel + screen ---------- */
.device { padding: var(--space-6) var(--space-6) 0; }
.screen {
  max-width: var(--screen-max);
  margin: 0 auto;
  background: var(--paper);
  border-radius: 14px;
  min-height: 80vh;
  overflow: hidden;
}
.bezel-mark {
  text-align: center;
  color: var(--bezel-text);
  font-family: var(--font-ui);
  font-size: var(--step--1);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  padding: var(--space-4) 0 var(--space-5);
}
@media (max-width: 720px) {
  .device { padding: 0; }
  .screen { border-radius: 0; }
  .bezel-mark { padding: var(--space-3) 0; }
}

.wrap { padding-inline: clamp(1rem, 4vw, 3.5rem); }

/* ---------- Status bar ---------- */
.status {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  padding: var(--space-3) clamp(1rem, 4vw, 3.5rem);
  border-bottom: 2px solid var(--rule);
  font-size: var(--step--1);
}
.brand { display: inline-flex; align-items: center; gap: var(--space-3); text-decoration: none; min-height: 44px; }
.brand svg { width: 34px; height: 40px; flex: none; }
.brand-words { display: flex; flex-direction: column; line-height: 1.1; }
.brand-words small { font-size: var(--step--1); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-soft); }
.brand-words strong { font-family: var(--font-read); font-size: 1.25rem; letter-spacing: 0.02em; }
.status-right { display: flex; align-items: center; gap: var(--space-4); color: var(--ink-soft); }
.status-note { white-space: nowrap; }
@media (max-width: 560px) { .status-note { display: none; } }

.invert {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 44px; padding: 0 var(--space-4);
  background: transparent; color: var(--ink);
  border: 2px solid var(--rule); border-radius: 999px; cursor: pointer;
  font-size: var(--step--1); font-weight: 700;
}
.invert svg { width: 18px; height: 18px; }
.invert:hover, .invert[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- Toolbar nav (never a slide-out menu) ---------- */
.toolbar { border-bottom: 1px solid var(--rule); }
.toolbar ul {
  list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
}
.toolbar li + li { border-left: 1px solid var(--rule); }
.toolbar a {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 52px; padding: var(--space-2);
  text-decoration: none; font-weight: 700; font-size: 1rem;
}
.toolbar a:hover { background: var(--paper-sunk); }
.toolbar a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.toolbar a[aria-current="page"]::before { content: "▸"; }
@media (max-width: 760px) {
  .toolbar ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .toolbar li { border-bottom: 1px solid var(--rule); }
  .toolbar li:nth-child(4n + 1) { border-left: 0; }
  .toolbar ul { margin-bottom: -1px; }
  .toolbar a { font-size: 0.9375rem; min-height: 48px; }
  .toolbar a[aria-current="page"]::before { content: none; }
}

/* ---------- Page head ---------- */
.eyebrow {
  font-family: var(--font-ui); font-size: var(--step--1); font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft);
  margin: 0 0 var(--space-3);
}
.pagehead { padding-block: var(--space-7) var(--space-6); border-bottom: 1px solid var(--rule); }
.pagehead .lede { max-width: 44ch; }
.lede { font-family: var(--font-read); font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); }
.pagehead-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--space-7); align-items: end; }
@media (max-width: 860px) { .pagehead-grid { grid-template-columns: 1fr; gap: var(--space-5); } }

/* ---------- Sections ---------- */
.section { padding-block: var(--space-7); border-bottom: 1px solid var(--rule); }
.section:last-of-type { border-bottom: 0; }
.section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) var(--space-5); margin-bottom: var(--space-5); }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--ink-soft); }
.section-head .more { font-weight: 700; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--space-7); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: var(--space-7); }
@media (max-width: 860px) { .two-col, .split { grid-template-columns: 1fr; gap: var(--space-6); } }

/* ---------- Links & buttons ---------- */
a { text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 3px; }
.more { text-decoration: underline; white-space: nowrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 var(--space-5);
  border: 2px solid var(--rule); border-radius: var(--radius);
  background: transparent; color: var(--ink);
  font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--paper-sunk); }
.btn:active { background: var(--ink); color: var(--paper); }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--paper); color: var(--ink); }
.btn--quiet { border-color: transparent; text-decoration: underline; padding-inline: var(--space-2); }
.btn--quiet:hover { background: transparent; text-decoration-thickness: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* ---------- Ink images: grayscale, posterised, halftone ---------- */
.ink { position: relative; background: var(--paper-sunk); overflow: hidden; border: 1px solid var(--rule); }
.ink img { width: 100%; height: 100%; object-fit: cover; filter: url(#eink) grayscale(1) contrast(1.08) brightness(var(--image-dim)); }
.ink::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(0,0,0,.22) 0.8px, transparent 1.1px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}
.ink--fallback { display: grid; place-items: center; color: var(--ink-soft); font-family: var(--font-read); font-style: italic; }
.ratio-wide { aspect-ratio: 16 / 9; }
.ratio-card { aspect-ratio: 4 / 3; }
.ratio-portrait { aspect-ratio: 4 / 5; }

/* ---------- Home: hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); border-bottom: 2px solid var(--rule); }
.hero .ink { border: 0; border-right: 2px solid var(--rule); min-height: 100%; }
.hero-copy { padding: var(--space-8) clamp(1rem, 4vw, 3.5rem) var(--space-7); display: flex; flex-direction: column; justify-content: center; }
.hero-copy h1 { font-size: var(--step-5); max-width: 13ch; }
.hero-copy .lede { max-width: 40ch; margin-bottom: var(--space-6); }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero .ink { border-right: 0; border-bottom: 2px solid var(--rule); aspect-ratio: 4 / 3; }
  .hero-copy { padding-block: var(--space-6); }
  .hero-copy h1 { font-size: var(--step-4); }
}

/* Plain stat table, instead of stat cards */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 2px solid var(--rule); margin: 0 0 var(--space-6); }
.stats div { padding: var(--space-3) var(--space-4); }
.stats div + div { border-left: 1px solid var(--rule); }
.stats dt { font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.stats dd { margin: 0; font-family: var(--font-read); font-size: var(--step-3); font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
@media (max-width: 420px) { .stats dd { font-size: var(--step-2); } .stats div { padding: var(--space-3); } }

/* ---------- Library list (e-reader list view) ---------- */
.library { list-style: none; border-top: 2px solid var(--rule); }
.library > li { border-bottom: 1px solid var(--rule); }
.entry {
  display: grid; grid-template-columns: 132px minmax(0, 1fr) 150px; gap: var(--space-5);
  padding: var(--space-4) 0; align-items: start;
}
.entry .ink { aspect-ratio: 4 / 3; }
.entry h3 { margin-bottom: var(--space-2); }
.entry h3 a { text-decoration: none; }
.entry h3 a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.entry p { margin: 0; color: var(--ink-soft); }
.entry-meta { font-size: var(--step--1); color: var(--ink-soft); text-align: right; line-height: 1.5; }
.entry-meta strong { display: block; color: var(--ink); font-size: 1rem; }
.entry--text { grid-template-columns: minmax(0, 1fr) 150px; }
.entry .glyph { width: 132px; aspect-ratio: 4 / 3; border: 1px solid var(--rule); display: grid; place-items: center; background: var(--paper-sunk); }
.entry .glyph svg { width: 56px; height: 56px; }
@media (max-width: 760px) {
  .entry { grid-template-columns: 88px minmax(0, 1fr); gap: var(--space-4); }
  .entry .glyph { width: 88px; }
  .entry .glyph svg { width: 40px; height: 40px; }
  .entry-meta { grid-column: 2; text-align: left; }
  .entry-meta strong { display: inline; margin-right: var(--space-2); }
  .entry--text { grid-template-columns: 1fr; }
  .entry--text .entry-meta { grid-column: 1; }
}
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin-top: var(--space-3); }
.tag { display: inline-block; font-size: var(--step--1); border: 1px solid var(--rule); border-radius: 999px; padding: 0 var(--space-3); line-height: 1.9; text-decoration: none; }
a.tag:hover { background: var(--ink); color: var(--paper); }
.mark { font-weight: 700; font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; }
.mark::before { content: "■ "; }

/* ---------- Shelf (cover grid) ---------- */
.shelf { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
.cover a { text-decoration: none; display: block; }
.cover .ink { aspect-ratio: 4 / 3; margin-bottom: var(--space-3); border-width: 2px; }
.cover h3 { margin-bottom: var(--space-2); }
.cover a:hover h3 { text-decoration: underline; text-decoration-thickness: 3px; }
.cover p { color: var(--ink-soft); margin: 0; }
.cover .eyebrow { margin-bottom: var(--space-2); }
@media (max-width: 860px) { .shelf { grid-template-columns: 1fr; gap: var(--space-6); } }
@media (min-width: 561px) and (max-width: 860px) { .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Boxes ---------- */
.box { border: 2px solid var(--rule); border-radius: var(--radius); padding: var(--space-5); }
.box h3 { margin-bottom: var(--space-3); }
.box--solid { background: var(--ink); color: var(--paper); }
.box--solid .btn { border-color: var(--paper); color: var(--paper); }
.box--solid .btn:hover { background: var(--paper); color: var(--ink); }
.box--sunk { background: var(--paper-sunk); border-width: 1px; }
.box-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 860px) { .box-grid { grid-template-columns: 1fr; } }
.plain-list { list-style: none; }
.plain-list li { display: flex; justify-content: space-between; gap: var(--space-4); padding: var(--space-2) 0; border-bottom: 1px dotted var(--rule-faint); }
.plain-list li:last-child { border-bottom: 0; }
.plain-list span { color: var(--ink-soft); white-space: nowrap; }
.box--solid .plain-list span { color: inherit; }

/* Collections index (home + writing) */
.collections { list-style: none; border-top: 2px solid var(--rule); }
.collections li { border-bottom: 1px solid var(--rule); }
.collections a {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-4); align-items: baseline;
  padding: var(--space-4) var(--space-3); text-decoration: none;
}
.collections a:hover { background: var(--ink); color: var(--paper); }
.collections a:hover .soft { color: inherit; }
.collections strong { font-family: var(--font-read); font-size: var(--step-1); }
.collections .soft { display: block; color: var(--ink-soft); font-size: 1rem; }
.collections .count { font-family: var(--font-read); font-size: var(--step-2); font-variant-numeric: tabular-nums; }

/* ---------- Pager ---------- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding-top: var(--space-4); }
.pager[hidden] { display: none; }
.pager-status { font-weight: 700; font-variant-numeric: tabular-nums; }
.pager .btn[aria-disabled="true"] { opacity: 1; color: var(--ink-soft); border-style: dashed; cursor: not-allowed; }
.pager .btn[aria-disabled="true"]:hover { background: transparent; }

/* ---------- Filters (applied on Enter, never on keystroke) ---------- */
.filters { display: grid; gap: var(--space-4); margin-bottom: var(--space-5); }
.search-row { display: flex; gap: var(--space-2); }
.field {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 var(--space-4);
  background: var(--paper-raised); color: var(--ink);
  border: 2px solid var(--rule); border-radius: var(--radius);
}
.field::placeholder { color: var(--ink-soft); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  min-height: 44px; padding: 0 var(--space-4); border: 1px solid var(--rule); border-radius: 999px;
  background: transparent; cursor: pointer; font-weight: 700; font-size: 1rem;
}
.chip:hover { background: var(--paper-sunk); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.chip[aria-pressed="true"]::before { content: "✓ "; }
.result-line { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); color: var(--ink-soft); }
.result-line select { min-height: 44px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); padding: 0 var(--space-3); }
.empty { border: 2px dashed var(--rule); border-radius: var(--radius); padding: var(--space-6); text-align: center; }
.empty[hidden] { display: none; }
.hint { font-size: var(--step--1); color: var(--ink-soft); margin: 0; }

/* ---------- Jump row ---------- */
.jump { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; padding-block: var(--space-4); border-bottom: 1px solid var(--rule); align-items: center; }
.jump a { display: inline-flex; min-height: 44px; align-items: center; padding: 0 var(--space-4); border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 1rem; }
.jump a:hover { background: var(--ink); color: var(--paper); }

/* ---------- Projects ---------- */
.feature { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); border: 2px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.feature .ink { border: 0; border-right: 2px solid var(--rule); min-height: 320px; }
.feature-body { padding: var(--space-6); }
@media (max-width: 860px) { .feature { grid-template-columns: 1fr; } .feature .ink { border-right: 0; border-bottom: 2px solid var(--rule); min-height: 0; aspect-ratio: 16/9; } .feature-body { padding: var(--space-5); } }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid var(--rule); margin: var(--space-5) 0; }
.mini-stats div { padding: var(--space-2) var(--space-3); }
.mini-stats div + div { border-left: 1px solid var(--rule); }
.mini-stats dt { font-size: var(--step--1); color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.mini-stats dd { margin: 0; font-family: var(--font-read); font-size: var(--step-2); font-weight: 650; font-variant-numeric: tabular-nums; }

.ledger { width: 100%; border-collapse: collapse; font-size: 1rem; }
.ledger caption { text-align: left; }
.ledger th, .ledger td { text-align: left; padding: var(--space-3); border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger thead th { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.1em; border-bottom: 2px solid var(--rule); color: var(--ink-soft); }
.ledger td.num, .ledger th.num { text-align: right; font-variant-numeric: tabular-nums; }
.ledger td:first-child { font-family: var(--font-read); font-weight: 650; font-size: var(--step-0); }
.table-scroll { overflow-x: auto; }
@media (max-width: 640px) {
  .ledger thead { display: none; }
  .ledger tr { display: block; border-bottom: 1px solid var(--rule); padding: var(--space-3) 0; }
  .ledger td { display: block; border: 0; padding: var(--space-1) 0; }
  .ledger td.num { text-align: left; }
  .ledger td[data-label]::before { content: attr(data-label) ": "; font-weight: 700; color: var(--ink-soft); }
}

/* ---------- About ---------- */
.portrait-head { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--space-7); align-items: center; }
.portrait-head .ink { aspect-ratio: 4 / 5; border-width: 2px; }
@media (max-width: 860px) { .portrait-head { grid-template-columns: 1fr; } .portrait-head .ink { max-width: 360px; } }
.timeline { list-style: none; border-left: 2px solid var(--rule); margin-left: var(--space-2); }
.timeline > li { position: relative; padding: 0 0 var(--space-6) var(--space-6); }
.timeline > li::before { content: ""; position: absolute; left: -9px; top: 0.45em; width: 16px; height: 16px; background: var(--paper); border: 2px solid var(--rule); }
.timeline > li:first-child::before { background: var(--ink); }
.timeline .period { font-weight: 700; font-size: var(--step--1); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.roles { list-style: none; margin-top: var(--space-3); }
.roles li { padding: var(--space-1) 0; }
.roles li span { color: var(--ink-soft); }
.career-bar { display: flex; flex-wrap: wrap; border: 2px solid var(--rule); border-radius: var(--radius); overflow: hidden; margin-bottom: var(--space-6); list-style: none; }
.career-bar li { flex: 1 1 140px; padding: var(--space-3); border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); margin: 0 -1px -1px 0; }
.career-bar li:first-child { background: var(--ink); color: var(--paper); }
.career-bar strong { display: block; font-family: var(--font-read); }
.career-bar span { font-size: var(--step--1); }
details.disclose > summary { cursor: pointer; list-style: none; display: inline-flex; }
details.disclose > summary::-webkit-details-marker { display: none; }
details.disclose > summary .btn::after { content: " ▾"; }
details.disclose[open] > summary .btn::after { content: " ▴"; }
details.disclose[open] > summary { margin-bottom: var(--space-6); }
.proverbs { list-style: none; counter-reset: proverb; }
.proverbs li { counter-increment: proverb; display: grid; grid-template-columns: 3rem minmax(0,1fr); padding: var(--space-3) 0; border-bottom: 1px solid currentColor; font-family: var(--font-read); font-style: italic; font-size: var(--step-1); }
.proverbs li::before { content: counter(proverb, upper-roman) "."; font-style: normal; font-weight: 700; font-family: var(--font-ui); font-size: 1rem; padding-top: 0.25em; }
.skills-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-5); }
@media (max-width: 760px) { .skills-grid { grid-template-columns: 1fr; } }
.skills-grid ul { list-style: none; margin-top: var(--space-3); }
.skills-grid li { padding: var(--space-1) 0; border-top: 1px dotted var(--rule-faint); }
.box--solid .skills-grid li { border-top-color: currentColor; }

/* ---------- Sleep screen (calm, peripheral) ---------- */
.sleep { border: 2px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--paper-raised); position: relative; }
.sleep img, .sleep svg { width: 100%; height: auto; display: block; }
.sleep figcaption { border-top: 2px solid var(--rule); padding: var(--space-3) var(--space-4); font-size: var(--step--1); color: var(--ink-soft); display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; background: var(--paper); }
.sleep-art { stroke: var(--ink); fill: none; }
.sleep .asset { position: absolute; inset: 0; bottom: auto; }

/* ---------- Article reader ---------- */
.reader-head { padding-block: var(--space-6) var(--space-5); }
.running { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; font-size: var(--step--1); color: var(--ink-soft); border-bottom: 1px solid var(--rule); padding-bottom: var(--space-3); margin-bottom: var(--space-6); }
.running a { font-weight: 700; color: var(--ink); }
.reader-head h1 { max-width: 20ch; font-size: clamp(2.25rem, 5vw, 3.75rem); }
.reader-head .lede { max-width: 48ch; }
.reader-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-5); font-size: 1rem; color: var(--ink-soft); list-style: none; margin-top: var(--space-4); }
.reader-meta li::before { content: "· "; }
.reader-meta li:first-child::before { content: none; }
.reader-hero { margin: 0 0 var(--space-7); }
.reader-hero .ink { aspect-ratio: 21 / 8; border-width: 2px; }
.reader-hero figcaption { font-size: var(--step--1); color: var(--ink-soft); padding-top: var(--space-2); }

.reader { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: var(--space-7); padding-bottom: var(--space-7); }
.toc { position: sticky; top: var(--space-4); align-self: start; font-size: 1rem; }
.toc h2 { font-family: var(--font-ui); font-size: var(--step--1); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: var(--space-3); }
.toc ol { list-style: none; border-top: 2px solid var(--rule); }
.toc li { border-bottom: 1px solid var(--rule-faint); }
.toc a { display: grid; grid-template-columns: 1.5rem minmax(0,1fr); padding: var(--space-2) 0; text-decoration: none; line-height: 1.35; min-height: 44px; align-items: center; }
.toc a:hover { text-decoration: underline; }
.toc a::before { content: ""; }
.toc a[aria-current="true"] { font-weight: 700; }
.toc a[aria-current="true"]::before { content: "▸"; }
.toc-mobile { display: none; }
.aside-col { font-size: 1rem; color: var(--ink-soft); }
.aside-col .box { position: sticky; top: var(--space-4); color: var(--ink); }
.toc-note { margin-top: var(--space-6); padding: var(--space-4); }
.toc-note p { font-size: 1rem; }
.toc-note p:last-child { margin: 0; }
@media (max-width: 900px) {
  .reader { grid-template-columns: 1fr; gap: 0; }
  .toc { display: none; }
  .toc-mobile { display: block; border: 2px solid var(--rule); border-radius: var(--radius); margin-bottom: var(--space-6); }
  .toc-mobile summary { min-height: 48px; display: flex; align-items: center; padding: 0 var(--space-4); font-weight: 700; cursor: pointer; }
  .toc-mobile ol { padding: 0 var(--space-4) var(--space-3) var(--space-7); }
  .toc-mobile li { padding: var(--space-1) 0; }
}

.prose { font-family: var(--font-read); font-size: 1.25rem; line-height: 1.7; min-width: 0; }
.prose > * { max-width: var(--measure); }
.prose h2 { font-size: var(--step-3); margin: var(--space-7) 0 var(--space-4); padding-top: var(--space-4); border-top: 2px solid var(--rule); scroll-margin-top: var(--space-4); }
.prose p, .prose ol, .prose ul { margin: 0 0 var(--space-5); }
.prose ol, .prose ul { padding-left: 1.5em; }
.prose li { margin-bottom: var(--space-2); }
.prose li::marker { font-weight: 700; }
.prose code { background: var(--paper-sunk); padding: 0.05em 0.3em; border-radius: 3px; font-size: 0.85em; }
.prose em { font-style: italic; }

.callout { font-family: var(--font-ui); font-size: var(--step-0); line-height: 1.6; margin: 0 0 var(--space-5); padding: var(--space-4) var(--space-5); }
.callout p:last-child { margin: 0; }
.callout-label { display: block; font-weight: 700; font-size: var(--step--1); letter-spacing: .14em; text-transform: uppercase; margin-bottom: var(--space-1); }
.callout--why { border-left: 6px solid var(--rule); background: var(--paper-sunk); }
.callout--ask { border: 2px dashed var(--rule); border-radius: var(--radius); }
.callout--ask .reply { display: inline-block; margin-top: var(--space-2); font-weight: 700; }
.callout--note { border: 2px solid var(--rule); border-radius: var(--radius); }
.callout--skill { background: var(--ink); color: var(--paper); border-radius: var(--radius); }
.callout--skill code { background: transparent; border: 1px solid currentColor; }

.code { margin: 0 0 var(--space-6); border: 2px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); max-width: calc(var(--measure) + 6rem) !important; }
.code-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--rule); padding-left: var(--space-4); font-family: var(--font-ui); font-size: var(--step--1); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.code-bar button { min-height: 40px; min-width: 88px; border: 0; border-left: 1px solid var(--rule); background: transparent; cursor: pointer; font-weight: 700; font-size: var(--step--1); letter-spacing: .06em; text-transform: uppercase; }
.code-bar button:hover { background: var(--ink); color: var(--paper); }
.code pre { margin: 0; padding: var(--space-4); overflow-x: auto; font-family: var(--font-code); font-size: 0.9375rem; line-height: 1.6; tab-size: 2; }
.code pre code { background: none; padding: 0; font-size: inherit; }
.code .c { font-style: italic; color: var(--ink-soft); }

.after { border-top: 2px solid var(--rule); padding-top: var(--space-6); display: grid; gap: var(--space-6); }
.share-row { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* Fixed page counter — the one piece of chrome that updates while you read */
.pagebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--paper); border-top: 2px solid var(--rule);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-3); min-height: 52px; font-size: 1rem;
}
.pagebar button { min-height: 44px; min-width: 44px; padding: 0 var(--space-3); border: 1px solid var(--rule); border-radius: var(--radius); background: transparent; font-weight: 700; cursor: pointer; }
.pagebar button:hover { background: var(--ink); color: var(--paper); }
.pagebar-mid { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.pagebar-count { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.segments { display: grid; grid-template-columns: repeat(20, 1fr); gap: 2px; flex: 1; min-width: 60px; height: 12px; }
.segments span { border: 1px solid var(--rule); }
.segments span.on { background: var(--ink); }
.pagebar-section { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-soft); max-width: 22ch; }
@media (max-width: 640px) { .pagebar-section { display: none; } .pagebar .label-long { display: none; } }
body.has-pagebar .device { padding-bottom: 60px; }

/* ---------- Patterns ---------- */
.three-ways { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 2px solid var(--rule); border-radius: var(--radius); }
.three-ways > div { padding: var(--space-5); }
.three-ways > div + div { border-left: 1px solid var(--rule); }
.three-ways h3 { font-family: var(--font-ui); font-size: var(--step-0); }
.three-ways p { margin: 0; }
.three-ways-foot { grid-column: 1 / -1; border-top: 1px solid var(--rule); background: var(--paper-sunk); }
@media (max-width: 860px) { .three-ways { grid-template-columns: 1fr; } .three-ways > div + div { border-left: 0; border-top: 1px solid var(--rule); } }
.pattern-grid { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; border-top: 2px solid var(--rule); }
.pattern-grid > li { border-bottom: 1px solid var(--rule); padding: var(--space-5) var(--space-5) var(--space-5) 0; display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: var(--space-4); }
.pattern-grid > li:nth-child(odd of :not([hidden])) { border-right: 1px solid var(--rule); }
.pattern-grid > li:nth-child(even of :not([hidden])) { padding-left: var(--space-5); }
.pattern-grid h3 { margin-bottom: var(--space-2); }
.pattern-grid h3 a { text-decoration: none; }
.pattern-grid h3 a:hover { text-decoration: underline; text-decoration-thickness: 3px; }
.pattern-grid p { margin: 0 0 var(--space-2); }
.pattern-grid .good { color: var(--ink-soft); font-size: 1rem; }
.pglyph { width: 72px; height: 72px; border: 1px solid var(--rule); display: grid; place-items: center; background: var(--paper-sunk); }
.pglyph svg { width: 44px; height: 44px; }
.pmeta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--step--1); color: var(--ink-soft); margin-bottom: var(--space-1); align-items: center; }
.pmeta .cat { font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink); }
.badge { border: 1px solid var(--rule); padding: 0 var(--space-2); font-weight: 700; color: var(--ink); letter-spacing: .06em; text-transform: uppercase; }
.badge--new { background: var(--ink); color: var(--paper); }
@media (max-width: 860px) {
  .pattern-grid { grid-template-columns: 1fr; }
  .pattern-grid > li { padding: var(--space-4) 0 !important; border-right: 0 !important; grid-template-columns: 56px minmax(0, 1fr); }
  .pglyph { width: 56px; height: 56px; }
  .pglyph svg { width: 34px; height: 34px; }
}

.back { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.usecases { columns: 2; column-gap: var(--space-7); list-style: none; }
.usecases li { break-inside: avoid; padding: var(--space-2) 0; border-bottom: 1px dotted var(--rule-faint); }
.usecases li::before { content: "▸ "; }
@media (max-width: 640px) { .usecases { columns: 1; } }

.panes { border: 2px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.panes-bar { display: flex; flex-wrap: wrap; justify-content: space-between; border-bottom: 2px solid var(--rule); }
.tabs { display: flex; flex-wrap: wrap; }
.tabs button { min-height: 48px; padding: 0 var(--space-4); border: 0; border-right: 1px solid var(--rule); background: transparent; font-weight: 700; cursor: pointer; font-size: 1rem; }
.tabs button:hover { background: var(--paper-sunk); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.pane-actions { display: flex; }
.pane-actions button { min-height: 48px; padding: 0 var(--space-4); border: 0; border-left: 1px solid var(--rule); background: transparent; font-weight: 700; cursor: pointer; font-size: 1rem; }
.pane-actions button:hover { background: var(--ink); color: var(--paper); }
.pane-actions button[hidden] { display: none; }
@media (max-width: 640px) { .pane-actions { width: 100%; border-top: 1px solid var(--rule); } .pane-actions button { flex: 1; } .pane-actions button:first-child { border-left: 0; } }
.pane { padding: var(--space-5); }
.pane[hidden] { display: none; }
.pane pre { margin: 0; overflow-x: auto; font-family: var(--font-code); font-size: 0.9375rem; line-height: 1.6; }
.pane .note { font-size: 1rem; background: var(--paper-sunk); padding: var(--space-3) var(--space-4); border-left: 4px solid var(--rule); margin-bottom: var(--space-4); }
.prompt-text { font-family: var(--font-read); max-width: var(--measure); }

/* The pattern itself, drawn in the 16 greys */
.hss-caption { font-size: 1rem; color: var(--ink-soft); margin: 0 0 var(--space-3); }
.hss-strip {
  display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
  grid-template-columns: 1fr; margin-bottom: var(--space-6);
}
@media (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 52rem) { .hss-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); } .hss-strip--five { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.hss-tile { background: var(--paper); padding: var(--space-3) var(--space-4); min-width: 0; text-align: left; border: 0; font: inherit; color: inherit; }
.hss-label { display: block; font-family: var(--font-code); font-size: 0.8125rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-soft); overflow-wrap: anywhere; }
.hss-figure { display: block; font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.hss-figure.missing { color: var(--ink-soft); }
.hss-sub { display: block; font-size: var(--step--1); color: var(--ink-soft); }
button.hss-tile { cursor: pointer; min-height: 44px; }
button.hss-tile:hover { background: var(--paper-sunk); }
button.hss-tile[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
button.hss-tile[aria-pressed="true"] .hss-label, button.hss-tile[aria-pressed="true"] .hss-sub { color: inherit; }
.hss-list { list-style: none; border-top: 1px solid var(--rule); }
.hss-list li { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-bottom: 1px solid var(--rule-faint); flex-wrap: wrap; }
.hss-list li span { font-weight: 700; }
.hss-status { font-size: 1rem; margin: var(--space-3) 0 0; font-weight: 700; }

/* ---------- Newsletter ---------- */
.subscribe { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.subscribe .field { flex: 1 1 220px; }
.subscribe-done { font-weight: 700; }

/* ---------- Footer ---------- */
.foot { border-top: 2px solid var(--rule); padding-block: var(--space-7) var(--space-5); }
.foot-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)) minmax(0, 1.6fr); gap: var(--space-6); }
.foot h2 { font-family: var(--font-ui); font-size: var(--step--1); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: var(--space-3); }
.foot ul { list-style: none; }
.foot li a { display: inline-flex; min-height: 36px; align-items: center; }
.foot-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-3); border-top: 1px solid var(--rule); margin-top: var(--space-6); padding-top: var(--space-4); font-size: var(--step--1); color: var(--ink-soft); }
@media (max-width: 860px) { .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .foot-grid > :first-child, .foot-grid > :last-child { grid-column: 1 / -1; } }

/* Story notice */
.notice { border: 2px solid var(--rule); border-radius: var(--radius); padding: var(--space-4) var(--space-5); background: var(--paper-sunk); }

@media print {
  body { background: #fff; }
  .device { padding: 0; }
  .toolbar, .status .invert, .pagebar, .bezel-mark { display: none; }
}

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.hero .ink img { object-position: 30% 30%; }
.prose-list li { margin-bottom: var(--space-2); }

[hidden] { display: none !important; }
@media (max-width: 51.99rem) { .hss-strip--five .hss-tile:last-child:nth-child(odd) { grid-column: 1 / -1; } }

.prose-fig { margin: 0 0 var(--space-5); }
.prose-fig .ink { border-width: 2px; }
.prose-fig .ink img { height: auto; display: block; }
