/* =========================================================================
   jcoffey.dev

   The same shell as coffeylabs.org -- a top bar, a sidebar of tinted tiles
   that folds to a rail, content on a sunk ground with cards on top, and
   sectioned pages in the inbuxa.org manner -- in this site's own palette.

   1. PALETTE -- the only place a color is written down: the terminal desk,
      a warm olive ground with an amber accent, derived from LINUXexpert.org.
   2. SHELL + COMPONENTS -- tokens only, shared in shape with coffeylabs.org.

   Dark is the default -- bare :root is the dark palette. Light arrives two
   ways, and both are needed: prefers-color-scheme for a visitor who never
   touches the switch, and [data-theme="light"] for one who does. The
   :not([data-theme="dark"]) guard stops the media query overriding somebody
   who explicitly asked for dark on a light desktop.
   ========================================================================= */

/* ---- 1. palette ---- */
:root {
  --ground: #12140F;
  --ground-alt: #15180F;
  --chrome: #171A13;
  --surface: #1B1E17;
  --surface-2: #21241A;
  --raised: #262A1D;
  --ink: #E7E3D3;
  --ink-soft: #A39E8D;
  --ink-faint: #6E6A5C;
  --line: #2A2C22;
  --line-strong: #3B3E30;
  --accent: #E0A233;
  --accent-hot: #F0B955;
  --accent-ink: #1B1305;
  --tint: rgba(224, 162, 51, 0.12);
  --glow: rgba(224, 162, 51, 0.18);
  --grid-line: rgba(224, 162, 51, 0.05);
  --live: #9BC266;
  --warm: #D9774A;
  --accent-2: #C9B27A;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.85);

  --tone-amber: #E0A233;
  --tone-olive: #B3C263;
  --tone-sage: #86B893;
  --tone-teal: #62B8AA;
  --tone-rust: #E0845A;
  --tone-plum: #C897C0;
  --tone-sand: #D2BD86;
  --tone-stone: #A39E8D;
  --tone-mix: 16%;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ground: #EDEAE0; --ground-alt: #E6E2D4; --chrome: #FFFFFF; --surface: #FFFFFF;
    --surface-2: #F4F0E4; --raised: #FFFFFF; --ink: #211E14; --ink-soft: #5B5646;
    --ink-faint: #8B8571; --line: #DAD5C4; --line-strong: #C6BFA8; --accent: #A2670F;
    --accent-hot: #83520A; --accent-ink: #FFFFFF; --tint: rgba(162, 103, 15, 0.09);
    --glow: rgba(162, 103, 15, 0.14); --grid-line: rgba(162, 103, 15, 0.07);
    --live: #4F7A1F; --warm: #A9491F; --accent-2: #7C6A36;
    --shadow: 0 1px 2px rgba(33, 30, 20, 0.05), 0 8px 24px -12px rgba(33, 30, 20, 0.16);
    --shadow-lg: 0 30px 60px -30px rgba(33, 30, 20, 0.35);
    --tone-amber: #A2670F; --tone-olive: #5E6B16; --tone-sage: #3F7550; --tone-teal: #1F7568;
    --tone-rust: #A9491F; --tone-plum: #85497C; --tone-sand: #7C6A36; --tone-stone: #5B5646;
    --tone-mix: 12%;
  }
}
:root[data-theme="light"] {
  --ground: #EDEAE0; --ground-alt: #E6E2D4; --chrome: #FFFFFF; --surface: #FFFFFF;
  --surface-2: #F4F0E4; --raised: #FFFFFF; --ink: #211E14; --ink-soft: #5B5646;
  --ink-faint: #8B8571; --line: #DAD5C4; --line-strong: #C6BFA8; --accent: #A2670F;
  --accent-hot: #83520A; --accent-ink: #FFFFFF; --tint: rgba(162, 103, 15, 0.09);
  --glow: rgba(162, 103, 15, 0.14); --grid-line: rgba(162, 103, 15, 0.07);
  --live: #4F7A1F; --warm: #A9491F; --accent-2: #7C6A36;
  --shadow: 0 1px 2px rgba(33, 30, 20, 0.05), 0 8px 24px -12px rgba(33, 30, 20, 0.16);
  --shadow-lg: 0 30px 60px -30px rgba(33, 30, 20, 0.35);
  --tone-amber: #A2670F; --tone-olive: #5E6B16; --tone-sage: #3F7550; --tone-teal: #1F7568;
  --tone-rust: #A9491F; --tone-plum: #85497C; --tone-sand: #7C6A36; --tone-stone: #5B5646;
  --tone-mix: 12%;
}

/* ---- 2. type -----------------------------------------------------------
   Bricolage Grotesque for display, JetBrains Mono for the wordmark, labels
   and terminal, the system sans for reading. Both faces variable, OFL and
   self-hosted -- licenses in /fonts/. */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
  src: url("/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("/fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2");
}
:root {
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: Charter, "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --top-h: 60px;
  --side-w: 16.5rem;
}

/* ---- base ---- */
html, body { margin: 0; padding: 0; }
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--top-h) + 1rem); color-scheme: dark; }
/* Native scrollbars and form controls follow the palette, not the OS. */
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) { color-scheme: light; } }
:root[data-theme="light"] { color-scheme: light; }
* { scrollbar-color: color-mix(in oklab, var(--ink-faint) 45%, transparent) transparent; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-ink); }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; color: inherit; }
code {
  font-family: var(--font-mono); font-size: 0.84em; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.06em 0.36em; white-space: nowrap;
}
/* Inside a <pre> the inline chrome comes back off: every terminal and code
   block here sets its own frame, and nowrap would fold it onto one line. */
