/* Theme definitions */
:root[data-theme="dark"] {
  --bg: #0b1020;
  --fg: #e8ecf7;
  --muted: #9fb0d0;
  --card: #111934;
  --accent: #7dd3fc;
  --accent2: #a78bfa;
  --ok: #22c55e;
  --warn: #f59e0b;
  --err: #ef4444;
  --link: #93c5fd;
  --shadow: 0 10px 30px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.02);
  --radius: 18px;
  --bg-gradient: radial-gradient(1200px 800px at 20% -10%, #1b2447 0%, #0d142d 40%, #0b1020 100%);
  --header-bg: linear-gradient(180deg, rgba(11,16,32,.9) 0%, rgba(11,16,32,.65) 100%);
}

:root[data-theme="light"] {
  --bg: #f8fafc;
  --fg: #0f172a;
  --muted: #475569;
  --card: #ffffff;
  --accent: #0284c7;
  --accent2: #7c3aed;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --link: #0284c7;
  --shadow: 0 10px 30px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.5);
  --radius: 18px;
  --bg-gradient: radial-gradient(1200px 800px at 20% -10%, #e0e7ff 0%, #f1f5f9 40%, #f8fafc 100%);
  --header-bg: linear-gradient(180deg, rgba(248,250,252,.95) 0%, rgba(248,250,252,.85) 100%);
}

:root[data-theme="ocean"] {
  --bg: #0a192f;
  --fg: #ccd6f6;
  --muted: #8892b0;
  --card: #112240;
  --accent: #64ffda;
  --accent2: #5ccfe6;
  --ok: #10b981;
  --warn: #fbbf24;
  --err: #f87171;
  --link: #64ffda;
  --shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 1px 0 rgba(100,255,218,.05);
  --radius: 18px;
  --bg-gradient: radial-gradient(1200px 800px at 20% -10%, #1a365d 0%, #0f2847 40%, #0a192f 100%);
  --header-bg: linear-gradient(180deg, rgba(10,25,47,.9) 0%, rgba(10,25,47,.65) 100%);
}

:root[data-theme="sunset"] {
  --bg: #1a0f1f;
  --fg: #fde7e9;
  --muted: #d4a5b3;
  --card: #2d1b2e;
  --accent: #ff6b9d;
  --accent2: #ffa45c;
  --ok: #4ade80;
  --warn: #fb923c;
  --err: #f43f5e;
  --link: #ff6b9d;
  --shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,107,157,.05);
  --radius: 18px;
  --bg-gradient: radial-gradient(1200px 800px at 20% -10%, #4a1942 0%, #2d1533 40%, #1a0f1f 100%);
  --header-bg: linear-gradient(180deg, rgba(26,15,31,.9) 0%, rgba(26,15,31,.65) 100%);
}

:root[data-theme="forest"] {
  --bg: #0f1e13;
  --fg: #e6f4ea;
  --muted: #a8c7ae;
  --card: #1a2e20;
  --accent: #52c788;
  --accent2: #8fd8a8;
  --ok: #34d399;
  --warn: #fbbf24;
  --err: #f87171;
  --link: #52c788;
  --shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 1px 0 rgba(82,199,136,.05);
  --radius: 18px;
  --bg-gradient: radial-gradient(1200px 800px at 20% -10%, #1e4d2b 0%, #143d1d 40%, #0f1e13 100%);
  --header-bg: linear-gradient(180deg, rgba(15,30,19,.9) 0%, rgba(15,30,19,.65) 100%);
}

:root[data-theme="amber"] {
  --bg: #1c1410;
  --fg: #fef3c7;
  --muted: #d4b896;
  --card: #2d2318;
  --accent: #fbbf24;
  --accent2: #fb923c;
  --ok: #84cc16;
  --warn: #f59e0b;
  --err: #ef4444;
  --link: #fcd34d;
  --shadow: 0 10px 30px rgba(0,0,0,.4), inset 0 1px 0 rgba(251,191,36,.05);
  --radius: 18px;
  --bg-gradient: radial-gradient(1200px 800px at 20% -10%, #4a3620 0%, #2d2115 40%, #1c1410 100%);
  --header-bg: linear-gradient(180deg, rgba(28,20,16,.9) 0%, rgba(28,20,16,.65) 100%);
}

* {
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-gradient);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

header {
  position: sticky;
  top: 0;
  z-index: 50;
  -webkit-backdrop-filter: saturate(160%) blur(8px);
  backdrop-filter: saturate(160%) blur(8px);
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255,255,255,.05);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

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

.logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: conic-gradient(from 210deg, var(--accent), var(--accent2), var(--accent));
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: logoGradient 8s ease infinite;
  background-size: 200% 200%;
}

.logo:before {
  content: "⌛";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.3));
}

