/* ============================================================
   TOGAF OGEA-103 Study Guide — Main Stylesheet
   Design: Light-first, editorial / Stripe-Docs aesthetic
   ============================================================ */

/* ── 1. CUSTOM PROPERTIES (LIGHT MODE DEFAULT) ──────────────── */
:root {
  --primary:    #1B3A6B;
  --primary-lt: #2D5499;
  --primary-bg: #EEF2FB;
  --accent:     #E8820C;
  --accent-lt:  #F59E2A;
  --accent-bg:  #FEF3E2;
  --accent2:    #0EA5E9;
  --accent2-lt: #38BDF8;
  --accent2-bg: #E0F2FE;
  --success:    #16A34A;
  --success-bg: #DCFCE7;
  --warning:    #D97706;
  --warning-bg: #FEF3C7;
  --error:      #DC2626;
  --error-bg:   #FEE2E2;

  --bg:         #FAFAFA;
  --bg2:        #F3F4F6;
  --surface:    #FFFFFF;
  --border:     #E5E7EB;
  --border2:    #D1D5DB;

  --text:       #111827;
  --text2:      #374151;
  --text3:      #6B7280;
  --text4:      #9CA3AF;

  --radius:     8px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-full:9999px;

  --shadow:     0 1px 3px rgba(0,0,0,0.10), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.12);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.15);

  --sidebar-w:  260px;
  --header-h:   60px;
  --transition: 200ms ease;
  --transition-slow: 350ms ease;

  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}

/* ── 2. DARK MODE ────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:         #0F172A;
  --bg2:        #1E293B;
  --surface:    #1E293B;
  --border:     #334155;
  --border2:    #475569;

  --text:       #F1F5F9;
  --text2:      #CBD5E1;
  --text3:      #94A3B8;
  --text4:      #64748B;

  --primary-bg: #1E2D4A;
  --accent-bg:  #2D1F0A;
  --accent2-bg: #0C2233;
  --success-bg: #052E16;
  --warning-bg: #1C1205;
  --error-bg:   #1C0505;

  --shadow:     0 1px 3px rgba(0,0,0,0.30), 0 1px 2px rgba(0,0,0,0.20);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.30);
  --shadow-lg:  0 10px 30px rgba(0,0,0,0.40);
  --shadow-xl:  0 20px 60px rgba(0,0,0,0.50);
}

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

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent); }

img, svg { display: block; max-width: 100%; }

ul, ol { list-style: none; }

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

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* ── 4. TYPOGRAPHY ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.375rem, 3vw, 1.875rem); font-weight: 600; }
h3 { font-size: clamp(1.125rem, 2.5vw, 1.375rem); font-weight: 600; }
h4 { font-size: 1.125rem; font-weight: 600; }
h5 { font-size: 1rem;     font-weight: 600; }
h6 { font-size: 0.875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text3); }

p { margin-bottom: 1rem; color: var(--text2); }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; color: var(--text); }
em     { font-style: italic; }

small  { font-size: 0.8125rem; color: var(--text3); }

.lead {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--text2);
  font-weight: 400;
}

.text-xs   { font-size: 0.75rem; }
.text-sm   { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }

.text-primary  { color: var(--primary); }
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text3); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-error    { color: var(--error); }

.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.font-normal { font-weight: 400; }

/* ── 5. SITE HEADER ──────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: background var(--transition), border-color var(--transition);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo .logo-mark {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

.site-logo .logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.site-logo .logo-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.site-logo .logo-sub {
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text3);
  letter-spacing: 0.04em;
}

/* Header nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-nav a {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text2);
  border-radius: var(--radius);
  transition: background var(--transition), color var(--transition);
}

.header-nav a:hover,
.header-nav a.active {
  background: var(--bg2);
  color: var(--text);
}

.header-nav a.active {
  color: var(--primary);
  font-weight: 600;
}

.header-spacer { flex: 1; }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text3);
  transition: background var(--transition), color var(--transition);
}

.btn-icon:hover {
  background: var(--bg2);
  color: var(--text);
}

.btn-icon svg { width: 18px; height: 18px; }

/* Dark mode toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text3);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--bg2);
  color: var(--text);
}

.theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-sun  { display: none; }

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

/* Mobile hamburger */
.btn-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text2);
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.btn-hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Progress indicator in header */
.reading-progress-bar {
  position: absolute;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  width: var(--progress, 0%);
  transition: width 100ms linear;
  border-radius: 0 2px 2px 0;
}

/* ── 6. LAYOUT SHELL ─────────────────────────────────────────── */
.layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
  max-width: 1440px;
  margin: 0 auto;
}

