/* ============================================================
   SequenceMedicine.com — Site-Specific Styles
   Supplements base.html inline CSS with page-level components.
   ============================================================ */

/* ── Evidence Tier Palette ────────────────────────────────── */
:root {
  --evidence-strong:   #16a34a;
  --evidence-moderate: #d97706;
  --evidence-emerging: #9ca3af;
  --evidence-strong-bg:   #dcfce7;
  --evidence-moderate-bg: #fef3c7;
  --evidence-emerging-bg: #f3f4f6;
}

/* ── Hero Section ─────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 3rem;
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero-title span {
  color: var(--blue-700);
}

.hero-subtitle {
  font-size: 1.125rem;
  color: var(--gray-600);
  font-weight: 400;
  max-width: 38rem;
  margin: 0 auto 1.25rem;
  line-height: 1.6;
}

.hero-description {
  font-size: 0.9375rem;
  color: var(--gray-500);
  max-width: 44rem;
  margin: 0 auto;
  line-height: 1.7;
}

/* ── Pillar Cards ─────────────────────────────────────────── */
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.pillar-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pillar-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border-color: var(--blue-500);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.pillar-card--disabled {
  opacity: 0.6;
  cursor: default;
}

.pillar-card--disabled:hover {
  box-shadow: none;
  border-color: var(--gray-200);
  transform: none;
}

.pillar-icon {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  line-height: 1;
}

.pillar-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.375rem;
}

.pillar-desc {
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  flex: 1;
}

.pillar-stat {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--blue-700);
}

.pillar-stat--muted {
  color: var(--gray-400);
  font-weight: 500;
}

/* ── Section Headings ─────────────────────────────────────── */
.section-heading {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 0.375rem;
}

.section-subheading {
  font-size: 0.9375rem;
  color: var(--gray-500);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ── Organ System Grid ────────────────────────────────────── */
.organ-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 3rem;
}

.organ-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.organ-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border-color: var(--gray-300);
  text-decoration: none;
  color: inherit;
}

.organ-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.organ-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.3;
}

.organ-card-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Yield Bar Visualization ──────────────────────────────── */
.yield-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.yield-bar {
  flex: 1;
  height: 6px;
  background: var(--gray-100);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  min-width: 80px;
}

.yield-bar-fill {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.yield-bar-fill--strong {
  background: var(--evidence-strong);
}

.yield-bar-fill--moderate {
  background: var(--evidence-moderate);
}

.yield-bar-fill--emerging {
  background: var(--evidence-emerging);
}

.yield-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
  min-width: 3.5rem;
  text-align: right;
}

.yield-value--tbd {
  color: var(--gray-400);
  font-weight: 500;
  font-style: italic;
}

/* ── Indication Count ─────────────────────────────────────── */
.indication-count {
  font-size: 0.75rem;
  color: var(--gray-500);
}

/* ── Stats Summary ────────────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  padding: 1.5rem;
  background: var(--blue-50);
  border: 1px solid var(--blue-100);
  border-radius: 0.5rem;
  margin-bottom: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--blue-700);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-600);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-divider {
  width: 1px;
  height: 2.5rem;
  background: var(--blue-100);
}

.stats-note {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--gray-500);
  margin-bottom: 3rem;
  line-height: 1.6;
}

/* ── Evidence Legend ───────────────────────────────────────── */
.evidence-legend {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.evidence-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--gray-600);
}

.evidence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.evidence-dot--strong   { background: var(--evidence-strong); }
.evidence-dot--moderate { background: var(--evidence-moderate); }
.evidence-dot--emerging { background: var(--evidence-emerging); }

/* ── Sidebar (for detail pages, Tasks 6-8) ────────────────── */
.page-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 2rem;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 1.5rem);
}

.sidebar-section {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.75rem;
}

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

.sidebar-list li {
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.8125rem;
  color: var(--gray-700);
}

.sidebar-list li:last-child {
  border-bottom: none;
}

.sidebar-list a {
  color: var(--blue-700);
  text-decoration: none;
  font-size: 0.8125rem;
}

.sidebar-list a:hover {
  text-decoration: underline;
}

.sidebar-badge {
  display: inline-block;
  margin-top: 0.5rem;
}

/* ── Chart Containers ────────────────────────────────────── */
.chart-section {
  margin-bottom: 3rem;
}