pre code { white-space: pre; background: none; border: 0; padding: 0; font-size: inherit; color: inherit; border-radius: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.nowrap { white-space: nowrap; }
.i { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; stroke: none; }

h1, h2, h3 { font-family: var(--font-display); letter-spacing: -0.02em; text-wrap: balance; margin: 0; }
h1 { font-weight: 750; font-size: clamp(1.8rem, 3.6vw, 2.5rem); line-height: 1.1; }
h2 { font-weight: 700; font-size: clamp(1.3rem, 2.4vw, 1.6rem); line-height: 1.2; }
h3 { font-weight: 700; font-size: 1.12rem; line-height: 1.3; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 0.8rem;
}
.eyebrow::before { content: ""; width: 1.4rem; height: 1px; background: currentColor; opacity: 0.6; }
.lede { color: var(--ink-soft); margin: 0.9rem 0 0; font-size: 1.06rem; text-wrap: pretty; }

/* ---- tiles ----
   The console's IconTile: a glyph on a soft wash of its own color. The wash
   is the tone mixed into transparent, so it sits right on any surface in
   either theme without a second value per tone. */
.tile {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  color: var(--t, var(--accent));
  background: color-mix(in oklab, var(--t, var(--accent)) var(--tone-mix), transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--t, var(--accent)) 18%, transparent);
}
.tile-sm { width: 1.5rem; height: 1.5rem; border-radius: 6px; font-size: 0.85rem; }
.tile-md { width: 1.85rem; height: 1.85rem; border-radius: 8px; font-size: 1rem; }
.tile-lg { width: 3rem; height: 3rem; border-radius: 12px; font-size: 1.45rem; }
.tile-letter { font-family: var(--font-mono); font-weight: 700; font-size: 0.72rem; }
.tile-md.tile-letter { font-size: 0.85rem; }
.tile-lg.tile-letter { font-size: 1.3rem; }
.tone-amber { --t: var(--tone-amber); }
.tone-olive { --t: var(--tone-olive); }
.tone-sage { --t: var(--tone-sage); }
.tone-teal { --t: var(--tone-teal); }
.tone-rust { --t: var(--tone-rust); }
.tone-plum { --t: var(--tone-plum); }
.tone-sand { --t: var(--tone-sand); }
.tone-stone { --t: var(--tone-stone); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.7rem 1.25rem; border-radius: 10px;
  font-family: var(--font-sans); font-size: 0.94rem; font-weight: 600;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: border-color .15s, color .15s, background .15s, transform .15s, box-shadow .15s;
}
.btn .i { font-size: 1.05em; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 8px 24px -10px var(--glow), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
.btn-primary:hover { background: var(--accent-hot); transform: translateY(-1px); }
.btn-primary:hover .i { transform: translateX(2px); }
.btn-primary .i { transition: transform .15s; }
/* background: transparent is load-bearing on a <button>, which otherwise comes
   with the browser's grey and renders blank in dark mode. */
.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: var(--tint); }
.btn-sm { padding: 0.42rem 0.8rem; font-size: 0.82rem; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { .btn, .btn .i { transition: none; transform: none !important; } }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem; border-radius: 9px;
  background: transparent; border: 0; color: var(--ink-soft); font-size: 1.1rem;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn-sm { width: 1.85rem; height: 1.85rem; font-size: 0.98rem; }

/* =========================================================================
   SHELL
   The body is the grid. Every page's markup is header, aside, main, footer
   in that order (from nav.php and footer.php), and the grid places them, so
   no page needed a wrapper element to get a sidebar. Fixed and absolute
   children (the skip link, scrim, dialog, consent banner) and <script>s take
   no cell.
   ========================================================================= */
body {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) 1fr auto;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
html.rail { --side-w: 4.5rem; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 90;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-mono); font-size: 0.8rem;
  padding: 0.6rem 1rem; text-decoration: none;
}
.skip:focus { left: 0; }

/* ---- top bar ---- */
.topbar {
  grid-column: 1 / -1; grid-row: 1;
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 1rem;
  height: var(--top-h); padding: 0 1rem 0 1.1rem;
  background: color-mix(in oklab, var(--chrome) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  display: inline-flex; align-items: center; gap: 0.6rem; flex: none;
  font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
  letter-spacing: -0.01em; white-space: nowrap; text-decoration: none; color: var(--ink);
}
.mark-tile {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 9px;
  background: linear-gradient(145deg, color-mix(in oklab, var(--accent) 28%, var(--surface)), var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 35%, transparent), 0 6px 18px -8px var(--glow);
}
.mark { width: 1.3rem; height: 1.3rem; color: var(--accent); }
.wordmark:hover .wm-text { color: var(--accent); }
.wm-text { transition: color .15s; }

/* The jump box: the console's search field, centred in the bar. */
.jump {
  flex: 1 1 auto; max-width: 30rem; margin: 0 auto;
  display: flex; align-items: center; gap: 0.6rem;
  height: 2.35rem; padding: 0 0.5rem 0 0.8rem;
  background: var(--ground); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink-faint); font-size: 0.88rem; text-align: left;
  transition: border-color .15s, background .15s;
}
.jump[hidden] { display: none; }
.jump:hover { border-color: var(--line-strong); background: var(--surface); }
.jump .i { font-size: 1rem; }
.jump-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
kbd {
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--ink-soft);
  background: var(--surface-2); border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 5px; padding: 0.05rem 0.4rem;
}
.topbar-end { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; flex: none; }
.jump:not([hidden]) + .topbar-end { margin-left: 0; }

/* The segmented theme control: the console's section switcher. */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line); }
.seg button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 1.75rem; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink-faint); font-size: 0.95rem;
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
:root[data-theme="light"] .seg button[aria-pressed="true"] { background: var(--ground); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .seg button[aria-pressed="true"] { background: var(--ground); } }

.nav-toggle { display: none; }
.nav-toggle .ex { display: none; }
.nav-toggle[aria-expanded="true"] .bars { display: none; }
.nav-toggle[aria-expanded="true"] .ex { display: block; }

/* ---- sidebar ---- */
.sidebar {
  grid-column: 1; grid-row: 2 / 4;
  position: sticky; top: var(--top-h); align-self: start;
  height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h));
  display: flex; flex-direction: column; gap: 0.35rem;
  overflow-y: auto; overflow-x: hidden; scrollbar-width: thin;
  padding: 0.6rem 0.6rem 0.9rem;
  background: var(--chrome); border-right: 1px solid var(--line);
  z-index: 30;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0.35rem 0.5rem 0.25rem; min-height: 2.2rem; }
