@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..600&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   Design Tokens — 3 Themes (Light / Sepia / Dark)
   ========================================================================== */
:root,
html[data-theme="light"] {
  --bg-body: #FDFBF7;
  --bg-card: #FFFFFF;
  --bg-elevated: #F8F5EE;
  --bg-header: rgba(253, 251, 247, 0.88);
  --border-color: #E6DFD3;
  --border-subtle: #EFEAE0;

  --text-main: #1E293B;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --brand-primary: #0F172A;

  --accent: #1D4ED8;
  --accent-hover: #1E40AF;
  --accent-light: #EFF6FF;
  --accent-border: rgba(29, 78, 216, 0.22);

  /* Semantic / Chart Palette */
  --chart-blue: #1D4ED8;
  --chart-blue-soft: #DBEAFE;
  --chart-orange: #D97706;
  --chart-orange-soft: #FEF3C7;
  --chart-red: #DC2626;
  --chart-red-soft: #FEE2E2;
  --chart-green: #059669;
  --chart-green-soft: #D1FAE5;
  --chart-gray: #64748B;
  --chart-gray-soft: #CBD5E1;
  --chart-grid: #E2E8F0;
  --chart-noise: rgba(100, 116, 139, 0.11);

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.14);

  --font-serif: 'Lora', Georgia, Cambria, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --base-font-size: 18px;
  --radius-card: 18px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

html[data-theme="sepia"] {
  --bg-body: #F4ECD8;
  --bg-card: #FAF4E8;
  --bg-elevated: #EDE3CD;
  --bg-header: rgba(244, 236, 216, 0.9);
  --border-color: #D8C7A5;
  --border-subtle: #E3D6B9;

  --text-main: #372E21;
  --text-secondary: #5C4D38;
  --text-muted: #7D6B52;
  --brand-primary: #2B2115;

  --accent: #C2410C;
  --accent-hover: #9A3412;
  --accent-light: #FBF0EA;
  --accent-border: rgba(194, 65, 12, 0.25);

  --chart-blue: #9A3412;
  --chart-blue-soft: #FDE8DB;
  --chart-orange: #B45309;
  --chart-orange-soft: #FDECC8;
  --chart-red: #B91C1C;
  --chart-red-soft: #FADBD8;
  --chart-green: #166534;
  --chart-green-soft: #DCFCE7;
  --chart-gray: #7D6B52;
  --chart-gray-soft: #C7B697;
  --chart-grid: #DFD2B7;
  --chart-noise: rgba(125, 107, 82, 0.13);

  --shadow-sm: 0 2px 8px rgba(55, 46, 33, 0.05);
  --shadow-md: 0 10px 30px rgba(55, 46, 33, 0.08);
  --shadow-lg: 0 20px 50px rgba(55, 46, 33, 0.18);
}

html[data-theme="dark"] {
  --bg-body: #0F172A;
  --bg-card: #1E293B;
  --bg-elevated: #273449;
  --bg-header: rgba(15, 23, 42, 0.88);
  --border-color: #334155;
  --border-subtle: #293548;

  --text-main: #F8FAFC;
  --text-secondary: #CBD5E1;
  --text-muted: #94A3B8;
  --brand-primary: #F8FAFC;

  --accent: #38BDF8;
  --accent-hover: #7DD3FC;
  --accent-light: rgba(56, 189, 248, 0.13);
  --accent-border: rgba(56, 189, 248, 0.3);

  --chart-blue: #38BDF8;
  --chart-blue-soft: rgba(56, 189, 248, 0.18);
  --chart-orange: #FBBF24;
  --chart-orange-soft: rgba(251, 191, 36, 0.16);
  --chart-red: #F87171;
  --chart-red-soft: rgba(248, 113, 113, 0.16);
  --chart-green: #34D399;
  --chart-green-soft: rgba(52, 211, 153, 0.16);
  --chart-gray: #94A3B8;
  --chart-gray-soft: #475569;
  --chart-grid: #334155;
  --chart-noise: rgba(148, 163, 184, 0.12);

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}

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

html {
  scroll-behavior: smooth;
  font-size: var(--base-font-size);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-serif);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

body.font-sans-mode {
  font-family: var(--font-sans);
  line-height: 1.75;
}

h1, h2, h3, h4, nav, button, .ui-text {
  font-family: var(--font-sans);
}

