/* ==========================================================================
   THE SUBSTANTIVE VOICE ANTHOLOGIES - STYLESHEET
   Design System: High-End Philosophical Editorial Digital Edition
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS VARIABLES & THEMES
   -------------------------------------------------------------------------- */
:root {
  /* Fonts */
  --font-display: 'Cinzel', 'Playfair Display', Georgia, serif;
  --font-serif: 'Newsreader', 'Lora', 'Charter', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Obsidian Dark Theme (Default) */
  --bg-primary: #0a0d12;
  --bg-secondary: #121820;
  --bg-tertiary: #19222e;
  --bg-card: rgba(22, 30, 42, 0.75);
  --bg-card-hover: rgba(28, 40, 56, 0.9);
  --bg-overlay: rgba(8, 11, 16, 0.85);
  --bg-input: #151e2a;

  --text-primary: #f0ede6;
  --text-secondary: #b8c0cc;
  --text-muted: #7b889b;
  --text-accent: #e5a93c;
  --text-quote: #e6dfd5;

  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(229, 169, 60, 0.2);
  --border-hover: rgba(229, 169, 60, 0.5);

  --accent-gold: #e5a93c;
  --accent-gold-glow: rgba(229, 169, 60, 0.25);
  --accent-amber: #f39c12;
  --accent-ruby: #e74c3c;
  --accent-sapphire: #3498db;
  --accent-emerald: #2ecc71;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px rgba(229, 169, 60, 0.15);

  --sidebar-width: 340px;
  --header-height: 70px;
  --content-max-width: 860px;
  --page-max-width: 1360px;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  /* Font Scaling */
  --font-scale: 1;
  --base-line-height: 1.8;
}

/* Light / Parchment Theme */
[data-theme="light"] {
  --bg-primary: #f9f6f0;
  --bg-secondary: #f0ebd9;
  --bg-tertiary: #e4ddc8;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: #ffffff;
  --bg-overlay: rgba(240, 235, 217, 0.85);
  --bg-input: #ffffff;

  --text-primary: #1f1b18;
  --text-secondary: #4a453e;
  --text-muted: #797166;
  --text-accent: #9e5b0b;
  --text-quote: #2c2520;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-card: rgba(158, 91, 11, 0.25);
  --border-hover: rgba(158, 91, 11, 0.55);

  --accent-gold: #a86208;
  --accent-gold-glow: rgba(168, 98, 8, 0.2);

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 0 25px rgba(168, 98, 8, 0.12);
}

/* Sepia / Library Theme */
[data-theme="sepia"] {
  --bg-primary: #f4ecd8;
  --bg-secondary: #e8dcc4;
  --bg-tertiary: #dccfb3;
  --bg-card: rgba(248, 243, 232, 0.88);
  --bg-card-hover: #fcf8f0;
  --bg-overlay: rgba(232, 220, 196, 0.88);
  --bg-input: #fdfbf7;

  --text-primary: #2b2216;
  --text-secondary: #534533;
  --text-muted: #82725e;
  --text-accent: #8b4a08;
  --text-quote: #36291a;

  --border-subtle: rgba(80, 50, 20, 0.12);
  --border-card: rgba(139, 74, 8, 0.25);
  --border-hover: rgba(139, 74, 8, 0.5);

  --accent-gold: #8b4a08;
  --accent-gold-glow: rgba(139, 74, 8, 0.2);

  --shadow-sm: 0 2px 8px rgba(50, 30, 10, 0.06);
  --shadow-md: 0 8px 24px rgba(50, 30, 10, 0.1);
  --shadow-lg: 0 16px 40px rgba(50, 30, 10, 0.14);
  --shadow-glow: 0 0 25px rgba(139, 74, 8, 0.12);
}

/* --------------------------------------------------------------------------
   2. RESET & GLOBAL BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: var(--base-line-height);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --------------------------------------------------------------------------
   3. HEADER & GLOBAL NAVIGATION
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--bg-overlay);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
}

.header-inner {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
}

.logo-emblem {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-gold) 0%, #7d4e13 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--accent-gold-glow);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.logo-subtitle {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

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

.nav-link {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-gold);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Theme Toggle Button Group */
.theme-switch {
  display: flex;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 3px;
  gap: 2px;
}