.side-label {
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint);
}
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-item {
  display: flex; align-items: center; gap: 0.7rem;
  min-height: 2.6rem; padding: 0.3rem 0.45rem; border-radius: 10px;
  text-decoration: none; color: var(--ink-soft); font-size: 0.92rem; font-weight: 500;
  transition: background .12s, color .12s;
}
.side-item:hover { background: var(--surface-2); color: var(--ink); }
.side-item.here { background: var(--tint); color: var(--ink); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.side-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .out { font-size: 0.85rem; color: var(--ink-faint); }

.side-group, .side-group-static { margin-top: 0.6rem; }
.side-group-static > .side-label { display: block; padding: 0.35rem 0.5rem 0.4rem; }
.side-group summary {
  display: flex; align-items: center; justify-content: space-between;
  list-style: none; cursor: pointer; padding: 0.35rem 0.5rem 0.4rem; border-radius: 8px;
}
.side-group summary::-webkit-details-marker { display: none; }
.side-group summary:hover .side-label { color: var(--ink-soft); }
.side-group .chev { font-size: 0.85rem; color: var(--ink-faint); transition: transform .2s; }
.side-group:not([open]) .chev { transform: rotate(-90deg); }
.side-sub { display: flex; flex-direction: column; gap: 1px; margin: 0 0 0 1.35rem; padding-left: 0.55rem; border-left: 1px solid var(--line); }
.side-subitem {
  display: flex; align-items: center; gap: 0.55rem;
  min-height: 2.1rem; padding: 0.2rem 0.45rem; border-radius: 8px;
  text-decoration: none; color: var(--ink-soft); font-size: 0.86rem;
  transition: background .12s, color .12s;
}
.side-subitem:hover { background: var(--surface-2); color: var(--ink); }
.side-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--ink-faint); opacity: 0.7; }
.side-dot.live { background: var(--live); opacity: 1; box-shadow: 0 0 0 3px color-mix(in oklab, var(--live) 18%, transparent); }

.side-foot { margin-top: auto; display: flex; gap: 1rem; padding: 0.9rem 0.6rem 0.1rem; border-top: 1px solid var(--line); }
.side-foot a { font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); text-decoration: none; }
.side-foot a:hover, .side-foot a.here { color: var(--accent); }

/* ---- rail: the sidebar folded to its tiles ---- */
html.rail .sidebar { padding-left: 0.5rem; padding-right: 0.5rem; scrollbar-width: none; }
html.rail .side-text, html.rail .side-item .out, html.rail .side-dot,
html.rail .side-label, html.rail .side-foot, html.rail .side-group .chev { display: none; }
html.rail .side-head { justify-content: center; padding: 0.35rem 0; }
html.rail .side-item, html.rail .side-subitem { justify-content: center; padding: 0.3rem; }
html.rail .side-sub { margin: 0; padding: 0; border: 0; }
html.rail .side-group summary { justify-content: center; padding: 0.2rem; height: 0.6rem; }
html.rail .side-group summary::after { content: ""; width: 1.4rem; height: 1px; background: var(--line); }
html.rail .side-group-static { border-top: 1px solid var(--line); padding-top: 0.5rem; }
html.rail .rail-toggle .i { transform: scaleX(-1); }

.scrim { display: none; }

/* ---- main + footer ---- */
main { grid-column: 2; grid-row: 2; min-width: 0; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2.5rem); }
main > .wrap { padding-top: clamp(1.8rem, 4vw, 3rem); padding-bottom: 4.5rem; }

footer.site { grid-column: 2; grid-row: 3; border-top: 1px solid var(--line); background: var(--chrome); }
.foot-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1.6rem; padding-top: 1.2rem; padding-bottom: 1.2rem; }
footer.site p { margin: 0; font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); }
.footer-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.footer-meta a, .footer-tag a { color: var(--ink-soft); text-decoration: none; }
.footer-meta a:hover, .footer-tag a:hover { color: var(--accent); }
.footer-meta .sep { color: var(--line-strong); }
/* "Cookie settings" opens a dialogue rather than going anywhere, so it is a
   <button> that looks like the links either side of it. */
.linklike {
  background: none; border: 0; padding: 0;
  font-family: var(--font-mono); font-size: inherit; color: var(--ink-soft); line-height: inherit;
}
.linklike:hover { color: var(--accent); }
.linklike[hidden] { display: none; }

/* ---- phones and small tablets: the sidebar becomes a drawer ---- */
@media (max-width: 900px) {
  body { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top-h) auto 1fr auto; }
  html.rail { --side-w: 16.5rem; }
  .topbar { padding: 0 0.6rem; gap: 0.5rem; }
  .nav-toggle { display: inline-flex; }
  .rail-toggle { display: none !important; }
  .jump { max-width: none; }
  .jump-label, .jump kbd { display: none; }
  .jump { flex: 0 0 auto; width: 2.35rem; padding: 0; justify-content: center; margin: 0 0 0 auto; }
  .topbar-source span { display: none; }
  .topbar-source { padding: 0.42rem 0.55rem; }

  /* With scripting off the sidebar is simply a block above the page: every
     link reachable, nothing to open. The drawer only exists behind html.js. */
  .sidebar { grid-column: 1; grid-row: 2; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  main { grid-column: 1; grid-row: 3; }
  footer.site { grid-column: 1; grid-row: 4; }

  /* Full height and UNDER the top bar (z 35 against its 40), padded down
     past it, rather than starting at the bar's bottom edge: the bar stays
     on top with the close button in reach whatever the viewport does. */
  html.js .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: min(18rem, 86vw);
    height: auto; padding-top: calc(var(--top-h) + 0.6rem);
    border-right: 1px solid var(--line); border-bottom: 0;
    transform: translateX(-102%); transition: transform .22s ease, visibility .22s;
    visibility: hidden; z-index: 35; box-shadow: var(--shadow-lg);
  }
  html.js .sidebar[data-open="true"] { transform: none; visibility: visible; }
  html.js .scrim:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(4, 8, 14, 0.55); z-index: 34; }
  .topbar { background: var(--chrome); }
  /* The rail is a wide-screen idea; a phone always gets the full drawer. */
  html.rail .side-text, html.rail .side-item .out, html.rail .side-dot,
  html.rail .side-label, html.rail .side-group .chev { display: revert; }
  html.rail .side-foot { display: flex; }
  html.rail .side-item, html.rail .side-subitem { justify-content: flex-start; }
}
@media (max-width: 420px) {
  .wm-text { font-size: 0.92rem; }
  .topbar-source { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  body, html.js .sidebar { transition: none; }
}

/* =========================================================================
   PAGE HEADER (inner pages) -- the console's PageHeader: tile, then where
   you are, then what the page is for.
   ========================================================================= */
.page-hero {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 1.1rem; align-items: center;
  padding-bottom: 2rem; margin-bottom: 2rem; border-bottom: 1px solid var(--line);
}
.page-hero > .tile { grid-row: 1 / span 2; align-self: center; }
.page-hero .eyebrow { margin-bottom: 0.35rem; }
.page-hero .eyebrow::before { display: none; }
.page-hero h1 { grid-column: 2; }
.page-hero .lede { grid-column: 1 / -1; max-width: 46rem; margin-top: 1.1rem; }
.page-hero-wide .lede { max-width: 60rem; }
.page-hero .lede a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }
@media (max-width: 520px) {
  .page-hero > .tile { width: 2.5rem; height: 2.5rem; font-size: 1.2rem; }
}

