/* ===== Custom Properties ===== */
:root {
  --bg: #faf8f5;
  --text: #2c2a26;
  --accent: #8b7e6a;
  --border: #e0dcd6;
  --text-muted: #6b6560;
  --font-serif: "EB Garamond", Georgia, serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --measure: 65ch;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 2rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1916;
    --text: #e0dbd4;
    --accent: #b8a88a;
    --border: #33302b;
    --text-muted: #9b9389;
  }
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

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

body {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-md);
  padding-top: var(--space-lg);
  padding-bottom: var(--space-xl);
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  background: var(--text);
  color: var(--bg);
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  z-index: 100;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-xs);
}

/* ===== Site Header ===== */
.site-header {
  margin-bottom: var(--space-xl);
}

.site-title {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.site-title:hover {
  color: var(--text);
}

/* ===== Site Footer ===== */
.site-footer {
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ===== Home Page ===== */
.home-hero {
  margin-bottom: var(--space-xl);
}

.home-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 400;
  line-height: 1.2;
  margin-bottom: var(--space-sm);
  letter-spacing: -0.01em;
}

.home-byline {
  font-style: italic;
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-bottom: var(--space-xs);
}

.home-date {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--accent);
}

/* ===== Chapter List ===== */
.chapter-list ol {
  list-style: none;
  padding: 0;
}

.chapter-list li {
  border-bottom: 1px solid var(--border);
}

.chapter-list li:first-child {
  border-top: 1px solid var(--border);
}

.chapter-list a {
  display: block;
  padding: var(--space-sm) 0;
  text-decoration: none;
  color: var(--text);
  transition: color 0.15s;
}

.chapter-list a:hover {
  color: var(--accent);
}

.chapter-list-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 0.5em;
}

.chapter-list-title {
  font-size: 1.15rem;
}

.home-more {
  margin-top: var(--space-lg);
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ===== Chapter Page ===== */
.chapter-label {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-xs);
}

.chapter-title {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.25;
  margin-bottom: var(--space-lg);
}

/* ===== Prose ===== */
.prose p {
  margin-bottom: 1.4em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose em {
  font-style: italic;
}

.prose strong {
  font-weight: 600;
}

.prose hr {
  border: none;
  text-align: center;
  margin: var(--space-lg) 0;
}

.prose hr::after {
  content: "* * *";
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.3em;
}

.prose blockquote {
  border-left: 2px solid var(--border);
  padding-left: var(--space-sm);
  margin: var(--space-md) 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== Chapter Navigation ===== */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}

.chapter-nav-link {
  text-decoration: none;
  color: var(--text);
  max-width: 50%;
}

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

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

.chapter-nav-direction {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2em;
}

.chapter-nav-title {
  font-size: 1rem;
  line-height: 1.35;
}

/* ===== Links ===== */
a {
  color: inherit;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  body {
    font-size: 1.05rem;
    padding: var(--space-sm);
    padding-top: var(--space-md);
    padding-bottom: var(--space-lg);
  }

  .home-title {
    font-size: 1.8rem;
  }

  .chapter-title {
    font-size: 1.6rem;
  }

  .chapter-nav {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .chapter-nav-link {
    max-width: 100%;
  }

  .chapter-nav-link.next {
    text-align: left;
    margin-left: 0;
  }

  .site-header {
    margin-bottom: var(--space-lg);
  }
}
