/* authorrao.com — one column, one typeface, nothing that competes with the words. */

:root {
  --paper: #f5f6f3;
  --ink: #1e2427;
  --muted: #5f6a68;
  --rule: #d6dad5;
  --link: #2e5a4f;
  --link-hover: #1d3f37;
  --mark: #e3e8e2;

  --measure: 36rem;
  --gutter: clamp(1rem, 5vw, 2.5rem);
  --step--1: 0.875rem;
  --step-0: 1.125rem;
  --step-1: 1.35rem;
  --step-2: 1.75rem;
  --step-3: clamp(2rem, 1.4rem + 2.4vw, 2.75rem);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171b1c;
    --ink: #e4e7e3;
    --muted: #9aa5a2;
    --rule: #2f3537;
    --link: #8fc2b2;
    --link-hover: #b7dccf;
    --mark: #243033;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  padding: 0 var(--gutter);
  background: var(--paper);
  color: var(--ink);
  font-family: "Literata", "Iowan Old Style", "Charter", Georgia, serif;
  font-optical-sizing: auto;
  font-size: var(--step-0);
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }

img { max-width: 100%; height: auto; display: block; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--gutter); top: 0.5rem; background: var(--paper); padding: 0.25rem 0.5rem; }

/* Masthead */
.masthead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
}
.wordmark {
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.masthead ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.masthead nav a { color: var(--muted); text-decoration: none; font-size: 1rem; }
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--ink); }
.masthead nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }

main { padding: 3rem 0 4rem; }

/* Home: the book is the one loud thing */
.book-feature {
  display: grid;
  grid-template-columns: minmax(0, 15rem) 1fr;
  gap: 2rem;
  align-items: center;
  margin-bottom: 4rem;
}
.book-feature .cover img { width: 100%; }
.book-feature h1 { font-size: var(--step-3); line-height: 1.1; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 0.75rem; }
.book-feature p { margin: 0 0 0.75rem; }
.book-feature p:first-of-type { font-style: italic; color: var(--muted); }

@media (max-width: 34rem) {
  .book-feature { grid-template-columns: 1fr; gap: 1.25rem; }
  .book-feature .cover { max-width: 16rem; }
}

.section-title, .list-title { font-weight: 600; letter-spacing: -0.01em; }
.section-title { font-size: var(--step-1); margin: 0 0 1rem; }
.list-title { font-size: var(--step-3); line-height: 1.15; margin: 0 0 1.5rem; }

/* Post lists: rows, not cards */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li { padding: 0.9rem 0; border-top: 1px solid var(--rule); }
.post-list li:last-child { border-bottom: 1px solid var(--rule); }
.post-title { display: block; color: var(--ink); text-decoration: none; font-size: var(--step-0); line-height: 1.4; }
.post-title:hover { color: var(--link); text-decoration: underline; }
.post-meta { color: var(--muted); font-size: var(--step--1); }
.post-meta a { color: inherit; }
.empty { color: var(--muted); }
.more { margin-top: 1.25rem; }

.category-filter { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; list-style: none; margin: 0 0 2rem; padding: 0; font-size: var(--step--1); }
.category-filter a { color: var(--muted); }

.pagination, .pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; font-size: var(--step--1); color: var(--muted); }

/* Long-form reading */
.prose h1 { font-size: var(--step-3); line-height: 1.15; font-weight: 600; letter-spacing: -0.015em; margin: 0 0 0.5rem; }
.entry-head { margin-bottom: 2.25rem; }
.entry-head .post-meta { margin: 0; }
.prose h2 { font-size: var(--step-2); line-height: 1.25; font-weight: 600; margin: 2.5rem 0 0.75rem; }
.prose h3 { font-size: var(--step-1); line-height: 1.3; font-weight: 600; margin: 2rem 0 0.5rem; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.15em; }
.prose li { margin-bottom: 0.35em; }
.prose figure { margin: 2rem 0; }
.prose img { margin: 2rem auto; }
.prose figure img { margin: 0 auto; }
.prose figcaption { color: var(--muted); font-size: var(--step--1); margin-top: 0.5rem; }
.prose blockquote { margin: 1.75rem 0; padding: 0 0 0 1.25rem; border-left: 2px solid var(--rule); color: var(--muted); font-style: italic; }
.prose hr { border: 0; text-align: center; margin: 2.5rem 0; }
.prose hr::after { content: "* * *"; color: var(--muted); letter-spacing: 0.5em; }
.prose mark { background: var(--mark); color: inherit; }
.prose dl { margin: 0 0 1.5em; }
.prose dt { font-weight: 600; margin-top: 1rem; }
.prose dd { margin: 0; }
.prose dt strong { font-weight: inherit; }
.prose table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 0.4rem 0.5rem; text-align: left; }

.after-post { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 1rem; }
.pager a { display: flex; flex-direction: column; max-width: 48%; text-decoration: none; color: var(--ink); line-height: 1.4; }
.pager a[rel="next"] { text-align: right; margin-left: auto; }
.pager a span { color: var(--muted); }
.pager a:hover { color: var(--link); }

.substack-embed { width: 100%; height: 320px; border: 1px solid var(--rule); background: #fff; margin: 1rem 0; }
.fallback { font-size: var(--step--1); color: var(--muted); }

/* Footer */
.colophon { border-top: 1px solid var(--rule); padding: 2rem 0 3rem; color: var(--muted); font-size: 1rem; }
.colophon p { margin: 0 0 1rem; }
.social { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; list-style: none; margin: 0 0 1.5rem; padding: 0; }
.social a, .fine a { color: var(--muted); }
.fine { font-size: var(--step--1); display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; }

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

@media print {
  .masthead nav, .colophon, .after-post, .pager { display: none; }
  body { background: #fff; color: #000; max-width: none; }
}
