/* ── PsychoPharmRef Blog — Shared Stylesheet ────────────────────────────── */
/* Matches the main app's parchment theme and full ba-* component library   */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #f5f0e8;
  --bg2:        #ece6db;
  --bg3:        #e2dbd0;
  --card:       #fefcf8;
  --card-bg:    #fefcf8;
  --surface:    #ece6db;
  --border:     #cfc8ba;
  --accent:     #4a7c35;
  --accent2:    #8b6914;
  --text:       #231e14;
  --text-muted: #6b6050;
  --green:      #3a6e28;
  --red:        #c04030;
  --yellow:     #8b6914;
  --orange:     #b05a20;
  --sidebar-w:  240px;
  --font:       'Segoe UI', system-ui, sans-serif;
}

html, body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

/* ── Page layout ─────────────────────────────────────────────────────────── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: border-color 0.15s, background 0.15s;
}
.back-link:hover { background: var(--bg2); border-color: var(--accent); }

.blog-article {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 48px 44px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
@media (max-width: 640px) { .blog-article { padding: 28px 18px; } }

/* ── Article header ──────────────────────────────────────────────────────── */
.ba-header { margin-bottom: 36px; padding-bottom: 24px; border-bottom: 2px solid var(--border); }
.ba-category {
  display: inline-block;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); font-weight: 700; margin-bottom: 12px;
  background: rgba(74,124,53,0.08); padding: 3px 10px; border-radius: 20px;
}
.ba-title { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1.2; margin-bottom: 12px; }
.ba-subtitle { font-size: 1.05rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 14px; }
.ba-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Body ────────────────────────────────────────────────────────────────── */
.ba-body { font-size: 14px; line-height: 1.75; color: var(--text); }
.ba-body p { margin-bottom: 16px; color: var(--text-muted); }
.ba-body ul, .ba-body ol { margin: 0 0 16px 22px; }
.ba-body li { margin-bottom: 8px; color: var(--text-muted); line-height: 1.65; }
.ba-body strong { color: var(--text); }

.ba-lead {
  font-size: 1.05rem; color: var(--text); line-height: 1.7; margin-bottom: 28px;
  padding: 18px 20px; background: var(--bg); border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
}

.ba-h2 {
  font-size: 1.35rem; font-weight: 700; color: var(--text);
  margin: 40px 0 14px; padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}
.ba-h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 24px 0 10px; }
.ba-chart-note { font-size: 11px; color: var(--text-muted); font-style: italic; margin-top: 6px; }