.layout-full {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  width: 100%;
}

/* ── 7. SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 1.25rem 0;
  transition: transform var(--transition-slow), background var(--transition);
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* Sidebar sections */
.sidebar-section { margin-bottom: 1.5rem; }

.sidebar-section-label {
  padding: 0 1rem 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text4);
}

/* Sidebar nav items */
.sidebar-nav { padding: 0 0.5rem; }

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.4375rem 0.625rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
  line-height: 1.35;
}

.sidebar-link:hover {
  background: var(--bg2);
  color: var(--text);
}

.sidebar-link.active {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link .sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link.active .sidebar-icon { opacity: 1; }

/* Chapter tree */
.chapter-tree { padding: 0 0.5rem; }

.chapter-item { }

.chapter-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.4375rem 0.625rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  text-align: left;
}

.chapter-toggle:hover {
  background: var(--bg2);
  color: var(--text);
}

.chapter-toggle.active {
  color: var(--primary);
}

.chapter-toggle .chapter-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: var(--bg2);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text3);
  flex-shrink: 0;
}

.chapter-toggle.active .chapter-num {
  background: var(--primary-bg);
  color: var(--primary);
}

.chapter-toggle .chevron {
  margin-left: auto;
  width: 14px;
  height: 14px;
  color: var(--text4);
  transition: transform var(--transition);
  flex-shrink: 0;
}

.chapter-item.open .chevron { transform: rotate(90deg); }

.chapter-subnav {
  display: none;
  padding: 0.25rem 0 0.25rem 1.75rem;
}

.chapter-item.open .chapter-subnav { display: block; }

.subnav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3125rem 0.625rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  color: var(--text3);
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.subnav-link:hover {
  background: var(--bg2);
  color: var(--text2);
}

.subnav-link.active {
  color: var(--primary);
  font-weight: 500;
}

/* Sidebar progress */
.sidebar-progress {
  padding: 0 1rem;
  margin-top: 1.5rem;
}

.sidebar-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text3);
  margin-bottom: 0.375rem;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
  backdrop-filter: blur(2px);
}

/* ── 8. MAIN CONTENT AREA ────────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 3rem;
  max-width: calc(100% - var(--sidebar-w));
}

.main-content-centered {
  max-width: 860px;
  margin: 0 auto;
}

/* ── 9. BREADCRUMB ───────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: var(--text3);
}

.breadcrumb-item { display: flex; align-items: center; gap: 0.25rem; }

.breadcrumb-item a {
  color: var(--text3);
  transition: color var(--transition);
}

.breadcrumb-item a:hover { color: var(--primary); }

.breadcrumb-item.active { color: var(--text2); font-weight: 500; }

.breadcrumb-sep {
  color: var(--text4);
  font-size: 0.75rem;
  select: none;
}

/* ── 10. CHAPTER PAGE LAYOUT ─────────────────────────────────── */
.chapter-header {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.chapter-title {
  margin-bottom: 1rem;
}

.chapter-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--text3);
}

.meta-item svg { width: 14px; height: 14px; }

/* Prev / Next nav */
.chapter-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.chapter-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  cursor: pointer;
}

.chapter-nav-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.chapter-nav-card.prev { align-items: flex-start; }
.chapter-nav-card.next { align-items: flex-end; text-align: right; }

.nav-card-direction {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text4);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

/* ── 11. HERO SECTION ────────────────────────────────────────── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 5rem 1.5rem 4rem;
  text-align: center;
  background: linear-gradient(160deg, var(--primary) 0%, #0D2045 100%);
  color: #fff;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(14,165,233,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 60% at 80% 20%, rgba(232,130,12,0.14) 0%, transparent 60%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  max-width: 760px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.20);
  border-radius: var(--radius-full);
  padding: 0.375rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: rgba(255,255,255,0.9);
  margin-bottom: 1.5rem;
  backdrop-filter: blur(4px);
  letter-spacing: 0.03em;
}

.hero h1 {
  color: #fff;
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.hero h1 span {
  background: linear-gradient(135deg, #F59E2A, #FBBF24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .lead {
  color: rgba(255,255,255,0.78);
  max-width: 580px;
  margin: 0 auto 2rem;
  font-size: 1.125rem;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  flex-wrap: wrap;
}

/* ── 12. BUTTONS ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition),
              transform var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(232,130,12,0.35);
}

.btn-primary:hover {
  background: var(--accent-lt);
  border-color: var(--accent-lt);
  box-shadow: 0 4px 16px rgba(232,130,12,0.45);
  color: #fff;
}

.btn-secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.30);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.20);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--border2);
}

.btn-outline:hover {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg2);
  color: var(--text);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  border-radius: 6px;
}

.btn-lg {
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

/* ── 13. STATS BAR ───────────────────────────────────────────── */
.stats-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
}

