/* Tobsy — the writing pages (2026-10-01). A READING surface on the site: paper by default, with a Dark switch that
   remembers the choice on the device. Both sets were settled on the blog's draft-3 review page (the human, over seven
   cuts of dark: white on near-black glowed, a grey ink went dull; what stayed is an ivory ink on a lifted violet-tinged
   dark, headings a step brighter, a hair of tracking and leading, a half step smaller). Georgia for the body (the italic
   the human chose), Gelasio embedded for phones that do not ship Georgia (Android); headings stay Newsreader; the chrome
   stays DM Sans / DM Mono. Loaded after styles.css; every rule is scoped to body.read, so no other page changes.
   THE SHAPE (the human, 2026-10-01): the reading column CENTRED on the page, the chapters in a sidebar to its left
   that follows the scroll, the post's title at the top of that sidebar, Dark and Share pinned above it; on a phone the
   sidebar is a contents card between the title and the text and the two buttons float in the corner, always in view. */
@font-face { font-family: 'Gelasio'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/gelasio-v14-latin.woff2) format('woff2'); }
@font-face { font-family: 'Gelasio'; font-style: italic; font-weight: 400 700; font-display: swap; src: url(/fonts/gelasio-v14-italic-latin.woff2) format('woff2'); }

body.read {
  color-scheme: light;
  --ground: #f1ebdd; --band: #e7dfcc; --surface: #fbf7ee; --raised: #fbf7ee;
  --ink: #262019; --ink-strong: #17120d; --ink-2: #625849; --ink-3: #7a6f5f;
  --line: #e1d9c6; --line-2: #cfc5ad;
  --brand: #6a59e6; --brand-deep: #5546c4; --brand-soft: rgba(106, 89, 230, 0.10);
  --bar: rgba(241, 235, 221, 0.88);
  --font-read: Georgia, 'Gelasio', 'Times New Roman', serif;
  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'DM Mono', ui-monospace, monospace;
  --read-size: 19px; --read-lh: 1.65; --read-ls: normal;
  --float-shadow: 0 10px 28px rgba(38, 32, 25, 0.18);
  background: var(--ground); color: var(--ink);
}
body.read.dark {
  color-scheme: dark;
  --ground: #22202a; --band: #302c3a; --surface: #2b2834; --raised: #2b2834;
  --ink: #dcd8cf; --ink-strong: #efebe3; --ink-2: #a8a39a; --ink-3: #857f78;
  --line: #3a3646; --line-2: #4a4557;
  --brand: #7c6aff; --brand-deep: #b8acff; --brand-soft: rgba(124, 106, 255, 0.16);
  --bar: rgba(34, 32, 42, 0.9);
  --read-size: 18px; --read-lh: 1.7; --read-ls: 0.008em;
  --float-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}
@media (max-width: 600px) {
  body.read { --read-size: 17.5px; --read-lh: 1.6; }
  body.read.dark { --read-size: 17.5px; --read-lh: 1.65; }
}

