/* ============================================================
   patchwindow.com — shared styles
   Dark blue-charcoal theme · teal/blue accents · Inter + JetBrains Mono
   ============================================================ */

/* ----- Reset / base ----- */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss03';
}

:root {
  /* Surface palette */
  --bg:           #0a0e1a;          /* page background */
  --bg-elev-1:   #0f1422;           /* subtle elevation, e.g. footer */
  --card:         #111827;          /* cards, tables */
  --card-hover:  #161f33;
  --border:       #1f2937;          /* default border / divider */
  --border-soft: #1a2334;

  /* Text */
  --text:         #e5e7eb;          /* body */
  --text-muted:  #9ca3af;
  --text-dim:    #6b7280;

  /* Accents */
  --teal:         #14b8a6;          /* primary accent */
  --teal-dim:    #0d9488;
  --teal-glow:   rgba(20, 184, 166, 0.15);
  --blue:         #3b82f6;          /* secondary accent */
  --blue-dim:    #2563eb;
  --blue-glow:   rgba(59, 130, 246, 0.15);

  /* Semantic */
  --warn:         #f59e0b;
  --danger:       #ef4444;
  --ok:           #14b8a6;

  /* Fonts */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Rhythm */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-4: 16px;
  --r-5: 24px;
  --r-6: 32px;
  --r-7: 48px;
  --r-8: 64px;

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

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow:    0 4px 12px rgba(0,0,0,0.35);

  --container: 1280px;
}

::selection { background: var(--teal-glow); color: #fff; }

/* ----- Typography ----- */

h1, h2, h3, h4, h5 { font-family: var(--font-sans); color: #f3f4f6; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: clamp(28px, 3.6vw, 40px); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(20px, 2.2vw, 26px); font-weight: 600; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; color: var(--text); }

p { margin: 0 0 1em 0; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--teal);
  text-decoration: none;
  transition: color 120ms ease;
}
a:hover { color: var(--blue); }
a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; border-radius: 2px; }

code, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-weight: 400;
}

.mono-tight { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ----- Layout primitives ----- */

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--r-5);
}

.section { padding: var(--r-7) 0; }
.section-sm { padding: var(--r-5) 0; }

.lede {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 70ch;
  line-height: 1.6;
}

.muted { color: var(--text-muted); }
.dim   { color: var(--text-dim); }
.small { font-size: 13px; }
.tiny  { font-size: 12px; }

.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: var(--r-2);
}

/* ----- Header ----- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 26, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: var(--r-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f3f4f6;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand:hover { color: #fff; }

.brand-mark {
  width: 26px; height: 26px;
  position: relative;
  display: inline-grid;
  place-items: center;
}
.brand-mark svg { width: 100%; height: 100%; display: block; }

.nav {
  display: flex;
  gap: var(--r-4);
  align-items: center;
}
.nav a {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
  transition: color 120ms ease, background 120ms ease;
}
.nav a:hover { color: var(--text); background: var(--card); }
.nav a.active {
  color: var(--teal);
  background: var(--teal-glow);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav {
    position: absolute;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--r-3) var(--r-5);
    gap: 4px;
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; }
  .nav-toggle { display: inline-flex; }
}

/* ----- Hero ----- */

.hero {
  padding: var(--r-8) 0 var(--r-7);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--teal-glow) 0%, transparent 65%);
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -300px; left: -200px;
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--blue-glow) 0%, transparent 65%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero h1 { max-width: 18ch; margin-bottom: var(--r-3); }
.hero .lede { margin-bottom: var(--r-5); }

/* Dashboard hero variant — wider text container so the new headline
   doesn't wrap mid-phrase and the lede paragraph fits on three lines. */
.hero.hero-wide h1 {
  max-width: none;
}
.hero.hero-wide .lede {
  max-width: 78ch;
}

/* Brand emphasis within the hero headline */
.brand-emph {
  color: var(--teal);
  font-weight: inherit;
}

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: var(--r-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.hero-meta .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px var(--teal);
}

/* ----- Cards ----- */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--r-5);
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}
.card:hover { border-color: var(--border-soft); }

.card-tight { padding: var(--r-4); }

.card h3 { margin-bottom: var(--r-2); }

