/* ─── Google Fonts ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Nunito+Sans:wght@400;600;700&display=swap');

/* ─── Topic page extras – sits on top of host.css ──────────────────────────── */

h1, h2, h3, h4, h5 {
  font-family: 'Outfit', system-ui, sans-serif;
}

body {
  font-family: 'Nunito Sans', system-ui, sans-serif;
}

.topic-header {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 22px;
  margin-bottom: 36px;
}

@media (min-width: 840px) {
  .topic-header { gap: 28px; }
}

.topic-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: #0e1e3d;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.back-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: #93c5fd;
  text-decoration: none;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(37,99,235,0.3);
  background: rgba(37,99,235,0.1);
  transition: background 0.15s, border-color 0.15s;
}

.back-link:hover {
  text-decoration: none;
  background: rgba(37,99,235,0.2);
  border-color: rgba(37,99,235,0.5);
}

/* ─── Hero band ────────────────────────────────────────────────────────────── */
.hero-band {
  margin-bottom: 22px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(30,40,64,0.9);
  background: rgba(6,10,20,0.9);
  box-shadow: 0 18px 40px rgba(0,0,0,0.5);
}

.hero-img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.hero-hook {
  margin: 0;
  padding: 14px 18px 18px;
  font-size: 0.92rem;
  color: #8b96b8;
  line-height: 1.6;
}

/* ─── Topic sections ───────────────────────────────────────────────────────── */
.topic-section {
  margin-bottom: 20px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid rgba(30,40,64,0.9);
  background: linear-gradient(145deg,
    rgba(9,13,26,0.97),
    rgba(14,20,40,0.98));
}

.topic-section h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e8eeff;
}

.topic-section h3 {
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #93c5fd;
}

.topic-section p,
.topic-section li {
  font-size: 0.9rem;
  line-height: 1.7;
  color: #8b96b8;
}

.topic-section strong { color: #c8d0e8; }

.topic-intro {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: #8b96b8;
}

/* ─── Revision media ───────────────────────────────────────────────────────── */
.revision-media {
  display: grid;
  gap: 18px;
}

@media (min-width: 880px) {
  .revision-media { grid-template-columns: 3fr 2fr; }
}

.media-column h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.video-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: 14px;
  overflow: hidden;
}

.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* When a topic page uses the newer embedded-player block inside .video-wrapper,
   cancel the old padding-bottom/height:0 hack so the iframe can render at full size. */
.video-wrapper.video-fallback {
  padding-bottom: 0;
  height: auto;
  overflow: visible;
}

.podcast-player {
  width: 100%;
  margin: 8px 0 10px;
}

/* ─── NotebookLM box ───────────────────────────────────────────────────────── */
.notebooklm-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(37,99,235,0.1);
  border: 1px solid rgba(37,99,235,0.35);
}

.notebooklm-box h3 {
  margin-top: 0;
  color: #93c5fd;
  font-size: 0.92rem;
}

.notebook-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  transition: transform 0.18s ease, filter 0.18s ease, box-shadow 0.18s ease;
}

.notebook-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 8px 24px rgba(37,99,235,0.45);
  text-decoration: none;
}

/* ─── Exam practice ────────────────────────────────────────────────────────── */
.exam-practice .exam-card {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(6,10,20,0.9);
  border: 1px solid rgba(30,40,64,0.9);
}

.exam-card h3 {
  margin-top: 0;
  font-size: 0.95rem;
  color: #e8eeff;
}

.technique {
  font-size: 0.84rem;
  color: #8b96b8;
}

.model-stem, .answer-steps {
  font-size: 0.84rem;
  color: #8b96b8;
  line-height: 1.65;
}

/* ─── Quick check ──────────────────────────────────────────────────────────── */
.quick-check ul {
  padding-left: 18px;
  margin: 6px 0 0;
}

/* ─── Video card (thumbnail fallback) ─────────────────────────────────────── */
.video-fallback { padding-bottom: 0; height: auto; }

.video-card {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(30,40,64,0.9);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  text-decoration: none;
}

.video-thumb {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;
}

.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 16px 18px;
  background: linear-gradient(to top, rgba(0,0,0,0.72), rgba(0,0,0,0.04));
}

.video-play-icon {
  width: 50px;
  height: 50px;
  border-radius: 999px;
  border: 2px solid rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 22px;
  color: #fff;
  background: rgba(37,99,235,0.45);
  flex-shrink: 0;
  transition: transform 0.18s ease, background 0.18s ease;
}