.theme-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background: var(--accent-gold);
  color: #fff;
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  transition: all 0.2s ease;
}

.btn-icon:hover {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   4. HOME VIEW - HERO SECTION
   -------------------------------------------------------------------------- */
.home-view {
  display: block;
}

.hero-section {
  position: relative;
  padding: 4.5rem 1.5rem 3.5rem;
  background: radial-gradient(circle at 50% 20%, var(--bg-secondary) 0%, var(--bg-primary) 70%);
  border-bottom: 1px solid var(--border-subtle);
  overflow: hidden;
  text-align: center;
}

.hero-ambient-glow {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 650px;
  height: 450px;
  background: radial-gradient(circle, var(--accent-gold-glow) 0%, rgba(229, 169, 60, 0) 70%);
  filter: blur(60px);
  pointer-events: none;
}

.hero-container {
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: 30px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-card);
  color: var(--accent-gold);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.hero-title .title-accent {
  background: linear-gradient(135deg, var(--accent-gold) 0%, #ffcf70 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-author {
  font-size: 1.15rem;
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}

.hero-quote-box {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-left: 4px solid var(--accent-gold);
  padding: 1.25rem 1.8rem;
  border-radius: var(--radius-md);
  margin: 0 auto 2.2rem;
  max-width: 780px;
  box-shadow: var(--shadow-md);
  text-align: left;
  backdrop-filter: blur(8px);
}

.hero-quote {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-quote);
  line-height: 1.6;
}

.hero-quote-author {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-description {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.75;
  max-width: 740px;
  margin: 0 auto 2.4rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.8rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-gold) 0%, #c48318 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 18px var(--accent-gold-glow);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px var(--accent-gold-glow);
  filter: brightness(1.08);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.25s ease;
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
  transform: translateY(-2px);
}

/* Stats Counter Bar */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  padding-top: 1.8rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   5. RANDOM CHAPTER SPOTLIGHT SECTION
   -------------------------------------------------------------------------- */
.random-section {
  padding: 4.5rem 1.5rem;
  max-width: var(--page-max-width);
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.section-eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-gold);
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
}

.section-desc {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0.6rem auto 0;
}

/* Random Chapter Card */
.random-card-wrapper {
  max-width: 960px;
  margin: 0 auto;
}

.random-chapter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.random-chapter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-gold), #ffcf70, var(--accent-amber));
}

.card-header-bar {
  padding: 1.4rem 2rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.badge-group {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.pill-badge {
  padding: 0.28rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg-tertiary);
  color: var(--text-accent);
  border: 1px solid var(--border-subtle);
}

.pill-badge.anthology-tag {
  background: var(--accent-gold-glow);
  color: var(--accent-gold);
  border-color: var(--border-card);
}

.card-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-shuffle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-shuffle:hover {
  background: var(--accent-gold);
  color: #fff;
  border-color: var(--accent-gold);
}

.btn-shuffle.rotating .shuffle-icon {
  animation: spin 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-read-anthology {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.95rem;
  border-radius: var(--radius-sm);
  background: var(--accent-gold-glow);
  border: 1px solid var(--border-card);
  color: var(--accent-gold);
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-read-anthology:hover {
  background: var(--accent-gold);
  color: #fff;
}

.card-body {
  padding: 2.4rem;
}

.chapter-provenance {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.chapter-display-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 1.8rem;
}

/* Essay Block */
.essay-content-block {
  font-family: var(--font-serif);
  font-size: calc(1.15rem * var(--font-scale));
  line-height: 1.85;
  color: var(--text-quote);
  margin-bottom: 2.2rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.essay-content-block p {
  margin-bottom: 1.25rem;
}

.essay-content-block p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.2rem;
  float: left;
  line-height: 0.8;
  padding-right: 0.6rem;
  padding-top: 0.15rem;
  color: var(--accent-gold);
  font-weight: 700;
}

/* Aphorisms Block */
.aphorisms-stream {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.aphorisms-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.aphorism-card {
  position: relative;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-gold);
  border-radius: var(--radius-sm);
  padding: 1.2rem 1.4rem;
  transition: all 0.2s ease;
}

.aphorism-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-sm);
}

.aphorism-card.highlight-target {
  animation: aphorismPulse 3s ease-out;
  border-left-width: 5px;
  border-color: var(--accent-gold);
}

@keyframes aphorismPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(229, 169, 60, 0.8);
    background: var(--bg-card-hover);
  }
  30% {
    box-shadow: 0 0 25px 6px rgba(229, 169, 60, 0.4);
    background: var(--bg-card-hover);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(229, 169, 60, 0);
  }
}