h1, h2, h3, h4 {
  color: var(--brand-primary);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-top: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

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

p {
  margin: 0 0 1.25rem;
}

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

/* ==========================================================================
   Reading Progress Bar
   ========================================================================== */
#progress-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: transparent;
  z-index: 1001;
  pointer-events: none;
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.1s linear;
}

/* ==========================================================================
   Sticky Header / Toolbar
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.72rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  white-space: nowrap;
}

.brand-link {
  font-weight: 800;
  color: var(--brand-primary);
  letter-spacing: -0.02em;
}

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

.brand-sep {
  color: var(--text-muted);
  opacity: 0.55;
}

.brand-subtitle {
  color: var(--text-secondary);
  font-weight: 500;
}

/* View Switcher Pills */
.view-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.2rem;
  gap: 0.15rem;
}

.view-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.view-btn:hover {
  color: var(--brand-primary);
}

.view-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Reader Controls */
.reader-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.control-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-pill);
  padding: 0.16rem;
  gap: 0.1rem;
}

.ctrl-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.32rem 0.58rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.ctrl-btn:hover {
  color: var(--brand-primary);
  background: var(--bg-card);
}

.ctrl-btn.active {
  background: var(--accent);
  color: #FFFFFF;
}

html[data-theme="dark"] .ctrl-btn.active {
  color: #0F172A;
}

.tts-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.38rem 0.78rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.tts-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tts-btn.speaking {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

html[data-theme="dark"] .tts-btn.speaking {
  color: #0F172A;
}

/* ==========================================================================
   Main Container & Hero
   ========================================================================== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 4rem;
}

.hero-section {
  max-width: 900px;
  margin: 0 auto 3rem;
  text-align: center;
}

.hero-pill {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 0.3rem 0.9rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1.15rem;
}

.hero-title {
  font-size: clamp(1.95rem, 4.3vw, 3.1rem);
  font-weight: 800;
  margin-bottom: 1.5rem;
  color: var(--brand-primary);
}

.hero-lead-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.75rem;
  text-align: left;
  font-style: italic;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.35rem;
  font-size: 1rem;
  line-height: 1.78;
}

.hero-meta {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem 0.85rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.meta-dot {
  opacity: 0.45;
}

/* ==========================================================================
   View Visibility & Transitions
   ========================================================================== */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
}

.fade-in {
  animation: fadeSlideIn 0.28s ease-out;
}

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

/* ==========================================================================
   View 1: Linear Layout (Sticky Sidebar TOC + Chapters)
   ========================================================================== */
.linear-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2.25rem;
  align-items: start;
}

.toc-sidebar {
  position: sticky;
  top: calc(var(--header-height, 74px) + 18px);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.35rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

.toc-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.9rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-subtle);
}

.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.toc-link {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-secondary);
  padding: 0.48rem 0.7rem;
  border-radius: 10px;
  border-left: 2px solid transparent;
  transition: all 0.18s ease;
}

.toc-link:hover {
  background: var(--bg-elevated);
  color: var(--brand-primary);
}

.toc-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  border-left-color: var(--accent);
}

.article-column {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
  max-width: 840px;
  width: 100%;
}

/* ==========================================================================
   Topic / Chapter Cards
   ========================================================================== */
.topic-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 2.4rem 2.5rem;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-height, 74px) + 18px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, background-color 0.25s ease, border-color 0.25s ease;
}

.topic-section:hover {
  box-shadow: var(--shadow-md);
}

.chapter-eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 0.22rem 0.75rem;
  border-radius: var(--radius-pill);
  margin-bottom: 0.85rem;
}

.topic-section h2 {
  font-size: clamp(1.45rem, 2.7vw, 2rem);
  font-weight: 700;
  margin-bottom: 1.35rem;
}

.topic-section h3 {
  font-size: 1.08rem;
  font-weight: 700;
  margin: 1.65rem 0 0.6rem;
  color: var(--brand-primary);
}

/* Key Takeaway Box */
.takeaway-box {
  background: var(--bg-elevated);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.15rem 1.35rem;
  margin-bottom: 1.7rem;
}

.takeaway-label {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.38rem;
}

.takeaway-box p {
  margin: 0;
  font-size: 0.96rem;
  line-height: 1.72;
  color: var(--text-main);
  font-weight: 500;
}