/* ----- Stat tiles ----- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--r-4);
}
.stat-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.stat-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 1100px) {
  .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .stat-grid-3 { grid-template-columns: 1fr; }
  .stat-grid-4 { grid-template-columns: 1fr; }
}

.stat {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--r-5);
  color: inherit;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 3px; height: 100%;
  background: var(--teal);
  opacity: 0;
  transition: opacity 150ms ease;
}
a.stat:hover { border-color: var(--teal); transform: translateY(-1px); }
a.stat:hover::before { opacity: 1; }
.stat.accent-blue::before { background: var(--blue); }
a.stat.accent-blue:hover { border-color: var(--blue); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--r-2);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 500;
  color: #f3f4f6;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: var(--r-2);
}
.stat-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  line-height: 1.4;
}
.stat-sub .arrow {
  color: var(--teal);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  height: 1em;
  position: relative;
  top: -1px;
}
.stat.accent-blue .stat-sub .arrow { color: var(--blue); }

/* ----- Chart cards ----- */

.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--r-4);
}
@media (max-width: 900px) {
  .viz-grid { grid-template-columns: 1fr; }
}

/* Full-width vertical stack of charts (dashboard) */
.viz-stack {
  display: flex;
  flex-direction: column;
  gap: var(--r-4);
}

.viz {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--r-5);
  position: relative;
}
.viz-head { margin-bottom: var(--r-4); }
.viz-head h3 { margin-bottom: 4px; }
.viz-head p { font-size: 13px; color: var(--text-muted); margin: 0; }

.viz-body { min-height: 448px; }
.viz-body.tall { min-height: 448px; }

/* Key-insight line, bottom-left of each chart card */
.viz-insight {
  margin-top: var(--r-3);
  padding-right: 140px; /* leave room for the watermark on the right */
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
.viz-insight strong {
  color: #f3f4f6;
  font-weight: 600;
}

/* Watermark for full-width dashboard charts */
.viz-stack .viz::after {
  content: 'patchwindow.com';
  position: absolute;
  right: var(--r-5);
  bottom: var(--r-5);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

/* ----- Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--teal);
  color: #042f2e;
  font-weight: 600;
}
.btn-primary:hover { background: #2dd4bf; color: #042f2e; }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal); background: var(--card); }

/* ----- Footer ----- */

.site-footer {
  margin-top: var(--r-8);
  border-top: 1px solid var(--border);
  background: var(--bg-elev-1);
  padding: var(--r-6) 0;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: var(--r-5);
}
@media (max-width: 720px) {
  .footer-inner { grid-template-columns: 1fr; }
}
.footer-inner .footer-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}
.footer-inner .footer-cta h4 { align-self: flex-end; }
.linkedin-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.linkedin-btn:hover {
  border-color: var(--teal);
  color: #f3f4f6;
  background: var(--card-hover);
}
.linkedin-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.footer-inner h4 {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: var(--r-3);
  font-weight: 500;
}
.footer-inner ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer-inner ul a { color: var(--text-muted); }
.footer-inner ul a:hover { color: var(--teal); }

.footer-fine {
  margin-top: var(--r-5);
  padding-top: var(--r-4);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

/* ----- Snapshot tables (static HTML, used on snapshots page) ----- */

.snapshot-table-wrap {
  overflow-x: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--r-5);
}

/* Indent snapshot section headings (KEV catalog growth, Time-to-exploit etc.)
   so they line up with the table content inside the card, rather than the
   card's outer edge. The card padding is var(--r-4) = 16px. */
.snapshot-section-head {
  padding-left: var(--r-4);
}

.snapshot-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.snapshot-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.015);
  white-space: nowrap;
}
.snapshot-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}
.snapshot-table tbody tr:last-child td { border-bottom: none; }
.snapshot-table tbody tr:hover td { background: var(--card-hover); }
.snapshot-table td.year { color: #f3f4f6; }
.snapshot-table td.dim  { color: var(--text-dim); }
.snapshot-table .pct-cell {
  position: relative;
}
.snapshot-table .pct-bar {
  display: inline-block;
  height: 4px;
  background: var(--teal);
  border-radius: 2px;
  margin-left: 10px;
  vertical-align: middle;
  opacity: 0.7;
}

/* ----- Database page ----- */

.db-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--r-3);
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--r-4);
  margin-bottom: var(--r-4);
}
.db-toolbar .input,
.db-toolbar select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 7px;
  font-family: var(--font-sans);
  font-size: 14px;
  min-width: 160px;
  outline: none;
  transition: border-color 120ms ease;
}
.db-toolbar .input:focus,
.db-toolbar select:focus { border-color: var(--teal); }
.db-toolbar .input { flex: 1; min-width: 240px; }
.db-toolbar .toolbar-right {
  margin-left: auto;
  display: flex;
  gap: var(--r-2);
  align-items: center;
}
.db-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* ----- Tabulator dark theme override ----- */