.stats-bar-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  max-width: 900px;
  margin: 0 auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 2.5rem;
  position: relative;
}

.stat-item + .stat-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: var(--border);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text3);
  font-weight: 500;
  margin-top: 0.25rem;
}

/* ── 14. FEATURE CARDS GRID ──────────────────────────────────── */
.features-section {
  padding: 4rem 1.5rem;
  background: var(--bg);
}

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

.section-kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin-bottom: 0.75rem;
}

.section-lead {
  font-size: 1rem;
  color: var(--text3);
  line-height: 1.6;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}

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

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--primary);
}

.feature-icon svg { width: 22px; height: 22px; }

.feature-card h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text3);
  margin: 0;
}

/* ── 15. CHAPTER CARDS GRID ──────────────────────────────────── */
.chapters-section {
  padding: 3rem 1.5rem 4rem;
  background: var(--bg2);
}

.chapter-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.chapter-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.chapter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent2));
  opacity: 0;
  transition: opacity var(--transition);
}

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

.chapter-card:hover::before { opacity: 1; }

.chapter-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.chapter-number {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text4);
}

.chapter-card h3 {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.4;
}

.chapter-card p {
  font-size: 0.8125rem;
  color: var(--text3);
  line-height: 1.55;
  margin: 0;
  flex: 1;
}

.chapter-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.chapter-card-meta {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 0.75rem;
  color: var(--text4);
}

/* ── 16. BADGE / PILL COMPONENTS ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.625rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.4;
  white-space: nowrap;
}

.badge-beginner {
  background: var(--success-bg);
  color: var(--success);
}

.badge-intermediate {
  background: var(--accent2-bg);
  color: var(--accent2);
}

.badge-advanced {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-exam-critical {
  background: var(--error-bg);
  color: var(--error);
}

.badge-primary {
  background: var(--primary-bg);
  color: var(--primary);
}

.badge-neutral {
  background: var(--bg2);
  color: var(--text3);
}

/* Tag pills */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text3);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  cursor: default;
  text-decoration: none;
}

.tag:hover {
  background: var(--primary-bg);
  color: var(--primary);
  border-color: var(--primary);
}

.tags { display: flex; flex-wrap: wrap; gap: 0.375rem; }

/* ── 17. CALLOUT BOXES ───────────────────────────────────────── */
.callout {
  display: flex;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-lg);
  border-left: 4px solid transparent;
  margin: 1.5rem 0;
  font-size: 0.9375rem;
}

.callout-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
}

.callout-body { flex: 1; min-width: 0; }

.callout-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.375rem;
}

.callout-body p { font-size: 0.9375rem; margin: 0; color: inherit; }

.callout-note {
  background: var(--accent2-bg);
  border-left-color: var(--accent2);
  color: #0C4A6E;
}

[data-theme="dark"] .callout-note { color: var(--accent2-lt); }

.callout-note .callout-title { color: var(--accent2); }
.callout-note .callout-icon  { color: var(--accent2); }

.callout-tip {
  background: var(--success-bg);
  border-left-color: var(--success);
  color: #14532D;
}

