/* libfossil explorer. Parchment and amber in the light, lamp-lit in
   the dark: a serif display face (Fraunces) for the story and section
   titles, mono for anything a machine wrote, sans for the interface,
   serif (Source Serif) for prose people wrote. Hairlines and soft
   shadows separate things; borders are kept for fields. */
:root {
  --bg: #f8f4ec; --surface: #fffdf8; --surface-2: #efe8da; --ink: #221d14; --muted: #6b6354;
  --line: #e2d9c6; --line-strong: #b8ad94;
  --hair: rgba(60, 45, 20, .12); --hair-2: rgba(60, 45, 20, .07);
  --accent: #9a4d00; --accent-fill: #b35d0b; --accent-soft: #f3e2c8; --on-accent: #ffffff;
  --hash: #1d6670; --hash-soft: #d9eaeb;
  --ok: #2d6a36; --warn: #8a5a00; --error: #a3261b; --error-soft: #f7dcd7;
  --code-bg: #f1ebdf; --mark: #f4d978; --focus: #1d6670;
  --rail-l: 42%; --rail-s: 55%; --chip-l: 27%;
  --glass: rgba(255, 253, 248, .72); --bezel: rgba(60, 45, 20, .035);
  --shadow: 0 10px 30px -18px rgba(60, 40, 10, .35); --shadow-sm: 0 4px 14px -10px rgba(60, 40, 10, .3);
  --inset: inset 0 1px 0 rgba(255, 255, 255, .9);
  --snip-bg: #231d13; --snip-ink: #efe6d3; --snip-k: #f0b56a; --snip-s: #c9b98f;
  --grain: .035;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --r: 10px; --r-lg: 20px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 36px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120d; --surface: #1e1a14; --surface-2: #2a251c; --ink: #ede5d3; --muted: #a89f8b;
    --line: #362f25; --line-strong: #5a5040;
    --hair: rgba(240, 225, 195, .12); --hair-2: rgba(240, 225, 195, .07);
    --accent: #f0a84c; --accent-fill: #e0902c; --accent-soft: #3a2a14; --on-accent: #1a1209;
    --hash: #7fc8d2; --hash-soft: #15282b;
    --ok: #86c98f; --warn: #e6b65c; --error: #f2907f; --error-soft: #3b1c17;
    --code-bg: #120f0b; --mark: #6b5317; --focus: #7fc8d2;
    --rail-l: 64%; --rail-s: 50%; --chip-l: 74%;
    --glass: rgba(30, 26, 20, .72); --bezel: rgba(255, 240, 210, .03);
    --shadow: 0 12px 34px -16px rgba(0, 0, 0, .7); --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, .6);
    --inset: inset 0 1px 0 rgba(255, 240, 210, .05);
    --snip-bg: #0f0c08; --snip-ink: #efe6d3; --snip-k: #f0b56a; --snip-s: #c9b98f;
    --grain: .05;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #15120d; --surface: #1e1a14; --surface-2: #2a251c; --ink: #ede5d3; --muted: #a89f8b;
  --line: #362f25; --line-strong: #5a5040;
  --hair: rgba(240, 225, 195, .12); --hair-2: rgba(240, 225, 195, .07);
  --accent: #f0a84c; --accent-fill: #e0902c; --accent-soft: #3a2a14; --on-accent: #1a1209;
  --hash: #7fc8d2; --hash-soft: #15282b;
  --ok: #86c98f; --warn: #e6b65c; --error: #f2907f; --error-soft: #3b1c17;
  --code-bg: #120f0b; --mark: #6b5317; --focus: #7fc8d2;
  --rail-l: 64%; --rail-s: 50%; --chip-l: 74%;
  --glass: rgba(30, 26, 20, .72); --bezel: rgba(255, 240, 210, .03);
  --shadow: 0 12px 34px -16px rgba(0, 0, 0, .7); --shadow-sm: 0 4px 14px -8px rgba(0, 0, 0, .6);
  --inset: inset 0 1px 0 rgba(255, 240, 210, .05);
  --snip-bg: #0f0c08; --snip-ink: #efe6d3; --snip-k: #f0b56a; --snip-s: #c9b98f;
  --grain: .05;
  color-scheme: dark;
}