/* ==========================================================================
   Inline SVG Figures & Lightbox Trigger
   ========================================================================== */
.figure-block {
  margin: 0 0 1.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  cursor: zoom-in;
  position: relative;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.figure-block:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.figure-stage {
  padding: 1.1rem 1.1rem 0.75rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.figure-stage svg {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  transition: transform 0.25s ease;
}

.figure-block:hover .figure-stage svg {
  transform: scale(1.012);
}

.figure-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.figure-caption {
  line-height: 1.45;
}

.zoom-badge {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 0.26rem 0.7rem;
  border-radius: var(--radius-pill);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.figure-block:hover .zoom-badge {
  background: var(--accent);
  color: #FFFFFF;
}

html[data-theme="dark"] .figure-block:hover .zoom-badge {
  color: #0F172A;
}

/* SVG internal text helpers */
.svg-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  fill: var(--brand-primary);
}

.svg-subtitle {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  fill: var(--text-muted);
}

.svg-label {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  fill: var(--text-main);
}

.svg-sublabel {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  fill: var(--text-muted);
}

.svg-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  fill: var(--brand-primary);
}

.svg-axis {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 500;
  fill: var(--text-muted);
}

/* ==========================================================================
   Methodological Filters Box (Chapter 6)
   ========================================================================== */
.filters-box {
  margin: 1.85rem 0 1.7rem;
  padding: 1.45rem 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.filters-box-title {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin: 0 0 0.35rem;
}

.filters-box-intro {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin: 0 0 1.1rem;
  line-height: 1.55;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.filter-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 0.95rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.filter-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.1rem;
}

.filter-item h4 {
  font-size: 0.86rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: var(--brand-primary);
}

.filter-item p {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.52;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   Academic Citations Block
   ========================================================================== */
.citations-box {
  margin-top: 1.85rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
}

.citations-title {
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.citation-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.citation-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  padding: 0.34rem 0.75rem;
  border-radius: var(--radius-pill);
  transition: all 0.18s ease;
}

.citation-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.citation-ext {
  font-size: 0.72rem;
  opacity: 0.75;
}

/* ==========================================================================
   Inline Glossary Terms & Floating Popover
   ========================================================================== */
.glossary-term {
  border-bottom: 1.5px dashed var(--accent);
  color: inherit;
  cursor: help;
  padding-bottom: 1px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.glossary-term:hover,
.glossary-term:focus {
  background: var(--accent-light);
  color: var(--accent);
  outline: none;
  border-radius: 3px;
}

#glossary-popover {
  position: fixed;
  z-index: 1200;
  max-width: 340px;
  width: calc(100vw - 2rem);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent);
  border-radius: 14px;
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
  pointer-events: none;
}

#glossary-popover.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.popover-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.45rem;
}

.popover-title {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin: 0;
}

.popover-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
}

.popover-close:hover {
  color: var(--brand-primary);
}

.popover-body {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.58;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   View 2: Focus / Cards Layout
   ========================================================================== */
.focus-container {
  max-width: 860px;
  margin: 0 auto;
}

.focus-nav-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.focus-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.focus-counter {
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 800;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 0.3rem 0.85rem;
  border-radius: var(--radius-pill);
}

.focus-step-btns {
  display: flex;
  gap: 0.5rem;
}

.step-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s ease;
}

.step-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.step-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.focus-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.focus-pill {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.34rem 0.75rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.18s ease;
}

.focus-pill:hover {
  border-color: var(--accent);
  color: var(--brand-primary);
}

.focus-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #FFFFFF;
}

html[data-theme="dark"] .focus-pill.active {
  color: #0F172A;
}

/* ==========================================================================
   View 3: Comparison Matrix & Myth vs. Reality Sections
   ========================================================================== */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  padding: 2.35rem 2.5rem;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: calc(var(--header-height, 74px) + 18px);
}

.section-header {
  margin-bottom: 1.75rem;
}

.section-header h2 {
  font-size: clamp(1.45rem, 2.7vw, 1.95rem);
  font-weight: 800;
  margin-bottom: 0.55rem;
}

.section-subtitle {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.62;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
}

.matrix-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem 1.45rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.matrix-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
}

.matrix-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}

.matrix-card h3 {
  font-size: 1.04rem;
  font-weight: 700;
  margin: 0 0 0.6rem;
}

