/* =========================================
   Base
   ========================================= */

:root {
  --bg: #ffffff;
  --text: #111827;       /* near-black */
  --muted: #4b5563;      /* gray-600 */
  --muted-2: #6b7280;    /* gray-500 */
  --border: #e5e7eb;     /* gray-200 */
  --card: #ffffff;
  --shadow: 0 1px 2px rgba(0,0,0,0.05), 0 8px 24px rgba(0,0,0,0.06);
  --accent: #1f2937;     /* gray-800 */
  --error: #b00020;
  --radius: 14px;
  --maxw: 1120px;
}

* { box-sizing: border-box; }

html, body {
  padding: 0;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

p { margin: 10px 0; }

a { color: inherit; }
a:hover { text-decoration: underline; }

.container {
  width: min(var(--maxw), calc(100% - 40px));
  margin: 0 auto;
}

/* =========================================
   Header (tight hero)
   ========================================= */

.site-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 0 12px;
  background: linear-gradient(180deg, #fafafa 0%, #ffffff 85%);
}

.kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.title {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  max-width: 40ch;
}

.byline {
  margin: 8px 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.byline a {
  color: var(--accent);
  text-decoration: none;
}

.byline a:hover {
  text-decoration: underline;
}

.byline-date {
  
  white-space: nowrap;
}


.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.lede {
  margin-top: 10px;
  color: var(--muted);
  max-width: 90ch;
}

.lede p {
  margin: 8px 0;
}

.lede .summary {
  color: var(--text);
  font-weight: 500;
}

.subsection-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0 10px;
}


/* Header actions (jump links) */


.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

a.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

a.button-link:hover {
  background: #f7f7f7;
  text-decoration: none;
}

a.button-link.primary {
  border-color: #d1d5db;
  background: #111827;
  color: #fff;
}

a.button-link.primary:hover {
  background: #0b1220;
}

/* =========================================
   Quick start (numbered steps; ordered correctly)
   ========================================= */

.quickstart {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  max-width: 90ch;
}

.quickstart h2 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* Default (mobile/normal): single column, clean numbering */
.quickstart ol {
  margin: 0;
  padding-left: 22px;          /* number gutter */
  list-style-position: outside;
  color: var(--muted);
}

.quickstart li {
  margin: 6px 0;
  line-height: 1.45;
}

/* Make the numbers read like “labels” */
.quickstart li::marker {
  font-weight: 700;
  color: var(--text);
}

/* Emphasis within each step */
.quickstart li strong {
  color: var(--text);
  font-weight: 600;
}

/* Wide screens: two columns WITH correct 1->2->3->4 order */
@media (min-width: 860px) {
  .quickstart ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 28px;
    row-gap: 8px;              /* slightly more breathing room than 6px */
    grid-auto-flow: row;       /* ensures left-to-right filling */
  }

  .quickstart li {
    margin: 0;
    break-inside: avoid;
  }
}

/* Optional: slightly tighten on very small screens */
@media (max-width: 420px) {
  .quickstart {
    padding: 10px 12px;
  }

  .quickstart li {
    margin: 5px 0;
  }
}
/* =========================================
   Details / Interact boxes
   ========================================= */

.details {
  margin-top: 10px;
  max-width: 90ch;
}

details.details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}

details.details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
}

details.details > summary::-webkit-details-marker {
  display: none;
}

details.details > summary::after {
  content: "▾";
  float: right;
  color: var(--muted-2);
}

details.details[open] > summary::after {
  content: "▴";
}

details.details .details-body {
  margin-top: 10px;
  color: var(--muted);
}

details.details .details-body p {
  margin: 8px 0;
}

.interact {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--accent);
  background: #fff;
}

/* =========================================
   Section headers (Option A: header strip inside cards)
   ========================================= */

.section-header {
  background: #f3f6fa;              /* very light blue-gray */
  border-left: 4px solid #5c7f8a;   /* muted accent */
  padding: 10px 14px;

  /* Key changes: integrate with card + reduce vertical whitespace */
  margin: -16px -18px 12px;         /* pull to card edges; bottom gap only */
  border-top-left-radius: var(--radius);
  border-top-right-radius: var(--radius);
}

.section-header h2 {
  margin: 0;
  font-size: 18px;
  color: #1f2937;
}


/* =========================================
   Cards / Sections (refined)
   ========================================= */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin: 12px 0;
}

.card-title {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.25;
}

.card-subtitle {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
}

.prose h3 {
  margin: 14px 0 6px;
  font-size: 15px;
}

.prose p, .prose li {
  color: var(--muted);
}

.prose ul {
  margin: 8px 0 0 18px;
}

/* =========================================
   Controls (refined)
   ========================================= */

.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.control { min-width: 0; }

.control label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

select,
button {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

.help {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted-2);
}

.control-wide {
  grid-column: 1 / -1;
}

/* Reset button */

#resetFiltersBtn {
  background: #fff;
  border: 1px solid var(--border);
  cursor: pointer;
  color: var(--text);
}

#resetFiltersBtn:hover {
  background: #f9fafb;
}


/* Bottom actions row in Filters */
.controls-actions {
  display: flex;
  justify-content: flex-end; /* desktop: button on the right */
  margin-top: 4px;
}

.controls-actions #resetFiltersBtn {
  width: auto;              /* don’t stretch across the row on desktop */
  min-width: 220px;
}

#filterStatus {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}


/* Mobile: make the button full-width */
@media (max-width: 520px) {
  .controls-actions {
    justify-content: stretch;
  }
  .controls-actions #resetFiltersBtn {
    width: 100%;
    min-width: 0;
  }
}



/* Responsive controls */
@media (max-width: 920px) {
  .controls-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .controls-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   Plots (balanced)
   ========================================= */

.plot {
  width: 100%;
  min-height: 440px;
}

#chart {
  min-height: 560px;
}

#comparisonChart {
  min-height: 440px;
}

@media (max-width: 520px) {
  .plot { min-height: 380px; }
  #chart { min-height: 460px; }
}

.viz-header {
  margin-bottom: 8px;
}

.viz-footnote {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 12px;
}

.empty-state {
  color: var(--muted);
  font-size: 14px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #fff;
}


/* =========================================
   Errors + Notes
   ========================================= */

.error {
  margin-top: 10px;
  color: var(--error);
  font-weight: 600;
}

.note {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
}

/* =========================================
   Footer
   ========================================= */

.footer {
  margin: 18px 0 34px;
  color: var(--muted-2);
  font-size: 12px;
}

/* Focus states */
select:focus,
button:focus,
a.button-link:focus,
details.details > summary:focus {
  outline: 3px solid rgba(17, 24, 39, 0.25);
  outline-offset: 2px;
}