.btn-copy-quote.copied {
  color: var(--accent-emerald) !important;
  background: rgba(46, 204, 113, 0.15) !important;
}

.aphorism-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.aphorism-number-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--accent-gold);
  text-decoration: none;
  transition: all 0.2s ease;
}

.aphorism-number-link:hover .aphorism-number {
  color: #fff;
  text-decoration: underline;
}

.aphorism-number-link .aphorism-link-icon {
  font-size: 0.72rem;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.aphorism-number-link:hover .aphorism-link-icon {
  opacity: 1;
}

.aphorism-number {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent-gold);
}

.aphorism-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-copy-link,
.btn-copy-quote {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-copy-link:hover,
.btn-copy-quote:hover {
  color: var(--accent-gold);
  background: var(--bg-input);
  border-color: var(--border-subtle);
}

.btn-copy-link.copied,
.btn-copy-quote.copied {
  color: var(--accent-emerald) !important;
  background: rgba(46, 204, 113, 0.15) !important;
  border-color: var(--accent-emerald) !important;
}
  color: var(--accent-gold);
  background: var(--bg-input);
}

.aphorism-text {
  font-family: var(--font-serif);
  font-size: calc(1.05rem * var(--font-scale));
  line-height: 1.7;
  color: var(--text-primary);
}

.card-footer-cta {
  padding: 1.2rem 2.4rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-footer-text {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. ANTHOLOGY LIBRARY GRID SECTION
   -------------------------------------------------------------------------- */
.anthologies-section {
  padding: 4.5rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.anthologies-grid {
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.8rem;
}

.anthology-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.anthology-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-gold);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.anthology-card-accent-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gold);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.anthology-card:hover .anthology-card-accent-bar {
  opacity: 1;
}

.anthology-card-header {
  margin-bottom: 1.2rem;
}

.card-top-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.canon-order-pill {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.anthology-badge {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-gold);
  background: var(--accent-gold-glow);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
}

.anthology-card-title {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.anthology-card-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.92rem;
  color: var(--accent-gold);
  margin-bottom: 0.8rem;
}

.anthology-card-summary {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.anthology-meta-stats {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.meta-stat {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.meta-stat strong {
  color: var(--text-primary);
}

.anthology-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.anthology-card:hover .anthology-card-btn {
  background: var(--accent-gold);
  border-color: var(--accent-gold);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-gold-glow);
}

/* --------------------------------------------------------------------------
   7. ABOUT / CANON GUIDE SECTION
   -------------------------------------------------------------------------- */
.guide-section {
  padding: 4.5rem 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  box-shadow: var(--shadow-md);
}

.guide-card h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--accent-gold);
  margin-bottom: 1rem;
}

.guide-card p {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 1.2rem;
}

.guide-card ul {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-secondary);
}

.guide-card li {
  margin-bottom: 0.5rem;
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   8. DEDICATED ANTHOLOGY READER VIEW
   -------------------------------------------------------------------------- */
.reader-view {
  display: none; /* Shown when viewing an anthology */
  min-height: calc(100vh - var(--header-height));
}

.reader-layout {
  display: flex;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  min-height: calc(100vh - var(--header-height));
}

/* Reader Sidebar */
.reader-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  position: sticky;
  top: var(--header-height);
  height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--accent-gold);
  margin-bottom: 0.6rem;
  transition: color 0.2s ease;
}

.sidebar-back-btn:hover {
  color: var(--text-primary);
}

.sidebar-anthology-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.25;
}