[data-theme="dark"] .callout-tip { color: #86EFAC; }

.callout-tip .callout-title { color: var(--success); }
.callout-tip .callout-icon  { color: var(--success); }

.callout-warning {
  background: var(--warning-bg);
  border-left-color: var(--warning);
  color: #78350F;
}

[data-theme="dark"] .callout-warning { color: #FCD34D; }

.callout-warning .callout-title { color: var(--warning); }
.callout-warning .callout-icon  { color: var(--warning); }

.callout-exam {
  background: linear-gradient(135deg, #FEF9EC, #FFF7ED);
  border-left-color: var(--accent);
  color: #7C2D12;
}

[data-theme="dark"] .callout-exam {
  background: linear-gradient(135deg, #2D1F0A, #1C1205);
  color: #FED7AA;
}

.callout-exam .callout-title { color: var(--accent); }
.callout-exam .callout-icon  { color: var(--accent); }

.callout-definition {
  background: var(--primary-bg);
  border-left-color: var(--primary);
  color: #1E3A5F;
}

[data-theme="dark"] .callout-definition { color: #BFDBFE; }

.callout-definition .callout-title { color: var(--primary); }
.callout-definition .callout-icon  { color: var(--primary); }

/* Exam tip with lightbulb SVG */
.exam-tip {
  background: linear-gradient(135deg, #FFFBEB, #FEF3C7);
  border: 1px solid #FDE68A;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  display: flex;
  gap: 0.875rem;
}

[data-theme="dark"] .exam-tip {
  background: linear-gradient(135deg, #1C1205, #111);
  border-color: #92400E;
  border-left-color: var(--accent);
}

.exam-tip-icon {
  flex-shrink: 0;
  color: var(--accent);
  width: 22px;
  height: 22px;
  margin-top: 0.1rem;
}

.exam-tip-body { flex: 1; }

.exam-tip-label {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.exam-tip-body p {
  font-size: 0.9375rem;
  color: #92400E;
  margin: 0;
}

[data-theme="dark"] .exam-tip-body p { color: #FCD34D; }

/* ── 18. CODE BLOCKS ─────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg2);
  color: var(--primary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: #0F172A;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  position: relative;
  box-shadow: var(--shadow-md);
  border: 1px solid #1E293B;
}

pre code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  color: #E2E8F0;
  border-radius: 0;
  line-height: 1.65;
}

/* Syntax highlighting */
.tok-keyword  { color: #C792EA; }
.tok-string   { color: #A8FF60; }
.tok-comment  { color: #546E7A; font-style: italic; }
.tok-number   { color: #F78C6C; }
.tok-function { color: #82AAFF; }
.tok-class    { color: #FFCB6B; }
.tok-operator { color: #89DDFF; }
.tok-punct    { color: #89DDFF; }
.tok-attr     { color: #FFCB6B; }
.tok-value    { color: #A8FF60; }
.tok-tag      { color: #F07178; }
.tok-builtin  { color: #ADDB67; }

/* Code block header */
.code-block {
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid #1E293B;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1E293B;
  padding: 0.625rem 1rem;
  border-bottom: 1px solid #334155;
}

.code-lang {
  font-size: 0.75rem;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

.code-copy-btn {
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748B;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.code-copy-btn:hover { color: #CBD5E1; background: #334155; }
.code-copy-btn.copied { color: #4ADE80; }

.code-block pre {
  margin: 0;
  border-radius: 0;
  border: none;
  box-shadow: none;
}

/* ── 19. COMPARISON TABLES ───────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  margin: 1.5rem 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--surface);
}

thead {
  background: var(--bg2);
  border-bottom: 2px solid var(--border2);
}

thead th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--bg2); }

tbody td {
  padding: 0.875rem 1rem;
  color: var(--text2);
  line-height: 1.5;
  vertical-align: top;
}

.table-highlight thead {
  background: var(--primary);
}

.table-highlight thead th {
  color: rgba(255,255,255,0.9);
}

.table-check   { color: var(--success); font-size: 1rem; }
.table-cross   { color: var(--error);   font-size: 1rem; }
.table-partial { color: var(--warning); font-size: 1rem; }

td.col-highlight {
  background: var(--primary-bg);
  font-weight: 600;
  color: var(--primary);
}

/* ── 20. ADM PHASE TIMELINE ──────────────────────────────────── */
.adm-timeline {
  margin: 2rem 0;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.adm-timeline-inner {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: 700px;
  position: relative;
}

.adm-timeline-inner::before {
  content: '';
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--accent2));
  z-index: 0;
}

.adm-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  position: relative;
  z-index: 1;
}

.adm-phase-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.875rem;
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-md);
  margin-bottom: 0.625rem;
  transition: transform var(--transition), box-shadow var(--transition);
  cursor: default;
}

.adm-phase:hover .adm-phase-dot {
  transform: scale(1.12);
  box-shadow: var(--shadow-lg);
}

.adm-phase.prelim  .adm-phase-dot { background: #64748B; }
.adm-phase.phase-a .adm-phase-dot { background: #1B3A6B; }
.adm-phase.phase-b .adm-phase-dot { background: #1D4ED8; }
.adm-phase.phase-c .adm-phase-dot { background: #0EA5E9; }
.adm-phase.phase-d .adm-phase-dot { background: #06B6D4; }
.adm-phase.phase-e .adm-phase-dot { background: #16A34A; }
.adm-phase.phase-f .adm-phase-dot { background: #D97706; }
.adm-phase.phase-g .adm-phase-dot { background: #E8820C; }
.adm-phase.phase-h .adm-phase-dot { background: #DC2626; }
.adm-phase.req-mgmt .adm-phase-dot { background: #7C3AED; }

.adm-phase.active .adm-phase-dot {
  box-shadow: 0 0 0 4px rgba(27,58,107,0.25), var(--shadow-md);
}

.adm-phase-label {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text3);
  text-align: center;
  line-height: 1.3;
  max-width: 64px;
}

.adm-phase:hover .adm-phase-label { color: var(--primary); }

.adm-phase-name {
  font-size: 0.6rem;
  color: var(--text4);
  text-align: center;
  margin-top: 0.2rem;
}

/* Compact ADM for sidebar / chapter intros */
.adm-compact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.adm-compact-phase {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 0.625rem;
  border-radius: var(--radius-full);
  background: var(--bg2);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text3);
  cursor: pointer;
  transition: all var(--transition);
}

.adm-compact-phase:hover,
.adm-compact-phase.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.adm-compact-phase .phase-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

/* ── 21. PROGRESS BAR ────────────────────────────────────────── */
.progress {
  height: 6px;
  background: var(--bg2);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--accent2));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-lg { height: 10px; }
.progress-sm { height: 4px; }

.progress-accent .progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-lt)); }
.progress-success .progress-bar { background: var(--success); }
.progress-warning .progress-bar { background: var(--warning); }

/* Progress with label */
.progress-labeled {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.progress-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text3);
}

.progress-label-row strong { color: var(--text2); }

/* ── 22. QUIZ / FLASHCARD COMPONENTS ─────────────────────────── */
.quiz-container {
  max-width: 720px;
  margin: 2rem auto;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.quiz-counter {
  font-size: 0.875rem;
  color: var(--text3);
  font-weight: 500;
}

.quiz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
}

.quiz-question {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg);
  text-align: left;
  width: 100%;
  font-size: 0.9375rem;
  color: var(--text2);
}

.quiz-option:hover {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--text);
}

.quiz-option.selected {
  border-color: var(--primary);
  background: var(--primary-bg);
  color: var(--primary);
}

.quiz-option.correct {
  border-color: var(--success);
  background: var(--success-bg);
  color: var(--success);
}

.quiz-option.incorrect {
  border-color: var(--error);
  background: var(--error-bg);
  color: var(--error);
}

.quiz-option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg2);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text3);
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}

.quiz-option.selected   .quiz-option-letter { background: var(--primary);  color: #fff; }
.quiz-option.correct    .quiz-option-letter { background: var(--success);  color: #fff; }
.quiz-option.incorrect  .quiz-option-letter { background: var(--error);    color: #fff; }

.quiz-explanation {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg2);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text2);
  border-left: 3px solid var(--primary);
  display: none;
}

.quiz-explanation.visible { display: block; animation: fadeIn 0.25s ease; }

.quiz-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* ── 23. FLASHCARD FLIP ──────────────────────────────────────── */
.flashcard-scene {
  perspective: 1200px;
  margin: 2rem auto;
  max-width: 600px;
  cursor: pointer;
}

.flashcard {
  width: 100%;
  min-height: 240px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.4, 0.2, 0.2, 1);
}

.flashcard.flipped { transform: rotateY(180deg); }

.flashcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--radius-xl);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.flashcard-front {
  background: linear-gradient(135deg, var(--primary) 0%, #0D2045 100%);
  color: #fff;
}

.flashcard-back {
  background: var(--surface);
  color: var(--text);
  transform: rotateY(180deg);
}

.flashcard-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.65;
  margin-bottom: 1rem;
}

.flashcard-content {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.5;
}

.flashcard-hint {
  margin-top: 1.5rem;
  font-size: 0.75rem;
  opacity: 0.5;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Flashcard deck controls */
.flashcard-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.flashcard-counter {
  font-size: 0.875rem;
  color: var(--text3);
  min-width: 60px;
  text-align: center;
}

/* ── 24. MODAL OVERLAY ───────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 500;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0;
}

.modal-title { font-size: 1.125rem; font-weight: 700; }

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text3);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover { background: var(--bg2); color: var(--text); }

.modal-body { padding: 1.25rem 1.5rem; }
.modal-footer {
  padding: 0 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Quiz results modal */
.results-score {
  text-align: center;
  padding: 1.5rem 0 1rem;
}

.results-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--success) var(--score-deg, 0deg), var(--bg2) 0);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  position: relative;
}

.results-circle::after {
  content: '';
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--surface);
}

.results-percent {
  position: relative;
  z-index: 1;
  font-size: 1.375rem;
  font-weight: 800;
  color: var(--text);
}

.results-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.result-stat {
  text-align: center;
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--bg2);
}

.result-stat .val {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}

.result-stat .lbl {
  font-size: 0.6875rem;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* ── 25. SEARCH OVERLAY ──────────────────────────────────────── */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 600;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 5vh 1rem;
  justify-content: flex-start;
  flex-direction: column;
  align-items: center;
}

.search-overlay.open {
  display: flex;
  animation: fadeIn 0.18s ease;
}

.search-box {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border2);
  overflow: hidden;
}

.search-input-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border);
}

.search-icon { color: var(--text4); width: 18px; height: 18px; flex-shrink: 0; }

.search-input {
  flex: 1;
  border: none;
  background: none;
  padding: 1rem 0;
  font-size: 1rem;
  color: var(--text);
  outline: none;
}

.search-input::placeholder { color: var(--text4); }

.search-close-btn {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text4);
  background: var(--bg2);
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
}

.search-results {
  max-height: 55vh;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-result-item {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
}

.search-result-item:hover { background: var(--bg2); }

.search-result-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--primary-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 700;
}

.search-result-body { flex: 1; min-width: 0; }

.search-result-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 0.75rem;
  color: var(--text3);
  margin-top: 0.125rem;
}

mark {
  background: rgba(232,130,12,0.25);
  color: inherit;
  border-radius: 2px;
  padding: 0 2px;
}

.search-footer {
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text4);
}

.search-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.search-shortcut kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.15rem 0.4rem;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text3);
}

/* ── 26. ACCORDION ───────────────────────────────────────────── */
.accordion { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin: 1rem 0; }

.accordion-item { border-bottom: 1px solid var(--border); }
.accordion-item:last-child { border-bottom: none; }

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  transition: background var(--transition);
  user-select: none;
  list-style: none;
}

.accordion-header:hover { background: var(--bg2); }

.accordion-header::-webkit-details-marker { display: none; }

.accordion-chevron {
  width: 16px;
  height: 16px;
  color: var(--text4);
  flex-shrink: 0;
  transition: transform var(--transition);
}

details[open] > .accordion-header .accordion-chevron { transform: rotate(180deg); }

.accordion-body {
  padding: 0 1.25rem 1.25rem;
  background: var(--surface);
  font-size: 0.9375rem;
  color: var(--text2);
  line-height: 1.65;
}

/* ── 27. LEARNING OBJECTIVES LIST ────────────────────────────── */
.learning-objectives {
  background: var(--success-bg);
  border: 1px solid rgba(22,163,74,0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

.learning-objectives-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--success);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.learning-objectives ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.learning-objectives li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.9375rem;
  color: #14532D;
  line-height: 1.5;
}

[data-theme="dark"] .learning-objectives li { color: #86EFAC; }

.learning-objectives li::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2316A34A'%3E%3Cpath fill-rule='evenodd' d='M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: contain;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

/* ── 28. QUOTE / HIGHLIGHT BLOCKS ────────────────────────────── */
blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.5rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 1rem;
  font-style: italic;
  color: var(--text2);
}

blockquote cite {
  display: block;
  font-size: 0.8125rem;
  font-style: normal;
  color: var(--text3);
  margin-top: 0.5rem;
  font-weight: 500;
}

blockquote cite::before { content: '— '; }

.highlight-block {
  background: linear-gradient(135deg, var(--accent-bg), #FFF7ED);
  border: 1px solid rgba(232,130,12,0.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}

[data-theme="dark"] .highlight-block {
  background: linear-gradient(135deg, #2D1F0A, #1C150A);
  border-color: rgba(232,130,12,0.3);
}

/* ── 29. KEY TERM HIGHLIGHTING ───────────────────────────────── */
.key-term {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.95em;
  cursor: help;
  border-bottom: 2px dotted var(--primary);
  text-decoration: none;
  position: relative;
}

/* Definition tooltip */
.tooltip-wrapper {
  position: relative;
  display: inline;
}

.tooltip-trigger {
  background: var(--primary-bg);
  color: var(--primary);
  font-weight: 600;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.95em;
  cursor: help;
  border-bottom: 2px dotted var(--primary);
}

.tooltip-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  width: 260px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  white-space: normal;
}

.tooltip-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text);
}

.tooltip-wrapper:hover .tooltip-popup { display: block; animation: fadeIn 0.15s ease; }

/* ── 30. BACK TO TOP ─────────────────────────────────────────── */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  z-index: 100;
  border: none;
}

.back-to-top.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary-lt);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.back-to-top svg { width: 18px; height: 18px; }

/* ── 31. CHAPTER COMPLETION CHECKBOX ─────────────────────────── */
.chapter-complete {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: 2.5rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}

.chapter-complete:hover { border-color: var(--success); background: var(--success-bg); }

.chapter-complete.completed {
  border-color: var(--success);
  background: var(--success-bg);
}

.chapter-complete-checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--transition), background var(--transition);
}

.chapter-complete.completed .chapter-complete-checkbox {
  background: var(--success);
  border-color: var(--success);
}

.chapter-complete-checkbox svg {
  width: 13px;
  height: 13px;
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition);
}

