/* assets/css/topic.css
   Dedicated stylesheet for topic content pages (t/index.php).
   Loaded only on topic pages — never on the homepage or other page types.
   Extracted from style.css + redesigned for the new topic-page template.
   Relies on CSS variables defined in style.css (:root), which loads first.
*/

/* ── Hero (compact) ──────────────────────────────────────────────────────── */
.page-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 0.7rem 1rem 0.65rem;
  margin-bottom: 0;
  border-bottom: 3px solid rgba(255,255,255,0.1);
}
.page-hero h1 {
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0;
  line-height: 1.15;
}
.page-hero .lead { font-size: 0.95rem; opacity: 0.85; max-width: 680px; }
.page-hero .badge-row { margin-bottom: 0.5rem; }

/* ── Metadata bar ─────────────────────────────────────────────────────────
   Reading time / topic type / MLA relevance, sits directly under the title.
*/
.topic-meta-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.topic-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 9999px;
  padding: 0.26rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  white-space: nowrap;
}
.topic-meta-pill .tmp-icon { font-size: 0.85rem; line-height: 1; }
.topic-meta-pill.tmp-mla-high {
  background: rgba(253, 230, 138, 0.22);
  border-color: rgba(253, 230, 138, 0.55);
  color: #fef3c7;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.topic-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  min-height: calc(100vh - 280px);
  max-width: 1200px;
  margin: 0 auto;
  gap: 0;
}
.topic-sidebar {
  background: var(--bg);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: calc(100vh - 68px);
  overflow-y: auto;
}
.topic-sidebar-inner { padding: 1.1rem 0; }
.topic-sidebar-header { padding: 0 0.85rem 0.85rem; border-bottom: 1px solid var(--border); margin-bottom: 0.5rem; }
.topic-sidebar-back { font-size: 0.76rem; color: var(--primary); font-weight: 600; }
.topic-sidebar-back:hover { text-decoration: none; color: var(--primary-dark); }
.topic-sidebar-list { padding: 0; }
.topic-sidebar-list li { padding: 0; }
.topic-sidebar-link {
  display: block;
  padding: 0.5rem 0.85rem 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text);
  border-left: 3px solid transparent;
  line-height: 1.3;
  transition: background 0.15s, border-color 0.15s;
}
.topic-sidebar-link:hover { background: var(--primary-light); text-decoration: none; color: var(--primary); }
.topic-sidebar-link.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 600; }

.topic-main {
  padding: 2rem 2.5rem 3rem;
  background: var(--bg-white);
  /* Optimal reading width for body content (~850-900px), independent of
     the 70ch unit used elsewhere on the platform. Scoped locally so it
     only affects topic pages. */
  --content-width: 880px;
}

/* Constrain prose line length for readability while letting cards/grids go full width */
.topic-content { max-width: var(--content-width); }
.topic-content .key-facts-grid,
.topic-content .callout,
.topic-content .topic-linked-cards,
.topic-content .related-topics-grid { max-width: none; }

/* ── Typography ───────────────────────────────────────────────────────────── */
.topic-section { margin-bottom: 2.75rem; }
.topic-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.01em;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
  margin-bottom: 1.2rem;
  line-height: 1.3;
}
.topic-section h3 {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  margin: 1.6rem 0 0.7rem;
  line-height: 1.35;
}
.topic-section h4 {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 1.3rem 0 0.55rem;
  line-height: 1.4;
}
.topic-section > *:first-child { margin-top: 0; }
.topic-summary {
  font-size: 1.08rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  line-height: 1.8;
  max-width: var(--content-width);
}

