/* Notebook design (option A). One stylesheet for every page. */

@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('/assets/fonts/Geist-Italic-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --ink: #0b0b0c;
  --text: #1c1d20;
  --muted: #5b5f66;
  --accent: #2f5bea;
  --accent-ink: #1e3fb0;
  --on-accent: #ffffff;
  --panel: #f4f5f7;
  --line: #ececee;
  --line-strong: #dcdce0;
  --footer-bg: #0b0b0c;
  --footer-text: #e8e8ea;
  --footer-muted: #a1a1aa;
  --mark: #fff3b0;
  --shadow: 0 1px 2px rgba(11, 11, 12, 0.04), 0 8px 24px rgba(11, 11, 12, 0.06);
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius: 16px;
  --container: 1120px;
  --narrow: 760px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e10;
    --ink: #f2f2f3;
    --text: #dcdde0;
    --muted: #a0a4ab;
    --accent: #7c9bff;
    --accent-ink: #a9bcff;
    --on-accent: #0b0b0c;
    --panel: #17181b;
    --line: #232428;
    --line-strong: #33353a;
    --footer-bg: #060607;
    --mark: #4a4012;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 24px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.container { max-width: var(--container); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.container.narrow { max-width: var(--narrow); }
.section { padding-bottom: 88px; }
.mono { font-family: var(--mono); font-size: 13px; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.eyebrow {
  margin: 0 0 16px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.lede { margin: 20px 0 0; font-size: 20px; line-height: 1.55; color: var(--muted); max-width: 640px; }
.sep { margin: 0 8px; color: var(--muted); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; padding: 8px 14px; background: var(--ink); color: var(--bg); border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 12px; }

/* ---------- buttons, chips ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button-accent { background: var(--accent); color: var(--on-accent); }
.button-accent:hover { color: var(--on-accent); filter: brightness(1.08); }
.button-dark { background: var(--ink); color: var(--bg); border-radius: 10px; min-height: 48px; padding: 0 22px; }
.button-dark:hover { color: var(--bg); opacity: 0.9; }
.chip {
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg);
  color: var(--text); font-size: 14px; cursor: pointer; text-align: left;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed='true'] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; padding-top: 14px; padding-bottom: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: inline-flex; width: 30px; height: 30px; border-radius: 8px; align-items: center; justify-content: center;
  background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 13px;
}
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 24px; font-size: 15px; }
.site-nav a { text-decoration: none; font-weight: 500; }
.site-nav a.muted { color: var(--muted); font-weight: 400; }
.site-nav a.muted:hover { color: var(--ink); }
.site-nav .button { min-height: 40px; padding: 0 16px; }

/* ---------- home: hero and ask ---------- */
.hero { padding-top: 56px; padding-bottom: 48px; }
.hero h1 { margin: 0; font-size: clamp(34px, 4.6vw, 50px); line-height: 1.06; letter-spacing: -0.035em; font-weight: 600; max-width: 900px; }
.hero .lede { margin-top: 16px; }

.ask { margin-top: 32px; max-width: 900px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--bg); box-shadow: var(--shadow); overflow: hidden; }
.ask-form { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; }
.ask-icon { display: inline-flex; color: var(--accent); flex: 0 0 auto; }
.ask-form input[type='search'] {
  flex: 1 1 auto; min-width: 0; min-height: 44px; border: none; outline: none; background: transparent;
  font-size: 17px; color: var(--ink); -webkit-appearance: none; appearance: none;
}
.ask-form input[type='search']::placeholder { color: var(--muted); }
.ask-form:focus-within { box-shadow: inset 0 0 0 2px var(--accent); border-radius: var(--radius) var(--radius) 0 0; }
.ask-kbd { font-family: var(--mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 7px; }
.ask-submit { min-height: 40px; padding: 0 16px; border-radius: 999px; border: none; background: var(--ink); color: var(--bg); cursor: pointer; font-weight: 500; }
.ask-results { border-top: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.ask-answer { margin: 0; font-size: 16px; line-height: 1.65; color: var(--text); }
.ask-answer blockquote { margin: 0; padding: 0 0 0 14px; border-left: 3px solid var(--accent); }
.ask-answer cite { display: block; margin-top: 8px; font-style: normal; font-size: 14px; color: var(--muted); }
.ask-cite { font-family: var(--mono); font-size: 12px; color: var(--accent); text-decoration: none; vertical-align: 1px; }
.ask-sources { display: grid; gap: 10px; }
.ask-source {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px;
  background: var(--panel); text-decoration: none; color: var(--ink);
}
.ask-source:hover { color: var(--ink); outline: 1px solid var(--line-strong); }
.ask-source .n { font-family: var(--mono); font-size: 12px; color: var(--accent); padding-top: 3px; flex: 0 0 auto; }
.ask-source .body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ask-source .title { font-weight: 600; }
.ask-source .where { font-size: 13px; color: var(--muted); }
.ask-source .snippet { font-size: 14px; line-height: 1.5; color: var(--muted); }
.ask-source mark { background: var(--mark); color: inherit; border-radius: 2px; }
.ask-note { margin: 0; font-size: 12px; color: var(--muted); }
.ask-suggestions { padding: 14px 16px 16px; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); }
.ask-status { margin: 0; font-size: 14px; color: var(--muted); }

/* ---------- home: list ---------- */
.list-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--ink); }
.list-head h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.altdown-note { margin: 0 0 28px; padding: 14px 16px; border-radius: 12px; background: var(--panel); color: var(--muted); font-size: 15px; line-height: 1.5; }
.altdown-note p { margin: 0; }
.altdown-note a, .altdown-row a { color: var(--accent); }
.altdown-explainer { margin-top: 8px !important; }
.altdown-row { margin: 18px 0 0; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.altdown-row a { text-decoration: none; }
.altdown-row a:hover, .altdown-info:hover { text-decoration: underline; }
.altdown-info { margin-left: 6px; text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { display: flex; flex-wrap: wrap; gap: 8px 32px; padding: 24px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.post-row:hover { color: var(--ink); }
.post-row:hover .post-row-title { color: var(--accent); }
.post-row time { flex: 0 0 140px; font-size: 14px; padding-top: 3px; }
.post-row-body { flex: 1 1 360px; display: flex; flex-direction: column; gap: 6px; }
.post-row-title { font-size: 20px; font-weight: 500; letter-spacing: -0.01em; }
.post-row-summary { font-size: 16px; line-height: 1.5; color: var(--muted); }
.post-row-focus { font-size: 12px; color: var(--accent); }
.badge-new {
  display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 999px; vertical-align: 3px;
  background: var(--accent); color: var(--on-accent); font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.chip-count { margin-left: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.chip[aria-pressed='true'] .chip-count { color: inherit; opacity: 0.7; }
.filter-empty { padding: 24px 0; }

/* ---------- newsletter ---------- */
.subscribe-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 32px 48px; padding: 48px; border-radius: 20px; background: var(--panel); }
.subscribe-copy { flex: 1 1 380px; }
.subscribe-copy h2 { margin: 0; font-size: 34px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 600; }
.subscribe-copy p:last-child { margin: 12px 0 0; font-size: 17px; color: var(--muted); }
.subscribe-action { flex: 1 1 380px; display: flex; flex-direction: column; gap: 10px; }
.subscribe-form { display: flex; flex-wrap: wrap; gap: 10px; }
.subscribe-form input {
  flex: 1 1 220px; min-width: 0; min-height: 48px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink);
}
.fine-print { margin: 0; font-size: 13px; color: var(--muted); }
.fine-print a { color: var(--muted); }
.subscribe-done { margin: 0; padding: 14px 16px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-strong); }
.subscribe-inline { margin-top: 48px; padding: 28px; border-radius: var(--radius); border: 1px solid var(--line-strong); display: flex; flex-direction: column; gap: 12px; }
.subscribe-inline h2 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.subscribe-inline > p { margin: 0; color: var(--muted); }

/* ---------- footer ---------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 32px 40px; padding-top: 64px; padding-bottom: 40px; }
.footer-about { flex: 1 1 320px; max-width: 420px; }
.footer-about p { margin: 0; font-size: 15px; color: var(--footer-muted); }
.footer-about .footer-name { margin-bottom: 10px; font-size: 20px; font-weight: 600; color: var(--footer-text); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-start; font-size: 15px; }
.footer-nav a { color: var(--footer-text); text-decoration: none; }
.footer-nav a:hover { color: #ffffff; text-decoration: underline; }
.footer-legal { padding-top: 20px; padding-bottom: 32px; border-top: 1px solid #26272b; font-family: var(--mono); font-size: 13px; color: var(--footer-muted); }

/* ---------- post ---------- */
.post-header { padding-top: 72px; padding-bottom: 32px; }
.post-meta { margin: 0 0 20px; color: var(--muted); }
.post-meta a { color: var(--muted); text-decoration: none; }
.post-meta a:hover { color: var(--accent); }
.post-meta .tag { color: var(--accent); }
.post-header h1 { margin: 0; font-size: clamp(34px, 5.4vw, 54px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 600; }
.post-header .lede { font-size: 22px; line-height: 1.5; }
.draft-badge { display: inline-block; margin: 16px 0 0; padding: 4px 10px; border-radius: 6px; background: var(--mark); color: var(--ink); font-family: var(--mono); font-size: 12px; letter-spacing: 0; text-transform: none; }
.eyebrow .draft-badge { margin: 0 0 0 8px; }

.takeaways { margin: 8px 0 8px; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 24px; }
.takeaways ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 16px; line-height: 1.55; color: var(--text); }
.takeaways .jump { margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.takeaways.jump-only { padding: 16px 20px; }
.takeaways.jump-only .jump { margin: 0; }
.jump a { color: var(--accent); text-decoration: none; }
.jump a:hover { text-decoration: underline; }

.prose { padding-top: 24px; font-size: 18px; line-height: 1.75; color: var(--text); overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 24px; }
.prose li { margin: 6px 0; }
.prose li > p { margin: 0 0 8px; }
.prose h2 { margin: 56px 0 16px; font-size: 28px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 600; color: var(--ink); }
.prose h3 { margin: 36px 0 12px; font-size: 21px; line-height: 1.3; font-weight: 600; color: var(--ink); }
.prose h4 { margin: 28px 0 8px; font-size: 18px; font-weight: 600; color: var(--ink); }
.prose a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { color: var(--accent-ink); text-decoration-thickness: 2px; }
.heading-anchor { margin-left: 8px; color: var(--line-strong) !important; text-decoration: none !important; opacity: 0; font-weight: 400; }
.prose h2:hover .heading-anchor, .prose h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose hr { border: none; border-top: 1px solid var(--line); margin: 48px 0; }
.prose blockquote { margin: 0 0 24px; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); color: var(--text); }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose :not(pre) > code { font-family: var(--mono); font-size: 0.86em; padding: 2px 6px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); }
.prose img { display: block; border-radius: 10px; }

.code-block { margin: 0 0 28px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); overflow: hidden; }
.code-block figcaption { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.copy-code { min-height: 30px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--muted); font-family: var(--mono); font-size: 12px; cursor: pointer; }
.copy-code:hover { color: var(--ink); }
.code-block pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--mono); font-size: 14px; line-height: 1.65; background: transparent !important; }
.shiki span { color: var(--shiki-light); }
@media (prefers-color-scheme: dark) { .shiki span { color: var(--shiki-dark); } }