.tabulator,
.tabulator .tabulator-tableholder,
.tabulator .tabulator-tableholder .tabulator-table {
  background: var(--card) !important;
  background-color: var(--card) !important;
}

.tabulator {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
}
.tabulator-header {
  background: var(--card) !important;
  background-color: var(--card) !important;
  border-bottom: 1px solid var(--border);
}
.tabulator-col {
  background: transparent !important;
  border-right: 1px solid var(--border-soft);
  color: #f3f4f6;
}
.tabulator-col-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f3f4f6;
  padding: 10px 12px;
}
.tabulator-col.tabulator-sortable .tabulator-col-title { cursor: pointer; }
.tabulator-col.tabulator-sortable:hover { background: var(--card-hover) !important; }
.tabulator-col .tabulator-arrow {
  border-bottom-color: var(--text-muted) !important;
  border-top-color: var(--text-muted) !important;
}
.tabulator-col[aria-sort="ascending"] .tabulator-arrow,
.tabulator-col[aria-sort="descending"] .tabulator-arrow {
  border-bottom-color: var(--teal) !important;
  border-top-color: var(--teal) !important;
}

.tabulator-row {
  background: var(--card) !important;
  background-color: var(--card) !important;
  border-bottom: 1px solid var(--border-soft) !important;
  color: var(--text) !important;
  min-height: 38px !important;
}
.tabulator-row.tabulator-row-even {
  background: var(--card) !important;
  background-color: var(--card) !important;
}
.tabulator-row:hover {
  background: var(--card-hover) !important;
  background-color: var(--card-hover) !important;
  cursor: pointer;
}
.tabulator-row.row-expanded { background: rgba(20, 184, 166, 0.04) !important; }
.tabulator-cell {
  border-right: 1px solid var(--border-soft) !important;
  padding: 9px 12px !important;
  font-variant-numeric: tabular-nums;
}
.tabulator-cell.mono { font-family: var(--font-mono); }

.tabulator-header-filter input,
.tabulator-header-filter select {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  padding: 5px 8px !important;
  font-size: 12px !important;
  border-radius: 5px !important;
  font-family: var(--font-mono) !important;
  width: 100%;
}
.tabulator-header-filter input:focus,
.tabulator-header-filter select:focus { border-color: var(--teal) !important; outline: none; }

/* Center the 'All' placeholder in Year and Confidence filter inputs */
.tabulator-col[tabulator-field="cve_year"] .tabulator-header-filter input,
.tabulator-col[tabulator-field="confidence"] .tabulator-header-filter input {
  text-align: center !important;
}

.tabulator-footer {
  background: var(--bg-elev-1) !important;
  border-top: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 14px !important;
}
.tabulator-paginator label { color: var(--text-muted) !important; }
.tabulator-page {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: 5px !important;
  padding: 4px 10px !important;
  margin: 0 2px !important;
}
.tabulator-page.active {
  background: var(--teal) !important;
  border-color: var(--teal) !important;
  color: #042f2e !important;
}
.tabulator-page:not(.disabled):hover {
  background: var(--card-hover) !important;
  color: var(--text) !important;
}

/* Tabulator drop-down menu (column filter selects) — keep visible on dark */
.tabulator-edit-list,
.tabulator-edit-select-list {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: var(--font-sans);
  font-size: 13px;
}
.tabulator-edit-list-item,
.tabulator-edit-select-list-item {
  color: var(--text) !important;
  padding: 6px 12px !important;
}
.tabulator-edit-list-item.active,
.tabulator-edit-select-list-item.active,
.tabulator-edit-list-item:hover,
.tabulator-edit-select-list-item:hover {
  background: var(--card-hover) !important;
  color: var(--teal) !important;
}

/* Expanded row detail panel */
.row-detail {
  background: var(--bg-elev-1);
  border-top: 1px solid var(--border);
  padding: var(--r-4) var(--r-4) var(--r-4) calc(var(--r-4) + 8px);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.row-detail dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px var(--r-4);
  margin: 0;
}
.row-detail dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-top: 2px;
}
.row-detail dd { margin: 0; color: var(--text); }
.row-detail dd.notes { line-height: 1.6; }
.row-detail a { word-break: break-all; }