/* --- base --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15.5px/1.55 var(--sans); overflow-x: hidden; }
/* a 3% paper grain over everything, never in the way */
body::after { content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"); }
[hidden] { display: none !important; }
code, pre, kbd, .hash, time, .mono { font-family: var(--mono); }
code { font-size: .9em; }
:not(pre) > code { background: var(--code-bg); padding: 0 .3em; border-radius: 4px; overflow-wrap: anywhere; }
a { color: var(--accent); text-underline-offset: 2px; }
h2, h3, h4 { font-family: var(--mono); font-weight: 600; letter-spacing: -.01em; line-height: 1.25; }
h2 { font-size: 20px; margin: 0 0 var(--s2); }
h3 { font-size: 15px; margin: var(--s5) 0 var(--s2); }
h4 { font-size: 13.5px; margin: 0 0 var(--s2); }
h3 .hint, h4 .hint { font-family: var(--sans); font-weight: 400; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.wrap { max-width: 1240px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left)) max(16px, env(safe-area-inset-right)); }
.skip { position: absolute; left: 8px; top: -40px; background: var(--ink); color: var(--bg); padding: 6px 10px; z-index: 60; border-radius: var(--r); }
.skip:focus { top: 8px; }
.hint { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; margin: var(--s2) 0; font-style: italic; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* Fraunces for the story and for section titles */
.display, .display-m, .display-s, .lede h2 { font-family: var(--display); font-weight: 400; letter-spacing: -.02em; font-optical-sizing: auto; }
.display { font-size: clamp(34px, 4.6vw, 52px); line-height: 1.05; margin: 0 0 14px; font-variation-settings: "opsz" 144; text-wrap: balance; }
.display em { font-style: italic; color: var(--accent); }
.display-m { font-size: 30px; line-height: 1.1; margin: 0; }
.display-s { font-size: 24px; line-height: 1.15; margin: 0 0 6px; }
.display-s code, .lede h2 code { font-size: .78em; background: none; padding: 0; }
.lede h2 { font-size: 30px; line-height: 1.12; margin: 0 0 var(--s3); text-wrap: balance; }

/* --- masthead: brand, one quiet status line, theme --- */
.mast-top { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s5); padding-block: 22px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.glyph { width: 30px; height: 30px; color: var(--line-strong); flex: none; }
.glyph .g-node { fill: var(--bg); stroke: var(--ink); stroke-width: 2; }
.glyph .g-tip { fill: var(--accent-fill); stroke: var(--accent-fill); stroke-width: 2; }
.wordmark { font: 600 20px/1 var(--mono); letter-spacing: -.02em; display: flex; align-items: baseline; gap: 10px; }
.wm-sub { font: 500 10.5px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.repo-line { margin: 0 0 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font: 12.5px/1.4 var(--sans); color: var(--muted); min-width: 0; }
.repo-line #repo-tip { font-family: var(--mono); }
.repo-line > span:not(.dot) + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: currentColor; vertical-align: middle; margin: 0 8px 2px 0; }
.repo-line .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-fill) 18%, transparent); flex: none; margin-right: 2px; }
.repo-line[data-state="ready"] .dot { background: #3f8f55; box-shadow: 0 0 0 3px rgba(63, 143, 85, .18); }
.repo-line[data-state="error"] .dot { background: var(--error); }
.repo-line[data-state="loading"] .dot { animation: pulse 1.4s var(--ease) infinite alternate; }
@keyframes pulse { to { opacity: .35; } }
.theme { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; font: 500 12.5px var(--mono); color: var(--muted); background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--hair); border-radius: 999px; padding: 5px 12px; cursor: pointer; transition: color .45s var(--ease); }
.theme svg { width: 15px; height: 15px; }
.theme:hover { color: var(--ink); }

/* --- navigation: a floating glass pill under the header --- */
.tabs { position: sticky; top: 10px; z-index: 20; display: flex; justify-content: center; margin: 18px auto 0; padding-inline: 16px; pointer-events: none; }
.tabs-in { pointer-events: auto; display: flex; align-items: stretch; gap: 2px; padding: 5px; max-width: 100%; overflow-x: auto; scrollbar-width: none; border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: var(--inset), 0 8px 30px -12px rgba(60, 40, 10, .28), 0 0 0 1px var(--hair); }
.tabs-in::-webkit-scrollbar { display: none; }
.tabs .sep { flex: none; width: 1px; background: var(--hair); margin: 7px 5px; }
.tabs button { flex: none; font: 500 14px var(--sans); background: transparent; border: 0; padding: 8px 16px; border-radius: 999px; color: var(--muted); cursor: pointer; white-space: nowrap;
  transition: background-color .5s var(--ease), color .5s var(--ease), transform .5s var(--ease); }
.tabs button:hover:not([aria-selected="true"]):not(:disabled) { background: var(--accent-soft); color: var(--ink); }
.tabs button:active:not(:disabled) { transform: scale(.97); }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.tabs button:focus-visible { outline-offset: -2px; border-radius: 999px; }
.tabs button:disabled { opacity: .5; cursor: progress; }
@media (max-width: 900px) { .tabs button { padding: 8px 11px; font-size: 13.5px; } .tabs .sep { margin-inline: 3px; } }