/* ---- panels + prose ---- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(1.3rem, 3vw, 2.2rem);
}
.panel + .panel, .principles + .panel { margin-top: 1.4rem; }
.panel-flush { padding: 0; overflow: hidden; max-width: 50rem; }
.prose { max-width: 48rem; }
.prose.panel { max-width: 50rem; }
.prose > p { color: var(--ink-soft); margin: 1rem 0 0; text-wrap: pretty; }
.prose h2 { margin-top: 2.2rem; font-size: 1.3rem; }
.prose h3 { margin-top: 1.8rem; }
.prose h2 + p, .prose h3 + p { margin-top: 0.7rem; }
.prose > *:first-child { margin-top: 0; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { color: var(--ink); }
.prose a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); transition: color .15s; }
.prose a:hover { color: var(--accent); }
.prose > ul { color: var(--ink-soft); margin: 1rem 0 0; padding-left: 1.2rem; }
.prose > ul li { margin: 0.45rem 0 0; text-wrap: pretty; }
.prose > ul li::marker { color: var(--accent); }

/* ---- on-this-page rail (added by theme.js on long pages) ---- */
.wrap.with-toc { display: grid; grid-template-columns: minmax(0, 1fr) 14rem; column-gap: 2.5rem; align-items: start; }
.wrap.with-toc > * { grid-column: 1; }
.wrap.with-toc > .page-hero { grid-column: 1 / -1; }
.wrap.with-toc > .toc { grid-column: 2; grid-row: 2 / span 30; position: sticky; top: calc(var(--top-h) + 1.5rem); }
.toc .side-label { display: block; margin-bottom: 0.6rem; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a {
  display: block; padding: 0.3rem 0 0.3rem 0.9rem; margin-left: -1px;
  font-size: 0.84rem; line-height: 1.4; color: var(--ink-faint); text-decoration: none;
  border-left: 1px solid transparent; transition: color .12s, border-color .12s;
}
.toc a:hover { color: var(--ink); }
.toc a.on { color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 1240px) {
  .wrap.with-toc { display: block; }
  .toc { display: none; }
}

/* ---- principles (approach) -- four cards, each a numbered rule ---- */
.principles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; }
.principles li {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.5rem 1.6rem 1.6rem;
}
.principles li::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--accent), transparent 70%); }
.principles .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.2rem; height: 2.2rem; border-radius: 9px; margin-bottom: 0.9rem;
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 700; color: var(--accent);
  background: var(--tint);
}
.principles h2 { font-size: 1.15rem; }
.principles p { color: var(--ink-soft); margin: 0.6rem 0 0; font-size: 0.95rem; text-wrap: pretty; }
@media (max-width: 760px) { .principles { grid-template-columns: 1fr; } }

/* ---- license table ---- */
.licenses { border-collapse: collapse; width: 100%; font-size: 0.94rem; }
.licenses th, .licenses td { text-align: left; padding: 0.8rem 1.4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.licenses thead th {
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); background: var(--surface-2);
}
.licenses tbody th { font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; color: var(--ink); white-space: nowrap; }
.licenses tbody td { font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-soft); }
.licenses tbody tr:hover { background: var(--tint); }
.licenses tbody tr:last-child th, .licenses tbody tr:last-child td { border-bottom: none; }
@media (max-width: 460px) {
  .licenses tbody th { white-space: normal; }
  .licenses th, .licenses td { padding: 0.6rem 0.8rem; }
}

/* ---- contact routes ---- */
.routes { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; gap: 0.7rem; }
.routes li { display: grid; gap: 0.25rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); }
.routes li > a {
  font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; color: var(--ink);
  text-decoration: none; justify-self: start; border-bottom: 1px solid var(--accent);
}
.routes li > a:hover { color: var(--accent); }
.routes span { color: var(--ink-soft); font-size: 0.94rem; text-wrap: pretty; }
.routes span a { color: var(--ink); border-bottom: 1px solid var(--accent); text-decoration: none; }
.routes span a:hover { color: var(--accent); }
.routes-note { color: var(--ink-faint); font-size: 0.92rem; margin: 1.4rem 0 0; }
.routes--marks li > a { display: inline-flex; align-items: center; gap: 0.45rem; }
.route-mark { width: 1.05em; height: 1.05em; flex: none; fill: currentColor; }

.asked {
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--ink-faint);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.7rem 1rem; margin: 0; overflow-wrap: anywhere;
}
.page-hero .lede + .asked { grid-column: 1 / -1; }


/* Status pills. */
.pill {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.64rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; white-space: nowrap;
  color: var(--ink-soft); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.6rem;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); }
.pill.live { color: var(--live); border-color: color-mix(in oklab, var(--live) 30%, var(--line)); background: color-mix(in oklab, var(--live) 9%, transparent); }
.pill.live::before { background: var(--live); box-shadow: 0 0 0 3px color-mix(in oklab, var(--live) 20%, transparent); }

/* =========================================================================
   LANDING -- sections in the inbuxa.org order.
   ========================================================================= */