/* CVE / vendor badges in table */
.cve-link {
  font-family: var(--font-mono);
  font-weight: 500;
  color: #f3f4f6;
}
.tabulator-row:hover .cve-link { color: var(--blue); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  white-space: nowrap;
  line-height: 1.6;
}
.badge-high   { background: rgba(20, 184, 166, 0.12); color: #5eead4; }
.badge-medium { background: rgba(59, 130, 246, 0.12); color: #93c5fd; }
.badge-low    { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; }
.badge-zd     { background: rgba(239, 68, 68, 0.12);  color: #fca5a5; }
.badge-pre    { background: rgba(245, 158, 11, 0.12); color: #fcd34d; }

/* ----- Apex tooltip override (dark theme) ----- */
.apexcharts-tooltip.apexcharts-theme-dark.patchwindow-tip {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5) !important;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.apexcharts-tooltip-title {
  background: rgba(255,255,255,0.03) !important;
  border-bottom: 1px solid var(--border) !important;
  color: var(--text-muted) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.apexcharts-xaxistooltip, .apexcharts-yaxistooltip {
  background: var(--card) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
}

/* ----- Methodology / Insights pages ----- */

.prose {
  max-width: 72ch;
}
/* Methodology page uses the full available width to reduce side-skewing */
.prose-wide {
  max-width: 100ch;
}
.methodology-hero .lede {
  max-width: 100ch;
}
.prose p { color: var(--text); line-height: 1.7; }
.prose h2 { margin-top: var(--r-6); margin-bottom: var(--r-3); }
.prose h3 { margin-top: var(--r-5); margin-bottom: var(--r-2); color: var(--teal); }
.prose ul, .prose ol {
  padding-left: 1.4em;
  margin: 0 0 1em 0;
}
.prose ul li, .prose ol li { margin-bottom: 0.4em; }
.prose code {
  background: var(--card);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}
.prose blockquote {
  border-left: 3px solid var(--teal);
  padding: 4px 0 4px 16px;
  margin: var(--r-3) 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ----- Insights cards ----- */

.insight-grid {
  display: flex;
  flex-direction: column;
  gap: var(--r-4);
}
.insight-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--r-5);
  position: relative;
  overflow: hidden;
}
.insight-card .placeholder-tag {
  position: absolute;
  top: var(--r-3);
  right: var(--r-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 2px 8px;
  border: 1px dashed var(--border);
  border-radius: 4px;
}
.insight-card h3 { margin-bottom: var(--r-2); }
.insight-card p { color: var(--text-muted); font-size: 14px; }

/* Expanded "article" variant: full prose, embedded charts */
.insight-card.is-article {
  padding: var(--r-6);
}
.insight-card.is-article h3 {
  font-size: 24px;
  margin-bottom: var(--r-2);
}
.insight-card.is-article .article-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: var(--r-2);
}
.insight-card.is-article p {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: var(--r-3);
}
.insight-card.is-article p.muted-note {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}
.insight-card.is-article .article-chart {
  margin: var(--r-5) 0;
  padding: var(--r-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.insight-card.is-article .article-chart-head h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.insight-card.is-article .article-chart-head p {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--r-3);
}
.insight-card.is-article .article-chart-body {
  min-height: 392px;
}

/* ----- Misc ----- */

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: var(--r-2); }
.gap-3 { gap: var(--r-3); }
.gap-4 { gap: var(--r-4); }
.gap-5 { gap: var(--r-5); }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.text-right { text-align: right; }
.mt-3 { margin-top: var(--r-3); }
.mt-4 { margin-top: var(--r-4); }
.mt-5 { margin-top: var(--r-5); }
.mt-6 { margin-top: var(--r-6); }
.mb-3 { margin-bottom: var(--r-3); }
.mb-4 { margin-bottom: var(--r-4); }
.mb-5 { margin-bottom: var(--r-5); }

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--r-6) 0;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--r-4);
  margin-bottom: var(--r-5);
  flex-wrap: wrap;
}
.section-head h2 { margin-bottom: 4px; }
.section-head p { color: var(--text-muted); font-size: 14px; margin: 0; max-width: 60ch; }

.kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* ----- Print: behave reasonably if someone prints ----- */
@media print {
  .site-header, .site-footer, .db-toolbar { display: none; }
  body { background: #fff; color: #000; }
  .card, .stat, .snapshot-table-wrap { border-color: #ccc; background: #fff; }
}