.chapter-complete.completed .chapter-complete-checkbox svg { opacity: 1; }

.chapter-complete-text {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text2);
  transition: color var(--transition);
}

.chapter-complete.completed .chapter-complete-text { color: var(--success); }

/* ── 32. CONTENT TYPOGRAPHY (article body) ───────────────────── */
.article-body h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.article-body h3 { margin-top: 1.75rem; margin-bottom: 0.625rem; }
.article-body h4 { margin-top: 1.25rem; margin-bottom: 0.5rem; }

.article-body ul,
.article-body ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text2);
  line-height: 1.7;
}

.article-body ul { list-style: disc; }
.article-body ol { list-style: decimal; }

.article-body li { margin-bottom: 0.375rem; }
.article-body li::marker { color: var(--primary); }

.article-body a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: rgba(27,58,107,0.3);
  text-underline-offset: 2px;
}

.article-body a:hover {
  text-decoration-color: var(--primary);
}

/* ── 33. TABLE OF CONTENTS (in-page) ─────────────────────────── */
.toc {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}

.toc-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
  margin-bottom: 0.75rem;
}

.toc-list { display: flex; flex-direction: column; gap: 0.25rem; }
.toc-list a { color: var(--text3); transition: color var(--transition); padding: 0.1rem 0; }
.toc-list a:hover { color: var(--primary); }

