/* ============================================
   FONTS (self-hosted)
   ============================================ */

@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 300; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 300; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-300-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 600; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-600-italic.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 700; font-display: swap; src: url('/assets/fonts/cormorant-garamond-latin-700-italic.woff2') format('woff2'); }

@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 300; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: italic; font-weight: 300; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-300-italic.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: italic; font-weight: 400; font-display: swap; src: url('/assets/fonts/ibm-plex-mono-latin-400-italic.woff2') format('woff2'); }

/* ============================================
   ROOT & TOKENS
   ============================================ */

:root {
  --cream:        #f7f3ec;
  --cream-dark:   #ede8df;
  --ink:          #0f0d0b;
  --ink-mid:      #1e1b17;
  --ink-light:    #7a7168;
  --ink-faint:    #b5ad9f;
  --accent:       #8b5e3c;
  --accent-light: #c49a78;

  --font-body:    'Cormorant Garamond', Georgia, serif;
  --font-mono:    'IBM Plex Mono', monospace;

  --measure:      68ch;
  --measure-wide: 80ch;

  --step--1: clamp(0.875rem, 0.85rem + 0.1vw, 0.95rem);
  --step-0:  clamp(1.2rem,   1.0rem  + 0.6vw, 1.5rem);
  --step-1:  clamp(1.5rem,   1.25rem + 0.9vw, 2rem);
  --step-2:  clamp(1.85rem,  1.5rem  + 1.4vw, 2.65rem);
  --step-3:  clamp(2.4rem,   1.9rem  + 2.2vw, 3.75rem);
  --step-4:  clamp(3rem,     2.4rem  + 3.2vw, 5.25rem);
}

/* Dark mode tokens */
[data-theme="dark"] {
  --cream:        #1a1714;
  --cream-dark:   #2a2520;
  --ink:          #f0ebe2;
  --ink-mid:      #d4cec4;
  --ink-light:    #a09890;
  --ink-faint:    #6b6459;
  --accent:       #c49a78;
  --accent-light: #8b5e3c;
}

/* ============================================
   RESET & BASE
   ============================================ */

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  background-color: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 500;
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* Subtle paper texture via CSS noise */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.025'/%3E%3C/svg%3E");
}

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

/* ============================================
   SCROLL PROGRESS BAR
   ============================================ */

.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
}

/* ============================================
   HEADER & NAV
   ============================================ */

.site-header {
  border-bottom: 1px solid var(--cream-dark);
  padding: 1.5rem 0;
  position: sticky;
  top: 0;
  background-color: var(--cream);
  background-image: inherit;
  z-index: 100;
}

.nav-inner {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.site-logo {
  text-decoration: none;
  line-height: 1;
  display: inline-flex;
  align-items: baseline;
  letter-spacing: -0.04em;
}

.logo-z {
  font-family: var(--font-body);
  font-size: var(--step-2);
  font-weight: 700;
  font-style: normal;
  color: var(--ink);
  line-height: 1;
  transition: color 0.2s ease;
}

.logo-p {
  font-family: var(--font-body);
  font-size: var(--step-2);
  font-weight: 600;
  font-style: normal;
  color: var(--accent);
  line-height: 1;
  transition: color 0.2s ease;
}

.site-logo:hover .logo-z { color: var(--accent); }
.site-logo:hover .logo-p { color: var(--ink); }

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: var(--step--1);
  color: var(--ink-light);
  text-decoration: none;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:hover {
  color: var(--accent);
}

/* ============================================
   MAIN & LAYOUT
   ============================================ */

.main-content {
  flex: 1;
  padding: 4rem 2rem 6rem;
}

/* ============================================
   LANDING PAGE
   ============================================ */

.landing {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 4rem 0 0;
}

.landing-eyebrow {
  font-size: var(--step--1);
  color: var(--ink-faint);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.landing-name {
  font-size: var(--step-4);
  font-weight: 600;
  font-style: italic;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 2.5rem;
}

.landing-bio {
  font-size: var(--step-1);
  font-weight: 300;
  font-style: italic;
  color: var(--ink-light);
  line-height: 1.65;
  max-width: 52ch;
}

.landing-bio p + p {
  margin-top: 1.2em;
}

.landing-rule {
  width: 3rem;
  height: 2px;
  background: var(--accent);
  margin: 2.5rem 0;
}

.landing-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: color 0.2s ease;
}

.landing-cta:hover { color: var(--accent); }

.landing-cta .arrow {
  display: inline-block;
  transition: transform 0.2s ease;
}

.landing-cta:hover .arrow { transform: translateX(4px); }

/* ============================================
   ESSAYS ARCHIVE
   ============================================ */

.archive {
  max-width: var(--measure);
  margin: 0 auto;
}

.archive-header {
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--cream-dark);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
}

