/* ============================================================
   LUMEN LIBRI — ARCHIVUM LITTERARUM
   Refined Scholarly & Editorial Library Theme
   Fraunces · Plus Jakarta Sans · Newsreader
   ============================================================ */

:root {
  /* Dark Archival Palette (Default) */
  --bg: #090c10;
  --bg-surface: #10151c;
  --bg-elevated: #161d26;
  --surface-glass: rgba(16, 21, 28, 0.85);
  --surface-card: #131922;
  --surface-card-hover: #17202c;
  --border: rgba(215, 174, 112, 0.16);
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(215, 174, 112, 0.42);

  --text: #f5efe6;
  --text-secondary: #b8b1a5;
  --text-muted: #827b70;

  --gold: #d7ae70;
  --gold-bright: #f2cb8a;
  --gold-dark: #8c6a34;
  --gold-glow: rgba(215, 174, 112, 0.16);
  --gold-soft: rgba(215, 174, 112, 0.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-gold: 0 8px 30px rgba(215, 174, 112, 0.14);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-reader: 'Newsreader', Georgia, serif;

  --container-max: 1240px;
}

body.light-theme {
  /* Warm Parchment Palette */
  --bg: #f7f3ea;
  --bg-surface: #efe8dc;
  --bg-elevated: #e6ded0;
  --surface-glass: rgba(247, 243, 234, 0.9);
  --surface-card: #ffffff;
  --surface-card-hover: #fcfbf9;
  --border: rgba(140, 106, 52, 0.2);
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(140, 106, 52, 0.5);

  --text: #1d1916;
  --text-secondary: #574f46;
  --text-muted: #8c8275;

  --gold: #aa7d33;
  --gold-bright: #8c6220;
  --gold-dark: #5c3e0e;
  --gold-glow: rgba(170, 125, 51, 0.14);
  --gold-soft: rgba(170, 125, 51, 0.08);

  --shadow-sm: 0 2px 8px rgba(50, 30, 10, 0.06);
  --shadow-md: 0 8px 24px rgba(50, 30, 10, 0.09);
  --shadow-lg: 0 16px 48px rgba(50, 30, 10, 0.13);
  --shadow-gold: 0 8px 30px rgba(170, 125, 51, 0.12);
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  width: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color .3s ease, color .3s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* Subtle Archival Texture (Clean, no tacky blobs) */
.archive-grain-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: radial-gradient(#000 1px, transparent 0);
  background-size: 8px 8px;
}
body.light-theme .archive-grain-layer {
  opacity: 0.05;
}

/* ============================================================
   TOPBAR NAVIGATION
   ============================================================ */
.navbar-wrapper {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color .2s ease, background-color .2s ease;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  gap: 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.brand-emblem-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(215, 174, 112, 0.18), rgba(215, 174, 112, 0.04));
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, border-color .2s ease;
}
.nav-brand:hover .brand-emblem-wrap {
  transform: translateY(-1px);
  border-color: var(--gold);
}
.brand-emblem-svg {
  width: 28px;
  height: 28px;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}
.brand-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.15;
  color: var(--text);
}
.brand-title span {
  color: var(--gold);
}
.brand-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-muted);
  font-weight: 600;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 550;
  transition: color .2s ease;
}
.nav-link:hover, .nav-link.active {
  color: var(--gold-bright);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Search Box */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
}
.search-input {
  width: 210px;
  height: 40px;
  padding: 0 34px 0 36px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: width .25s ease, border-color .25s ease, background-color .25s ease;
}
.search-input:focus {
  width: 260px;
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.search-icon {
  position: absolute;
  left: 12px;
  pointer-events: none;
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}
.search-clear {
  position: absolute;
  right: 11px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.search-clear.visible {
  display: flex;
}

/* Language Switcher */
.lang-dropdown-wrapper {
  position: relative;
}
.lang-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .2s ease, background-color .2s ease;
}
.lang-dropdown-btn:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
}
.lang-dropdown-btn svg {
  color: var(--gold);
}
.caret-icon {
  transition: transform .2s ease;
}
.lang-dropdown-wrapper.active .caret-icon {
  transform: rotate(180deg);
}
.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  max-height: 380px;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 200;
  display: none;
  flex-direction: column;
  gap: 2px;
}
.lang-dropdown-wrapper.active .lang-menu {
  display: flex;
}
.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
  width: 100%;
  text-align: left;
}
.lang-option:hover {
  background: var(--gold-soft);
  color: var(--gold-bright);
}
.lang-option.active {
  background: var(--gold);
  color: #120e09;
  font-weight: 700;
}
.lang-option-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Theme Toggle */
.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--gold);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .25s ease;
}
.theme-toggle-btn:hover {
  border-color: var(--gold);
  transform: rotate(15deg);
  background: var(--gold-soft);
}