/* Content blocks: break long paragraphs into readable chunks with breathing room */
.prose { line-height: 1.85; max-width: var(--content-width); }
.prose h2 { font-size: 1.3rem; font-weight: 800; color: var(--primary); border-bottom: 2px solid var(--primary-light); padding-bottom: 0.5rem; margin: 2rem 0 1rem; line-height: 1.3; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.12rem; font-weight: 700; color: var(--text); margin: 1.6rem 0 0.7rem; line-height: 1.35; }
.prose h4 { font-size: 0.96rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 1.3rem 0 0.55rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.2rem; line-height: 1.85; }
.prose li { margin-bottom: 0.45rem; }
.prose li:last-child { margin-bottom: 0; }
.prose li > ul, .prose li > ol { margin-top: 0.45rem; margin-bottom: 0; }
.prose p { margin-bottom: 1.2rem; }
.prose p:last-child { margin-bottom: 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.92rem; }
.prose table th, .prose table td { padding: 0.65rem 0.85rem; border: 1px solid var(--border); text-align: left; line-height: 1.5; }
.prose table th { background: var(--bg); font-weight: 700; }
.prose blockquote { border-left: 3px solid var(--primary-light); padding: 0.2rem 0 0.2rem 1.1rem; margin: 1.3rem 0; color: var(--text-muted); font-style: italic; }

.md-content h2 { font-size: 1.3rem; font-weight: 800; color: var(--primary); border-bottom: 2px solid var(--primary-light); padding-bottom: 0.5rem; margin: 2rem 0 1rem; line-height: 1.3; }
.md-content h2:first-child { margin-top: 0; }
.md-content h3 { font-size: 1.12rem; font-weight: 700; margin: 1.6rem 0 0.7rem; line-height: 1.35; }
.md-content h4 { font-size: 0.96rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 1.3rem 0 0.55rem; }
.md-content p { margin-bottom: 1.2rem; line-height: 1.85; max-width: var(--content-width); }
.md-content ul, .md-content ol { padding-left: 1.4rem; margin-bottom: 1.2rem; line-height: 1.85; max-width: var(--content-width); }
.md-content li { margin-bottom: 0.45rem; }
.md-content li:last-child { margin-bottom: 0; }
.md-content strong { font-weight: 700; }
.md-content em { font-style: italic; }
.md-content code { background: var(--bg); border: 1px solid var(--border); border-radius: 3px; padding: 0.1rem 0.35rem; font-size: 0.85em; font-family: monospace; }
.md-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.md-content table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.92rem; max-width: none; }
.md-content table th, .md-content table td { padding: 0.65rem 0.85rem; border: 1px solid var(--border); text-align: left; line-height: 1.5; }
.md-content table th { background: var(--bg); font-weight: 700; }

/* ── Visual separation between major content sections ────────────────────── */
.topic-content > section + section,
.topic-content > .topic-section + .topic-section {
  border-top: 1px solid var(--border);
  padding-top: 2.25rem;
}

/* ── Key Facts: responsive card grid (replaces plain bullet list) ──────────── */
.key-facts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
  margin: 0 0 1rem;
}
.key-fact-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}
.key-fact-card strong { color: var(--primary-dark); }

/* ── MLA High-Yield: promoted section, near top ─────────────────────────────
   Visually distinct from generic callouts — this is the page's anchor section.
*/
.mla-notes-block {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 1px solid #f59e0b;
  border-radius: 12px;
  padding: 1.5rem 1.6rem;
  margin-bottom: 2rem;
  box-shadow: 0 2px 10px rgba(217, 119, 6, 0.1);
}
.mla-notes-block h3 {
  color: #92400e;
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.mla-notes-block .prose,
.mla-notes-block p,
.mla-notes-block ul { font-size: 0.9rem; color: #78350f; max-width: 68ch; }
.mla-notes-block ul { padding-left: 1.25rem; }

.mla-connections-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
}
.mla-connection-tag {
  background: rgba(255,255,255,0.55);
  border: 1px solid #f59e0b;
  color: #92400e;
  font-size: 0.76rem;
  font-weight: 700;
  border-radius: 9999px;
  padding: 0.2rem 0.65rem;
}

/* ── Visual callouts ──────────────────────────────────────────────────────── */
.callout {
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 0 0 1.5rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
}
.callout-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 800;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.7rem;
}
/* Single-paragraph callouts (e.g. OSCE Tip) keep prose width for readability. */
.callout-body { font-size: 0.92rem; line-height: 1.65; max-width: 68ch; }
.callout-body ul { padding-left: 1.1rem; margin: 0; }
.callout-body li { margin-bottom: 0.4rem; }
.callout-body li:last-child { margin-bottom: 0; }