.video-card:hover .video-play-icon {
  transform: scale(1.08);
  background: rgba(37,99,235,0.7);
}

.video-text { display: flex; flex-direction: column; gap: 2px; }
.video-label { font-family: 'Outfit', sans-serif; font-weight: 700; color: #fff; font-size: 0.92rem; }
.video-sub { font-size: 0.78rem; color: #93c5fd; }
.video-note { margin-top: 10px; font-size: 0.78rem; color: #8b96b8; }

.video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(30,40,64,0.9);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
  background: #050b1d;
}

.video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video-note a {
  color: #93c5fd;
  font-weight: 600;
}

.video-note a:hover {
  color: #dbeafe;
}


/* ─── Inline infographic (shared) ─────────────────────────────────────────── */
.infographic-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: stretch;
  margin-top: 1.25rem;
}

.infographic-card {
  flex: 1 1 300px;
  background: #0d1a3a;
  border-radius: 16px;
  padding: 1.5rem 1.75rem;
  color: #e8eeff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
  border: 1px solid rgba(37,99,235,0.2);
}

.infographic-card h3 {
  margin-top: 0;
  margin-bottom: 0.65rem;
  font-size: 1.3rem;
  color: #fff;
}

.infographic-tagline {
  font-size: 0.88rem;
  color: #8b96b8;
  margin-bottom: 0.9rem;
}

.infographic-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.infographic-list li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.55rem;
  line-height: 1.45;
  font-size: 0.88rem;
  color: #c8d0e8;
}

.infographic-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  top: 0;
  color: #60a5fa;
  font-size: 1.2rem;
  line-height: 1;
}

.infographic-pill {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: rgba(37,99,235,0.16);
  border: 1px solid rgba(37,99,235,0.3);
  color: #93c5fd;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.infographic-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.infographic-icon { flex: 0 0 36px; }

/* ─── Exam pill ────────────────────────────────────────────────────────────── */
.exam-pill {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 6px;
  background: rgba(37,99,235,0.14);
  color: #93c5fd;
  border: 1px solid rgba(37,99,235,0.3);
}


/* ─── Topic anchor menu ───────────────────────────────────────────────────── */
.topic-anchor-menu {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.topic-anchor-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(244, 177, 99, 0.45);
  background: rgba(10, 18, 38, 0.96);
  color: #fdf5e6;
  font: 700 0.92rem 'Outfit', system-ui, sans-serif;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.topic-anchor-toggle:hover,
.topic-anchor-toggle:focus-visible {
  background: rgba(17, 27, 54, 0.98);
  outline: none;
}

.topic-anchor-toggle svg {
  width: 18px;
  height: 18px;
  color: #f4b163;
}

.topic-anchor-panel {
  width: min(320px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(244, 177, 99, 0.25);
  background: linear-gradient(180deg, rgba(11, 20, 41, 0.98), rgba(7, 13, 28, 0.98));
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(10px);
}

.topic-anchor-panel[hidden] {
  display: none;
}

.topic-anchor-title {
  margin: 0 0 10px;
  font: 800 0.95rem 'Outfit', system-ui, sans-serif;
  color: #fdf5e6;
}

.topic-anchor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.topic-anchor-link {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: #c9d4f0;
  text-decoration: none;
  font-size: 0.92rem;
  line-height: 1.35;
}

.topic-anchor-link:hover,
.topic-anchor-link:focus-visible,
.topic-anchor-link.is-active {
  background: rgba(37, 99, 235, 0.16);
  border-color: rgba(37, 99, 235, 0.45);
  color: #ffffff;
  outline: none;
}

.topic-anchor-top {
  margin-top: 10px;
  width: 100%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(244, 177, 99, 0.25);
  background: rgba(244, 177, 99, 0.08);
  color: #f4d2a6;
  text-decoration: none;
  font-weight: 700;
}

.topic-anchor-top:hover,
.topic-anchor-top:focus-visible {
  background: rgba(244, 177, 99, 0.14);
  outline: none;
}

.topic-anchor-sentinel {
  position: relative;
  top: -92px;
  display: block;
  height: 0;
  width: 0;
}

@media (max-width: 700px) {
  .topic-anchor-menu {
    right: 12px;
    bottom: 12px;
    left: 12px;
    align-items: stretch;
  }

  .topic-anchor-toggle {
    align-self: flex-end;
    min-height: 46px;
  }

  .topic-anchor-panel {
    width: 100%;
    max-height: 58vh;
    border-radius: 16px;
  }
}