/* ============================================================
   HERO SECTION (Scholarly & Archival)
   ============================================================ */
.hero-section {
  padding: 56px 0 46px;
  position: relative;
  border-bottom: 1px solid var(--border-subtle);
}
.hero-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 48px;
  align-items: center;
}
.hero-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 15px;
  border-radius: var(--radius-full);
  background: var(--gold-soft);
  border: 1px solid var(--border);
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  width: fit-content;
}
.hero-title {
  font-family: var(--font-display);
  font-size: 46px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -1.2px;
  color: var(--text);
}
.hero-title em {
  font-style: italic;
  color: var(--gold-bright);
  font-weight: 400;
}
.hero-desc {
  font-size: 16.5px;
  line-height: 1.68;
  color: var(--text-secondary);
  max-width: 580px;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 24px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  color: #120e09;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  box-shadow: var(--shadow-gold);
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(215, 174, 112, 0.32);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: all .2s ease;
}
.btn-secondary:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-top: 14px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
}
.stat-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stat-number {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--gold-bright);
}
.stat-label {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ============================================================
   SPOTLIGHT SHOWCASE CARD (High-End Archival)
   ============================================================ */
.spotlight-card {
  position: relative;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  display: flex;
  gap: 24px;
  align-items: center;
  overflow: hidden;
  transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.spotlight-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-gold);
}
.spotlight-cover-wrap {
  width: 140px;
  flex-shrink: 0;
  cursor: pointer;
}
.spotlight-cover-wrap img {
  width: 100%;
  aspect-ratio: 3/4.4;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: -6px 8px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: transform .3s ease;
}
.spotlight-cover-wrap:hover img {
  transform: scale(1.03) rotate(-1deg);
}

.spotlight-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.spotlight-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}
.spotlight-title {
  font-family: var(--font-display);
  font-size: 26px;
  line-height: 1.2;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.spotlight-title:hover {
  color: var(--gold-bright);
}
.spotlight-author {
  font-size: 14px;
  color: var(--gold-bright);
  font-weight: 600;
}
.spotlight-quote {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.spotlight-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ============================================================
   BOOKSHELF & GRID
   ============================================================ */
.bookshelf-section {
  padding: 56px 0;
  scroll-margin-top: 74px;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.section-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.section-eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-weight: 700;
  color: var(--gold);
}
.section-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.6px;
  color: var(--text);
}

/* Filter Controls */
.filters-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 34px;
}
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  width: fit-content;
}
.filter-tab {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s ease;
  font-family: inherit;
}
.filter-tab:hover {
  color: var(--gold-bright);
  background: var(--gold-soft);
}
.filter-tab.active {
  background: var(--gold);
  color: #120e09;
  box-shadow: 0 4px 12px rgba(215, 174, 112, 0.3);
}