@keyframes logoGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

h1 {
  font-size: 24px;
  margin: 0;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 22px;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

h3 {
  font-size: 18px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.theme-switcher {
  display: flex;
  gap: 4px;
  align-items: center;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 4px;
}

.theme-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(255,255,255,.05);
  transition: all 0.2s ease;
  position: relative;
}

.theme-btn:hover {
  transform: scale(1.1);
  background: rgba(255,255,255,.1);
}

.theme-btn.active {
  border-color: var(--accent);
  background: rgba(255,255,255,.15);
  box-shadow: 0 0 12px var(--accent);
}

button {
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.02));
  color: var(--fg);
  border: 1px solid rgba(255,255,255,.1);
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
  font-family: inherit;
  font-size: 14px;
}

button:hover {
  transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,.04));
}

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 20px;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 40px rgba(0,0,0,.4);
}

.card-head {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-head:hover {
  background: rgba(255,255,255,.02);
}

.card-body {
  padding: 20px 24px;
  line-height: 1.8;
}

.hero {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, rgba(125,211,252,.1), rgba(167,139,250,.1));
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius);
  margin: 20px 0 40px;
}

.hero h1 {
  font-size: 42px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 18px;
  color: var(--muted);
  max-width: 800px;
  margin: 0 auto;
}

.timeline-event {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
  animation: fadeInUp 0.3s ease backwards;
}

.timeline-event:last-child {
  border-bottom: none;
}

.year-badge {
  font-weight: 700;
  color: #0b1020;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  padding: 8px 10px;
  border-radius: 10px;
  text-align: center;
  font-size: 13px;
  height: fit-content;
}

.event-content strong {
  color: var(--accent);
}

.toc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 30px 0;
}

.toc-btn {
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
}

.fact-grid {
  display: grid;
  gap: 16px;
}

.fact-item {
  padding: 16px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
  transition: all 0.2s ease;
}

.fact-item:hover {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.12);
  transform: translateX(4px);
}

.fact-item strong {
  color: var(--accent);
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
}

.collapse-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.collapse-content.open {
  max-height: 5000px;
}

.toggle-icon {
  font-size: 20px;
  transition: transform 0.3s ease;
}

.toggle-icon.open {
  transform: rotate(180deg);
}

.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.2s ease;
  z-index: 100;
}

.scroll-top.visible {
  opacity: 1;
  pointer-events: all;
}

.scroll-top:hover {
  transform: translateY(-4px);
}

/* Breadcrumb Navigation */
nav[aria-label="Breadcrumb"] {
  font-size: 14px;
}

nav[aria-label="Breadcrumb"] ol {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 8px;
  align-items: center;
}

nav[aria-label="Breadcrumb"] a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease;
}

nav[aria-label="Breadcrumb"] a:hover {
  color: var(--accent);
  text-decoration: underline;
}

footer {
  margin: 60px 0 40px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  padding-top: 40px;
  border-top: 1px solid rgba(255,255,255,.06);
}

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

/* Share buttons */
.share-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  justify-content: center;
}

.share-btn {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: var(--fg);
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  font-weight: 500;
  min-height: 44px; /* Touch-friendly */
}

.share-btn:hover {
  transform: translateY(-2px);
  background: rgba(255,255,255,.12);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
}

.share-btn:active {
  transform: translateY(0);
}

