/* ============================================
   EXTENSIONS — v2 (videos, glossary, timeline, map, see-also)
   ============================================ */

/* Hero image for rich lessons */
.lesson-hero-img {
  width: 100%;
  aspect-ratio: 16 / 7;
  object-fit: cover;
  margin: 24px 0 0;
  border: 1px solid var(--rule);
  filter: saturate(0.9);
}

/* Lesson callout */
.lesson-callout {
  margin: 32px 0;
  padding: 20px 24px;
  background: var(--paper-2);
  border-left: 3px solid var(--moss);
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink);
}

/* Video gallery */
.lesson-videos { margin: 48px 0 32px; }
.lesson-videos-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.video-card {
  margin-bottom: 28px;
}
.video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--ink);
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--rule);
}
.video-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.video-thumb:hover img { transform: scale(1.03); }
.video-thumb iframe { width: 100%; height: 100%; border: 0; }
.video-play {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(to top, rgba(0,0,0,0.5), rgba(0,0,0,0.1));
  color: var(--paper);
  pointer-events: none;
}
.video-play-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--amber);
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  transition: transform 0.2s;
}
.video-thumb:hover .video-play-btn { transform: scale(1.08); }
.video-play-btn::before {
  content: '';
  border-left: 18px solid var(--paper);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  margin-left: 4px;
}
.video-meta {
  display: flex;
  gap: 14px;
  padding: 14px 0 0;
  align-items: flex-start;
}
.video-meta-text { flex: 1; }
.video-title { font-family: var(--serif); font-size: 21px; line-height: 1.2; margin-bottom: 4px; }
.video-channel { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0.12em; text-transform: uppercase; }
.video-why { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin-top: 8px; font-style: italic; }

/* See also */
.see-also {
  margin: 48px 0 32px;
  padding: 28px 32px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
}
.see-also-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
}
.see-also-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}
.see-also-item {
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: all 0.15s;
}
.see-also-item:hover { border-color: var(--ink); background: var(--paper-3); }
.see-also-sub {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.see-also-name { font-family: var(--serif); font-size: 18px; line-height: 1.15; }

/* Further reading */
.further-reading { margin: 40px 0; }
.further-reading-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.book-row {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-soft);
  align-items: center;
}
.book-row:last-child { border-bottom: none; }
.book-spine {
  width: 6px;
  height: 56px;
  background: var(--amber);
  flex-shrink: 0;
}
.book-info { flex: 1; }
.book-title { font-family: var(--serif); font-size: 19px; line-height: 1.2; }
.book-author { font-size: 13px; color: var(--ink-3); margin-top: 3px; }
.book-note { font-size: 12px; color: var(--ink-3); font-style: italic; margin-top: 4px; }