.archive-title {
  font-size: var(--step-4);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-style: italic;
}

.archive-count {
  font-size: var(--step--1);
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================
   HOME (legacy - remove old .home styles)
   ============================================ */

.home {
  max-width: var(--measure-wide);
  margin: 0 auto;
}

.home-header {
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--cream-dark);
}

.home-title {
  font-size: var(--step-4);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 0.75rem;
}

.home-description {
  font-size: var(--step-0);
  color: var(--ink-light);
  font-style: italic;
  font-weight: 300;
}

/* Post List */
.post-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.post-item {
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--cream-dark);
  transition: background 0.15s ease;
}

.post-item:first-child {
  border-top: none;
}

.post-item-meta {
  font-size: var(--step--1);
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.post-item-title {
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 0.6rem;
}

.post-item-title a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.2s ease;
  background-image: linear-gradient(var(--accent-light), var(--accent-light));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 0.3s ease, color 0.2s ease;
}

.post-item-title a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

.post-item-excerpt {
  font-size: var(--step-0);
  color: var(--ink-light);
  font-style: italic;
  font-weight: 300;
  line-height: 1.6;
  max-width: 55ch;
}

.archive-footer {
  padding: 2rem 0 0;
}

.archive-all-link {
  font-size: var(--step--1);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
  transition: color 0.2s ease;
}

.archive-all-link:hover {
  color: var(--accent);
}

.archive-year-group {
  margin-bottom: 3rem;
}

.archive-year {
  font-size: var(--step-1);
  font-weight: 300;
  font-style: italic;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
  padding-bottom: 0.75rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--cream-dark);
}

.archive-year-list .post-item--compact {
  padding: 1.25rem 0;
}

.archive-year-list .post-item-title {
  font-size: var(--step-1);
}

/* ============================================
   POST
   ============================================ */

.post {
  max-width: var(--measure);
  margin: 0 auto;
}

.post-header {
  margin-bottom: 2rem;
}

.post-meta {
  font-size: var(--step--1);
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.meta-sep {
  color: var(--ink-faint);
  font-style: normal;
}

.post-title {
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-style: italic;
  margin-bottom: 1rem;
}

.post-subtitle {
  font-size: var(--step-1);
  font-weight: 300;
  color: var(--ink-light);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.post-rule {
  width: 3rem;
  height: 2px;
  background: var(--accent);
  margin-top: 2rem;
}

/* ============================================
   POST BODY — ESSAY TYPOGRAPHY
   ============================================ */

.post-body {
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink-mid);
  font-weight: 500;
}

/* Drop cap — top aligns with line 1, bottom aligns with line 3 */
.post-body > p:first-of-type::first-letter {
  font-size: 6em;
  font-weight: 600;
  float: left;
  line-height: 0.84;
  margin-right: 0.08em;
  margin-top: 0.00em;
  margin-bottom: -0.04em;
  color: var(--accent);
  font-style: normal;
}

.post-body p {
  margin-bottom: 0.9em;
}

.post-body p + p {
  text-indent: 0;
}

.post-body p {
  margin-bottom: 0.9em;
}

.post-body h2 {
  font-size: var(--step-2);
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.75em 0 0.5em;
  line-height: 1.2;
}

.post-body h3 {
  font-size: var(--step-1);
  font-weight: 500;
  font-style: italic;
  color: var(--ink);
  margin: 1.5em 0 0.4em;
}

.post-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-light);
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.post-body a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink-faint);
}

.post-body strong {
  font-weight: 600;
  color: var(--ink);
}

.post-body em {
  font-style: italic;
}

/* Pull quote — decorative marks, no border */
.post-body blockquote {
  position: relative;
  margin: 1.75em 0;
  padding: 0;
  border: none;
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-1);
  color: var(--ink-light);
  line-height: 1.5;
}

.post-body blockquote::before {
  content: '\201C';
  display: block;
  font-size: 4em;
  line-height: 0.75;
  color: var(--accent);
  font-style: normal;
  font-weight: 700;
  font-family: var(--font-body);
  margin-bottom: 0.1em;
  margin-left: -0.05em;
}

.post-body blockquote p {
  margin: 0;
}

/* Source quote — border + monospace citation */
.post-body blockquote.source {
  position: relative;
  margin: 1.75em 0;
  padding: 0.1em 0 0.1em 1.5rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  font-weight: 300;
  font-size: var(--step-0);
  color: var(--ink-light);
  line-height: 1.6;
}

.post-body blockquote.source::before {
  display: none;
}

.post-body blockquote.source p {
  margin: 0;
}

.post-body blockquote.source cite,
.post-body blockquote.source p:last-of-type {
  display: block;
  margin-top: 0.85em;
  padding-top: 0.75em;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--ink-light);
  letter-spacing: 0.04em;
  position: relative;
}