.home main > section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.home main > section.tinted { background: var(--ground-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.home main > section[id] { scroll-margin-top: var(--top-h); }

/* ---- hero: a faint blueprint grid behind, a glow where the eye starts ---- */
.hero { position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 30% 20%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 80% 70% at 30% 20%, #000 30%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; width: 46rem; height: 46rem; left: -12rem; top: -24rem;
  background: radial-gradient(circle, var(--glow), transparent 62%); pointer-events: none;
}
.hero-grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(2rem, 4vw, 3.5rem); align-items: center;
}
@media (max-width: 1180px) { .hero-grid { grid-template-columns: minmax(0, 1fr); } }
.release-note {
  display: inline-flex; align-items: center; gap: 0.6rem; margin: 0 0 1.4rem;
  font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--ink-soft);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.9rem 0.35rem 0.7rem;
}
.release-note a { color: var(--accent); text-decoration: none; }
.release-note a:hover { text-decoration: underline; text-underline-offset: 3px; }
.release-note .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 4px color-mix(in oklab, var(--live) 18%, transparent); flex: none; }
.hero h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.4rem); font-weight: 800; letter-spacing: -0.04em; line-height: 1.02;
  font-stretch: 90%;
}
.hero h1 .line { display: block; }
.hero h1 .accent {
  background: linear-gradient(100deg, var(--accent) 10%, var(--tone-rust) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lede { font-size: clamp(1.05rem, 1.5vw, 1.2rem); max-width: 36rem; margin-top: 1.4rem; }
.hero-ctas { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-top: 2rem; }
.badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.8rem; }
.badge {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.8rem; background: var(--surface);
}
.badge strong { color: var(--ink-soft); font-weight: 600; }

/* ---- the terminal ---- */
.terminal {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: color-mix(in oklab, var(--ground) 70%, #000);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.02);
  overflow: hidden;
}
:root[data-theme="light"] .terminal { background: #0D0F0A; border-color: #0D0F0A; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .terminal { background: #0D0F0A; border-color: #0D0F0A; } }
.terminal .bar { display: flex; align-items: center; gap: 7px; padding: 0.7rem 0.95rem; border-bottom: 1px solid rgba(163, 158, 141, 0.14); background: rgba(163, 158, 141, 0.05); }
.terminal .lamp { width: 10px; height: 10px; border-radius: 50%; background: rgba(163, 158, 141, 0.25); }
.terminal .lamp.on { background: #E0A233; }
.terminal .name { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.06em; color: #A39E8D; margin-left: 0.5rem; }
/* The terminal is always dark, in both themes -- a light terminal reads as a
   screenshot of somebody else's editor -- so its text colors are fixed rather
   than tokens. They are the dark palette's own values. */
.term-body { padding: 1rem 1.1rem 1.1rem; font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.75; color: #E7E3D3; }
.term-cmd { margin: 0; }
.term-cmd .p { color: #E0A233; margin-right: 0.4rem; }
.term-ls { list-style: none; margin: 0.3rem 0 0.4rem; padding: 0; }
/* Fixed character tracks, not fractions: each row is its own grid, and
   only widths in ch line the columns up from one row to the next. */
.term-ls li { display: grid; grid-template-columns: 20ch minmax(0, 1fr) 8ch; gap: 1rem; align-items: baseline; }
.term-ls .lic { text-align: right; }
.term-ls a { color: #E7E3D3; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term-ls a:hover { color: #F0B955; text-decoration: underline; text-underline-offset: 3px; }
.term-ls .st { color: #A39E8D; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-ls .st.live { color: #9BC266; }
.term-ls .lic { color: #6E6A5C; }
.cursor { display: inline-block; width: 0.55em; height: 1.05em; background: #E0A233; vertical-align: -0.18em; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
@media (max-width: 520px) {
  .term-body { font-size: 0.72rem; }
  .term-ls li { grid-template-columns: 19ch minmax(0, 1fr); }
  .term-ls .lic { display: none; }
}

/* ---- section heads ---- */
.section-head { max-width: 46rem; margin: 0 0 clamp(1.8rem, 4vw, 2.8rem); }
.section-title { font-size: clamp(1.7rem, 3.4vw, 2.6rem); font-weight: 780; letter-spacing: -0.03em; line-height: 1.08; }
.section-sub { color: var(--ink-soft); margin: 1rem 0 0; font-size: 1.04rem; max-width: 40rem; text-wrap: pretty; }
.section-sub a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }

/* ---- the bench: every project as a compact card ---- */
.bench { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; }
@media (max-width: 1280px) { .bench { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 980px) { .bench { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .bench { grid-template-columns: 1fr; } }
.bench-card {
  position: relative; display: flex; flex-direction: column; height: 100%;
  padding: 1.1rem 1.1rem 1rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.bench-card:hover { border-color: color-mix(in oklab, var(--t, var(--accent)) 55%, var(--line)); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .bench-card:hover { transform: none; } }
.bench-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.bench-top .pill { font-size: 0.58rem; padding: 0.14rem 0.5rem; }
.bench-name { margin-top: 0.9rem; font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; letter-spacing: -0.015em; color: var(--ink); overflow-wrap: anywhere; }
.bench-tag { margin-top: 0.25rem; color: var(--ink-soft); font-size: 0.88rem; line-height: 1.45; flex: 1; }
.bench-lic { margin-top: 0.9rem; font-family: var(--font-mono); font-size: 0.66rem; color: var(--ink-faint); }

/* ---- two panels side by side ---- */
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.1rem; align-items: stretch; }
.cols-2 .panel + .panel { margin-top: 0; }
.cols-2 .prose { max-width: none; }
.cols-2 h3 { font-size: 1.25rem; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: 1fr; } }

/* ---- copyleft: text beside a list of what is not here ---- */
.split { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(1.8rem, 4vw, 3.5rem); align-items: center; }
@media (max-width: 980px) { .split { grid-template-columns: 1fr; } }
.split .section-sub code { white-space: nowrap; }
.nolist {
  list-style: none; margin: 0; padding: 1.4rem; display: grid; gap: 0.3rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.nolist li {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.4rem;
  font-family: var(--font-mono); font-size: 0.82rem; color: var(--ink-soft);
}
.nolist li + li { border-top: 1px dashed var(--line); }
.nolist .x { color: var(--warm); font-size: 1rem; }
.nolist .ok { color: var(--live); font-size: 1rem; }
.nolist li:last-child { color: var(--ink); font-weight: 600; }

/* ---- proof numbers ---- */
.proof { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.1rem; }
@media (max-width: 1100px) { .proof { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .proof { grid-template-columns: 1fr; } }
.proof-item { padding: 1.3rem 1.3rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.proof-item .pv {
  margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.04em;
  font-size: clamp(2.2rem, 4vw, 3rem); line-height: 1; color: var(--accent);
}
.proof-item .pk { margin: 0.5rem 0 0; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); }
.proof-item p:last-child { margin: 0.6rem 0 0; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; }
.proof-item a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }

/* ---- closing band ---- */
.license-band {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem 2rem; flex-wrap: wrap;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: linear-gradient(120deg, var(--tint), transparent 65%), var(--surface);
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--line)); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.license-band h3 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); letter-spacing: -0.025em; }
.license-band p { margin: 0.5rem 0 0; color: var(--ink-soft); max-width: 36rem; }
.license-band .hero-ctas { margin-top: 0; }

/* ---- onward links ---- */
.onward { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.9rem; margin: 1.4rem 0 0; }
@media (max-width: 1180px) { .onward { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .onward { grid-template-columns: 1fr; } }
.onward a {
  display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.15rem; transition: border-color .15s;
}
.onward a:hover { border-color: var(--accent); }
.onward .tile { margin-bottom: 0.7rem; }
.onward-label { display: flex; align-items: center; gap: 0.4rem; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.onward-label .go { font-size: 0.9rem; color: var(--accent); opacity: 0; transform: translateX(-4px); transition: opacity .15s, transform .15s; }
.onward a:hover .go { opacity: 1; transform: none; }
.onward-note { color: var(--ink-soft); font-size: 0.9rem; line-height: 1.5; text-wrap: pretty; }

/* =========================================================================
   JUMP PALETTE
   ========================================================================= */
.palette {
  width: min(36rem, calc(100vw - 2rem)); max-height: min(28rem, 70vh);
  margin: 12vh auto auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--raised); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden;
}
.palette::backdrop { background: rgba(4, 8, 14, 0.6); backdrop-filter: blur(2px); }
.palette-box { display: flex; flex-direction: column; max-height: inherit; }
.palette-input { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink-faint); }
.palette-input .i { font-size: 1.1rem; }
.palette-input input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 1rem; color: var(--ink);
}
.palette-list { list-style: none; margin: 0; padding: 0.4rem; overflow-y: auto; }
.palette-list li {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border-radius: 9px; cursor: pointer;
}
.palette-list li[aria-selected="true"] { background: var(--tint); }
.palette-list .pl-name { font-weight: 600; font-size: 0.92rem; }
.palette-list .pl-note { color: var(--ink-faint); font-size: 0.8rem; margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }
.palette-list .pl-empty { color: var(--ink-faint); cursor: default; justify-content: center; padding: 1.2rem; }


/* =========================================================================
   jcoffey.dev COMPONENTS
   ========================================================================= */
.muted { color: var(--ink-faint); font-size: 0.9rem; margin-top: 1.2rem; }
.muted a, .empty a { color: var(--ink); border-bottom: 1px solid var(--accent); text-decoration: none; }
.empty { color: var(--ink-soft); margin-top: 1.5rem; }
.lede a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.16em; }
.lede a:hover { color: var(--accent); }
.page-hero .lede + .asked { margin-top: 1.2rem; }

/* ---- module heads: a section title with a "more" link at its right ---- */
.module { margin-top: clamp(2.4rem, 5vw, 3.4rem); }
.module:first-child { margin-top: 0; }
.module-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  font-size: clamp(1.25rem, 2.2vw, 1.5rem); margin: 0 0 1.2rem;
}
.module-head .more { font-family: var(--font-mono); font-size: 0.74rem; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.module-head .more:hover { text-decoration: underline; text-underline-offset: 3px; }
.module > .lede { margin: -0.4rem 0 1.2rem; max-width: 46rem; }

/* ---- cards (articles, projects) ---- */
.cards { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.cards.compact { margin-top: 0; }
@media (max-width: 1000px) { .cards { grid-template-columns: 1fr; } }
.card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem 1.35rem 1.2rem;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
@media (prefers-reduced-motion: reduce) { .card:hover { transform: none; } }
.card-link { text-decoration: none; display: block; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card h2, .card h3 { font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.015em; transition: color .15s; }
.card-link:hover h2, .card-link:hover h3 { color: var(--accent); }
.card-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); margin: 0.55rem 0 0; }
.card-meta .origin { color: var(--ink-soft); }
.card-summary { color: var(--ink-soft); font-size: 0.93rem; line-height: 1.55; margin: 0.65rem 0 0; flex: 1; }
.card-summary mark { background: var(--accent); color: var(--accent-ink); padding: 0 0.15em; border-radius: 3px; }
/* Tags sit above the card's stretched link so each one is its own target. */
.card-tags { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0.9rem 0 0; }
.card-tags a, .article-tags a, .tag-row a {
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--ink-soft); text-decoration: none;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 0.18rem 0.55rem;
  transition: color .15s, border-color .15s;
}
.card-tags a:hover, .article-tags a:hover, .tag-row a:hover { color: var(--accent); border-color: var(--accent); }

/* The first card of the front page's latest list spans the row, as a lead. */
.cards.lead > li:first-child { grid-column: 1 / -1; padding: 1.6rem 1.7rem; background: linear-gradient(130deg, var(--tint), transparent 60%), var(--surface); }
.cards.lead > li:first-child h3 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); }

/* ---- search + tag row ---- */
.search {
  display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0 0 1.2rem; max-width: 44rem;
}
.search input[type="search"] {
  flex: 1 1 18rem; min-width: 0; font: inherit; font-size: 0.98rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.95rem;
  box-shadow: var(--shadow); transition: border-color .15s;
}
.search input[type="search"]:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--tint); }
.search input::placeholder { color: var(--ink-faint); }
.search button {
  font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--accent-ink); background: var(--accent);
  border: 0; border-radius: 10px; padding: 0.72rem 1.2rem;
}
.search button:hover { background: var(--accent-hot); }
.search .clear { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-faint); text-decoration: none; }
.search .clear:hover { color: var(--ink); }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.6rem; }
.tag-row a { display: inline-flex; align-items: baseline; gap: 0.4rem; }
.tag-row a span { color: var(--ink-faint); font-size: 0.62rem; }
.tag-row a.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tag-row a.on span { color: var(--accent-ink); opacity: 0.75; }
.tag-row a.all-tags { border-style: dashed; }
.tag-index { gap: 0.5rem; }
.tag-index a { font-size: 0.78rem; padding: 0.35rem 0.75rem; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 2rem 0 0; font-family: var(--font-mono); font-size: 0.8rem; }
.pager a { color: var(--ink); text-decoration: none; padding: 0.45rem 0.9rem; border: 1px solid var(--line-strong); border-radius: 8px; transition: border-color .15s, color .15s; }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .count { color: var(--ink-faint); font-size: 0.72rem; }
.pager .prev:only-of-type { margin-right: auto; }
.pager .next:only-of-type { margin-left: auto; }