/* Multi-point callouts (High Yield, Clinical Pearl, Exam Tip) render as a
   scan-friendly card grid — one point per card — instead of long bullet text,
   optimised for rapid revision rather than continuous reading. */
.callout-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.7rem;
}
.callout-item {
  background: rgba(255,255,255,0.6);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.75rem 0.9rem;
  font-size: 0.87rem;
  line-height: 1.5;
}
.callout-item strong { display: block; margin-bottom: 0.15rem; }

/* Clinical Pearl — calm teal, "insight" tone */
.callout-pearl {
  background: var(--primary-light);
  border-color: #99f6e4;
  border-left-color: var(--primary);
}
.callout-pearl .callout-head { color: var(--primary-dark); }
.callout-pearl .callout-item { background: rgba(255,255,255,0.65); border-color: rgba(15,118,110,0.15); color: var(--primary-dark); }
.callout-pearl .callout-item strong { color: var(--primary-dark); }

/* Exam Tip — amber, "be careful" tone, distinct from MLA gold block */
.callout-examtip {
  background: #fff7ed;
  border-color: #fed7aa;
  border-left-color: #ea580c;
}
.callout-examtip .callout-head { color: #9a3412; }
.callout-examtip .callout-body { color: #7c2d12; }
.callout-examtip .callout-item { background: rgba(255,255,255,0.65); border-color: rgba(234,88,12,0.18); color: #7c2d12; }

/* OSCE Tip — blue, "clinical skills station" tone */
.callout-osce {
  background: #eff6ff;
  border-color: #bfdbfe;
  border-left-color: #2563eb;
}
.callout-osce .callout-head { color: #1d4ed8; }
.callout-osce .callout-body { color: #1e3a5f; }

/* High Yield — bold red/pink, "this will be examined" tone */
.callout-highyield {
  background: #fef2f2;
  border-color: #fecaca;
  border-left-color: var(--danger);
}
.callout-highyield .callout-head { color: #991b1b; }
.callout-highyield .callout-body { color: #7f1d1d; }
.callout-highyield .callout-item { background: rgba(255,255,255,0.65); border-color: rgba(220,38,38,0.18); color: #7f1d1d; }

/* ── Learning objectives ─────────────────────────────────────────────────── */
.objectives-block {
  background: var(--primary-light);
  border: 1px solid #99f6e4;
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.15rem 1.4rem;
  margin: 0 0 2rem;
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: var(--content-width);
}
.objectives-block h3 {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
  margin-bottom: 0.65rem;
}
.objectives-block ul { padding-left: 1.25rem; margin: 0; }
.objectives-block li { margin-bottom: 0.4rem; }
.objectives-block li:last-child { margin-bottom: 0; }

/* ── Quick Revision list (now rendered inside the MLA accordion body) ────────
   The card/shadow/header styling for the old top-of-page placement has been
   removed since that markup no longer exists; only the list styling remains,
   reused inside .ta-body. */
.quick-start-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.6rem 1.5rem;
  padding: 0;
  margin: 0;
  list-style: none;
}
.quick-start-list.ta-spaced { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.quick-start-list li {
  position: relative;
  padding-left: 1.2rem;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
}
.quick-start-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* ── Topic accordions ─────────────────────────────────────────────────────
   Collapsible secondary-information stack (MLA & Quick Revision, Exam
   Pearls, Key Facts, Related Topics, References), rendered after the main
   content body. Collapsed by default (no `open` attribute in the markup).
   Opening animates via CSS (see .ta-body below); closing is animated by a
   small JS helper in index.php, since <details> has no native close
   transition. */
.topic-accordions {
  margin-top: 3.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  max-width: var(--content-width);
}

/* Short helper line above the stack, signalling these sections expand. */
.ta-helper-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 1.1rem;
  line-height: 1.6;
}

.ta-accordion {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 1rem;
  background: var(--bg);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ta-accordion:last-child { margin-bottom: 0; }
.ta-accordion[open] { border-color: var(--primary-light); }

/* The entire header is the native <summary> element, so the whole row is
   clickable by default — no separate click target needed for the icon. */
.ta-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  padding: 1.15rem 1.4rem;
  cursor: pointer;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg-white);
  list-style: none;
  user-select: none;
  transition: background 0.15s ease;
}
/* Suppress the native disclosure marker in every browser. Without all
   three of these, Firefox renders its own triangle ALONGSIDE the custom
   .ta-chevron below, producing two indicators on the same header. */
.ta-summary { list-style-type: none; }
.ta-summary::marker { content: ''; }
.ta-summary::-webkit-details-marker { display: none; }

.ta-summary:hover { background: var(--primary-light); }
.ta-summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.ta-summary-label { display: flex; align-items: center; gap: 0.65rem; }
.ta-icon { font-size: 1.05rem; line-height: 1; }

/* Single, larger expand/collapse indicator. */
.ta-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  flex-shrink: 0;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--primary);
  transition: transform 0.25s ease;
}
.ta-accordion[open] .ta-chevron { transform: rotate(180deg); }

/* Animated open. Native <details> toggles its content with no built-in
   transition hook, so the body uses a quick fade+slide on open for a smooth
   feel — no JavaScript or extra wrapper markup required. Closing is handled
   by the JS helper in index.php. */
.ta-body {
  padding: 0 1.4rem 1.4rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  font-size: 0.92rem;
  background: var(--bg-white);
  animation: ta-body-in 0.22s ease;
}
@keyframes ta-body-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ta-body .prose { font-size: 0.92rem; max-width: none; }
.ta-body .key-facts-grid,
.ta-body .callout-items,
.ta-body .related-topics-grid { max-width: none; }
.ta-subsection { margin-bottom: 1.1rem; }
.ta-subsection:last-child { margin-bottom: 0; }
.ta-references-list { padding-left: 1.25rem; line-height: 1.85; max-width: none; }

/* ── Linked content (flashcards / questions) ─────────────────────────────── */
.topic-linked-cards { margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.topic-linked-cards h3 { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 0.85rem; }

/* ── Related topics: premium card grid ──────────────────────────────────────
   Icon badge + name + category, with a deliberate hover state (lift, border
   colour shift, icon badge fill) so it reads as a navigable product surface
   rather than a list of links. */
.related-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
}
.related-topic-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  transition: box-shadow 0.18s ease, transform 0.18s ease, border-color 0.18s ease;
}
.related-topic-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
  color: var(--text);
}
.related-topic-card:hover .rtc-icon {
  background: var(--primary);
  color: white;
}
.related-topic-card:hover .rtc-arrow {
  opacity: 1;
  transform: translateX(0);
}
.related-topic-card .rtc-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: var(--primary-light);
  border-radius: 8px;
  transition: background 0.18s ease, color 0.18s ease;
}
.related-topic-card .rtc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.related-topic-card .rtc-name { line-height: 1.3; }
.related-topic-card .rtc-system { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.related-topic-card .rtc-arrow {
  flex-shrink: 0;
  font-size: 1rem;
  color: var(--primary);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.related-topic-card.is-unresolved {
  cursor: default;
  color: var(--text-muted);
  background: var(--bg);
}
.related-topic-card.is-unresolved .rtc-icon { background: var(--border); opacity: 0.7; }

/* ── References ───────────────────────────────────────────────────────────── */
.references-block { margin-top: 2.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--text-muted); max-width: var(--content-width); }
.references-block h3 { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.5rem; }

/* ── Prev/Next ────────────────────────────────────────────────────────────── */
.topic-prevnext { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.prevnext-btn { flex: 1; max-width: 280px; padding: 0.85rem 1.1rem; border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; gap: 0.2rem; transition: box-shadow 0.15s, border-color 0.15s; }
.prevnext-btn:hover { box-shadow: var(--shadow-md); border-color: var(--accent-bright); text-decoration: none; }
.prevnext-next { text-align: right; margin-left: auto; }
.prevnext-label { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.prevnext-name { font-size: 0.9rem; font-weight: 600; color: var(--text); }

/* ── Not-yet-populated state ──────────────────────────────────────────────── */
.tnp-header { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 2px solid var(--border); }
.tnp-icon { font-size: 2.5rem; flex-shrink: 0; }
.tnp-title { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.2rem; }
.tnp-subtitle { color: var(--text-muted); font-size: 0.875rem; margin: 0; }
.tnp-notice { display: inline-flex; align-items: center; gap: 0.5rem; background: var(--bg); border: 1.5px dashed var(--border); border-radius: var(--radius); padding: 0.65rem 1rem; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; }
.tnp-skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.tnp-skeleton-section { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.tnp-skeleton-heading { font-size: 0.85rem; font-weight: 700; margin-bottom: 0.65rem; color: var(--text-muted); }
.tnp-skeleton-lines { display: flex; flex-direction: column; gap: 0.45rem; }
.tnp-line { height: 10px; border-radius: 4px; background: var(--border); animation: skeleton-pulse 1.8s ease-in-out infinite; }
.tnp-line-full { width: 100%; }
.tnp-line-3q { width: 75%; }
.tnp-line-half { width: 50%; }
@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ── Mobile-first responsiveness ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .topic-layout { grid-template-columns: 1fr; }
  .topic-sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); display: none; }
  .topic-main { padding: 1.5rem 1.25rem 2.5rem; }
  .topic-content, .prose, .md-content p, .md-content ul, .md-content ol,
  .topic-summary, .objectives-block, .references-block,
  .callout, .topic-accordions { max-width: none; }
}

@media (max-width: 640px) {
  .page-hero { padding: 0.6rem 1rem 0.55rem; }
  .topic-meta-bar { gap: 0.4rem; }
  .topic-meta-pill { font-size: 0.72rem; padding: 0.26rem 0.6rem; }
  .topic-section h2 { font-size: 1.2rem; }
  .key-facts-grid { grid-template-columns: 1fr; }
  .callout-items { grid-template-columns: 1fr; }
  .related-topics-grid { grid-template-columns: 1fr; }
  .topic-prevnext { flex-direction: column; }
  .prevnext-next { text-align: left; margin-left: 0; }
  .prevnext-btn { max-width: none; }
  .quick-start-list { grid-template-columns: 1fr; }
  .ta-summary { padding: 0.95rem 1.1rem; font-size: 0.92rem; gap: 0.6rem; }
  .ta-body { padding: 0 1.1rem 1.1rem; padding-top: 1rem; }
  .ta-chevron { width: 1.4rem; height: 1.4rem; font-size: 1.15rem; }
}


/* ═══════════════════════════════════════════════════════════════════════════
   190619.05 – Clinical Governance & Formatting Standardisation
   Appended to topic.css — all additions are additive; no existing rules
   removed or overridden. Safe to apply to all existing topic pages.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Clinical Governance Banner ──────────────────────────────────────────────
   Shown only when clinical_governance metadata exists in a topic record.
   Zero visual footprint when absent — no empty containers are rendered.      */
.cg-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid #16a34a;
  border-radius: 8px;
  padding: 0.85rem 1.1rem;
  margin: 0 0 1.75rem;
  max-width: var(--content-width);
  font-size: 0.82rem;
  line-height: 1.5;
}
.cg-banner-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 0.05rem;
}
.cg-banner-body {
  flex: 1;
  min-width: 0;
}
.cg-banner-title {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #166534;
  margin-bottom: 0.35rem;
}
.cg-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  color: #15803d;
}
.cg-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}
.cg-meta-label {
  font-weight: 600;
  color: #166534;
}
/* Overdue review — amber warning variant */
.cg-banner.cg-overdue {
  background: #fff7ed;
  border-color: #fed7aa;
  border-left-color: #ea580c;
}
.cg-banner.cg-overdue .cg-banner-title { color: #9a3412; }
.cg-banner.cg-overdue .cg-meta-row { color: #c2410c; }
.cg-banner.cg-overdue .cg-meta-label { color: #9a3412; }
/* Due-soon — yellow variant */
.cg-banner.cg-due-soon {
  background: #fefce8;
  border-color: #fef08a;
  border-left-color: #ca8a04;
}
.cg-banner.cg-due-soon .cg-banner-title { color: #854d0e; }
.cg-banner.cg-due-soon .cg-meta-row { color: #a16207; }
.cg-banner.cg-due-soon .cg-meta-label { color: #854d0e; }
/* Curriculum Mapped — blue-slate, neutral/informational */
.cg-banner.cg-mapped {
  background: #f0f9ff;
  border-color: #bae6fd;
  border-left-color: #0284c7;
}
.cg-banner.cg-mapped .cg-banner-title { color: #0c4a6e; }
.cg-banner.cg-mapped .cg-meta-row { color: #0369a1; }

/* ── Callout: Exam Pearl (new named variant) ─────────────────────────────────
   Distinct from existing callout-pearl (Clinical Pearl — teal) and
   callout-highyield (red). Purple tone = "diamond" / exam focus.              */
.callout-exampearl {
  background: #faf5ff;
  border-color: #e9d5ff;
  border-left-color: #7c3aed;
}
.callout-exampearl .callout-head { color: #5b21b6; }
.callout-exampearl .callout-item {
  background: rgba(255,255,255,0.65);
  border-color: rgba(124,58,237,0.15);
  color: #4c1d95;
}

/* ── Callout: Clinical Warning (new named variant) ───────────────────────────
   Red with stronger contrast than callout-examtip. Used for safety-critical
   notes (contraindications, drug interactions, red flags).                    */
.callout-warning {
  background: #fff1f2;
  border-color: #fecdd3;
  border-left-color: #dc2626;
}
.callout-warning .callout-head { color: #991b1b; }
.callout-warning .callout-body { color: #7f1d1d; }
.callout-warning .callout-item {
  background: rgba(255,255,255,0.65);
  border-color: rgba(220,38,38,0.2);
  color: #7f1d1d;
}

/* ── Typography: tighten h2 spacing inside prose for denser structured notes ─ */
.prose h2 + p,
.md-content h2 + p { margin-top: 0.6rem; }

/* ── Table: zebra striping for readability in long comparison tables ─────────  */
.prose table tbody tr:nth-child(even) td { background: #f8fafc; }
.md-content table tbody tr:nth-child(even) td { background: #f8fafc; }

/* ── Inline code in prose: slightly warmer background ───────────────────────── */
.prose code {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  font-size: 0.85em;
  font-family: ui-monospace, 'Cascadia Code', 'Source Code Pro', monospace;
  color: #065f46;
}

/* ── Objectives block: slightly larger font for legibility ───────────────────  */
.objectives-block { font-size: 0.94rem; }

/* ── Sidebar: improve active state legibility at narrow widths ───────────────  */
.topic-sidebar-link.active { font-weight: 700; }

/* ── Section dividers: use border-top on all top-level blocks in .topic-main ─ */
.topic-linked-cards + .topic-linked-cards {
  border-top: 1px solid var(--border);
  margin-top: 1.5rem;
  padding-top: 1.5rem;
}

/* ── Accordion helper text: slightly bolder for visual hierarchy ─────────────  */
.ta-helper-text { font-weight: 500; }

/* ── Mobile: governance banner stacks cleanly ────────────────────────────────  */
@media (max-width: 640px) {
  .cg-banner { flex-direction: column; gap: 0.5rem; }
  .cg-meta-row { flex-direction: column; gap: 0.25rem; }
}

/* ── Career Resource — CVtoWebsite.com ──────────────────────────────────────
   Lightweight resource reference. No borders, no buttons, no accent colours.
   Visually subordinate to all educational content above it.                   */
.career-resource {
  max-width: var(--content-width, 880px);
  margin: 1.5rem 0 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border, #e2e8f0);
}
.career-resource-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted, #94a3b8);
  margin: 0 0 0.35rem;
}
.career-resource-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text, #0f172a);
  margin: 0 0 0.25rem;
  line-height: 1.4;
}
.career-resource-text {
  font-size: 0.83rem;
  color: var(--text-muted, #64748b);
  line-height: 1.55;
  margin: 0 0 0.4rem;
}
.career-resource-link {
  font-size: 0.83rem;
  color: var(--primary, #1d4ed8);
  text-decoration: none;
}
.career-resource-link:hover { text-decoration: underline; }