/* ── Stat cards ──────────────────────────────────────────────────────────── */
.ba-stat-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px; margin: 24px 0;
}
.ba-stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 16px; text-align: center;
}
.ba-stat-card--alert { border-top: 3px solid var(--red); }
.ba-stat-card--good  { border-top: 3px solid var(--green); }
.ba-stat-num { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 8px; }
.ba-stat-card--alert .ba-stat-num { color: var(--red); }
.ba-stat-card--good  .ba-stat-num { color: var(--green); }
.ba-stat-label { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ── Timeline ────────────────────────────────────────────────────────────── */
.ba-timeline { position: relative; padding-left: 20px; margin: 24px 0; border-left: 2px solid var(--accent); }
.ba-tl-item { position: relative; padding: 0 0 22px 20px; }
.ba-tl-item--last, .ba-tl-item:last-child { padding-bottom: 0; }
.ba-tl-dot {
  position: absolute; left: -27px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid var(--card);
}
.ba-tl-dot--last { background: var(--yellow); }
.ba-tl-dot--muted { background: var(--text-muted); }
.ba-tl-time { font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.ba-tl-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.ba-tl-text strong { color: var(--text); }

/* ── Insight box ─────────────────────────────────────────────────────────── */
.ba-insight-box {
  display: flex; gap: 14px;
  background: rgba(74,124,53,0.06); border: 1px solid rgba(74,124,53,0.2);
  border-radius: 8px; padding: 16px; margin: 20px 0;
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
}
.ba-insight-box--alert {
  background: rgba(192,64,48,0.06); border-color: rgba(192,64,48,0.25);
}
.ba-insight-icon { font-size: 22px; flex-shrink: 0; margin-top: 1px; }
.ba-insight-box strong { color: var(--text); }
.ba-insight-title { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ba-insight-box[style*="--ib-color"] {
  background: color-mix(in srgb, var(--ib-color, var(--accent)) 8%, transparent);
  border-color: color-mix(in srgb, var(--ib-color, var(--accent)) 25%, transparent);
}
.ba-insight-box[style*="--ib-color"] .ba-insight-title { color: var(--ib-color, var(--text)); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.ba-table-wrap { overflow-x: auto; margin: 16px 0 24px; border-radius: 8px; border: 1px solid var(--border); }
.ba-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ba-table thead { background: var(--bg2); border-bottom: 2px solid var(--accent); }
.ba-table th { padding: 10px 14px; color: var(--text); font-size: 12px; font-weight: 700; text-align: left; }
.ba-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-muted); vertical-align: top; line-height: 1.5; }
.ba-table tr:last-child td { border-bottom: none; }
.ba-table tbody tr:hover td { background: var(--bg); }
.ba-tr-highlight td { background: rgba(74,124,53,0.05); color: var(--text); }

/* ── Compare row ─────────────────────────────────────────────────────────── */
.ba-compare-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
@media (max-width: 600px) { .ba-compare-row { grid-template-columns: 1fr; } }
.ba-compare-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px;
}
.ba-compare-card h5 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.ba-compare-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }
.ba-compare-card--winner { border-top: 3px solid var(--green); }
.ba-compare-badge { font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; background: rgba(58,110,40,0.12); color: var(--green); border-radius: 10px; padding: 2px 10px; display: inline-block; margin-bottom: 8px; font-weight: 700; }
.ba-compare-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ba-compare-pct { font-size: 2.2rem; font-weight: 800; line-height: 1; margin-bottom: 4px; color: var(--accent); }
.ba-compare-sub { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.ba-compare-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

/* Compare grid (full-info variant) */
.ba-compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
@media (max-width: 900px) { .ba-compare-grid { grid-template-columns: 1fr; } }
.ba-compare-grid .ba-compare-card { text-align: left; border-top: 3px solid var(--cc, var(--accent)); }
.ba-compare-header { font-size: 1.2rem; font-weight: 800; color: var(--cc, var(--accent)); margin-bottom: 2px; }
.ba-compare-brand { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.ba-compare-mech {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); padding: 3px 8px;
  background: color-mix(in srgb, var(--cc, var(--accent)) 10%, transparent);
  border-radius: 4px; display: inline-block; margin-bottom: 12px;
}
.ba-compare-list { padding-left: 16px; font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.ba-compare-list li { margin-bottom: 4px; }
.ba-compare-list strong { color: var(--text); }

/* ── Therapy / support / populations grids ───────────────────────────────── */
.ba-therapy-grid, .ba-support-grid, .ba-pop-grid, .ba-stacked-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; margin: 20px 0;
}
.ba-therapy-card, .ba-pop-card, .ba-stacked-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 18px;
}
.ba-stacked-card { border-top: 3px solid var(--sc, var(--accent)); }
.ba-support-card { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px; padding: 18px; }
.ba-therapy-icon, .ba-pop-icon, .ba-stacked-icon { font-size: 26px; margin-bottom: 8px; }
.ba-therapy-title, .ba-stacked-title { font-size: 14px; font-weight: 700; color: var(--sc, var(--accent)); margin-bottom: 6px; }
.ba-stacked-sub { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.ba-therapy-card p, .ba-pop-card p, .ba-support-card p { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; margin: 0; }
.ba-pop-card h4, .ba-support-card h4 { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.ba-stacked-list, .ba-pop-list { padding-left: 16px; margin: 0; }
.ba-stacked-list li, .ba-pop-list li { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 4px; }
.ba-support-num { font-size: 1.2rem; font-weight: 800; color: var(--accent); margin-bottom: 4px; }

/* 5 A's grid */
.ba-5a-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.ba-5a-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; text-align: center; }
.ba-5a-num { font-size: 1.6rem; font-weight: 800; color: var(--accent); line-height: 1; }
.ba-5a-letter { font-size: 14px; font-weight: 700; color: var(--text); margin: 4px 0; }
.ba-5a-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }

/* ── Bar chart ───────────────────────────────────────────────────────────── */
.ba-bar-chart { margin: 20px 0; display: flex; flex-direction: column; gap: 14px; }
.ba-bar-row { display: flex; align-items: center; gap: 12px; }
.ba-bar-label { width: 180px; flex-shrink: 0; font-size: 12px; color: var(--text-muted); line-height: 1.35; }
.ba-bar-track {
  flex: 1; background: var(--bg3); border-radius: 4px; height: 28px;
  position: relative; display: flex; align-items: center; overflow: hidden;
}
.ba-bar-fill { height: 100%; border-radius: 4px; }
.ba-bar-pct { position: absolute; right: 8px; font-size: 13px; font-weight: 700; color: var(--text); }