.sidebar-search-box {
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-search-input {
  width: 100%;
  padding: 0.55rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.sidebar-search-input:focus {
  border-color: var(--accent-gold);
}

.sidebar-nav-scroll {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem 0;
}

.sidebar-section-label {
  padding: 0.5rem 1.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-item {
  display: block;
  padding: 0.65rem 1.4rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
}

.sidebar-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: var(--bg-tertiary);
  color: var(--accent-gold);
  font-weight: 600;
  border-left-color: var(--accent-gold);
}

.book-group-header {
  padding: 0.7rem 1.4rem 0.4rem;
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.book-group-header:hover {
  color: #fff;
}

.book-chapter-list {
  padding-left: 0.4rem;
}

.chapter-nav-item {
  display: block;
  padding: 0.45rem 1.4rem;
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

.chapter-nav-item:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.chapter-nav-item.active {
  color: var(--accent-gold);
  font-weight: 600;
  border-left-color: var(--accent-gold);
  background: var(--bg-tertiary);
}

/* Reader Main Content Area */
.reader-main {
  flex-grow: 1;
  padding: 3.5rem 3rem 6rem;
  max-width: 920px;
  margin: 0 auto;
}

.reader-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.reader-breadcrumb a:hover {
  color: var(--accent-gold);
}

.breadcrumb-separator {
  color: var(--border-hover);
}

/* Overview Mode Content */
.overview-container {
  display: block;
}

.overview-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.overview-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.18;
  margin-bottom: 0.8rem;
}

.overview-subtitle {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.25rem;
  color: var(--accent-gold);
  margin-bottom: 1.5rem;
}

.overview-epigraph {
  background: var(--bg-card);
  border-left: 3px solid var(--accent-gold);
  padding: 1.2rem 1.6rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--text-quote);
  margin-bottom: 2rem;
  border-radius: var(--radius-sm);
}

.overview-section {
  margin-bottom: 3rem;
}

.overview-section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--accent-gold);
  margin-bottom: 1rem;
  letter-spacing: 0.04em;
}

.overview-body {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.overview-body p {
  margin-bottom: 1.25rem;
}

/* Chapter Reading Mode */
.chapter-container {
  display: block;
}

.chapter-badge-tag {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 0.8rem;
}

.chapter-headline {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 2.2rem;
}

.chapter-essay-body {
  font-family: var(--font-serif);
  font-size: calc(1.18rem * var(--font-scale));
  line-height: 1.85;
  color: var(--text-quote);
  margin-bottom: 3rem;
}

.chapter-essay-body p {
  margin-bottom: 1.4rem;
}

.chapter-essay-body p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.4rem;
  float: left;
  line-height: 0.8;
  padding-right: 0.7rem;
  padding-top: 0.15rem;
  color: var(--accent-gold);
  font-weight: 700;
}

.chapter-aphorisms-container {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
}

.chapter-aphorisms-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--accent-gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

/* Pagination Footer */
.reader-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.pagination-btn {
  display: inline-flex;
  flex-direction: column;
  padding: 1rem 1.4rem;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  max-width: 320px;
  transition: all 0.2s ease;
}

.pagination-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

.pagination-direction {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin-bottom: 0.25rem;
}

.pagination-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

/* Mobile Sidebar Toggle */
.mobile-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  background: var(--accent-gold);
  color: #fff;
  padding: 0.8rem 1.2rem;
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 0.88rem;
  align-items: center;
  gap: 0.4rem;
}

/* Toast Notifications */
.toast-notice {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--accent-gold);
  padding: 0.75rem 1.4rem;
  border-radius: 30px;
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   9. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  padding: 3.5rem 1.5rem;
  text-align: center;
}

.footer-inner {
  max-width: var(--page-max-width);
  margin: 0 auto;
}

.footer-logo-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.footer-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
}

.footer-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

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

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE DESIGN
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 290px;
  }
  .reader-main {
    padding: 2.5rem 2rem 5rem;
  }
}