/* ---- article ---- */
.article-head { max-width: 50rem; padding-bottom: 1.8rem; margin-bottom: 1.8rem; border-bottom: 1px solid var(--line); }
.article-head .eyebrow a { color: inherit; text-decoration: none; }
.article-head .eyebrow a:hover { text-decoration: underline; }
.article-head h1 { font-size: clamp(1.9rem, 4.2vw, 2.8rem); line-height: 1.1; letter-spacing: -0.03em; }
.byline-row { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; font-family: var(--font-mono); font-size: 0.74rem; color: var(--ink-faint); margin: 1.1rem 0 0; }
.byline-row .byline { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 0.5rem; }
.byline-row .byline img { width: 1.6rem; height: 1.6rem; border-radius: 50%; }
.byline-row .sep { opacity: 0.5; }
.origin-note {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint);
  background: var(--surface); border: 1px solid var(--line); border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 0.6rem 0.9rem; margin: 1.2rem 0 0;
}
.origin-note a { color: var(--ink-soft); }

/* Long-form reading stays in the serif: the chrome is sans and mono, the
   words somebody came to read are set for reading. ~70 characters a line. */
.article-body.prose { font-family: var(--font-serif); font-size: 1.12rem; line-height: 1.78; max-width: 50rem; padding: clamp(1.4rem, 4vw, 2.6rem) clamp(1.3rem, 4vw, 3rem); }
.article-body.prose > p { color: var(--ink); opacity: 0.92; margin: 1.3em 0 0; }
.article-body.prose > :first-child { margin-top: 0; }
.article-body.prose h2, .article-body.prose h3, .article-body.prose h4 { font-family: var(--font-display); color: var(--ink); line-height: 1.25; }
.article-body.prose h2 { font-size: 1.45rem; margin: 2.2em 0 0; }
.article-body.prose h3 { font-size: 1.18rem; margin: 1.9em 0 0; }
.article-body.prose h4 { font-size: 1rem; margin: 1.6em 0 0; color: var(--ink-soft); }
.article-body.prose h2 + p, .article-body.prose h3 + p, .article-body.prose h4 + p { margin-top: 0.6em; }
.article-body.prose a { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.18em; border: 0; }
.article-body.prose strong { font-weight: 700; }
.article-body.prose ul, .article-body.prose ol { margin: 1.2em 0 0; padding-left: 1.4em; color: var(--ink); }
.article-body.prose li { margin: 0.45em 0; }
.article-body.prose li::marker { color: var(--accent); }
.article-body.prose blockquote { margin: 1.6em 0 0; padding: 0.2em 0 0.2em 1.2em; border-left: 2px solid var(--accent); color: var(--ink-soft); font-style: italic; }
.article-body.prose blockquote p { margin: 0.6em 0; }
.article-body.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.article-body.prose hr + h2 { margin-top: 0; }
.article-body.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1.6em 0 0; }
.article-body.prose code { font-size: 0.82em; white-space: normal; overflow-wrap: break-word; }
.article-body.prose pre {
  background: #0D0F0A; color: #E7E3D3; border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 1rem 1.1rem; margin: 1.6em 0 0; overflow-x: auto; font-size: 0.84rem; line-height: 1.6;
}
.article-body.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; color: inherit; white-space: pre; }
.article-body.prose table { width: 100%; border-collapse: collapse; margin: 1.6em 0 0; font-family: var(--font-sans); font-size: 0.9rem; display: block; overflow-x: auto; }
.article-body.prose th, .article-body.prose td { border: 1px solid var(--line); padding: 0.55rem 0.8rem; text-align: left; vertical-align: top; }
.article-body.prose th { background: var(--surface-2); font-family: var(--font-mono); font-size: 0.76rem; }