.post-body blockquote.source cite::before,
.post-body blockquote.source p:last-of-type::before {
  content: '';
  display: block;
  width: 50%;
  height: 1px;
  background: var(--cream-dark);
  margin-bottom: 0.75em;
}

.post-body blockquote.source cite em,
.post-body blockquote.source p:last-of-type em {
  font-style: italic;
}

.post-body blockquote p {
  margin-bottom: 0;
}

.post-body blockquote p:first-of-type::first-letter {
  /* override drop cap inside blockquotes */
  font-size: inherit;
  font-weight: inherit;
  float: none;
  line-height: inherit;
  margin: 0;
  color: inherit;
}

/* Code */
.post-body code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85em;
  background: var(--cream-dark);
  padding: 0.1em 0.35em;
  border-radius: 2px;
  color: var(--ink);
}

.post-body pre {
  background: var(--ink);
  color: var(--cream);
  padding: 1.5rem;
  overflow-x: auto;
  margin: 2em 0;
  font-size: 0.85em;
  line-height: 1.6;
}

.post-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Horizontal rule */
.post-body hr {
  border: none;
  text-align: center;
  margin: 3em 0;
  color: var(--ink-faint);
}

.post-body hr::before {
  content: '· · ·';
  font-size: var(--step-0);
  letter-spacing: 0.5em;
}

/* Lists */
.post-body ul,
.post-body ol {
  padding-left: 1.5em;
  margin-bottom: 1.6em;
}

.post-body li {
  margin-bottom: 0.4em;
}

/* Footnotes */
.post-body sup {
  font-size: 0.7em;
  vertical-align: super;
  line-height: 0;
}

.post-body sup a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0 1px;
  transition: color 0.2s ease;
}

.post-body sup a:hover {
  color: var(--ink);
}

/* Footnote list at bottom of post — generated by markdown-it-footnote */
.post-body .footnotes {
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--cream-dark);
}

.post-body .footnotes ol {
  padding-left: 1.25em;
  margin: 0;
}

.post-body .footnotes li {
  font-size: var(--step--1);
  color: var(--ink-light);
  line-height: 1.7;
  margin-bottom: 0.5em;
}

.post-body .footnotes a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.post-body .footnotes a:hover {
  border-color: var(--accent);
}

/* Back-reference arrow */
.post-body .footnotes a[href^="#fnref"] {
  font-size: 0.8em;
  margin-left: 0.25em;
  border: none;
}

/* Images */
.post-body figure {
  margin: 2.5em 0;
}

.post-body figcaption {
  font-size: var(--step--1);
  color: var(--ink-faint);
  font-style: italic;
  text-align: center;
  margin-top: 0.75rem;
}

/* ============================================
   POST FOOTER
   ============================================ */

.post-footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--cream-dark);
}

.back-link {
  font-size: var(--step--1);
  color: var(--ink-light);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
}

/* Series navigation */
.series-note {
  font-size: var(--step--1);
  color: var(--ink-faint);
  font-style: italic;
  letter-spacing: 0.02em;
  margin-bottom: 2.5rem;
}

.series-note-link {
  color: var(--ink-faint);
  text-decoration: none;
  border-bottom: 1px solid var(--cream-dark);
  padding-bottom: 1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.series-note-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* Series page */
.series-page {
  max-width: var(--measure);
  margin: 0 auto;
}

.series-page-header {
  padding-bottom: 3rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--cream-dark);
}

.series-page-eyebrow {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.series-page-title {
  font-size: var(--step-4);
  font-weight: 300;
  font-style: italic;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.series-page-count {
  font-size: var(--step--1);
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
}

.series-nav {
  border-top: 1px solid var(--cream-dark);
  border-bottom: 1px solid var(--cream-dark);
  padding: 1.25rem 0;
}

.series-nav--bottom {
  margin-top: 3rem;
}

.series-label {
  display: block;
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.85rem;
}

.series-nav-links {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
}

.series-nav-link {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 45%;
}

.series-nav-link--next {
  margin-left: auto;
  text-align: right;
}

.series-nav-direction {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.2s ease;
}

.series-nav-title {
  font-size: var(--step-0);
  font-style: italic;
  color: var(--ink);
  line-height: 1.3;
  transition: color 0.2s ease;
}

.series-nav-link:hover .series-nav-direction,
.series-nav-link:hover .series-nav-title {
  color: var(--accent);
}



/* ============================================
   SEARCH
   ============================================ */

.search-trigger,
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-light);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
}

.search-trigger:hover,
.theme-toggle:hover {
  color: var(--accent);
}

/* Sun/moon icons — show correct one per theme */
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }

