/* writeup.css — the shared article layer for /story and the six writeups.
   Loaded after vibed.css and after each page's own <style>, so equal-specificity
   rules here win. Layout C: a big condensed title, the whole Riso cover, a side
   rail (contents; /story also keeps its In short) beside the body column. */

/* The writeups were built on their own token names. Point them at Vibed's,
   so every page component follows the site's light and dark themes. */
:root {
  --font-body: var(--font-sans);
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-surface-2: var(--surface-raised);
  --color-divider: var(--line);
  --color-border: var(--line);
  --color-text: var(--ink);
  --color-text-muted: var(--ink-2);
  --color-text-faint: var(--ink-3);
  --color-primary: var(--accent);
  --color-primary-hover: var(--accent-fill);
}

body { background: var(--bg); color: var(--ink); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- article shell ---------- */
main.wrap {
  max-width: 1184px;
  margin-inline: auto;
  padding: 0 24px 96px;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.65;
  --measure: 38em;
}
/* zero specificity, like the old `*` reset, so each page's own spacing rules still win */
:where(main.wrap) :where(h1, h2, h3, p, figure, dl, dd, ol, ul, pre) { margin: 0; padding: 0; }
:where(main.wrap) img { display: block; max-width: 100%; }
:where(main.wrap) a { color: var(--accent); text-underline-offset: 3px; }
main.wrap code { font-family: var(--font-mono); font-size: 0.86em; background: var(--surface-raised); padding: 1px 5px; border-radius: 4px; }
main.wrap h1 { scroll-margin-top: 88px; }

.opening { padding: 56px 0 0; }
.dateline { font: 500 11px/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 20px; }
.title {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 85;
  font-weight: 600;
  font-size: clamp(48px, 7.6vw, 112px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin-bottom: 20px;
}
.standfirst { font: 400 clamp(19px, 1.5vw, 22px)/1.45 var(--font-sans); color: var(--ink-2); max-width: 40ch; }

.wu-cover { margin-top: 40px; }
.wu-cover img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #f0f0ee;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ---------- side rail: contents (In short only on /story) ---------- */
.wu-side { margin-top: 40px; font-size: 15px; line-height: 1.5; }
.wu-side-label,
.wu-side .tldr .tl { font: 500 11px/1.4 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 12px; }
.wu-side .tldr { margin: 0; max-width: none; width: auto; }
.wu-side .tldr p { position: relative; padding-left: 28px; margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: var(--ink); }
.wu-side .tldr p:last-child { margin-bottom: 0; }
.wu-side .tldr p.tl { padding-left: 0; }
.wu-side .tldr .n { position: absolute; left: 0; top: 1px; font: 500 12px/1.5 var(--font-mono); color: var(--accent); }
.wu-toc { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
/* the writeups have no In short, so their contents open the rail with no divider */
.wu-side > .wu-toc:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.wu-toc ol { list-style: none; border-left: 1px solid var(--line); }
.wu-side .wu-toc a { display: block; padding: 5px 0 5px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--ink-2); text-decoration: none; font-size: 14px; line-height: 1.35; }
.wu-side .wu-toc a:hover { color: var(--ink); }
.wu-side .wu-toc a.is-active { color: var(--ink); border-left-color: var(--accent-fill); }

/* ---------- body ---------- */
.sec-head h2 { font-family: var(--font-sans); font-size: clamp(26px, 1.4vw + 16px, 34px); letter-spacing: -0.02em; color: var(--ink); }
main.wrap h2 { scroll-margin-top: 88px; }
figcaption { font: 400 14px/1.45 var(--font-sans); letter-spacing: 0; color: var(--ink-3); padding-top: 10px; }
figcaption .src { color: var(--ink-3); }
.plate { border-radius: 8px; }
.plate::after { content: none; } /* no file-name stamp while a capture loads */
.rail-title { text-transform: uppercase; letter-spacing: 0.08em; }

/* ---------- end of page ---------- */
.wu-footer { margin-top: 0; border-top: 1px solid var(--line); }
.wu-footer .vb-container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding-block: 32px 48px; }
.wu-footer-copy { font: 400 13px/1.4 var(--font-sans); color: var(--ink-3); margin: 4px 0 0; }
.wu-footer nav { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- layout C ---------- */
@media (min-width: 1024px) {
  main.wrap { display: grid; grid-template-columns: 240px minmax(0, 1fr); column-gap: 64px; align-items: start; }
  main.wrap > * { grid-column: 2; min-width: 0; }
  main.wrap > .opening,
  main.wrap > .wu-cover { grid-column: 1 / -1; }
  /* the rail fills its whole grid area; In short scrolls away and the contents stick */
  main.wrap > .wu-side { grid-column: 1; grid-row: 3 / span 60; align-self: stretch; margin-top: 64px; }
  .wu-side .wu-toc { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; }
  main.wrap > .lede,
  main.wrap > .story-body { padding-top: 64px; }
}
@media (max-width: 1023px) {
  .wu-side { padding-top: 24px; border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  main.wrap { padding-inline: 16px; font-size: 17px; }
  .opening { padding-top: 36px; }
  .wu-cover { margin-top: 28px; }
}