.toc-list-l2 { padding-left: 1rem; margin-top: 0.2rem; }
.toc-list-l3 { padding-left: 2rem; margin-top: 0.1rem; }

/* ── 34. CARD VARIANTS ───────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-body { padding: 1.5rem; }
.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.card-sm .card-body { padding: 1rem; }

/* Stat card */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-card-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text3);
}

.stat-card-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-card-sub {
  font-size: 0.8125rem;
  color: var(--text4);
}

/* ── 35. EXAM OBJECTIVE SECTIONS ─────────────────────────────── */
.exam-objective {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background: var(--error-bg);
  border: 1px solid rgba(220,38,38,0.2);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--error);
  letter-spacing: 0.04em;
}

.exam-objective svg { width: 13px; height: 13px; }

/* ── 36. FOOTER ──────────────────────────────────────────────── */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 2rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2rem;
}

.footer-brand { display: flex; flex-direction: column; gap: 0.75rem; }
.footer-brand p { font-size: 0.875rem; color: var(--text3); margin: 0; }

.footer-col-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.875rem;
}

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

.footer-links a {
  font-size: 0.875rem;
  color: var(--text3);
  transition: color var(--transition);
}

.footer-links a:hover { color: var(--text); }

.footer-bottom {
  max-width: 1100px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text4);
}