/* ── Pipeline cards ──────────────────────────────────────────────────────── */
.ba-pipeline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 20px 0; }
@media (max-width: 900px) { .ba-pipeline-grid { grid-template-columns: 1fr; } }
.ba-pipeline-card { background: rgba(74,124,53,0.04); border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.ba-pipeline-tag {
  display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; background: rgba(74,124,53,0.12); color: var(--accent);
  border-radius: 4px; padding: 2px 8px; margin-bottom: 10px;
}
.ba-pipeline-tag--star { background: rgba(139,105,20,0.12); color: var(--accent2); }
.ba-pipeline-name { font-size: 1.3rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.ba-pipeline-class { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.ba-pipeline-data { display: flex; gap: 14px; margin-bottom: 14px; }
.ba-pipeline-stat { flex: 1; background: rgba(74,124,53,0.07); border-radius: 8px; padding: 10px 12px; }
.ba-pipeline-num { font-size: 1.4rem; font-weight: 800; color: var(--accent); display: block; }
.ba-pipeline-desc { font-size: 11px; color: var(--text-muted); line-height: 1.4; display: block; margin-top: 2px; }
.ba-pipeline-note { font-size: 13px; color: var(--text-muted); line-height: 1.7; }

/* ── Cost timeline ───────────────────────────────────────────────────────── */
.ba-cost-timeline { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin: 20px 0; }
.ba-cost-header { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 16px; text-transform: uppercase; letter-spacing: .04em; }
.ba-cost-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.ba-cost-label { width: 200px; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.ba-cost-track { flex: 1; background: var(--bg3); border-radius: 4px; height: 28px; overflow: hidden; }
.ba-cost-bar { height: 100%; display: flex; align-items: center; padding: 0 10px; font-size: 12px; font-weight: 700; color: #fff; border-radius: 4px; white-space: nowrap; }
.ba-cost-bar--surgery { background: #3a6e28; }
.ba-cost-bar--glp1 { background: #2a5fa0; }
.ba-cost-bar--over { background: var(--red); }
.ba-cost-caption { font-size: 12px; color: var(--text-muted); margin-top: 12px; line-height: 1.6; }

/* ── Takeaway grid ───────────────────────────────────────────────────────── */
.ba-takeaway-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0; }
@media (max-width: 900px) { .ba-takeaway-grid { grid-template-columns: 1fr; } }
.ba-takeaway-card { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px; }
.ba-takeaway-num {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #fff; font-size: 1.1rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.ba-takeaway-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.ba-takeaway-body p { font-size: 13px; color: var(--text-muted); line-height: 1.7; }

/* ── Summary box ─────────────────────────────────────────────────────────── */
.ba-summary-box {
  background: rgba(74,124,53,0.07); border: 1px solid rgba(74,124,53,0.2);
  border-radius: 10px; padding: 22px 24px; margin: 32px 0;
}
.ba-summary-box h3 { font-size: 15px; font-weight: 700; color: var(--accent); margin-bottom: 10px; }
.ba-summary-box p { font-size: 13px; color: var(--text-muted); line-height: 1.65; margin: 0 0 8px; }
.ba-summary-box ul { margin: 0 0 0 18px; }
.ba-summary-box li { font-size: 13px; color: var(--text-muted); line-height: 1.65; margin-bottom: 6px; }

/* ── Warning box ─────────────────────────────────────────────────────────── */
.ba-warning-box {
  background: rgba(192,64,48,0.06); border: 1px solid rgba(192,64,48,0.2);
  border-radius: 8px; padding: 16px 20px; margin: 20px 0;
  font-size: 13px; color: var(--text-muted); line-height: 1.6;
}
.ba-warning-box strong { color: var(--red); }

/* ── References ──────────────────────────────────────────────────────────── */
.ba-references { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.ba-ref-title { font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.05em; }
.ba-ref-list { list-style: none; counter-reset: ref; margin: 0; padding: 0; }
.ba-ref-list li { counter-increment: ref; margin-bottom: 10px; padding-left: 28px; position: relative; font-size: 12px; color: var(--text-muted); line-height: 1.55; }
.ba-ref-list li::before { content: '[' counter(ref) ']'; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.ba-ref-item { font-size: 12px; color: var(--text-muted); line-height: 1.55; margin-bottom: 10px; padding-left: 0; }

/* ── Footer ──────────────────────────────────────────────────────────────── */
.ba-footer { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ── SVG / diagram containers ────────────────────────────────────────────── */
svg { display: block; width: 100%; height: auto; }
.svg-container, .diagram-container {
  width: 100%; margin: 24px 0;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; overflow: hidden;
}
.svg-caption, .diagram-caption {
  text-align: center; font-size: 12px; color: var(--text-muted);
  margin-top: 8px; font-style: italic;
}

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Mobile hamburger button (blog) ────────────────────────────────────── */
#mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 44px;
  height: 44px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  padding: 0;
}
#mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.2s;
}
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.25s;
}
#sidebar-overlay.overlay-visible {
  opacity: 1;
}

/* ── Responsive: tablet (≤900px) ──────────────────────────────────────── */
@media (max-width: 900px) {
  .blog-article { padding: 36px 28px; }
  .ba-bar-label { width: 140px; font-size: 11px; }
  .ba-cost-label { width: 150px; font-size: 11px; }
}

/* ── Responsive: mobile (≤768px) ──────────────────────────────────────── */
@media (max-width: 768px) {
  /* Show hamburger, sidebar slides in */
  #mobile-menu-btn { display: flex; }

  #sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 280px;
    display: flex;
  }
  #sidebar.sidebar-open {
    transform: translateX(0);
  }
  #sidebar-overlay {
    display: block;
    pointer-events: none;
  }
  #sidebar-overlay.overlay-visible {
    pointer-events: auto;
  }

  #content { margin-left: 0; }
  body.sidebar-is-open { overflow: hidden; }

  /* Container and article */
  .container { padding: 60px 12px 40px; }
  .blog-article { padding: 24px 16px; border-radius: 8px; }

  /* Larger, more readable body text on mobile */
  .ba-body { font-size: 15px; line-height: 1.8; }
  .ba-body p { margin-bottom: 18px; }
  .ba-body li { margin-bottom: 10px; line-height: 1.75; }

  /* Headers */
  .ba-title { font-size: 1.5rem; }
  .ba-subtitle { font-size: 0.95rem; }
  .ba-h2 { font-size: 1.2rem; margin: 32px 0 12px; }
  .ba-h3 { font-size: 1rem; }

  /* Lead paragraph */
  .ba-lead { font-size: 0.95rem; padding: 14px 16px; }

  /* Bar charts — stack label above bar */
  .ba-bar-row { flex-wrap: wrap; }
  .ba-bar-label { width: 100%; margin-bottom: 4px; }

  /* Cost timeline */
  .ba-cost-row { flex-wrap: wrap; }
  .ba-cost-label { width: 100%; margin-bottom: 4px; }

  /* Tables — ensure scroll works */
  .ba-table-wrap { margin: 12px -16px; border-radius: 0; border-left: none; border-right: none; }
  .ba-table th, .ba-table td { padding: 8px 10px; font-size: 12px; }

  /* Insight boxes */
  .ba-insight-box { flex-direction: column; gap: 8px; padding: 14px; }
  .ba-insight-icon { font-size: 20px; }

  /* Stat cards */
  .ba-stat-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ba-stat-num { font-size: 1.5rem; }

  /* Summary box */
  .ba-summary-box { padding: 16px 14px; }

  /* Compare cards */
  .ba-compare-row { grid-template-columns: 1fr; }
  .ba-compare-grid { grid-template-columns: 1fr; }
  .ba-pipeline-grid { grid-template-columns: 1fr; }
  .ba-takeaway-grid { grid-template-columns: 1fr; }

  /* Timeline */
  .ba-timeline { padding-left: 16px; }
  .ba-tl-dot { left: -23px; }

  /* Back link */
  .back-link { font-size: 12px; padding: 6px 12px; }

  /* References */
  .ba-ref-list li { font-size: 11px; }
}

/* ── Responsive: small mobile (≤480px) ────────────────────────────────── */
@media (max-width: 480px) {
  .container { padding: 56px 8px 32px; }
  .blog-article { padding: 20px 14px; }
  .ba-title { font-size: 1.3rem; }
  .ba-body { font-size: 14.5px; }
  .ba-stat-row { grid-template-columns: 1fr; }
  .ba-table th, .ba-table td { padding: 6px 8px; font-size: 11px; }
}