.article-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.6rem 0 0; max-width: 50rem; }
.neighbours { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; margin: 1.6rem 0 0; max-width: 50rem; }
.neighbours a {
  display: block; text-decoration: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.15rem; box-shadow: var(--shadow); transition: border-color .15s;
}
.neighbours a:hover { border-color: var(--accent); }
.neighbours a span { display: block; font-family: var(--font-mono); font-size: 0.68rem; color: var(--accent); margin-bottom: 0.35rem; }
.neighbours a strong { font-family: var(--font-display); font-size: 1rem; font-weight: 700; line-height: 1.3; }
.neighbours .next { text-align: right; }
.neighbours .next:only-child { grid-column: 2; }
@media (max-width: 620px) {
  .neighbours { grid-template-columns: 1fr; }
  .neighbours .next, .neighbours .next:only-child { text-align: left; grid-column: 1; }
}

/* ---- contact / related lists ---- */
.elsewhere { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.elsewhere li { display: grid; gap: 0.25rem; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); }
.elsewhere a { display: inline-flex; align-items: center; gap: 0.5rem; justify-self: start; font-family: var(--font-mono); font-size: 0.88rem; font-weight: 600; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent); }
.elsewhere a:hover { color: var(--accent); }
.elsewhere-icon { width: 1.05em; height: 1.05em; flex: none; fill: currentColor; }
.elsewhere span { color: var(--ink-soft); font-size: 0.93rem; }