/* Key terms strip */
.key-terms { margin: 40px 0 32px; }
.key-terms-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.key-terms-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.key-term-chip {
  padding: 6px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.key-term-chip:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ============================================
   GLOSSARY PAGE
   ============================================ */
.glossary-page { max-width: 1100px; margin: 0 auto; padding: var(--edge); }
.glossary-head {
  padding: 32px 0 40px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 32px;
}
.glossary-head h1 { font-size: clamp(56px, 8vw, 96px); line-height: 0.95; letter-spacing: -0.035em; }
.glossary-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  margin: 24px 0;
  max-width: 480px;
}
.glossary-search input { flex: 1; font-family: var(--serif); font-size: 22px; }
.glossary-alpha {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 40px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.glossary-letter {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink-3);
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.15s;
}
.glossary-letter.has { color: var(--ink); font-weight: 500; }
.glossary-letter.has:hover { background: var(--ink); color: var(--paper); }
.glossary-letter.empty { opacity: 0.3; pointer-events: none; }
.glossary-section { margin-bottom: 40px; }
.glossary-section-letter {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 0.8;
  color: var(--amber);
  margin-bottom: 20px;
}
.glossary-entry {
  padding: 18px 0;
  border-bottom: 1px solid var(--rule-soft);
  display: grid;
  grid-template-columns: 240px 1fr auto;
  gap: 24px;
  align-items: baseline;
  cursor: pointer;
  transition: all 0.15s;
}
.glossary-entry:hover { padding-left: 12px; border-color: var(--ink); }
.glossary-entry-term { font-family: var(--serif); font-size: 22px; }
.glossary-entry-def { font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.glossary-entry-from { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0.12em; text-transform: uppercase; }

/* ============================================
   TIMELINE PAGE
   ============================================ */
.timeline-page { max-width: 1400px; margin: 0 auto; padding: var(--edge); }
.timeline-head { padding: 32px 0 40px; border-bottom: 1px solid var(--rule); margin-bottom: 48px; }
.timeline-head h1 { font-size: clamp(56px, 8vw, 96px); line-height: 0.95; letter-spacing: -0.035em; }
.timeline-filter {
  display: flex;
  gap: 8px;
  margin: 24px 0;
  flex-wrap: wrap;
}
.timeline-filter-chip {
  padding: 8px 14px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-size: 12px;
  cursor: pointer;
  border-radius: 999px;
  transition: all 0.15s;
}
.timeline-filter-chip:hover { border-color: var(--ink-3); }
.timeline-filter-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.timeline-scale {
  position: relative;
  height: 40px;
  border-bottom: 1px solid var(--ink);
  margin: 40px 0;
}
.timeline-scale-tick {
  position: absolute;
  top: 20px;
  width: 1px;
  height: 20px;
  background: var(--ink);
}
.timeline-scale-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
}
.timeline-rows { position: relative; }
.timeline-row {
  position: relative;
  height: 80px;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  align-items: center;
}
.timeline-row-label {
  width: 140px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  flex-shrink: 0;
  padding-right: 16px;
}
.timeline-track { flex: 1; position: relative; height: 100%; }
.timeline-event {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 5px 10px;
  background: var(--paper);
  border: 1px solid var(--ink);
  font-size: 11px;
  line-height: 1.2;
  max-width: 180px;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 1;
}
.timeline-event:hover { background: var(--ink); color: var(--paper); z-index: 2; transform: translate(-50%, -50%) scale(1.05); }
.timeline-event-date { font-family: var(--mono); font-size: 9px; color: var(--ink-3); letter-spacing: 0.1em; }
.timeline-event:hover .timeline-event-date { color: var(--amber-soft); }

/* ============================================
   MAP PAGE
   ============================================ */
.map-page { max-width: 1600px; margin: 0 auto; padding: var(--edge); }
.map-head { padding: 32px 0 32px; border-bottom: 1px solid var(--rule); margin-bottom: 32px; }
.map-head h1 { font-size: clamp(56px, 8vw, 96px); line-height: 0.95; letter-spacing: -0.035em; }
.map-frame {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.map-frame svg { display: block; width: 100%; height: auto; }
.map-pin {
  cursor: pointer;
  transition: all 0.2s;
}
.map-pin circle { transition: all 0.2s; }
.map-pin:hover circle { fill: var(--amber); r: 10; }
.map-pin-tooltip {
  position: absolute;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 12px;
  border-radius: 4px;
  pointer-events: none;
  z-index: 5;
  max-width: 240px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.map-pin-tooltip strong { font-family: var(--serif); font-size: 15px; display: block; margin-bottom: 4px; color: var(--amber-soft); }

/* ============================================
   DAILY PAGE
   ============================================ */
.daily-page { max-width: 900px; margin: 0 auto; padding: var(--edge); }
.daily-dateline {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-bottom: 20px;
  margin: 20px 0 32px;
  border-bottom: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
}
.daily-masthead {
  font-family: var(--serif);
  font-size: clamp(72px, 10vw, 128px);
  line-height: 0.85;
  letter-spacing: -0.04em;
  text-align: center;
  padding: 20px 0 40px;
  border-bottom: 1px solid var(--rule);
}
.daily-masthead em { color: var(--amber); font-style: italic; }

.daily-section-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 40px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

/* Tutor — depth selector and modes */
.tutor-modes {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  align-items: center;
  font-size: 11px;
}
.tutor-modes-lbl {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-right: 4px;
}
.tutor-mode-chip {
  padding: 4px 10px;
  border: 1px solid var(--rule);
  background: var(--paper);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-3);
  transition: all 0.15s;
}
.tutor-mode-chip:hover { color: var(--ink); border-color: var(--ink-3); }
.tutor-mode-chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Random spinner */
.random-page { max-width: 900px; margin: 0 auto; padding: var(--edge); text-align: center; }
.random-wheel {
  font-family: var(--serif);
  font-size: clamp(56px, 8vw, 110px);
  line-height: 0.9;
  letter-spacing: -0.03em;
  margin: 48px 0;
  min-height: 200px;
  display: grid;
  place-items: center;
}
.random-wheel em { color: var(--amber); font-style: italic; }
.random-wheel.spinning { filter: blur(4px); }

/* Nav additions */
.nav-side {
  display: flex;
  gap: 2px;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 3px;
  margin-right: 8px;
}
.nav-side button {
  padding: 6px 12px;
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 999px;
  color: var(--ink-3);
}
.nav-side button:hover { color: var(--ink); }
.nav-side button.active { background: var(--ink); color: var(--paper); }

/* Study plan cards */
.study-plan {
  margin: 16px 0;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--amber);
}
.study-plan-title {
  font-family: var(--serif);
  font-size: 18px;
  margin-bottom: 12px;
}
.study-plan-day {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
  align-items: baseline;
}
.study-plan-day:last-child { border-bottom: none; }
.study-plan-day-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.15em;
  width: 60px;
  flex-shrink: 0;
}