.chart-container {
  position: relative;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.chart-container--tall {
  height: 420px;
}

.chart-container--medium {
  height: 320px;
}

.chart-container--short {
  height: 240px;
}

.chart-container--square {
  max-width: 360px;
  margin: 0 auto;
}

.chart-container canvas {
  max-width: 100%;
}

/* ── Mermaid Diagram Containers ──────────────────────────── */
.mermaid-container {
  width: 100%;
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.mermaid-container .mermaid {
  display: flex;
  justify-content: center;
}

/* ── Cost Impact Table ───────────────────────────────────── */
.impact-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 2rem;
}

.impact-table th {
  background: var(--blue-50);
  color: var(--gray-800);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 2px solid var(--blue-100);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.impact-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}

.impact-table tr:hover td {
  background: var(--gray-50);
}

.impact-table .highlight {
  font-weight: 600;
  color: var(--green-600);
}

.impact-table .cost-negative {
  font-weight: 600;
  color: #dc2626;
}

.impact-table .cost-saved {
  font-weight: 700;
  color: var(--green-600);
  font-size: 1rem;
}

/* ── Evidence Table (detail pages) ───────────────────────── */
.evidence-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  margin-bottom: 1.5rem;
}

.evidence-table th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-weight: 600;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.evidence-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: top;
}

.evidence-table tr:hover td {
  background: var(--gray-50);
}

/* ── Responsive Breakpoints ───────────────────────────────── */
@media (max-width: 1024px) {
  .pillar-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .organ-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-with-sidebar {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .chart-container--tall {
    height: 350px;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 2rem 0 2rem;
    margin-bottom: 2rem;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .pillar-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .pillar-card {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
  }

  .pillar-icon {
    margin-bottom: 0;
    font-size: 1.5rem;
  }

  .pillar-desc {
    margin-bottom: 0.25rem;
  }

  .organ-grid {
    grid-template-columns: 1fr;
  }

  .stats-bar {
    flex-direction: column;
    gap: 1rem;
  }

  .stat-divider {
    width: 3rem;
    height: 1px;
  }

  .evidence-legend {
    gap: 0.75rem;
  }

  .chart-container--tall {
    height: 300px;
  }

  .chart-container--medium {
    height: 260px;
  }

  .mermaid-container {
    padding: 1rem;
  }

  .impact-table th,
  .impact-table td,
  .evidence-table th,
  .evidence-table td {
    padding: 0.5rem 0.625rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.5rem;
  }

  .organ-card {
    padding: 1rem;
  }

  .yield-bar {
    min-width: 60px;
  }
}

/* ── Print Styles ─────────────────────────────────────────── */
@media print {
  /* Hide nav, footer, search */
  .site-nav,
  .site-footer,
  #search,
  .nav-toggle {
    display: none !important;
  }

  /* Reset layout */
  body {
    color: #000;
    background: #fff;
    font-size: 11pt;
    line-height: 1.5;
  }

  .site-main {
    padding-top: 0;
    max-width: 100%;
  }

  /* Remove decorative shadows and transitions */
  * {
    box-shadow: none !important;
    transition: none !important;
  }

  /* Cards get borders for clarity */
  .card,
  .pillar-card,
  .organ-card,
  .sidebar-section {
    border: 1px solid #ccc !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  /* Grid goes single column */
  .pillar-grid,
  .organ-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .page-with-sidebar {
    grid-template-columns: 1fr;
  }

  /* Yield bars print as text */
  .yield-bar {
    display: none;
  }

  .yield-value {
    font-weight: bold;
    color: #000;
  }

  /* Evidence badges use text contrast */
  .badge--strong {
    color: #000 !important;
    background: #e0e0e0 !important;
    border: 1px solid #999;
  }

  .badge--moderate {
    color: #000 !important;
    background: #f0f0f0 !important;
    border: 1px solid #999;
  }

  .badge--emerging {
    color: #666 !important;
    background: #f5f5f5 !important;
    border: 1px solid #ccc;
  }

  /* Stats bar is simpler */
  .stats-bar {
    background: #f5f5f5 !important;
    border: 1px solid #ccc !important;
  }

  .stat-number {
    color: #000 !important;
  }

  /* Links show URLs */
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #666;
    font-weight: normal;
  }

  /* But not nav/internal links */
  .pillar-card a[href]::after,
  .organ-card[href]::after,
  .nav-brand[href]::after {
    content: none;
  }

  /* Hero is compact */
  .hero {
    padding: 1rem 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #000;
  }

  .hero-title {
    font-size: 18pt;
  }

  /* Charts, diagrams, and tables */
  .chart-container,
  .mermaid-container {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
  }

  .chart-container canvas {
    max-height: 250px !important;
  }

  .impact-table,
  .evidence-table {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .impact-table th {
    background: #f0f0f0 !important;
  }
}