.matrix-card p {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  line-height: 1.62;
  color: var(--text-secondary);
  margin: 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.tag-pill {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.22rem 0.62rem;
  border-radius: var(--radius-pill);
}

/* Myth vs. Reality Cards */
.myth-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
  gap: 1.15rem;
}

.myth-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 15px;
  padding: 1.35rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.myth-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.myth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.myth-kicker {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.verdict-badge {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
}

.verdict-false {
  background: var(--chart-red-soft);
  color: var(--chart-red);
}

.verdict-warning {
  background: var(--chart-orange-soft);
  color: var(--chart-orange);
}

.verdict-supported {
  background: var(--chart-green-soft);
  color: var(--chart-green);
}

.myth-claim {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.96rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--brand-primary);
  margin: 0;
}

.myth-reality {
  font-family: var(--font-sans);
  font-size: 0.83rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border-subtle);
}

.matrix-stack {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

/* ==========================================================================
   Shared Kislexikon Section
   ========================================================================== */
#lexicon-section {
  margin-top: 3rem;
}

.lexicon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.1rem;
}

.lexicon-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.25rem 1.35rem;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  font-family: inherit;
  color: inherit;
}

.lexicon-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.lexicon-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
}

.lexicon-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
  color: var(--brand-primary);
}

.lexicon-more {
  flex-shrink: 0;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
}

.lexicon-card p {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  line-height: 1.56;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   Modals (SVG Lightbox & Glossary Detail Modal)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  max-width: 1040px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.97);
  transition: transform 0.2s ease;
}

.modal-overlay.open .modal-dialog {
  transform: scale(1);
}

.modal-dialog.glossary-dialog {
  max-width: 620px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
}

.modal-title {
  font-family: var(--font-sans);
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin: 0;
}

.modal-close {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
}

.modal-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.lightbox-body {
  padding: 1.5rem;
  overflow: auto;
  background: var(--bg-card);
}

.lightbox-body svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 620px;
}

.lightbox-caption {
  padding: 0.9rem 1.4rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-color);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.glossary-modal-body {
  padding: 1.5rem 1.6rem 1.7rem;
  overflow-y: auto;
}

.glossary-modal-body p {
  font-size: 0.96rem;
  line-height: 1.75;
  color: var(--text-main);
  margin-bottom: 1rem;
}

.glossary-context-box {
  background: var(--bg-elevated);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 0.9rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.83rem;
  color: var(--text-secondary);
  line-height: 1.58;
}

.glossary-context-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding: 2.25rem 1.25rem 3rem;
  text-align: center;
  font-family: var(--font-sans);
}

.footer-brand {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--brand-primary);
  margin: 0 0 0.4rem;
}

.footer-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.55;
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 1080px) {
  .brand-subtitle,
  .brand-sep {
    display: none;
  }
}

@media (max-width: 992px) {
  .header-inner {
    padding: 0.55rem 1rem;
    gap: 0.45rem 0.75rem;
    justify-content: center;
  }

  .linear-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .toc-sidebar {
    position: static;
  }

  .toc-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.35rem;
  }

  .article-column {
    max-width: 100%;
  }
}

@media (max-width: 680px) {
  .page-container {
    padding: 1.85rem 0.9rem 3rem;
  }

  .topic-section,
  .section-card {
    padding: 1.55rem 1.2rem;
    border-radius: 14px;
  }

  .hero-lead-card {
    padding: 1.15rem 1.2rem;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .brand-subtitle {
    display: none;
  }

  .brand-sep {
    display: none;
  }

  .figure-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .lightbox-body svg {
    min-width: 500px;
  }
}

/* ==========================================================================
   Print Stylesheet
   ========================================================================== */
@media print {
  #progress-container,
  .site-header,
  .toc-sidebar,
  .focus-nav-bar,
  .zoom-badge,
  #lexicon-section,
  .modal-overlay,
  #glossary-popover {
    display: none !important;
  }

  body {
    background: #FFFFFF !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .linear-layout {
    display: block !important;
  }

  .view-panel {
    display: none !important;
  }

  #view-linear {
    display: block !important;
  }

  .topic-section,
  .section-card,
  .figure-block {
    box-shadow: none !important;
    break-inside: avoid;
    border: 1px solid #CCCCCC !important;
    margin-bottom: 1.2rem !important;
  }
}