/* ============================================
   Atlas Pull — cross-field wonder connections
   ============================================ */
.sg-pull {
  margin-top: 56px;
  padding-top: 40px;
  border-top: 1px solid var(--rule-soft);
}
.sg-pull-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.sg-pull > p.sg-pull-sub {
  font-size: 15px;
  color: var(--ink-2);
  margin: 0 0 24px;
  line-height: 1.6;
  max-width: 560px;
}
.sg-pull-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.sg-pull-card {
  padding: 18px 20px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}
.sg-pull-card:hover {
  background: var(--paper-2);
  transform: translateY(-2px);
}
.sg-pull-subject {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.sg-pull-name {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.2;
  margin-bottom: 6px;
}
.sg-pull-dek {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================
   Age Mode Toggle — Explorer / Scholar
   ============================================ */
.age-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1px solid var(--rule-soft);
  border-radius: 999px;
  background: transparent;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.age-toggle:hover {
  background: var(--paper-2);
  color: var(--ink);
}
.age-toggle--explorer {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-wash, rgba(224,154,90,0.08));
}
.age-toggle-icon { font-size: 13px; }
.age-toggle-label { }

/* Explorer mode overrides — larger, friendlier, more colorful */
body.age-explorer {
  --base-size: 17px;
}
body.age-explorer .lesson-body p,
body.age-explorer .lesson-body li {
  font-size: 17px;
  line-height: 1.75;
}
body.age-explorer .sg-pull-card {
  border-radius: 8px;
  border-width: 2px;
}
body.age-explorer .subject-card {
  border-radius: 12px;
}
body.age-explorer .interactive {
  border-radius: 12px;
  border: 2px solid var(--amber);
}
body.age-explorer .key-term-chip {
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 999px;
}
@media (max-width: 768px) {
  .age-toggle-label { display: none; }
}

/* ============================================
   Wonder Hook — Explorer-mode curiosity spark
   ============================================ */
.wonder-hook {
  display: none; /* hidden in Scholar mode */
  align-items: flex-start;
  gap: 14px;
  margin: 0 0 32px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(224,154,90,0.10) 0%, rgba(224,154,90,0.04) 100%);
  border: 1px solid rgba(224,154,90,0.35);
  border-left: 4px solid var(--amber);
  border-radius: 4px;
}
body.age-explorer .wonder-hook { display: flex; }
.wonder-hook-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}
.wonder-hook-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
}

/* ============================================
   Wikipedia Source Footer
   ============================================ */
.wiki-source {
  margin: 40px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--rule-soft);
}
.wiki-source-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.wiki-source-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wiki-source-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  flex-shrink: 0;
}
.wiki-source-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}
.wiki-source-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.wiki-source-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
}
.wiki-source-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--lapis, #2980b9);
  text-decoration: none;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.wiki-source-link:hover { text-decoration: underline; }

/* Truth confidence badge */
.truth-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.truth-badge--high   { color: #27ae60; }
.truth-badge--medium { color: var(--amber); }
.truth-badge--low    { color: var(--wine, #8e1a1a); }
.truth-badge--unverified { color: var(--ink-3); }

/* Scholar note — advanced nuance */
.scholar-note {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--paper-2);
  border-left: 2px solid var(--lapis, #2980b9);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  font-style: italic;
}
.study-plan-day-what { flex: 1; }