.share-btn.twitter { border-color: rgba(29,161,242,.3); }
.share-btn.twitter:hover { background: rgba(29,161,242,.15); }
.share-btn.reddit { border-color: rgba(255,69,0,.3); }
.share-btn.reddit:hover { background: rgba(255,69,0,.15); }
.share-btn.facebook { border-color: rgba(24,119,242,.3); }
.share-btn.facebook:hover { background: rgba(24,119,242,.15); }
.share-btn.copy { border-color: rgba(125,211,252,.3); }
.share-btn.copy:hover { background: rgba(125,211,252,.15); }
.share-btn.native { border-color: var(--accent); background: linear-gradient(135deg, rgba(125,211,252,.15), rgba(167,139,250,.15)); }
.share-btn.native:hover { background: linear-gradient(135deg, rgba(125,211,252,.25), rgba(167,139,250,.25)); }

/* Floating share bar for mobile */
.floating-share {
  position: fixed;
  bottom: 80px;
  right: 16px;
  z-index: 90;
  display: none;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  transform: translateX(60px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.floating-share.visible {
  opacity: 1;
  transform: translateX(0);
}

.floating-share .share-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

.floating-share .share-btn span {
  display: none;
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--card);
  color: var(--fg);
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
  z-index: 1000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border: 1px solid rgba(255,255,255,.1);
}

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

.toast.success {
  border-color: var(--ok);
  background: linear-gradient(135deg, rgba(34,197,94,.15), var(--card));
}

/* Reduced Motion Support (Accessibility) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* RESPONSIVE DESIGN - Tablet (768px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .wrap {
    padding: 20px;
  }
  
  .hero {
    padding: 50px 24px;
  }
  
  .hero h1 {
    font-size: 36px;
  }
  
  .toc {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .timeline-event {
    grid-template-columns: 110px 1fr;
  }
  
  .fact-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .card-body {
    padding: 24px;
  }
  
  .theme-switcher {
    gap: 2px;
    padding: 3px;
  }
  
  .theme-btn {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }
}

/* RESPONSIVE DESIGN - Mobile (max 640px) */
@media (max-width: 640px) {
  .wrap {
    padding: 12px;
  }
  
  .hero {
    padding: 40px 16px;
    margin: 12px 0 24px;
  }
  
  .hero h1 {
    font-size: 28px;
    line-height: 1.2;
  }
  
  .hero p {
    font-size: 15px;
    line-height: 1.6;
  }
  
  .timeline-event {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .year-badge {
    width: fit-content;
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .toc {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .toc-btn {
    padding: 14px 16px;
    font-size: 14px;
    min-height: 48px;
  }
  
  /* Mobile header improvements */
  header .row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  header .brand {
    justify-content: center;
    text-align: center;
  }
  
  header h1 {
    font-size: 18px;
    line-height: 1.3;
  }
  
  header button[aria-label="Return to main timeline"] {
    display: none; /* Use breadcrumb instead on mobile */
  }
  
  .theme-switcher {
    justify-content: center;
    margin: 0 auto;
  }
  
  .theme-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  /* Card improvements */
  .card {
    border-radius: 12px;
    margin-bottom: 16px;
  }
  
  .card-head {
    padding: 16px;
  }
  
  .card-body {
    padding: 16px;
  }
  
  .act-badge {
    font-size: 10px;
    padding: 4px 8px;
    margin-right: 8px;
  }
  
  /* Fact items */
  .fact-item {
    padding: 14px;
  }
  
  .fact-grid {
    gap: 12px;
  }
  
  /* Deep dive & curiosity hooks - touch friendly */
  .curiosity-hook {
    font-size: 13px;
    padding: 10px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  
  .deep-dive {
    font-size: 13px;
    padding: 12px 14px;
  }
  
  .deep-dive.open {
    padding-top: 14px;
    padding-bottom: 14px;
  }
  
  .why-matters {
    padding: 14px 16px;
    font-size: 13px;
  }
  
  /* Engagement prompt */
  .engagement-prompt {
    padding: 16px;
  }
  
  .engagement-prompt h4 {
    font-size: 16px;
  }
  
  .engagement-prompt p {
    font-size: 13px;
  }
  
  /* Share buttons mobile */
  .share-buttons {
    flex-direction: column;
    gap: 10px;
  }
  
  .share-btn {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
  }
  
  /* Show floating share on mobile */
  .floating-share {
    display: flex;
  }
  
  /* Scroll top button adjustment */
  .scroll-top {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  
  /* Footer mobile */
  footer {
    margin: 40px 0 24px;
    padding-top: 24px;
    font-size: 12px;
  }
  
  /* Progress bar thicker on mobile for visibility */
  .progress-bar {
    height: 4px;
  }
  
  /* Section intro mobile */
  .section-intro {
    padding: 12px 14px;
    font-size: 14px;
  }
  
  /* Breadcrumb mobile */
  nav[aria-label="Breadcrumb"] {
    font-size: 13px;
    padding: 10px 0;
  }
  
  /* Curiosity badge smaller */
  .curiosity-badge {
    font-size: 9px;
    padding: 3px 6px;
  }
}

/* Small mobile (max 375px) */
@media (max-width: 375px) {
  .hero h1 {
    font-size: 24px;
  }
  
  .hero p {
    font-size: 14px;
  }
  
  header h1 {
    font-size: 16px;
  }
  
  .theme-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  
  .toc-btn {
    font-size: 13px;
    padding: 12px 14px;
  }
}

/* Print styles for educational use */
@media print {
  * {
    background: white !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  header, .theme-switcher, .scroll-top, .floating-share, 
  .progress-bar, .share-buttons, .curiosity-hook, footer a {
    display: none !important;
  }
  
  .collapse-content {
    max-height: none !important;
    overflow: visible !important;
  }
  
  .deep-dive {
    max-height: none !important;
    opacity: 1 !important;
    padding: 12px !important;
    border: 1px solid #ccc !important;
    margin: 12px 0 !important;
  }
  
  .card {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
    margin-bottom: 20px !important;
  }
  
  .hero {
    border: 2px solid #333 !important;
    padding: 30px !important;
  }
  
  a {
    text-decoration: underline;
  }
  
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 10px;
  }
  
  .year-badge {
    background: #f0f0f0 !important;
    border: 1px solid #333 !important;
  }
  
  .fact-item {
    border: 1px solid #ddd !important;
    margin-bottom: 12px !important;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  footer {
    border-top: 1px solid #ccc !important;
    padding-top: 20px !important;
  }
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

.act-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-right: 12px;
}

.section-intro {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(255,255,255,.02);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
}

ul, ol {
  margin: 16px 0;
  padding-left: 24px;
  line-height: 1.8;
}

ul li, ol li {
  margin: 8px 0;
}

h4 {
  font-size: 16px;
  margin: 24px 0 12px;
  color: var(--accent);
  font-weight: 600;
}

/* Curiosity & Engagement Enhancements */
.curiosity-hook {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  margin: 16px 0;
  background: linear-gradient(135deg, rgba(125,211,252,.15), rgba(167,139,250,.15));
  border: 1px solid rgba(125,211,252,.3);
  border-radius: 10px;
  font-size: 14px;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.curiosity-hook:hover {
  background: linear-gradient(135deg, rgba(125,211,252,.25), rgba(167,139,250,.25));
  border-color: var(--accent);
  transform: translateX(4px);
}

.curiosity-hook::before {
  content: "💡";
  font-size: 18px;
}

.why-matters {
  margin: 20px 0;
  padding: 16px 20px;
  background: rgba(34,197,94,.1);
  border-left: 4px solid var(--ok);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.7;
}

.why-matters strong {
  color: var(--ok);
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.connection-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent2);
  border-radius: 50%;
  margin: 0 6px;
  vertical-align: middle;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

.timeline-event {
  position: relative;
}

.timeline-event:hover .event-content {
  color: var(--fg);
}

.event-content {
  position: relative;
}

.deep-dive {
  margin-top: 12px;
  padding: 0 16px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
  transition: all 0.4s ease;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.deep-dive.open {
  max-height: 800px;
  opacity: 1;
  margin-top: 12px;
  padding-top: 12px;
  padding-bottom: 12px;
}

.deep-dive-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  font-size: 12px;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s ease;
}

.deep-dive-toggle:hover {
  background: rgba(255,255,255,.1);
  border-color: var(--accent);
}

.deep-dive-toggle::before {
  content: "🔍";
  font-size: 14px;
}

.deep-dive-toggle.open::before {
  content: "🔍";
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  z-index: 1000;
  transition: width 0.1s ease;
  box-shadow: 0 2px 8px rgba(125,211,252,.5);
}

.curiosity-badge {
  display: inline-block;
  padding: 4px 8px;
  margin-left: 8px;
  background: var(--accent2);
  color: var(--bg);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
  animation: glow 2s ease infinite;
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 5px var(--accent2); }
  50% { box-shadow: 0 0 15px var(--accent2); }
}

.tooltip-trigger {
  position: relative;
  display: inline-block;
  cursor: help;
  border-bottom: 1px dotted var(--accent);
  color: var(--accent);
}

.tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 8px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  max-width: 250px;
  white-space: normal;
}

.tooltip-trigger:hover .tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
  pointer-events: all;
}

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

.engagement-prompt {
  margin: 24px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(125,211,252,.1), rgba(167,139,250,.1));
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
}

.engagement-prompt h4 {
  margin: 0 0 12px;
  font-size: 18px;
}

.engagement-prompt p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .curiosity-hook {
    font-size: 13px;
    padding: 6px 10px;
  }
  
  .deep-dive {
    font-size: 12px;
    padding: 10px 12px;
  }
  
  .tooltip {
    max-width: 200px;
    font-size: 11px;
  }
}

/* Global Navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 8px 16px;
  z-index: 1000;
  font-weight: 600;
  border-radius: 0 0 8px 0;
  transition: top 0.2s ease;
}

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

.global-nav {
  background: rgba(0,0,0,.3);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding: 0;
  position: relative;
  z-index: 51;
}

.global-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.nav-links a:hover {
  color: var(--fg);
  background: rgba(255,255,255,.03);
}

.nav-links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--fg);
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }
  
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--card);
    border-bottom: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 10px 30px rgba(0,0,0,.3);
  }
  
  .nav-links.open {
    display: flex;
  }
  
  .nav-links a {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,.05);
  }
  
  .nav-links a.active {
    border-bottom: 1px solid rgba(255,255,255,.05);
    border-left: 3px solid var(--accent);
  }
  
  .global-nav-inner {
    position: relative;
  }
}

/* --- Era deep-dive additions (scripts/build-deep-dives.js) --- */
header .header-back { margin-left: auto; color: var(--fg); text-decoration: none; padding: 8px 12px; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; font-size: 14px; white-space: nowrap; }
.crumbs { margin: 20px 0; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.crumbs ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; gap: 8px; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--link); text-decoration: none; }
.method-note { font-size: 14px; color: var(--muted); }
.fact-source { margin-top: 6px; font-size: 12px; color: var(--muted); }
.fact-source a { color: var(--link); }
.era-nav { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 0 0 20px; }
.era-nav a, .related-list a, .next-step a { color: var(--link); }
.related-list { margin: 0; padding-left: 20px; line-height: 1.9; }
.next-step { margin: 24px 0; padding: 20px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: var(--card); }
.next-step h2 { margin: 0 0 8px; font-size: 18px; }
.next-step ol { margin: 0; padding-left: 20px; line-height: 1.9; }
.quiz-score { font-weight: 600; }
.quiz-q { border: 1px solid rgba(255,255,255,.1); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; min-width: 0; }
.quiz-q legend { font-weight: 600; padding: 0 6px; }
.quiz-option { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.15); background: transparent; color: var(--fg); font: inherit; cursor: pointer; overflow-wrap: anywhere; }
.quiz-option:hover:not(:disabled) { border-color: var(--accent); }
.quiz-option.is-correct { border-color: var(--ok); background: rgba(34,197,94,.12); }
.quiz-option.is-wrong { border-color: var(--err); background: rgba(239,68,68,.12); }
.quiz-feedback { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
:root[data-theme="light"] .quiz-q, :root[data-theme="light"] .quiz-option, :root[data-theme="light"] .next-step { border-color: rgba(0,0,0,.15); }
.lean-mode .theme-switcher { display: none !important; }