[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Overlay */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 13, 11, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.search-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.search-modal {
  background: var(--cream);
  width: 100%;
  max-width: 640px;
  margin: 0 2rem;
  border-radius: 2px;
  box-shadow: 0 24px 64px rgba(15, 13, 11, 0.2);
  overflow: hidden;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--cream-dark);
}

.search-modal-header #search {
  flex: 1;
}

.search-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 0.85rem;
  padding: 0.5rem;
  line-height: 1;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.search-close:hover {
  color: var(--ink);
}

/* Pagefind UI overrides */
.pagefind-ui__form {
  display: flex;
  align-items: center;
}

.pagefind-ui__search-input {
  width: 100% !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  font-family: var(--font-body) !important;
  font-size: var(--step-0) !important;
  font-style: italic !important;
  color: var(--ink) !important;
  padding: 1rem 1.25rem !important;
  box-shadow: none !important;
}

/* Hide Pagefind's own search icon — we have our own in the nav */
.pagefind-ui__search-input[type="search"]::-webkit-search-decoration,
.pagefind-ui__search-input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.pagefind-ui__form::before {
  display: none !important;
}

.pagefind-ui__search-input::placeholder {
  color: var(--ink-faint) !important;
}

.pagefind-ui__search-clear {
  background: none !important;
  border: none !important;
  color: var(--ink-faint) !important;
  cursor: pointer !important;
  padding: 0 1rem !important;
  font-size: 0.8rem !important;
}

.pagefind-ui__results {
  padding: 0.5rem 0 !important;
  max-height: 55vh;
  overflow-y: auto;
}

.pagefind-ui__result {
  padding: 1rem 1.25rem !important;
  border-bottom: 1px solid var(--cream-dark) !important;
  list-style: none !important;
}

.pagefind-ui__result:last-child {
  border-bottom: none !important;
}

.pagefind-ui__result-link {
  font-family: var(--font-body) !important;
  font-size: var(--step-0) !important;
  font-style: italic !important;
  font-weight: 500 !important;
  color: var(--ink) !important;
  text-decoration: none !important;
  display: block !important;
  margin-bottom: 0.3rem !important;
  transition: color 0.15s ease !important;
}

.pagefind-ui__result-link:hover {
  color: var(--accent) !important;
}

.pagefind-ui__result-excerpt {
  font-family: var(--font-body) !important;
  font-size: var(--step--1) !important;
  color: var(--ink-light) !important;
  line-height: 1.6 !important;
  margin: 0 !important;
}

.pagefind-ui__result-excerpt mark {
  background: none !important;
  color: var(--accent) !important;
  font-weight: 600 !important;
}

.pagefind-ui__message {
  font-family: var(--font-body) !important;
  font-size: var(--step--1) !important;
  color: var(--ink-faint) !important;
  font-style: italic !important;
  padding: 1rem 1.25rem !important;
}

/* Body lock when search open */
body.search-open {
  overflow: hidden;
}

/* ============================================
   TABLE OF CONTENTS
   ============================================ */

.toc-sidebar {
  position: fixed;
  left: calc((100vw - var(--measure)) / 2 - 16rem);
  width: 13rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 50;
}

.toc-sidebar.is-visible {
  opacity: 1;
  pointer-events: all;
}

.toc-label {
  font-size: var(--step--1);
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 0.75rem;
}

.toc-list {
  list-style: none;
  border-left: 1px solid var(--cream-dark);
  padding-left: 0;
}

.toc-item {
  padding: 0;
}

.toc-item--h3 .toc-link {
  padding-left: 1.25rem;
  font-size: 0.78rem;
}

.toc-link {
  display: block;
  padding: 0.3rem 0 0.3rem 1rem;
  font-size: 0.82rem;
  font-family: var(--font-body);
  font-style: italic;
  color: var(--ink-faint);
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.toc-link:hover {
  color: var(--ink-light);
}

.toc-link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* Hide TOC on smaller screens where there's no room */
@media (max-width: 1200px) {
  .toc-sidebar {
    display: none;
  }
}

/* ============================================
   FOOTER
   ============================================ */

.site-footer {
  border-top: 1px solid var(--cream-dark);
  padding: 2.5rem 2rem;
}

.footer-inner {
  max-width: var(--measure-wide);
  margin: 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
}

.footer-name {
  font-style: italic;
  font-weight: 600;
  font-size: var(--step-0);
  color: var(--ink);
}

.footer-copy {
  font-size: var(--step--1);
  color: var(--ink-faint);
  font-style: italic;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 640px) {
  .nav-inner {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .footer-inner {
    flex-direction: column;
    gap: 0.5rem;
  }

  .post-body > p:first-of-type::first-letter {
    font-size: 3.5em;
  }
}

/* ============================================
   SUBTLE PAGE LOAD ANIMATION
   ============================================ */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.main-content > article,
.main-content > section {
  animation: fadeUp 0.5s ease both;
}