/* ── 37. UTILITY CLASSES ─────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex     { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem;  }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem;    }

.mt-0  { margin-top: 0;      }
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1rem;   }
.mt-6  { margin-top: 1.5rem; }
.mt-8  { margin-top: 2rem;   }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }

.w-full  { width: 100%; }
.mx-auto { margin-left: auto; margin-right: auto; }

.divide-y > * + * { border-top: 1px solid var(--border); }

/* ── 38. ANIMATIONS / KEYFRAMES ──────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

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

@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position:  200% 0; }
}

.animate-pulse  { animation: pulse 2s ease infinite; }
.animate-spin   { animation: spin  1s linear infinite; }
.animate-fadein { animation: fadeIn 0.3s ease; }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}

/* ── 39. MOBILE RESPONSIVE ───────────────────────────────────── */
@media (max-width: 1024px) {
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-inner  { grid-template-columns: 1fr 1fr; }
  .main-content  { padding: 2rem 2rem; }
}

@media (max-width: 768px) {
  /* Header */
  .header-nav    { display: none; }
  .btn-hamburger { display: flex; }

  /* Sidebar — off-canvas drawer */
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    transform: translateX(-100%);
    z-index: 160;
    box-shadow: var(--shadow-xl);
    width: min(var(--sidebar-w), 85vw);
    border-right: none;
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay { display: block; }
  .sidebar-overlay.hidden { display: none; }

  /* Main content full-width */
  .main-content {
    max-width: 100%;
    padding: 1.5rem 1rem;
  }

  /* Chapter nav stacked */
  .chapter-nav { grid-template-columns: 1fr; }
  .chapter-nav-card.next { text-align: left; align-items: flex-start; }

  /* Hero */
  .hero { padding: 3.5rem 1rem 3rem; }
  .hero-actions { flex-direction: column; }

  /* Features/chapters grids */
  .features-grid      { grid-template-columns: 1fr; }
  .chapter-cards-grid { grid-template-columns: 1fr; }
  .stats-bar-inner    { flex-wrap: wrap; }

  /* Stats */
  .stat-item { padding: 0.5rem 1.25rem; }

  /* ADM timeline horizontal scrollable */
  .adm-timeline-inner { min-width: 560px; }

  /* Results breakdown */
  .results-breakdown { grid-template-columns: repeat(3, 1fr); }

  /* Modal */
  .modal { max-width: 100%; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .modal-overlay { align-items: flex-end; padding: 0; }

  /* Back to top */
  .back-to-top { bottom: 1rem; right: 1rem; }

  /* Footer */
  .footer-inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; gap: 0.5rem; text-align: center; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.625rem; }
  h2 { font-size: 1.25rem; }

  .quiz-card  { padding: 1.25rem; }
  .modal-body { padding: 1rem; }
  .modal-header, .modal-footer { padding-left: 1rem; padding-right: 1rem; }
}

