/* PAS Resource – Design System
 * Modern sidebar-based layout inspired by Tailwind/Stripe docs
 * ────────────────────────────────────────────────────────────── */

/* ── Variables ── */
:root {
  --primary: #2c5f7c;
  --primary-dark: #1a3d52;
  --primary-light: #4a8fb0;
  --accent: #3a9e8f;
  --accent-light: #6dc4b8;

  --bg: #ffffff;
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  --bg-sidebar: #f8fafc;

  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --border: #e2e8f0;
  --border-light: #f1f5f9;

  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);

  --radius: 8px;
  --radius-lg: 12px;

  --sidebar-width: 272px;
  --topbar-height: 56px;

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  --content-max: 960px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; scroll-padding-top: 24px; }
body {
  font-family: var(--font-main);
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Accessibility ── */
.skip-link {
  position: absolute; top: -100%; left: 1rem;
  background: var(--primary); color: white;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  z-index: 10000; font-weight: 600; text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 0.5rem; outline: 3px solid var(--accent); outline-offset: 2px; }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ══════════════════════════════════════
   LAYOUT: Sidebar + Top Bar + Content
   ══════════════════════════════════════ */

/* ── Top Bar ── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-height);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.topbar-inner {
  display: flex; align-items: center;
  height: 100%; padding: 0 1rem;
  gap: 0.75rem;
}
.topbar-logo {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 1.05rem;
  white-space: nowrap;
}
.topbar-logo:hover { color: var(--primary); text-decoration: none; }
.topbar-logo .site-logo-svg { color: var(--primary); }
.topbar-spacer { flex: 1; }

.sidebar-toggle {
  display: none; /* shown on mobile */
  background: none; border: none;
  color: var(--text-secondary); cursor: pointer;
  padding: 6px; border-radius: 6px;
  line-height: 0;
}
.sidebar-toggle:hover { background: var(--bg-alt); color: var(--text); }

/* Reading progress bar */
.reading-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 2px; background: var(--accent);
  width: 0; transition: width 0.1s;
  z-index: 200;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  overflow-y: auto; overflow-x: hidden;
  z-index: 90;
  padding: 0 0 1rem;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }

.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 0.5rem;
  text-decoration: none; color: var(--text);
  font-weight: 700; font-size: 1rem;
}
.sidebar-logo:hover { color: var(--primary); text-decoration: none; }
.sidebar-logo .site-logo-svg { color: var(--primary); }

.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.3); z-index: 89;
  opacity: 0; transition: opacity 0.2s;
}
.sidebar-overlay.visible { display: block; opacity: 1; }