/* --- phone: a bottom dock with a "More" sheet --- */
.dock { display: none; }
@media (max-width: 699.98px) {
  html { scroll-padding-top: 12px; scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .tabs { display: none; }
  .dock { display: block; position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 24px); }
  .dock-in { display: flex; gap: 2px; padding: 5px; border-radius: 999px; background: #221d14; box-shadow: 0 12px 30px -10px rgba(20, 14, 4, .55), 0 0 0 1px rgba(255, 240, 210, .08); }
  .dock-in button { min-height: 44px; min-width: 44px; padding: 0 15px; border: 0; border-radius: 999px; background: transparent; color: #d6ccb8; font: 500 14px var(--sans); cursor: pointer;
    transition: background-color .45s var(--ease), color .45s var(--ease), transform .45s var(--ease); }
  .dock-in button[aria-current], .dock-in button.on { background: #fbf6ea; color: #221d14; }
  .dock-in #dock-more[aria-expanded="true"]:not(.on) { background: rgba(251, 246, 234, .14); color: #fbf6ea; }
  .dock-in button:active:not(:disabled) { transform: scale(.96); }
  .dock-in button:disabled { opacity: .5; }
  .dock-in button:focus-visible { outline: 2px solid #f0b56a; outline-offset: 1px; }
  .sheet { position: absolute; right: 0; bottom: calc(100% + 10px); width: min(260px, calc(100vw - 24px)); display: grid; gap: 2px; padding: 6px; border-radius: 22px;
    background: var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--hair); animation: sheet-in .45s var(--ease); }
  .sheet button { min-height: 46px; text-align: left; padding: 0 16px; border: 0; border-radius: 16px; background: transparent; color: var(--ink); font: 500 15px var(--sans); cursor: pointer; transition: background-color .45s var(--ease); }
  .sheet button:hover:not(:disabled) { background: var(--accent-soft); }
  .sheet button[aria-current] { background: var(--ink); color: var(--surface); }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(6px); } }
}
@media (max-width: 699.98px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dock-in { background: #3a3226; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 240, 210, .14); }
}
@media (max-width: 699.98px) {
  :root[data-theme="dark"] .dock-in { background: #3a3226; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 240, 210, .14); }
}

main { padding-block: var(--s5) var(--s6); outline: none; }

/* --- the landing bento --- */
.bezel { padding: 6px; border-radius: 26px; background: var(--bezel); box-shadow: 0 0 0 1px var(--hair); min-width: 0; }
.core { border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--inset), var(--shadow); padding: 26px 28px; height: 100%; min-width: 0; }
.hero { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: 18px; margin: var(--s4) 0 0; }
.hero-main p { color: var(--muted); max-width: 56ch; margin: 0 0 18px; }
.hero-short { display: none; }
.snip { margin: 0; font: 13px/1.6 var(--mono); background: var(--snip-bg); color: var(--snip-ink); border-radius: 14px; padding: 16px 18px; overflow-x: auto; box-shadow: 0 0 0 1px var(--hair); }
.snip .k { color: var(--snip-k); } .snip .s { color: var(--snip-s); }
.stats { display: flex; flex-wrap: wrap; gap: 10px 30px; margin: 24px 0 0; font-size: 13px; color: var(--muted); }
.stats b { display: block; font: 500 22px/1.3 var(--mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-side { display: grid; gap: 18px; min-width: 0; }
.hero-side .core { padding: 20px 22px; display: flex; flex-direction: column; align-items: flex-start; }
.hero-side p { font-size: 14px; margin: 0 0 14px; color: var(--muted); }
.hero-side .go { margin-top: auto; }
.go { display: inline-flex; align-items: center; gap: 10px; min-height: 42px; font: 500 14px var(--sans); padding: 6px 7px 6px 16px; border-radius: 999px; background: var(--ink); color: var(--surface); text-decoration: none;
  transition: background-color .5s var(--ease), color .5s var(--ease), transform .5s var(--ease); }
.icon { display: inline-block; flex: none; }
.go i .icon, .hero-cards i .icon { width: 15px; height: 15px; }
.go i { width: 28px; height: 28px; border-radius: 50%; background: color-mix(in srgb, var(--surface) 16%, transparent); display: grid; place-items: center; font-style: normal; transition: transform .6s var(--ease); }
.go:hover i { transform: translate(2px, -2px) scale(1.05); }
.go:active { transform: scale(.98); }
.go.ghost { background: transparent; color: var(--ink); box-shadow: 0 0 0 1px var(--hair); }
.go.ghost i { background: var(--accent-soft); }
.go.ghost:hover { background: var(--accent-soft); }
.hero-cards { display: none; }

/* --- the timeline's head: title, search, branch, surprise --- */
.tl-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s5); margin: 44px 4px 14px; }
.tl-tools { margin: 0; flex: 0 1 auto; justify-content: flex-end; }
.tl-tools #search, .tl-tools #branch, .tl-tools .btn { border-radius: 999px; border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--hair), var(--shadow-sm); min-height: 40px; }
.tl-tools #search { flex: 1 1 320px; width: 330px; padding: 9px 16px; }
.tl-tools #branch { width: 11.5rem; max-width: 100%; padding: 8px 12px 8px 14px; font-size: 13.5px; }
.tl-tools .btn { padding: 8px 16px; font-size: 13.5px; }
.tl-core { padding: 6px 24px 18px; }
@media (max-width: 1000px) { .hero { grid-template-columns: minmax(0, 1fr); } .hero-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tl-tools { flex: 1 1 100%; justify-content: flex-start; } }
@media (max-width: 699.98px) {
  .mast-top { padding-top: 14px; gap: 6px 12px; }
  .repo-line { order: 3; flex-basis: 100%; margin-left: 0; font-size: 12px; }
  .theme { margin-left: auto; min-height: 44px; }
  .hero { display: block; margin-top: var(--s2); }
  .hero-main { padding: 0; background: none; box-shadow: none; border-radius: 0; }
  .hero-main .core { padding: 0; background: none; box-shadow: none; }
  .hero-main .display { font-size: 34px; margin: 6px 0 10px; }
  .hero-long, .snip, .stats, .hero-side { display: none; }
  .hero-short { display: block; font-size: 14.5px; margin: 0 0 16px; }
  .hero-cards { display: grid; gap: 10px; }
  .hero-cards a { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; padding: 12px 16px; border-radius: 18px; background: var(--surface); color: var(--ink); text-decoration: none;
    box-shadow: 0 0 0 1px var(--hair), var(--shadow-sm); transition: transform .45s var(--ease), background-color .45s var(--ease); }
  .hero-cards a:active { transform: scale(.98); }
  .hero-cards b { font-weight: 500; }
  .hero-cards i { flex: none; font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--ink); }
  .tl-head { margin: 32px 0 12px; }
  .tl-tools #search { width: auto; flex-basis: 100%; }
  .tl-tools #branch { flex: 1 1 auto; max-width: none; min-width: 0; }
  .tl-tools .btn, .tl-tools #branch, .tl-tools #search { min-height: 44px; }
  .bezel { padding: 4px; border-radius: 22px; }
  .core { border-radius: 18px; }
  #tab-timeline .bezel { padding: 0; background: none; box-shadow: none; }
  .tl-core { padding: 2px 8px 14px; box-shadow: 0 0 0 1px var(--hair), var(--shadow-sm); }
}