/* ---- the fastfetch terminals (/system/, and the front page) ---- */
.fetch { margin: 0; border: 1px solid var(--line-strong); border-radius: var(--radius); background: #0D0F0A; box-shadow: var(--shadow-lg); overflow: hidden; }
.fetch figcaption {
  display: flex; align-items: center; gap: 7px; padding: 0.7rem 0.95rem;
  background: rgba(163, 158, 141, 0.05); border-bottom: 1px solid rgba(163, 158, 141, 0.14);
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.04em; color: #A39E8D;
}
.fetch .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.fetch .dot.r { background: #C4534B; }
.fetch .dot.y { background: #C9A227; }
.fetch .dot.g { background: #5C8A4A; }
.fetch pre { margin: 0; padding: 1rem 1.1rem 1.1rem; overflow-x: auto; font-family: var(--font-mono); font-size: 0.78rem; line-height: 1.75; color: #A39E8D; }
.fetch .p { color: #E0A233; font-weight: 700; }
.fetch .k { color: #E7E3D3; font-weight: 700; }
.fetch .sec { color: #6E6A5C; }
.page-hero + .fetch { margin-top: 0; }

.lab { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: clamp(1rem, 3vw, 2rem); align-items: start; }
.lab-photo { margin: 0; }
.lab-photo img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.lab-photo figcaption { margin-top: 0.6rem; font-family: var(--font-mono); font-size: 0.68rem; line-height: 1.6; color: var(--ink-faint); }
/* Set from the measurement: the panel's longest line needs 619px. */
@media (max-width: 1240px) {
  .lab { grid-template-columns: 1fr; }
  .lab-photo img { max-width: 300px; margin-inline: auto; }
  .lab-photo figcaption { text-align: center; }
}
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips span { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 0.25rem 0.65rem; }

/* ---- credentials ---- */
.group-blurb { font-size: 0.97rem; }
.creds { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1100px) { .creds { grid-template-columns: 1fr; } }
.cred {
  display: grid; grid-template-columns: 76px 1fr; gap: 1.1rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.2rem; transition: border-color .15s;
}
.cred:hover { border-color: var(--accent); }
/* Badge art is mostly white line-work on transparency; the plate gives it
   something to sit on in both themes. */
.cred-badge { width: 76px; height: 76px; object-fit: contain; background: var(--surface-2); border-radius: 10px; padding: 4px; }
.cred-badge.placeholder { display: grid; place-items: center; font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; color: var(--accent); border: 1px solid var(--line); }
.cred-body h3 { font-size: 1rem; line-height: 1.35; }
.cred-body h3 a { text-decoration: none; transition: color .15s; }
.cred-body h3 a:hover { color: var(--accent); }
.cred-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; font-family: var(--font-mono); font-size: 0.7rem; color: var(--ink-faint); margin: 0.5rem 0 0; }
.cred-meta .issuer { color: var(--ink-soft); }
.cred-meta .sep { opacity: 0.45; }
@media (max-width: 560px) {
  .cred { grid-template-columns: 56px 1fr; gap: 0.9rem; }
  .cred-badge { width: 56px; height: 56px; }
}

/* ---- front page: the profile card beside the hero ---- */
.profile { padding: 1.4rem; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); }
.profile-top { display: flex; align-items: center; gap: 1rem; }
.profile-top img { width: 84px; height: 84px; border-radius: 16px; object-fit: cover; box-shadow: 0 0 0 1px var(--line-strong), 0 10px 24px -12px var(--glow); }
.profile-name { font-family: var(--font-display); font-weight: 750; font-size: 1.3rem; letter-spacing: -0.02em; margin: 0; }
.profile-role { color: var(--ink-soft); font-size: 0.88rem; margin: 0.2rem 0 0; line-height: 1.4; }
.profile-stats { list-style: none; margin: 1.2rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.profile-stats li { display: block; text-decoration: none; background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 0.7rem 0.8rem; }
.profile-stats a { text-decoration: none; display: block; }
.profile-stats a:hover .pv { color: var(--accent-hot); }
.profile-stats .pv { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.6rem; line-height: 1; color: var(--accent); letter-spacing: -0.03em; transition: color .15s; }
.profile-stats .pk { display: block; margin-top: 0.35rem; font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); }
.profile .fetch { margin-top: 1.1rem; box-shadow: none; }
.profile .fetch pre { font-size: 0.72rem; line-height: 1.7; }

/* ---- /system/: the production and QA diagram ----
   Every stroke and fill is a token, so it follows the theme. Wider than a
   phone on purpose: the wrapper scrolls rather than shrinking the text. */
.diagram { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(0.8rem, 2vw, 1.4rem); }
.diagram-scroll { overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 880px; height: auto; }
.dg-t { font-family: var(--font-sans); font-size: 15px; font-weight: 600; fill: var(--ink); }
.dg-sm { font-size: 13.5px; }
.dg-s { font-family: var(--font-sans); font-size: 12.5px; fill: var(--ink-soft); }
.dg-xs { font-size: 11px; }
.dg-h { font-family: var(--font-display); font-size: 20px; font-weight: 750; fill: var(--ink); }
.dg-label { font-family: var(--font-mono); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; fill: var(--accent); }
.dg-pill { fill: var(--surface-2); stroke: var(--line-strong); }
.dg-edge { fill: var(--tint); stroke: color-mix(in oklab, var(--accent) 40%, var(--line)); }
.dg-node { fill: var(--ground); stroke: var(--line-strong); stroke-width: 1.2; }
.dg-bar { fill: color-mix(in oklab, var(--tone-teal) 18%, transparent); stroke: color-mix(in oklab, var(--tone-teal) 45%, transparent); }
.dg-box { fill: var(--surface); stroke: var(--line-strong); }
.dg-zone { stroke-dasharray: 4 3; }
.dg-zone-mail { fill: color-mix(in oklab, var(--tone-plum) 9%, transparent); stroke: color-mix(in oklab, var(--tone-plum) 45%, transparent); }
.dg-zone-data { fill: color-mix(in oklab, var(--tone-olive) 9%, transparent); stroke: color-mix(in oklab, var(--tone-olive) 45%, transparent); }
.dg-ai { stroke: color-mix(in oklab, var(--tone-plum) 60%, transparent); }
.dg-lead { stroke: var(--accent); stroke-width: 1.6; }
.dg-qa { stroke: var(--accent); stroke-width: 1.6; fill: var(--tint); }
.dg-mesh { fill: color-mix(in oklab, var(--tone-sage) 12%, transparent); stroke: color-mix(in oklab, var(--tone-sage) 55%, transparent); }
.dg-link { fill: none; stroke: var(--ink-faint); stroke-width: 1.4; }
.dg-mail { stroke: var(--tone-plum); stroke-dasharray: 5 4; }
.dg-arrowhead { fill: var(--ink-faint); }

/* HotDog CMS's consent banner takes its colours from --surface, --line,
   --accent and --text; this site calls its text colour --ink. */
:root { --text: var(--ink); }