.figure, .embed, .quote-card { margin: 32px 0; }
.figure img { margin: 0 auto; }
.figure-narrow img { max-width: 560px; width: 100%; }
.figure figcaption, .embed figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); text-align: center; }
.embed iframe { display: block; width: 100%; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); }
.embed-pdf iframe { height: 900px; max-height: 80vh; }
.embed-video iframe { aspect-ratio: 16 / 9; height: auto; }
.quote-card { padding: 20px 22px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--bg); }
.quote-card blockquote { margin: 0; padding: 0; border: none; font-size: 17px; }
.quote-card blockquote p { margin: 0 0 10px; }
.quote-card figcaption { font-size: 14px; color: var(--muted); }
.quote-card figcaption a { color: var(--muted); }

.table-wrap { margin: 0 0 28px; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.5; }
.table-wrap th, .table-wrap td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.table-wrap th { background: var(--panel); font-weight: 600; color: var(--ink); }
.table-wrap tr:last-child td { border-bottom: none; }

.related { margin: 56px 0 96px; }
.related ul { list-style: none; margin: 0; padding: 0; }
.related a { display: flex; justify-content: space-between; gap: 16px; padding: 18px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 18px; font-weight: 500; }
.related li:last-child a { border-bottom: 1px solid var(--line); }
.related a span[aria-hidden] { color: var(--muted); }

/* ---------- 404 ---------- */
.not-found { padding-top: 96px; padding-bottom: 96px; }
.not-found h1 { margin: 0; font-size: clamp(34px, 5vw, 48px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 600; }
.not-found h2 { margin-top: 48px; }
.plain-list { padding-left: 20px; font-size: 18px; line-height: 1.9; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero { padding-top: 40px; padding-bottom: 40px; }
  .ask-suggestions .chip:nth-child(n + 3) { display: none; }
  .subscribe-panel { padding: 28px; }
  .post-header { padding-top: 48px; }
  .prose { font-size: 17px; }
  .post-row time { flex-basis: 100%; }
  .ask-kbd { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