/* the site's chrome follows the page's tokens; the top bar's own ground is hard-coded for night, so it is set here */
body.read .ntop { background: var(--bar); }
body.read .ntop nav a.btn--primary { color: #fff; }
body.read.dark .ntop nav a.btn--primary, body.read.dark .btn--primary { color: #0b0b14; }
body.read.dark .btn--ghost { background: transparent; color: var(--ink); }
body.read footer { border-top-color: var(--line); color: var(--ink-3); }
body.read footer a { color: var(--ink-2); }
body.read footer a:hover { color: var(--ink); }

/* ── the post: a centred reading column, the sidebar to its left ─────────────── */
.post { padding-block: clamp(28px, 5vw, 56px) clamp(56px, 8vw, 110px); }
.post .wrap { width: min(1400px, calc(100% - 40px)); }   /* wider than the site's 1200 wrap: the sidebar gets the room (the human: "a lot of empty space on the left") */
.post__grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr); column-gap: clamp(24px, 3vw, 48px); row-gap: 28px; align-items: start; }
.post__head { grid-column: 2; display: grid; gap: 14px; }
.post__head h1 { color: var(--ink-strong); font-size: clamp(34px, 4.4vw, 52px); line-height: 1.08; }
.post__head h1 em { font-style: italic; color: var(--brand-deep); }
.post__meta { font-family: var(--font-ui); font-size: 14.5px; color: var(--ink-3); }
.side { grid-column: 1; grid-row: 2; justify-self: end; width: 100%; max-width: 340px; position: sticky; top: 86px; font-family: var(--font-ui); }
.rail__tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px 10px; }
.rail__tools .tools__chapters, .rail__head .rail__close { display: none; }   /* the drawer's opener and closer: a phone's (two classes, so the .theme rule below cannot outrank it) */
.ico { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico-sun { display: none; }
body.read.dark .ico-moon { display: none; }
body.read.dark .ico-sun { display: block; }
.rail__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rail__h { margin: 0 0 6px; padding-left: 10px; font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.rail__post { display: block; margin: 0 0 6px; padding: 8px 10px; border-radius: 10px; font-family: 'Newsreader', Georgia, serif; font-weight: 500; font-size: 19px; line-height: 1.25; color: var(--ink-strong); text-decoration: none; text-wrap: balance; }
.rail__post:hover { background: var(--band); text-decoration: none; }
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail ol a { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 4px 10px; align-items: baseline; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-size: 15px; font-weight: 500; line-height: 1.3; text-decoration: none; }
.rail ol a:hover { background: var(--band); color: var(--ink); text-decoration: none; }
.rail ol a[aria-current="true"] { background: var(--brand-soft); color: var(--ink); }
.rail__n { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.rail ol a[aria-current="true"] .rail__n { color: var(--brand-deep); }
.rail__m { grid-column: 2; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--ink-3); }
.theme { display: inline-flex; align-items: center; gap: 7px; font: 600 13px/1 var(--font-ui); padding: 9px 13px 9px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.theme:hover { color: var(--ink); border-color: var(--ink-3); }
.article { grid-column: 2; grid-row: 2; font-family: var(--font-read); font-size: var(--read-size); line-height: var(--read-lh); letter-spacing: var(--read-ls); color: var(--ink); display: grid; gap: 52px; overflow-wrap: break-word; }

/* narrower than the sidebar needs: one centred column; the sidebar becomes a DRAWER that slides in from the left,
   opened from a pill of three icons floating in the bottom corner (chapters · moon or sun · share) that stays in view
   wherever the reader is — the human, on a phone: "there's no left panel… I can't really change chapters" */
@media (max-width: 1279px) {
  .post__grid { grid-template-columns: minmax(0, 720px); justify-content: center; }
  .post__head, .side, .article { grid-column: 1; grid-row: auto; }
  .side { position: static; width: auto; max-width: none; justify-self: stretch; }
  .rail__tools { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 30; margin: 0; padding: 6px; gap: 6px; flex-wrap: nowrap; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; box-shadow: var(--float-shadow); }
  .rail__tools .theme { padding: 10px; }
  .rail__tools .ico { width: 18px; height: 18px; }
  .rail__tools .tl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* the word stays for a screen reader */
  .rail__tools .tools__chapters { display: inline-flex; }
  .rail { position: fixed; top: 0; bottom: 0; left: 0; z-index: 50; width: min(330px, 86vw); padding: 16px 14px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line-2); box-shadow: var(--float-shadow); transform: translateX(-104%); transition: transform .22s ease; }
  .rail.open { transform: none; }
  .rail__head .rail__close { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; }
  .rail__head { margin-bottom: 10px; }
  .rail__head .rail__h { margin: 0; }
  .rail ol a { padding: 9px 8px; font-size: 15.5px; }
  .scrim { position: fixed; inset: 0; z-index: 45; background: rgba(20, 16, 12, 0.35); }
  .scrim[hidden] { display: none; }
  body.drawer-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } }

/* ── a chapter ─────────────────────────────────────────────────────────────── */
.chapter { display: grid; gap: 22px; scroll-margin-top: 84px; padding-block: 0; }   /* styles.css pads every section ~96px; the article's own gap spaces chapters */
.chapter .btn, .chapter .btn:hover { text-decoration: none; }   /* the chapter's links are underlined; its buttons are not */
.chapter .eyebrow .rt { color: var(--ink-3); }
.chapter h2 { font-family: 'Newsreader', Georgia, 'Times New Roman', serif; font-weight: 500; letter-spacing: -0.01em; font-size: clamp(28px, 3.6vw, 38px); line-height: 1.12; margin-top: -6px; color: var(--ink-strong); }
.chapter h3 { font-family: 'Newsreader', Georgia, 'Times New Roman', serif; font-weight: 500; letter-spacing: -0.005em; font-size: clamp(22px, 2.4vw, 26px); line-height: 1.2; margin-top: 14px; color: var(--ink-strong); }
.chapter p { margin: 0; }
.chapter p.lead-i { font-style: italic; }
.chapter strong { font-weight: 700; color: var(--ink); }
.chapter a { text-decoration: underline; text-underline-offset: 3px; }
.chapter blockquote { margin: 4px 0; padding: 16px 20px 14px; background: var(--band); border-radius: 14px; font-size: 1.08em; line-height: 1.5; color: var(--ink); }
.chapter blockquote p { margin: 0; }
.chapter blockquote cite { display: block; margin-top: 10px; font-family: var(--font-ui); font-style: normal; font-size: 0.72em; line-height: 1.5; letter-spacing: normal; color: var(--ink-2); }

/* every chapter's own row: Useful (a thumbs-up with the count) and Share, as small pills with icons */
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: -6px; font-family: var(--font-ui); letter-spacing: normal; }
.act { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px 8px 11px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 600 13.5px/1 var(--font-ui); cursor: pointer; }
.act:hover { color: var(--ink); border-color: var(--ink-3); }
.act[hidden] { display: none; }
.act svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
body.read.dark .act[aria-pressed="true"] { color: #0b0b14; }
.act__n { font-family: var(--font-mono); font-size: 12px; line-height: 1; min-width: 1.5em; padding: 4px 7px; border-radius: 999px; background: var(--band); color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.act__n:empty { display: none; }
.act[aria-pressed="true"] .act__n { background: rgba(255, 255, 255, 0.24); color: inherit; }

/* the From Tobsy card after each chapter */
.ps { margin-top: 6px; border: 1px solid var(--line-2); border-radius: 16px; padding: 18px 20px 16px; background: var(--surface); display: grid; gap: 10px; }
.ps__eyebrow { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.ps__eyebrow .wordmark { font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--brand); }
.ps__mark { flex: none; width: 20px; height: 20px; border-radius: 5px; }
.ps p { margin: 0; font-size: 0.97em; }
.ps__btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; font-family: var(--font-ui); letter-spacing: normal; }
.ps__btns .btn { font-size: 15px; padding: 10px 16px; white-space: normal; text-align: center; }
@media (max-width: 480px) { .ps__btns .btn { width: auto; } }

/* sources, collapsed under the chapter */
.srcs { border-top: 1px solid var(--line); padding-top: 14px; font-family: var(--font-ui); font-size: 14.5px; line-height: 1.5; letter-spacing: normal; color: var(--ink-2); }
.srcs summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.srcs ol { margin: 10px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.srcs li { margin: 0; }
.srcs a { text-decoration: none; }
.srcs a:hover { text-decoration: underline; }

/* after the last chapter: pass it on, or write back */
.after { display: grid; gap: 14px; padding-top: 8px; font-family: var(--font-ui); letter-spacing: normal; }
.after__h { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.after .btn-row .btn { font-size: 15px; padding: 10px 16px; white-space: normal; }