/* --- status line --- */
.status { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; padding: 10px 16px; margin-bottom: var(--s4); background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--hair), var(--shadow-sm); border-radius: 14px; font-size: 14px; }
.status[data-kind="error"] { color: var(--error); background: var(--error-soft); box-shadow: 0 0 0 1px color-mix(in srgb, var(--error) 35%, transparent); }
.status[data-kind="warn"] { color: var(--warn); }
.spin { width: 12px; height: 12px; border: 2px solid var(--line-strong); border-top-color: var(--accent-fill); border-radius: 50%; animation: spin .8s linear infinite; display: none; }
.status[data-busy="1"] .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
#status-bar { flex: 1 1 200px; height: 6px; appearance: none; border: 0; border-radius: 3px; overflow: hidden; background: var(--surface-2); }
#status-bar::-webkit-progress-bar { background: var(--surface-2); }
#status-bar::-webkit-progress-value { background: var(--accent-fill); transition: width .1s; }
#status-bar::-moz-progress-bar { background: var(--accent-fill); }

/* --- controls --- */
.bar { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; margin-bottom: var(--s3); }
.bar > .hint { flex: 1 1 200px; }
.field-inline { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); min-width: 0; max-width: 100%; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r); padding: 6px 9px; min-width: 0; max-width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: -1px; }
.btn { font: 500 14px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: 6px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background-color .45s var(--ease), color .45s var(--ease), border-color .45s var(--ease), transform .45s var(--ease); }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; border-color: var(--line); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--surface); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 82%, var(--accent)); }
.btn.danger { color: var(--error); }
.btn.danger:hover:not(:disabled) { border-color: var(--error); }
.btn.small { font-size: 12.5px; padding: 2px 8px; }
.btn[aria-busy="true"] { cursor: progress; opacity: .7; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
button.link { font: inherit; font-size: 13px; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
kbd { font: 12px var(--mono); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 4px; background: var(--surface); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

/* --- surfaces --- */
.panel { min-width: 0; background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--hair), var(--shadow-sm); border-radius: 16px; padding: var(--s4) 18px; }
.panel > h3:first-child, .panel > h4:first-child { margin-top: 0; }
.lede { margin: var(--s3) 0 var(--s5); max-width: 80ch; }
.lede p { color: var(--muted); }
.lede p { margin: 0 0 var(--s3); }
.lede .actions { margin-top: var(--s3); }
.block { margin-top: var(--s6); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; border-bottom: 1px solid var(--hair); padding-bottom: 8px; margin-bottom: var(--s3); }
.block-head h3 { margin: 0; font: 400 22px/1.2 var(--display); letter-spacing: -.015em; }
.block-head h3 code { font-size: .8em; background: none; padding: 0; }
.scroll { overflow-x: auto; max-width: 100%; }

/* SQL as the page runs it */
.sql-show { margin: 0 0 var(--s3); background: var(--code-bg); border: 0; box-shadow: 0 0 0 1px var(--hair-2); border-radius: var(--r); padding: 8px 10px; font-size: 12.5px; line-height: 1.5; overflow-x: auto; white-space: pre; color: var(--ink); }
.sql-box { width: 100%; font: 13px/1.55 var(--mono); background: var(--code-bg); padding: 10px; resize: vertical; tab-size: 2; }
.sql-out { margin-top: var(--s2); }
.sql-error { color: var(--error); font-family: var(--mono); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--error-soft); padding: 8px 10px; border-radius: var(--r); margin: 0; }

/* --- timeline: a graph rail, one node per check-in --- */
.count { margin: 0 0 var(--s2); min-height: 1em; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline .day { font: 600 12.5px var(--mono); letter-spacing: .04em; color: var(--muted); padding: var(--s4) 0 var(--s1) 62px; position: relative; }
.timeline .day::before { content: ""; position: absolute; left: 62px; right: 0; bottom: 0; border-bottom: 1px dashed var(--hair); }
.ci-row { display: grid; grid-template-columns: 44px 18px 1fr; gap: 0 var(--s3); position: relative; }
.ci-row time { color: var(--muted); font-size: 12.5px; padding-top: 11px; text-align: right; }
.rail { position: relative; }
.rail::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.rail::after { content: ""; position: absolute; left: 3px; top: 13px; width: 12px; height: 12px; border-radius: 50%; background: hsl(var(--hue, 30) var(--rail-s) var(--rail-l)); box-shadow: 0 0 0 3px var(--bg); }
.ci-row.leaf .rail::after { background: var(--bg); border: 3px solid var(--accent-fill); }
.ci-row.merge .rail::after { border-radius: 2px; transform: rotate(45deg); }
.timeline.graphed { --tcol: 44px; --gap: var(--s3); --gw: 16px; }
.timeline.graphed .ci-row { grid-template-columns: var(--tcol) var(--gw) minmax(0, 1fr); gap: 0 var(--gap); min-height: 40px; }
.timeline.graphed .day { padding-left: calc(var(--tcol) + var(--gw) + 2 * var(--gap)); }
.timeline.graphed .day::before { left: calc(var(--tcol) + var(--gw) + 2 * var(--gap)); }
.rail.graph::before, .rail.graph::after { content: none; }
.rail.graph svg { position: absolute; inset: -1px 0; width: 100%; height: calc(100% + 2px); overflow: visible; }
.rail.graph svg * { fill: none; stroke-width: 2; stroke-linecap: round; }
.rail.graph svg [stroke-dasharray] { stroke-width: 1.6; stroke-linecap: butt; }
.timeline .day > .rail.graph { position: absolute; left: var(--tcol); top: 0; bottom: 0; width: var(--gw); margin-left: var(--gap); }
.timeline.graphed + #more { margin-left: calc(44px + var(--gw, 16px) + 2 * var(--s3)); }
.ci-body { min-width: 0; padding: 8px 0 10px; border-bottom: 1px solid var(--hair); }
.comment { margin: 0; overflow-wrap: anywhere; }
.ci-row.leaf .comment, .ci-row.merge .comment { font-weight: 500; }
.ci-row.leaf .comment { font-weight: 600; }
.meta { margin: 3px 0 0; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.hash { font-size: 12.5px; color: var(--hash); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
a.hash:hover { text-decoration: underline; }
.hash.hit { background: var(--mark); border-radius: 2px; }
.meta a.files { font-size: 11.5px; color: var(--muted, inherit); text-decoration: underline; text-underline-offset: 2px; }
.branch, .tag { font: 500 11.5px/1.6 var(--mono); padding: 0 8px; border-radius: 999px; white-space: nowrap; }
.branch { max-width: 100%; white-space: normal; overflow-wrap: anywhere; color: hsl(var(--hue, 30) 60% var(--chip-l)); background: hsl(var(--hue, 30) 45% 50% / .16); }
.tag { color: var(--muted); box-shadow: inset 0 0 0 1px var(--hair); }
.tag.gone { color: var(--error); box-shadow: inset 0 0 0 1px currentColor; }
#more { margin: var(--s4) 0 0 62px; }

/* --- files --- */
.ci { min-width: 0; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; flex: 1 1 400px; }
.ci .comment { flex: 1 1 260px; }
.split { display: grid; grid-template-columns: minmax(240px, 340px) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.tree-wrap { padding: var(--s2) var(--s1); max-height: 78vh; overflow: auto; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: 14px; margin-left: 6px; border-left: 1px solid var(--hair); }
.tree li.file { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.dirname, .fname { font: 13px/1.5 var(--mono); background: none; border: 0; color: var(--ink); cursor: pointer; padding: 2px 6px; text-align: left; border-radius: 6px; transition: background-color .4s var(--ease); text-decoration: none; overflow-wrap: anywhere; min-width: 0; }
.dirname { font-weight: 600; }
.dirname .icon { width: 13px; height: 13px; margin-right: 4px; vertical-align: -1px; color: var(--muted); transition: transform .45s var(--ease); }
.dirname[aria-expanded="true"] .icon { transform: rotate(90deg); }
.dirname:hover, .fname:hover { background: var(--surface-2); }
a.fname { display: inline-block; }
a.fname.current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.size { font: 12px var(--mono); color: var(--muted); padding-right: 6px; white-space: nowrap; }
.vhead { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: var(--s3); }
.vhead > code:first-child { font-weight: 600; background: none; padding: 0; }
.vhead h3 { margin: 0; }
.vhead .actions { margin-left: auto; gap: 6px; }
.code { margin: 0; background: var(--code-bg); padding: 10px 12px; border-radius: var(--r); overflow: auto; max-height: 72vh; font-size: 12.5px; line-height: 1.5; tab-size: 4; }
.viewer img { max-width: 100%; }
.diff .d-file { color: var(--muted); font-weight: 600; }
.diff .d-hunk { color: var(--hash); }
.diff .d-add { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.diff .d-del { background: color-mix(in srgb, var(--error) 14%, transparent); }
.blame-wrap { overflow: auto; max-height: 72vh; background: var(--code-bg); border-radius: var(--r); }
.blame { border-collapse: collapse; font: 12.5px/1.5 var(--mono); width: 100%; }
.blame td { padding: 0 8px; vertical-align: top; white-space: pre; }
.blame tr:not(.same) td { border-top: 1px solid var(--hair); }
.blame .b-ci, .blame .b-who { white-space: nowrap; color: var(--muted); }
.blame .b-no { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.blame .b-text { width: 100%; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s3); padding: 10px 0; border-bottom: 1px solid var(--hair); }
.h-when { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--muted); }
.h-body { min-width: 0; }

/* --- read --- */
.featured { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); background: var(--accent-soft); border: 0; box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent); border-radius: 16px; padding: 14px 18px; margin-bottom: var(--s4); transition: transform .5s var(--ease); }
.featured:hover { transform: translateY(-1px); }
.featured strong { font: 600 19px/1.3 var(--serif); }
.kicker { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.seg { display: flex; padding: 4px 4px 8px; }
.seg { gap: 2px; margin: 0 4px 8px; padding: 4px; border-radius: 999px; background: var(--surface-2); }
.seg button { flex: 1; font: 500 13px var(--sans); background: transparent; color: var(--muted); border: 0; padding: 6px 6px; border-radius: 999px; cursor: pointer; transition: background-color .45s var(--ease), color .45s var(--ease); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); position: relative; }
.read-list .tree li { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.read-item { font-family: var(--sans) !important; font-size: 14px !important; white-space: normal; }
.read-list li.sub { display: block; padding: 10px 6px 4px; }
.read-head { border-bottom: 1px solid var(--hair); margin-bottom: var(--s4); padding-bottom: var(--s2); }
.read-head h1 { font: 600 28px/1.2 var(--serif); margin: 0 0 6px; text-wrap: balance; letter-spacing: -.01em; }
.prose { font: 17px/1.65 var(--serif); overflow-wrap: anywhere; }
.prose .hint, .prose .meta { font-family: var(--sans); }
.prose > div, .post-body { max-width: 72ch; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); line-height: 1.25; letter-spacing: 0; }
.prose h2 { font-size: 22px; margin-top: 28px; }
.prose h3 { font-size: 18px; }
.prose pre { background: var(--code-bg); padding: 10px 12px; border-radius: var(--r); overflow: auto; font-size: 13px; line-height: 1.5; }
.prose blockquote { margin: 10px 0; padding: 6px 14px; background: var(--surface-2); border-radius: var(--r); color: var(--muted); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; font-family: var(--sans); font-size: 14px; }
.prose th, .prose td { border: 1px solid var(--hair); padding: 4px 8px; }
.prose img { max-width: 100%; }
.post { border-top: 1px solid var(--hair); padding: 12px 0; }
.post .meta { margin: 0 0 4px; }
.fields { margin: 8px 0 12px; }
.fields th { width: 30%; text-transform: capitalize; }

/* --- tables --- */
.grid { width: 100%; border-collapse: collapse; background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--hair); border-radius: 12px; overflow: hidden; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--hair); overflow-wrap: anywhere; vertical-align: top; }
.grid th { font: 600 11.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); white-space: nowrap; }
.grid tr.current td { background: var(--accent-soft); }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.null { color: var(--muted); font-style: italic; }
pre.cell { margin: 0; max-height: 18em; overflow: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
td.barcell { position: relative; min-width: 140px; isolation: isolate; }
td.barcell > .bar-fill { position: absolute; inset: 5px auto 5px 0; background: color-mix(in srgb, var(--accent-fill) 28%, transparent); border-right: 2px solid var(--accent-fill); z-index: -1; }

/* --- SQL tab --- */
.examples { display: grid; gap: var(--s3); margin: 0 0 var(--s3); }
.ex-group h3 { font-size: 13px; margin: 0 0 6px; }
.ex-group .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sql-on { font-size: 13px; color: var(--muted); }
.sql-on select { font: 13px var(--sans); max-width: 100%; }
.chip { font: 13px var(--sans); background: var(--surface); color: var(--ink); border: 0; box-shadow: 0 0 0 1px var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; transition: background-color .45s var(--ease), color .45s var(--ease), transform .45s var(--ease); }
.chip:hover { background: var(--accent-soft); }
.chip:active { transform: scale(.97); }
.sql-box + .bar { margin-top: 10px; }

/* --- playground --- */
.play { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.play-forms, .play-state { display: grid; gap: var(--s3); min-width: 0; }
.pg-form { background: var(--surface); border: 0; box-shadow: 0 0 0 1px var(--hair), var(--shadow-sm); border-radius: 16px; padding: var(--s4) 18px; display: grid; gap: 8px; scroll-margin-top: 84px; }
.pg-form h3 { margin: 0; font-size: 14.5px; }
.pg-form label, .duo-form label, .wk-new label, .wk-commit label { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.pg-form input, .pg-form textarea, .pg-form select, .duo-form input, .duo-form textarea, .wk-new input, .wk-new textarea, .wk-commit input { width: 100%; background: var(--bg); }
.pg-form textarea, .duo-form textarea, .wk-new textarea { font: 13px/1.5 var(--mono); }
.pg-form .btn { justify-self: start; }
.pg-sql { margin: 0; font: 12px/1.45 var(--mono); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--code-bg); padding: 6px 8px; border-radius: 6px; }
.play-state h3 { margin: 0 0 6px; font-size: 14.5px; }
.play-state h3 + * + h3, .play-state .pg-list + h3, .play-state .empty + h3 { margin-top: var(--s3); }
.pg-list { margin: 0; padding-left: 18px; font-size: 13.5px; }
.pg-ok { color: var(--ok); font-weight: 600; }
.pg-err { color: var(--error); overflow-wrap: anywhere; }
.pg-form.pg-target { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent), var(--shadow-sm); }

/* --- multi-repo and work --- */
.twin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.twin .sql-show { font-size: 12px; }
.mini-tl { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.mini-tl li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--hair); position: relative; }
.mini-tl li:last-child { border-bottom: 0; }
.mini-tl li > span:first-child { width: 9px; height: 9px; margin-top: 6px; border-radius: 50%; background: hsl(var(--hue, 30) var(--rail-s) var(--rail-l)); }
.mini-tl li.pending > span:first-child { background: none; border: 2px dashed var(--accent-fill); width: 10px; height: 10px; }
.mini-tl li.here > span:first-child { background: var(--bg); border: 3px solid var(--accent-fill); width: 11px; height: 11px; margin-top: 5px; }
.mini-tl .c { overflow-wrap: anywhere; }
.mini-tl .m { display: block; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.mini-tl li.pending .c { font-style: italic; }
.use-probe { margin-top: var(--s3); font-size: 13.5px; }
.use-probe .kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 6px 0 0; font-family: var(--mono); font-size: 12.5px; }
.use-probe .kv dt { color: var(--muted); }
.use-probe .kv dd { margin: 0; overflow-wrap: anywhere; }
.duo { display: grid; grid-template-columns: minmax(260px, 360px) minmax(0, 1fr); gap: var(--s3); align-items: start; margin-bottom: var(--s3); }
.duo-form { display: grid; gap: 10px; }
.txn { margin: 0; font: 500 13px var(--mono); color: var(--muted); min-height: 1.4em; }
.txn[data-open="1"] { color: var(--accent); }
.txn[data-open="1"]::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-right: 7px; vertical-align: 1px; }
.steps { font-size: 13px; }
.steps ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.steps li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.steps pre { margin: 0; font: 12.5px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.steps .res { font: 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; padding-left: 2ch; }
.steps .res.err { color: var(--error); }
.steps .res.ok .icon { width: 13px; height: 13px; margin-right: 5px; vertical-align: -2px; }
.steps h4 { margin-bottom: 6px; }
.work { display: grid; grid-template-columns: minmax(200px, 260px) minmax(0, 1fr) minmax(240px, 320px); gap: var(--s3); align-items: start; margin-bottom: var(--s3); }
.wk-side { display: grid; gap: var(--s3); min-width: 0; }
.wk-files .tree li { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.wk-files .fname[aria-current="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.wk-new, .wk-commit { display: grid; gap: 8px; margin-top: var(--s3); padding-top: var(--s3); border-top: 1px solid var(--hair); }
.wk-new .btn, .wk-commit .btn { justify-self: start; }
.editor { min-height: 280px; background: var(--code-bg); }
.wk-where { margin: 0; font-size: 14px; flex: 1 1 320px; }
.status-list { list-style: none; margin: 0; padding: 0; font: 13px var(--mono); }
.status-list li { display: flex; gap: 10px; padding: 3px 0; overflow-wrap: anywhere; }
.chg { flex: none; width: 8.5ch; font-weight: 600; text-transform: uppercase; font-size: 11.5px; padding-top: 1px; }
.chg-edited { color: var(--accent); }
.chg-added { color: var(--ok); }
.chg-missing, .chg-deleted { color: var(--error); }
.badge { font: 600 11.5px var(--mono); text-transform: uppercase; letter-spacing: .05em; }

.wk-cow { margin: 0 0 var(--s3); font-size: 14px; padding: 10px 16px; background: var(--accent-soft); border-radius: 14px; font-variant-numeric: tabular-nums; }
.wk-cow b { font-weight: 600; }
.wk-files .tree li { flex-wrap: wrap; }
.cow { flex: 1 0 100%; padding: 0 6px 2px; font: 500 11.5px var(--mono); color: var(--muted); }
.cow[data-state="copy"] { color: var(--accent); font-weight: 600; }
#wk-diff { margin-bottom: var(--s3); }
#wk-diff h3 { margin-top: 0; }
#wk-diff .code { max-height: 40vh; }
.wk-edit .bar { gap: var(--s2); }

/* --- opfs --- */
#opfs-usage { color: var(--muted); }

/* --- footer --- */
.foot { border-top: 1px solid var(--hair); color: var(--muted); font-size: 13px; padding-block: var(--s4) var(--s6); }
.foot p { margin: 0 0 4px; }
.offline { color: var(--ok); font-weight: 600; }

#mr-repos th, #mr-repos td { white-space: nowrap; overflow-wrap: normal; }
#mr-out .grid th, #mr-out .grid td { overflow-wrap: normal; }
#mr-sql { max-width: 100%; box-sizing: border-box; }

/* --- narrow screens --- */
@media (max-width: 1080px) {
  .work { grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); }
  .wk-side { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .split, .play, .duo, .work, .twin, .wk-side { grid-template-columns: minmax(0, 1fr); }
  .lede h2 { font-size: 26px; }
  .tree-wrap { max-height: 50vh; }
  .ci-row { grid-template-columns: 38px 16px minmax(0, 1fr); gap: 0 var(--s2); }
  .timeline .day { padding-left: 54px; }
  .timeline .day::before { left: 54px; }
  #more { margin-left: 54px; }
  .timeline.graphed { --tcol: 38px; --gap: var(--s2); }
  .timeline.graphed + #more { margin-left: calc(38px + var(--gw, 16px) + 2 * var(--s2)); }
  .field-inline { flex: 1 1 100%; }
  .history li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .h-when { flex-direction: row; gap: 10px; }
  .read-head h1 { font-size: 23px; }
  .prose { font-size: 16.5px; }
  .vhead .actions { margin-left: 0; }
  .editor { min-height: 200px; }
}
.mini-tl li.none > span:first-child { background: none; }

/* iOS Safari zooms into any focused field under 16px and stays zoomed;
   phones get 16px fields. */
@media (max-width: 700px), (pointer: coarse) {
  input, textarea, select { font-size: 16px !important; }
}