.lang-filter-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lang-filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 4px;
}
.lang-pill {
  padding: 5px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .18s ease;
}
.lang-pill:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}
.lang-pill.active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--gold-bright);
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 28px;
}
.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.book-card:hover {
  transform: translateY(-6px);
  border-color: var(--border-hover);
  box-shadow: var(--shadow-gold);
}
.book-cover-container {
  position: relative;
  width: 100%;
  aspect-ratio: 3/3.8;
  background: #06090d;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}
.book-cover-img {
  width: 154px;
  height: 220px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: -4px 6px 18px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: transform .3s ease;
  position: relative;
  z-index: 1;
}
.book-card:hover .book-cover-img {
  transform: scale(1.04) rotate(-1deg);
}

.book-card-body {
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  gap: 12px;
}
.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.category-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  padding: 3px 8px;
  border-radius: 4px;
}
.reading-time-pill {
  font-size: 11.5px;
  color: var(--text-muted);
}
.book-title {
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.24;
  color: var(--text);
  font-weight: 650;
  margin-top: 2px;
  cursor: pointer;
}
.book-title:hover {
  color: var(--gold-bright);
}
.book-author {
  font-size: 13.5px;
  color: var(--gold-bright);
  font-weight: 600;
}
.book-desc {
  font-size: 13.5px;
  line-height: 1.58;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.book-card-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.btn-read-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: var(--gold);
  color: #120e09;
  font-weight: 700;
  font-size: 13px;
  border: 0;
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease;
}
.btn-read-card:hover {
  transform: scale(1.03);
  background: var(--gold-bright);
}
.btn-guide-card {
  font-size: 12.5px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  transition: all .2s ease;
}
.btn-guide-card:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.empty-results {
  display: none;
  text-align: center;
  padding: 64px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px dashed var(--border);
  margin-top: 32px;
}
.empty-results h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-results p {
  font-size: 14px;
  color: var(--text-muted);
}

/* ============================================================
   STUDY GUIDES SECTION
   ============================================================ */
.guides-section {
  padding: 64px 0;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}
body.light-theme .guides-section {
  background: rgba(0, 0, 0, 0.02);
}
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 26px;
  margin-top: 34px;
}
.guide-card {
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform .2s ease, border-color .2s ease;
}
.guide-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}
.guide-card-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.guide-card-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.guide-card-byline {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}
.guide-card-summary {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-secondary);
}
.guide-card-bullets {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
  border-left: 2px solid var(--border);
  padding-left: 12px;
  margin: 4px 0;
}
.guide-card-footer {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ============================================================
   PILLARS / MISSION SECTION
   ============================================================ */
.pillars-section {
  padding: 64px 0;
  border-top: 1px solid var(--border-subtle);
}
.pillars-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 36px;
}
.pillar-card {
  padding: 30px 24px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .2s ease;
}
.pillar-card:hover {
  border-color: var(--border);
}
.pillar-icon {
  font-size: 28px;
}
.pillar-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.pillar-desc {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  margin-top: auto;
  padding: 56px 0 32px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 40px;
}
.footer-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-heading {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--gold);
}
.footer-links-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-links-list a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  transition: color .2s ease;
}
.footer-links-list a:hover {
  color: var(--gold-bright);
}
.footer-bottom-bar {
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 12px;
}

/* ============================================================
   ADVANCED SCHOLARLY READER MODAL
   ============================================================ */
.reader-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: none;
  flex-direction: column;
  background: #0d1217;
  color: #ebdcc7;
  animation: readerFadeIn .22s ease forwards;
}
.reader-modal.active {
  display: flex;
}
@keyframes readerFadeIn {
  from { opacity: 0; transform: scale(0.99); }
  to { opacity: 1; transform: scale(1); }
}

/* Reader Themes */
.reader-modal.theme-sepia {
  background: #f4ecd8;
  color: #2b231a;
}
.reader-modal.theme-dark {
  background: #0d1217;
  color: #ebdcc7;
}
.reader-modal.theme-light {
  background: #faf8f5;
  color: #1e1a16;
}

/* Reader Header */
.reader-header {
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(215, 174, 112, 0.15);
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.reader-modal.theme-sepia .reader-header {
  border-bottom-color: rgba(120, 84, 40, 0.15);
  background: rgba(255, 255, 255, 0.4);
}
.reader-modal.theme-light .reader-header {
  border-bottom-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.85);
}

.reader-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(215, 174, 112, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s ease;
}
.reader-back-btn:hover {
  background: rgba(215, 174, 112, 0.16);
  border-color: var(--gold);
}

.reader-title-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  overflow: hidden;
  max-width: 50%;
}
.reader-book-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.reader-chapter-label {
  font-size: 11.5px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.reader-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
}
.reader-tool-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(215, 174, 112, 0.2);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all .18s ease;
}
.reader-tool-btn:hover {
  border-color: var(--gold);
  background: rgba(215, 174, 112, 0.14);
}
.reader-tool-btn.active {
  background: var(--gold);
  color: #120e09;
}