/* Nav groups */
.nav-group { margin-bottom: 0.25rem; }
.nav-group-label {
  padding: 0.5rem 1.25rem 0.35rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.sidebar-nav ul { list-style: none; padding: 0; margin: 0 0 0.5rem; }
.sidebar-nav li { margin: 0; }
.nav-link {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-right: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
  line-height: 1.4;
}
.nav-link:hover {
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
}
.nav-link.active {
  color: var(--primary);
  font-weight: 600;
  background: rgba(44, 95, 124, 0.06);
  border-right-color: var(--primary);
}
.nav-icon {
  flex-shrink: 0;
  opacity: 0.5;
}
.nav-link.active .nav-icon { opacity: 1; }
.nav-link:hover .nav-icon { opacity: 0.8; }

/* Sidebar sub-nav (on-this-page TOC nested under active item) */
.nav-sub {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}
.nav-sub.open { max-height: 2000px; }
.nav-sub li { margin: 0; }
.nav-sub a {
  display: block;
  padding: 0.25rem 1.25rem 0.25rem 2.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  border-right: 2px solid transparent;
  transition: color 0.15s, background 0.15s;
  line-height: 1.4;
}
.nav-sub a:hover { color: var(--text); background: var(--bg-alt); text-decoration: none; }
.nav-sub a.active {
  color: var(--primary);
  font-weight: 500;
  border-right-color: var(--primary);
}
.nav-sub .toc-h3 a { padding-left: 3.5rem; font-size: 0.75rem; }

/* ── Main Content Area ── */
.has-sidebar {
  padding-left: var(--sidebar-width);
}
/* Desktop: hide topbar (logo is in sidebar); no content offset needed */
.has-sidebar .topbar {
  display: none;
}
.has-sidebar .page-with-toc,
.has-sidebar .content-wrapper {
  padding-top: 0;
}
/* When we have the sidebar layout, the old right TOC is hidden */
.has-sidebar .page-with-toc {
  display: block;
  max-width: none;
}
.has-sidebar .page-with-toc .toc { display: none !important; }

/* Hero top padding is set in the hero rule blocks below (combined with shorthand) */

/* Content column */
.content-wrapper {
  max-width: calc(var(--content-max) + 6rem);
  margin-left: auto; margin-right: auto;
  padding: 2rem 3rem;
}
.has-sidebar .content-wrapper {
  max-width: calc(var(--content-max) + 6rem);
  margin: 0 auto;
}
.content-body {
  max-width: var(--content-max);
  margin: 0 auto 2rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* Page-with-toc: now just a simple wrapper */
.page-with-toc {
  max-width: calc(var(--content-max) + 6rem);
  margin: 0 auto;
  padding: 2rem 3rem;
}
.has-sidebar .page-with-toc {
  max-width: calc(var(--content-max) + 6rem);
  margin: 0 auto;
}
.page-with-toc .content-body {
  max-width: none;
}

/* ══════════════
   TYPOGRAPHY
   ══════════════ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-main);
  font-weight: 700;
  line-height: 1.3;
  color: var(--primary-dark);
  margin-bottom: 0.5em;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; font-weight: 800; }
h2 {
  font-size: 1.5rem;
  padding-bottom: 0.4em;
  margin-top: 2.5em;
  border-bottom: 1px solid var(--border);
}
h3 { font-size: 1.2rem; color: var(--primary); margin-top: 1.5em; font-weight: 600; }
h4 { font-size: 1.05rem; color: var(--text-secondary); font-weight: 600; }
p { margin-bottom: 1.15em; }
.content-body p, .content-body li { max-width: 72ch; }
a { color: var(--primary); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); text-decoration: underline; }
strong { font-weight: 600; }
ul, ol { margin-bottom: 1em; padding-left: 1.5em; }
li { margin-bottom: 0.3em; }
blockquote {
  border-left: 3px solid var(--accent);
  background: var(--bg-alt);
  padding: 1em 1.5em;
  margin: 1em 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-secondary);
}

/* ══════════════
   HERO SECTIONS
   ══════════════ */
.hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: white;
  padding: 3.5rem 2rem 3rem;
  text-align: center;
}
.hero h1 { color: white; font-size: 2.25rem; margin-bottom: 0.5em; border: none; }
.hero .subtitle { font-size: 1.1rem; opacity: 0.9; max-width: 650px; margin: 0 auto; }

.page-hero {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: white;
  padding: 2.5rem 2rem 1.5rem;
}
.page-hero h1 { color: white; font-size: 1.75rem; margin-bottom: 0.25em; border: none; }
.page-hero .subtitle { font-size: 0.95rem; opacity: 0.85; max-width: 600px; }
.hero-breadcrumb { font-size: 0.85rem; opacity: 0.6; margin-bottom: 0.75rem; }
.hero-breadcrumb a { color: rgba(255,255,255,0.8); }
.hero-breadcrumb a:hover { color: white; }
.last-reviewed { font-size: 0.8rem; color: rgba(255,255,255,0.5); margin-top: 0.5rem; }

/* ══════════════
   CARDS
   ══════════════ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.card:hover { border-color: var(--primary-light); box-shadow: var(--shadow-md); }
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover { text-decoration: none; }
.card-icon { font-size: 1.75rem; margin-bottom: 0.5rem; }
.card h3 { color: var(--primary); margin-top: 0; font-size: 1.1rem; }
.card p { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0; }

/* ══════════════
   INFO BOXES
   ══════════════ */
.info-box {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
  border-left: 3px solid;
}
.info-box.note { background: #eff6ff; border-color: var(--info); }
.info-box.warning { background: #fffbeb; border-color: var(--warning); }
.info-box.danger { background: #fef2f2; border-color: var(--danger); }
.info-box.success { background: #f0fdf4; border-color: var(--success); }
.info-box .info-title {
  font-weight: 700; margin-bottom: 0.3em;
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.95rem;
}
.info-box.note .info-title { color: var(--info); }
.info-box.warning .info-title { color: var(--warning); }
.info-box.danger .info-title { color: var(--danger); }
.info-box.success .info-title { color: var(--success); }

/* ══════════════
   STAT BOXES
   ══════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.stat-box {
  text-align: center;
  padding: 1.25rem 1rem;
  background: var(--bg-alt);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
}
.stat-value {
  font-size: 1.75rem; font-weight: 700;
  color: var(--primary); line-height: 1.2;
}
.stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.25rem; }
.stat-note { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.25rem; font-style: italic; }

/* ══════════════
   TABLES
   ══════════════ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.5rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
thead {
  background: var(--bg-alt);
}
th {
  padding: 0.65rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
}
tbody tr:hover { background: var(--bg-alt); }

/* Comparison classes */
.comparison-table { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.comparison-table table { min-width: 600px; }
.comparison-table .better, .better { color: var(--success); font-weight: 600; }
.comparison-table .worse, .worse { color: var(--danger); font-weight: 600; }
.comparison-table .neutral, .neutral { color: var(--warning); font-weight: 600; }

/* ══════════════
   CHARTS
   ══════════════ */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.5rem 0;
}
.chart-container h4 { text-align: center; margin-bottom: 1rem; }
.chart-wrapper { position: relative; max-width: 600px; margin: 0 auto; }
.chart-wrapper.wide { max-width: 100%; }

/* ══════════════
   SEVERITY SCALE
   ══════════════ */
.severity-scale {
  display: flex; margin: 2rem 0;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.severity-level {
  flex: 1; padding: 1.25rem;
  color: white; text-align: center;
}
.severity-level h4 { color: white; margin: 0 0 0.5rem; }
.severity-level p { font-size: 0.85rem; margin: 0; opacity: 0.9; }
.severity-level.accreta { background: var(--warning); }
.severity-level.increta { background: var(--accent); }
.severity-level.percreta { background: var(--danger); }

/* ══════════════
   DIAGRAMS
   ══════════════ */
.diagram {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem; margin: 1.5rem 0;
  text-align: center;
}
.anatomy-svg { max-width: 500px; margin: 0 auto; display: block; }

/* ══════════════
   CITATIONS / REFERENCES
   ══════════════ */
.source {
  font-size: 0.8rem; color: var(--text-muted);
  font-style: italic; margin-top: 0.5rem;
}
.source a { color: var(--text-secondary); }
.source a:hover { color: var(--primary); }

.citation {
  display: inline-block;
  background: var(--bg-alt);
  color: var(--primary);
  font-size: 0.65rem;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  vertical-align: super;
  cursor: help;
  font-weight: 600;
  text-decoration: none;
}
.citation:hover { background: var(--primary); color: white; text-decoration: none; }

.references {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-top: 2rem;
}
.references h3 { margin-top: 0; }
.references ol { font-size: 0.8rem; color: var(--text-secondary); }
.references li { margin-bottom: 0.5rem; }

/* ══════════════
   HOSPITAL CARDS
   ══════════════ */
.hospital-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin: 0.75rem 0;
  transition: border-color 0.2s;
}
.hospital-card:hover { border-color: var(--primary-light); }
.hospital-card .rank {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--primary); color: white;
  border-radius: 50%; font-weight: 700; font-size: 0.9rem;
  margin-right: 0.75rem; flex-shrink: 0;
}
.hospital-card .hospital-header { display: flex; align-items: center; margin-bottom: 0.75rem; }
.hospital-card h3 { margin: 0; }
.hospital-card .hospital-location { color: var(--text-secondary); font-size: 0.9rem; }
.hospital-card .hospital-details { font-size: 0.9rem; }
.hospital-card .hospital-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.75rem; }
.hospital-tag {
  display: inline-block;
  background: var(--bg-alt); color: var(--primary);
  font-size: 0.7rem; padding: 0.2em 0.5em;
  border-radius: 4px; font-weight: 600;
}

/* Fertility preservation status badge — shown in hospital card header */
.fertility-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25em 0.7em;
  border-radius: 100px;
  margin-top: 0.3rem;
  line-height: 1.3;
  width: fit-content;
}
.fertility-badge.yes {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.fertility-badge.emerging {
  background: #fef9c3;
  color: #a16207;
  border: 1px solid #fde047;
}
.fertility-badge.no {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.fertility-badge .badge-icon {
  font-size: 0.85em;
}

/* Strategy label shown below fertility badge */
.hospital-strategy {
  font-size: 0.78rem;
  color: #64748b;
  font-style: italic;
  margin-top: 0.25rem;
}

/* ══════════════
   TIMELINE
   ══════════════ */
.timeline { position: relative; padding-left: 2rem; margin: 1.5rem 0; }
.timeline::before {
  content: ''; position: absolute; left: 0.5rem; top: 0; bottom: 0;
  width: 2px; background: var(--border); border-radius: 2px;
}
.timeline-item { position: relative; margin-bottom: 1.5rem; padding-left: 1rem; }
.timeline-item::before {
  content: ''; position: absolute; left: -1.65rem; top: 0.5rem;
  width: 10px; height: 10px;
  background: var(--primary); border-radius: 50%;
  border: 2px solid var(--bg);
}
.timeline-item h4 { margin: 0 0 0.25rem; color: var(--primary); }

/* ══════════════
   FLOWCHART
   ══════════════ */
.flowchart {
  display: flex; flex-direction: column;
  align-items: center; gap: 0.5rem; margin: 2rem 0;
}
.flow-node {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  text-align: center; max-width: 350px;
  font-size: 0.9rem; font-weight: 500;
}
.flow-node.start { background: var(--primary); color: white; }
.flow-node.decision { background: var(--warning); color: white; border-radius: 4px; }
.flow-node.action { background: var(--bg-alt); border: 2px solid var(--primary); color: var(--text); }
.flow-node.end { background: var(--success); color: white; }
.flow-node.danger { background: var(--danger); color: white; }
.flow-arrow { font-size: 1.5rem; color: var(--text-muted); }
.flow-branch { display: flex; gap: 2rem; justify-content: center; flex-wrap: wrap; }

/* ══════════════
   TABS
   ══════════════ */
.tabs { margin: 1.5rem 0; }
.tab-buttons { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 1rem; }
.tab-btn {
  padding: 0.5rem 1rem;
  border: none; background: none;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
  font-family: var(--font-main);
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ══════════════
   ACCORDION
   ══════════════ */
.accordion { margin: 1rem 0; }
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem; overflow: hidden;
}
.accordion-header {
  background: var(--bg-alt);
  padding: 0.85rem 1.25rem;
  cursor: pointer; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 0.15s;
  font-size: 0.95rem;
  width: 100%;
  border: none;
  text-align: left;
  font-family: var(--font-main);
  color: var(--text);
}
.accordion-header:hover { background: var(--border-light); }
.accordion-header::after { content: '+'; font-size: 1.1rem; color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.accordion-item.open .accordion-header::after { content: '\2212'; }
/* Hide explicit icon spans (some pages have them) to avoid doubling with ::after */
.accordion-icon { display: none; }
.accordion-body { padding: 0 1.25rem; max-height: 0; overflow: hidden; transition: all 0.3s; }
.accordion-item.open .accordion-body { padding: 1rem 1.25rem; max-height: 5000px; }

/* ══════════════
   KEY TAKEAWAYS
   ══════════════ */
.key-takeaways {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  padding: 1.25rem 1.75rem;
  margin: 1.5rem 0 2rem;
}
.key-takeaways h4 {
  color: var(--primary);
  margin-top: 0; margin-bottom: 0.75rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.key-takeaways ul { margin-bottom: 0; }
.key-takeaways li { margin-bottom: 0.4em; }

/* ══════════════
   RELATED TOPICS
   ══════════════ */
.related-topics {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.related-topics h3 {
  text-align: center;
  margin-bottom: 1.25rem;
  color: var(--text-secondary);
  font-weight: 600; font-size: 1rem;
}

/* ══════════════
   SPECIALIST CARDS
   ══════════════ */
.specialist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem; margin: 1rem 0;
  display: grid; grid-template-columns: auto 1fr;
  gap: 1.5rem; align-items: start;
}
.specialist-avatar {
  width: 56px; height: 56px;
  background: var(--bg-alt); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem; color: var(--primary);
  font-weight: 700; border: 2px solid var(--border);
}
.specialist-info h4 { margin: 0 0 0.25rem; color: var(--primary-dark); }
.specialist-info .specialist-title { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 0.5rem; }
.specialist-info .specialist-location { color: var(--text-secondary); font-size: 0.9rem; margin: 0 0 0.5rem; font-weight: 500; }
.specialist-info ul { margin: 0.5rem 0; padding-left: 1.25rem; font-size: 0.9rem; }
.specialist-info ul li { margin-bottom: 0.4rem; }
.specialist-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }
.specialist-tag {
  display: inline-block; background: var(--bg-alt);
  color: var(--primary); font-size: 0.7rem;
  padding: 0.2em 0.5em; border-radius: 4px; font-weight: 600;
}
.specialist-tag.highlight { background: var(--primary); color: white; }

/* Experience ranking */
.experience-rank {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.75rem; font-weight: 600;
  padding: 0.25em 0.7em; border-radius: 20px;
  margin-bottom: 0.5rem;
}
.experience-rank.tier-1 { background: #fef3c7; color: #92400e; }
.experience-rank.tier-2 { background: #e0e7ff; color: #3730a3; }
.experience-rank.tier-3 { background: #f3f4f6; color: #4b5563; }

/* ══════════════
   MISC COMPONENTS
   ══════════════ */

/* Back to top */
.back-to-top {
  position: fixed; bottom: 2rem; right: 2rem;
  width: 40px; height: 40px;
  background: var(--primary); color: white;
  border: none; border-radius: 50%;
  font-size: 1.1rem; cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0; transition: all 0.2s;
  z-index: 80;
  display: flex; align-items: center; justify-content: center;
}
.back-to-top.visible { opacity: 1; }
.back-to-top:hover { background: var(--primary-dark); }

/* Heading anchor links */
.heading-anchor {
  opacity: 0; color: var(--text-muted);
  text-decoration: none; margin-left: 0.5rem;
  font-weight: 400; transition: opacity 0.15s;
}
h2:hover .heading-anchor, h3:hover .heading-anchor { opacity: 1; }
.heading-anchor:hover { color: var(--primary); }

/* Section spacing */
section { margin-bottom: 2.5rem; }

/* Footer */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,0.65);
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
}
/* Footer margin handled by body padding-left */
.site-footer a { color: rgba(255,255,255,0.85); }
.site-footer a:hover { color: white; }
.site-footer .disclaimer {
  max-width: 600px;
  margin: 1rem auto 0;
  font-size: 0.75rem;
  opacity: 0.6;
  line-height: 1.5;
}
/* Hide the extensive footer nav — sidebar now handles navigation */
.site-footer nav { display: none; }

/* ══════════════════
   MOBILE RESPONSIVE
   ══════════════════ */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    top: 0;
    height: 100vh;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 16px rgba(0,0,0,0.1);
  }
  .sidebar-toggle { display: flex; }

  .has-sidebar {
    padding-left: 0;
  }
  /* On mobile, show the topbar with hamburger + logo */
  .has-sidebar .topbar {
    display: flex;
    left: 0;
    width: 100%;
  }
  html { scroll-padding-top: calc(var(--topbar-height) + 16px); }
  .page-hero { padding-top: calc(var(--topbar-height) + 1.5rem); }
  .hero { padding-top: calc(var(--topbar-height) + 2rem); }
}

@media (max-width: 768px) {
  .content-body { padding: 1.5rem 1.25rem; }
  .content-wrapper,
  .page-with-toc { padding: 1.25rem; }
  .page-hero { padding: calc(var(--topbar-height) + 1rem) 1.25rem 1rem; }
  .page-hero h1 { font-size: 1.5rem; }
  .page-hero .subtitle { font-size: 0.9rem; }
  .hero { padding: calc(var(--topbar-height) + 1.5rem) 1.25rem 2rem; }
  .hero h1 { font-size: 1.75rem; }
  .card-grid { gap: 1rem; }
  .info-box { padding: 1rem 1.25rem; }
  .severity-scale { flex-direction: column; }
  .specialist-card { grid-template-columns: 1fr; }
  .specialist-avatar { margin: 0 auto; }

  /* Better table handling on mobile */
  .table-responsive,
  .comparison-table { margin: 1rem -0.5rem; padding: 0 0.5rem; }
}

@media (max-width: 500px) {
  .card-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .flow-branch { flex-direction: column; align-items: center; gap: 1rem; }
}

/* ══════════════════════════════════════
   US MAP – Fertility Preservation Centers (jsvectormap)
   ══════════════════════════════════════ */
#jsvectormap-container {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}
/* Hide zoom buttons */
#jsvectormap-container .jvm-zoom-btn { display: none !important; }
/* Override jsvectormap tooltip styles */
#jsvectormap-container .jvm-tooltip {
  z-index: 50;
  font-family: var(--font-main);
}
/* Marker hover effect */
#jsvectormap-container circle[data-index] {
  cursor: pointer;
  transition: r 0.15s ease, filter 0.15s ease;
}
#jsvectormap-container circle[data-index]:hover {
  filter: brightness(1.15) drop-shadow(0 0 4px rgba(0,0,0,0.3));
}

/* Legend */
.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  justify-content: center;
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.map-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.map-legend-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.map-legend-dot.green  { background: #16a34a; border: 2px solid #dcfce7; }
.map-legend-dot.amber  { background: #ca8a04; border: 2px solid #fef9c3; }
.map-legend-dot.red    { background: #dc2626; border: 2px solid #fee2e2; }

@media (max-width: 768px) {
  #jsvectormap-container { height: 350px !important; }
}
@media (max-width: 500px) {
  #jsvectormap-container { height: 280px !important; }
}

/* ══════════════
   PRINT STYLES
   ══════════════ */
@media print {
  .topbar, .sidebar, .sidebar-overlay, .toc, .back-to-top, .reading-progress, .skip-link { display: none !important; }
  .has-sidebar { padding-left: 0; }
  .content-body { box-shadow: none; border: none; padding: 0; }
  .content-wrapper { padding: 0; }
  body { background: white; color: black; font-size: 12pt; line-height: 1.5; }
  .hero, .page-hero { background: var(--primary-dark) !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  a { color: var(--primary-dark); text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.8em; color: #666; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .info-box, .severity-scale, .key-takeaways, .hospital-card, .specialist-card { break-inside: avoid; box-shadow: none; }
  table { break-inside: auto; font-size: 0.9em; }
  tr { break-inside: avoid; }
  thead { display: table-header-group; }
  h1, h2, h3, h4 { break-after: avoid; }
  img { max-width: 100% !important; }
  .chart-container { break-inside: avoid; }
  .site-footer nav { display: none; }
  blockquote { border-left-color: #999; }
}
