:root {
  --paper: #f2f3f0;
  --paper-2: #e6e8e3;
  --ink: #15181d;
  --ink-2: #434852;
  --muted: #767b85;
  --rule: #d6d9d3;
  --accent: #2149c9;
  --accent-soft: #dfe6fb;
  --display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --max: 68rem;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121419;
    --paper-2: #1b1e25;
    --ink: #e9ebef;
    --ink-2: #b9bec8;
    --muted: #8a909b;
    --rule: #2b2f38;
    --accent: #86a2ff;
    --accent-soft: #1d2640;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121419;
  --paper-2: #1b1e25;
  --ink: #e9ebef;
  --ink-2: #b9bec8;
  --muted: #8a909b;
  --rule: #2b2f38;
  --accent: #86a2ff;
  --accent-soft: #1d2640;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

/* Masthead */
.masthead { border-bottom: 1px solid var(--rule); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--paper); }
.masthead-inner { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-top: 1.1rem; padding-bottom: 1rem; flex-wrap: wrap; }
.wordmark { font-family: var(--display); font-weight: 700; font-size: 1.55rem; letter-spacing: -0.03em; text-decoration: none; }
.nav { display: flex; gap: 1.4rem; font-family: var(--sans); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; overflow-x: auto; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 0.2rem 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* Hero */
.hero { padding-top: clamp(3rem, 9vw, 6.5rem); padding-bottom: clamp(2.5rem, 6vw, 4.5rem); display: grid; gap: 2.5rem; grid-template-columns: 1fr; }
@media (min-width: 60rem) { .hero { grid-template-columns: 1.7fr 1fr; align-items: end; } }
.hero-line { font-family: var(--display); font-weight: 600; text-wrap: balance; font-size: clamp(2.4rem, 6.2vw, 4.6rem); line-height: 0.98; letter-spacing: -0.035em; margin: 0; }
.hero-line em { font-style: normal; color: var(--accent); }
.aside { display: block; margin-top: 1.1rem; font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.hero-bio p { margin: 0 0 0.9rem; color: var(--ink-2); font-size: 1.05rem; }

/* Section headings with rule */
.rule-head { font-family: var(--sans); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 1.25rem; display: flex; align-items: center; gap: 0.8rem; }
.rule-head::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.latest, .shelves { padding-bottom: 3.5rem; }

/* Lead story */
.lead { display: block; text-decoration: none; padding-bottom: 2rem; border-bottom: 1px solid var(--rule); }
.lead-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; margin-bottom: 1.2rem; }
.lead-title { display: block; font-family: var(--display); font-weight: 600; text-wrap: balance; font-size: clamp(1.9rem, 4.4vw, 3rem); line-height: 1.08; letter-spacing: -0.02em; margin: 0.35rem 0 0.8rem; }
.lead-teaser { display: block; color: var(--ink-2); font-style: italic; font-size: 1.2rem; max-width: 42rem; }
.lead:hover .lead-title { color: var(--accent); }

/* Article list */
.items { list-style: none; margin: 0; padding: 0; }
.item { border-bottom: 1px solid var(--rule); }
.item-link { display: flex; gap: 1.2rem; padding: 1.35rem 0; text-decoration: none; align-items: flex-start; }
.item-body { display: block; min-width: 0; }
.item-pub { display: block; font-family: var(--sans); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.item-title { display: block; font-size: 1.45rem; line-height: 1.2; letter-spacing: -0.01em; margin: 0.25rem 0 0.35rem; }
.item-teaser { display: block; color: var(--ink-2); font-size: 1rem; max-width: 44rem; }
.item-link:hover .item-title { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.item-num { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); min-width: 2rem; padding-top: 0.1rem; font-variant-numeric: tabular-nums; }
.item-img { width: 7rem; aspect-ratio: 4/3; object-fit: cover; flex: none; }
.more { font-family: var(--sans); font-size: 0.9rem; margin-top: 1.5rem; }
.more a { color: var(--accent); text-underline-offset: 0.2em; }

/* Section shelves on home */
.shelf-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.shelf { background: var(--paper); padding: 1.4rem 1.3rem 1.6rem; text-decoration: none; display: block; transition: background 0.15s; }
.shelf:hover { background: var(--accent-soft); }
.shelf:hover .shelf-title { color: var(--accent); }
.shelf-count { font-family: var(--sans); font-size: 0.75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.shelf-title { display: block; font-family: var(--display); font-weight: 600; font-size: 1.9rem; letter-spacing: -0.015em; margin: 0.2rem 0 0.4rem; }
.shelf-blurb { display: block; color: var(--ink-2); font-size: 0.98rem; }

/* Section pages */
.page-head { padding-top: clamp(2.5rem, 7vw, 5rem); padding-bottom: 2rem; }
.kicker { font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.6rem; }
.page-head h1 { font-family: var(--display); font-weight: 600; text-wrap: balance; font-size: clamp(2.8rem, 8vw, 5.2rem); line-height: 1; letter-spacing: -0.03em; margin: 0 0 1rem; }
.lede { font-size: 1.25rem; color: var(--ink-2); max-width: 40rem; margin: 0; }
.lede a { color: var(--accent); }
.toc { display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; font-family: var(--sans); font-size: 0.85rem; padding-bottom: 1rem; }
.toc a { text-decoration: none; color: var(--ink-2); }
.toc a span { color: var(--muted); font-variant-numeric: tabular-nums; }
.toc a:hover { color: var(--accent); }
.sub { padding-top: 2.5rem; scroll-margin-top: 5rem; }
.sub-head { padding-top: 0.9rem; border-top: 3px solid var(--accent); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; }
.sub-head h2 { font-family: var(--display); font-weight: 600; font-size: 1.9rem; letter-spacing: -0.015em; margin: 0; }
.sub-head p { margin: 0; color: var(--muted); font-style: italic; }
main > .wrap:last-child { padding-bottom: 4rem; }

/* Archive filter */
.filter { display: block; margin: 0.5rem 0 0.4rem; }
.filter span { display: block; font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem; }
.filter input { width: 100%; max-width: 30rem; font: inherit; font-size: 1.1rem; color: var(--ink); background: transparent; border: 0; border-bottom: 2px solid var(--ink); padding: 0.4rem 0; border-radius: 0; }
.filter input:focus { outline: none; border-bottom-color: var(--accent); }
.filter-count { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); min-height: 1.2em; margin: 0 0 0.5rem; }

/* Contact */
.contact { padding-bottom: 5rem; }
.contact-email { font-size: clamp(1.8rem, 5vw, 3rem); letter-spacing: -0.02em; color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; word-break: break-word; }
.contact-social { color: var(--ink-2); }

/* Footer */
.footer { border-top: 1px solid var(--rule); padding: 2rem 0 2.5rem; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer p { margin: 0; }
.footer-mark { color: var(--ink); font-family: var(--display); font-weight: 600; font-size: 1.1rem; }
.footer-mark span { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin-left: 0.6rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1.2rem; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--accent); }

@media (max-width: 40rem) {
  body { font-size: 1.0625rem; }
  .masthead { position: static; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 0.6rem; padding-bottom: 0.7rem; }
  .nav { gap: 0.4rem 1rem; width: 100%; flex-wrap: wrap; overflow: visible; font-size: 0.74rem; }
  .item-title { font-size: 1.3rem; }
  .item-img { width: 5.5rem; }
}

a:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