/* Progress Track */
.reader-progress-track {
  height: 3px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  flex-shrink: 0;
}
.reader-progress-bar {
  height: 100%;
  background: var(--gold);
  width: 0%;
  transition: width .2s ease;
}

/* Reader Scroll & Text Area */
.reader-scroll-area {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 40px 24px 60px;
  scroll-behavior: smooth;
}
.reader-article {
  width: 100%;
  max-width: 760px;
  font-family: var(--font-reader);
  font-size: 21px;
  line-height: 1.82;
  letter-spacing: -0.01em;
}
.reader-article.font-sans {
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.78;
}
.reader-article p {
  margin-bottom: 1.5em;
  text-indent: 1.8em;
}
.reader-article p:first-of-type {
  text-indent: 0;
}
.reader-article h2, .reader-article h3 {
  font-family: var(--font-display);
  margin: 2em 0 1em;
  line-height: 1.25;
  color: var(--gold-bright);
}
.reader-modal.theme-sepia .reader-article h2,
.reader-modal.theme-sepia .reader-article h3,
.reader-modal.theme-light .reader-article h2,
.reader-modal.theme-light .reader-article h3 {
  color: var(--gold-dark);
}

/* Reader Footer (Pagination Controls) */
.reader-footer {
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid rgba(215, 174, 112, 0.15);
  background: rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}
.reader-modal.theme-sepia .reader-footer {
  border-top-color: rgba(120, 84, 40, 0.15);
  background: rgba(255, 255, 255, 0.4);
}
.reader-modal.theme-light .reader-footer {
  border-top-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.85);
}

.reader-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(215, 174, 112, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s ease;
}
.reader-nav-btn:hover:not(:disabled) {
  background: rgba(215, 174, 112, 0.16);
  border-color: var(--gold);
}
.reader-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.reader-page-indicator {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.8;
  font-variant-numeric: tabular-nums;
}

/* TOC Drawer */
.reader-toc-drawer {
  position: absolute;
  top: 64px;
  left: 0;
  bottom: 0;
  width: 340px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  z-index: 1000;
  animation: tocSlideIn .2s ease forwards;
}
.reader-toc-drawer.open {
  display: flex;
}
@keyframes tocSlideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
.reader-toc-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
}
.reader-toc-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
}
.reader-toc-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
}
.reader-toc-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all .15s ease;
}
.reader-toc-item:hover {
  background: var(--gold-soft);
  color: var(--gold-bright);
}
.reader-toc-item.active {
  background: var(--gold);
  color: #120e09;
  font-weight: 700;
}

/* Spinner Loader */
.reader-loading-overlay {
  position: absolute;
  inset: 64px 0 0 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 100;
}
.reader-loading-overlay.visible {
  display: flex;
}
.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(215, 174, 112, 0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 580px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  z-index: 900;
}
.cookie-banner[hidden] {
  display: none !important;
}
.cookie-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.cookie-btn {
  padding: 8px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.cookie-btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #120e09;
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .hero-layout {
    grid-template-columns: 1fr;
    gap: 36px;
  }
  .spotlight-card {
    max-width: 600px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }
  .pillars-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }
  .search-input {
    width: 140px;
  }
  .search-input:focus {
    width: 180px;
  }
  .hero-title {
    font-size: 34px;
  }
  .hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .spotlight-card {
    flex-direction: column;
    text-align: center;
    padding: 22px;
  }
  .spotlight-cover-wrap {
    width: 120px;
  }
  .spotlight-actions {
    justify-content: center;
  }
  .reader-header {
    padding: 0 12px;
    height: 56px;
  }
  .reader-back-btn span {
    display: none;
  }
  .reader-title-area {
    max-width: 38%;
  }
  .reader-article {
    font-size: 18px;
  }
  .cookie-banner {
    flex-direction: column;
    bottom: 12px;
    left: 12px;
    right: 12px;
    text-align: center;
  }
}