@media (max-width: 768px) {
  .header-inner {
    padding: 0 1rem;
  }
  .logo-title {
    font-size: 1rem;
  }
  .nav-menu {
    display: none;
  }
  .hero-section {
    padding: 3.5rem 1rem 2.5rem;
  }
  .hero-stats {
    gap: 1.5rem;
  }
  .random-section, .anthologies-section {
    padding: 3rem 1rem;
  }
  .card-body {
    padding: 1.5rem;
  }
  .anthologies-grid {
    grid-template-columns: 1fr;
  }
  .reader-layout {
    flex-direction: column;
  }
  .reader-sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .reader-sidebar.open {
    transform: translateX(0);
  }
  .mobile-sidebar-toggle {
    display: flex;
  }
  .reader-main {
    padding: 2rem 1.25rem 5rem;
  }
}


/* ============================================================================
   QUOTE LAYER (2026-09-08) - tweet-length quotes drawn from each aphorism and essay
   ============================================================================ */
.aphorism-quotes { margin-top: 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; }
.essay-quotes { margin: 1.4rem 0 2.2rem; display: flex; flex-direction: column; gap: 0.5rem; }
.quotes-heading {
  font-family: var(--font-sans); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 0.3rem;
}
.quote-chip {
  border: 1px solid var(--border-subtle); border-left: 3px solid var(--border-card);
  background: var(--bg-input); border-radius: var(--radius-sm); padding: 0.6rem 0.8rem 0.45rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.quote-chip:hover { border-left-color: var(--accent-gold); background: var(--bg-card-hover); }
.quote-chip-text { font-family: var(--font-serif); font-size: calc(0.98rem * var(--font-scale)); line-height: 1.55; color: var(--text-quote); }
.quote-chip-meta { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.quote-chip-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.quote-chip-tag {
  font-family: var(--font-sans); font-size: 0.68rem; color: var(--text-muted);
  border: 1px solid var(--border-subtle); border-radius: 999px; padding: 0.1rem 0.5rem;
}
.quote-chip.highlight-target { animation: aphorismPulse 3s ease-out; border-left-color: var(--accent-gold); border-color: var(--accent-gold); }
mark.quote-span { background: var(--accent-gold-glow); color: inherit; padding: 0 0.15em; border-radius: 3px; box-shadow: 0 0 0 1px var(--border-hover); }
.overview-quotes { margin-top: 2rem; }

/* ---- local editor (editor.js + serve_editor.py; body.editor-on only) ---- */
.btn-edit-quote { display: none; font-size: 0.75rem; color: var(--text-muted); align-items: center; gap: 0.3rem; padding: 0.22rem 0.55rem; border-radius: 4px; background: transparent; border: 1px solid transparent; cursor: pointer; transition: all 0.2s ease; }
.editor-on .btn-edit-quote { display: inline-flex; }
.btn-edit-quote:hover { color: var(--accent-sapphire); background: var(--bg-input); }
.editor-pill { align-items: center; gap: 0.4rem; }
.editor-pill-label { font-family: var(--font-sans); font-size: 0.72rem; color: var(--accent-sapphire); padding: 0 0.4rem; white-space: nowrap; }
.quote-editor { display: flex; flex-direction: column; gap: 0.4rem; font-family: var(--font-sans); }
.quote-editor-verbatim { font-family: var(--font-serif); font-size: 0.9rem; color: var(--text-secondary); border-left: 2px solid var(--border-subtle); padding-left: 0.6rem; }
.quote-editor-verbatim .quote-chip-tag { display: inline-block; margin-bottom: 0.25rem; }
.quote-editor-label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); display: flex; justify-content: space-between; }
.quote-editor-count.over { color: var(--accent-ruby); font-weight: 600; }
.quote-editor-text, .quote-editor-note { width: 100%; box-sizing: border-box; font-family: var(--font-serif); font-size: 1rem; line-height: 1.5; color: var(--text-primary); background: var(--bg-primary); border: 1px solid var(--border-card); border-radius: var(--radius-sm); padding: 0.5rem 0.6rem; }
.quote-editor-text:focus, .quote-editor-note:focus { outline: none; border-color: var(--accent-gold); }
.quote-editor-actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.quote-editor-actions .btn-primary, .quote-editor-actions .btn-secondary { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.quote-editor-status { font-size: 0.78rem; color: var(--accent-ruby); }