/* ── 40. PRINT STYLES ────────────────────────────────────────── */
@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  :root {
    --bg:      #fff;
    --surface: #fff;
    --text:    #000;
    --text2:   #222;
    --border:  #ccc;
  }

  .site-header,
  .sidebar,
  .chapter-nav,
  .back-to-top,
  .header-actions,
  .quiz-actions,
  .modal-overlay,
  .search-overlay,
  .site-footer {
    display: none !important;
  }

  .main-content {
    max-width: 100%;
    padding: 0;
  }

  .layout { display: block; }

  h1, h2, h3 { page-break-after: avoid; color: #000; }
  p, li { orphans: 3; widows: 3; }

  .callout, .exam-tip, blockquote {
    border-left-width: 3px;
    background: #f8f8f8 !important;
    -webkit-print-color-adjust: exact;
  }

  .adm-timeline { overflow: visible; }

  pre {
    white-space: pre-wrap;
    word-break: break-all;
    background: #1a1a2e !important;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #666;
  }

  a[href^="#"]::after { content: ''; }

  .page-break { page-break-before: always; }
}

/* ── 41. FOCUS / ACCESSIBILITY ───────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  font-size: 0.875rem;
  z-index: 999;
  transition: top var(--transition);
}

.skip-link:focus { top: 0; }

/* ── 42. SCROLL AREA (right sidebar / outline) ───────────────── */
.outline-nav {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  width: 200px;
  flex-shrink: 0;
  padding-left: 2rem;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  max-height: calc(100vh - var(--header-h) - 4rem);
  overflow-y: auto;
  font-size: 0.8125rem;
}

.outline-nav-title {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text4);
  margin-bottom: 0.5rem;
}

.outline-nav a {
  color: var(--text3);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: color var(--transition), background var(--transition);
  line-height: 1.45;
}

.outline-nav a:hover { color: var(--text); background: var(--bg2); }
.outline-nav a.active { color: var(--primary); font-weight: 600; }
.outline-nav .l2 { padding-left: 1rem; }
.outline-nav .l3 { padding-left: 1.75rem; font-size: 0.75rem; }

/* Three-column layout with outline */
.layout-three-col {
  display: flex;
  gap: 0;
}

.layout-three-col .main-content { flex: 1; min-width: 0; }

@media (max-width: 1280px) {
  .outline-nav { display: none; }
}

/* ── 43. NOTIFICATION / TOAST ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 340px;
  pointer-events: auto;
  animation: slideUp 0.25s ease;
}

.toast-icon { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success { background: var(--success); color: #fff; }
.toast.warning { background: var(--warning); color: #fff; }
.toast.error   { background: var(--error);   color: #fff; }

/* ── 44. EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text3);
  gap: 0.875rem;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  color: var(--text4);
}

.empty-state h3 { font-size: 1rem; color: var(--text2); margin: 0; }
.empty-state p  { font-size: 0.875rem; max-width: 320px; margin: 0; }

/* ── 45. DIVIDER WITH LABEL ──────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--text4);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── END OF FILE ─────────────────────────────────────────────── */
