/* amoredatus data stories — shared styles. Tokens mirror src/app/globals.css (design system). */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-grouped: #f5f6f4;
  --bg-raised: #ffffff;
  --fill-hover: #eef1ef;
  --material: rgba(255, 255, 255, 0.72);
  --label: #1a1a1a;
  --label-secondary: #5e6762;
  --label-tertiary: #6a726d;
  --separator: #e3e7e4;
  --border-control: #868f8a;
  --accent: #2d6a4f;
  --accent-fill: #2d6a4f;
  --accent-fill-pressed: #1b4332;
  --on-accent: #ffffff;
  --accent-tint: #f0f7f2;
  --accent-tint-border: #b7e4c7;
  --focus-ring: #2d6a4f;
  --data-1: #2d6a4f;
  --data-2: #52b788;
  --data-3: #b7e4c7;
  --data-context: #c9cfcb;
  --shadow-raised: 0 1px 2px rgba(16, 24, 20, 0.04), 0 8px 24px rgba(16, 24, 20, 0.06);
  --shadow-float: 0 12px 40px rgba(16, 24, 20, 0.12);

  --green-900: #1b4332;
  --green-700: #2d6a4f;
  --green-500: #52b788;
  --green-300: #95d5b2;
  --green-200: #b7e4c7;
  --green-50: #f0f7f2;
  --ink-950: #0f0f0f;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 144px;

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 20px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  --width-content: 1120px;
  --width-reading: 680px;
  --height-nav: 60px;
  --blur-material: 20px;

  --font-display: "Passenger Display", var(--font-bodoni), "Didot", Georgia, serif;
  --font-text: var(--font-inter), -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --font-wordmark: var(--font-montserrat), var(--font-inter), sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f0f;
    --bg-grouped: #141414;
    --bg-raised: #1f1f1f;
    --fill-hover: #2a2a2a;
    --material: rgba(15, 15, 15, 0.72);
    --label: #e0e0e0;
    --label-secondary: #a3a3a3;
    --label-tertiary: #888888;
    --separator: #2a2a2a;
    --border-control: #6e6e6e;
    --accent: #95d5b2;
    --accent-fill: #95d5b2;
    --accent-fill-pressed: #b7e4c7;
    --on-accent: #0f0f0f;
    --accent-tint: #17241d;
    --accent-tint-border: #2d6a4f;
    --focus-ring: #95d5b2;
    --data-1: #95d5b2;
    --data-2: #52b788;
    --data-3: #2d6a4f;
    --data-context: #3d423f;
    --shadow-raised: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f0f;
  --bg-grouped: #141414;
  --bg-raised: #1f1f1f;
  --fill-hover: #2a2a2a;
  --material: rgba(15, 15, 15, 0.72);
  --label: #e0e0e0;
  --label-secondary: #a3a3a3;
  --label-tertiary: #888888;
  --separator: #2a2a2a;
  --border-control: #6e6e6e;
  --accent: #95d5b2;
  --accent-fill: #95d5b2;
  --accent-fill-pressed: #b7e4c7;
  --on-accent: #0f0f0f;
  --accent-tint: #17241d;
  --accent-tint-border: #2d6a4f;
  --focus-ring: #95d5b2;
  --data-1: #95d5b2;
  --data-2: #52b788;
  --data-3: #2d6a4f;
  --data-context: #3d423f;
  --shadow-raised: 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.5);
}


/* Font families loaded from Google Fonts in each story page */
:root {
  --font-bodoni: "Bodoni Moda";
  --font-inter: "Inter";
  --font-montserrat: "Montserrat";
}

/* =========================================================
   Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: var(--bg); color: var(--label);
  font-family: var(--font-text); font-size: 17px; line-height: 27px;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: var(--accent-tint-border); color: var(--label); }
button { font: inherit; }
h1, h2, h3, h4, h5 { font-weight: 500; }

.ad-wordmark { font-family: var(--font-wordmark); font-weight: 700; font-size: 18px; line-height: 24px; letter-spacing: 0.02em; color: var(--accent); }
.ad-tagline { font-family: var(--font-wordmark); font-weight: 500; font-size: 12px; line-height: 16px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--label-tertiary); }
.ad-eyebrow { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }

/* ---------- Site nav (matches the main site) ---------- */
.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--height-nav);
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur-material));
  backdrop-filter: saturate(180%) blur(var(--blur-material));
  border-bottom: 1px solid var(--separator);
}
.site-nav-inner { max-width: var(--width-content); height: 100%; margin: 0 auto; padding: 0 var(--space-6); display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.site-brand { display: inline-flex; align-items: center; gap: 10px; }
.site-brand:hover { text-decoration: none; }
.site-brand img { width: 30px; height: 30px; border-radius: 50%; display: block; }
.site-nav-right { display: flex; align-items: center; gap: var(--space-2); }
.site-links { display: flex; gap: var(--space-1); list-style: none; }
.site-links a {
  display: inline-flex; align-items: center; height: 32px; padding: 0 var(--space-3); border-radius: var(--radius-pill);
  font-size: 15px; color: var(--label-secondary); transition: background-color .2s ease-out, color .2s ease-out;
}
.site-links a:hover { background: var(--fill-hover); color: var(--label); text-decoration: none; }
.site-links a[aria-current="page"] { color: var(--accent); font-weight: 500; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px;
  background: none; border: 0; color: var(--label-secondary); border-radius: var(--radius-pill); cursor: pointer;
  transition: background-color .2s ease-out, color .2s ease-out;
}
.icon-btn:hover { background: var(--fill-hover); color: var(--label); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
[data-appearance="dark"] .theme-toggle .icon-sun { display: block; }
[data-appearance="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Story header ---------- */
.header, .hero {
  max-width: var(--width-content); margin: 0 auto; text-align: left;
  padding: calc(var(--height-nav) + var(--space-8)) var(--space-6) var(--space-6);
  background: none; border: 0;
}
.story-back { display: inline-block; font-size: 13px; line-height: 18px; margin-bottom: var(--space-6); }
.header .ad-eyebrow, .hero .ad-eyebrow { margin-bottom: var(--space-3); }
.header h1, .hero h1 {
  font-family: var(--font-display); font-weight: 500; font-size: 56px; line-height: 60px; letter-spacing: -0.01em;
  color: var(--label); margin: 0; max-width: 860px; text-wrap: balance; font-optical-sizing: auto;
}
.header .subtitle, .hero .subtitle {
  font-size: 19px; line-height: 31px; color: var(--label-secondary); max-width: 680px; margin: var(--space-4) 0 0;
}
.story-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin-top: var(--space-5); }
.story-tags li {
  display: inline-flex; align-items: center; height: 28px; padding: 0 var(--space-3); border-radius: var(--radius-pill);
  background: var(--accent-tint); border: 1px solid var(--accent-tint-border); color: var(--accent);
  font-size: 13px; line-height: 18px; font-weight: 500;
}

/* ---------- Section tabs (segmented, sticky under the nav) ---------- */
.nav-slicer, .nav-tabs {
  position: sticky; top: var(--height-nav); z-index: 90;
  display: flex; justify-content: flex-start; flex-wrap: nowrap; overflow-x: auto; gap: var(--space-1);
  max-width: none; margin: 0; padding: var(--space-3) max(var(--space-6), calc((100vw - var(--width-content)) / 2 + var(--space-6)));
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur-material));
  backdrop-filter: saturate(180%) blur(var(--blur-material));
  border-bottom: 1px solid var(--separator); border-top: 0;
  scrollbar-width: none;
}
.nav-slicer::-webkit-scrollbar, .nav-tabs::-webkit-scrollbar { display: none; }
.nav-btn, .nav-tab {
  flex: none; height: 32px; padding: 0 var(--space-4); border-radius: var(--radius-pill);
  border: 0; background: transparent; color: var(--label-secondary);
  font-family: var(--font-text); font-size: 13px; font-weight: 500; line-height: 32px; cursor: pointer;
  transition: background-color .2s ease-out, color .2s ease-out;
}
.nav-btn:hover, .nav-tab:hover { background: var(--fill-hover); color: var(--label); border-color: transparent; }
.nav-btn.active, .nav-tab.active { background: var(--accent-fill); color: var(--on-accent); border-color: transparent; font-weight: 500; }

/* ---------- Sections ---------- */
.section { display: none; max-width: var(--width-content); margin: 0 auto; padding: var(--space-8) var(--space-6) 0; overflow: visible; animation: none; }
.section.active { display: block; }
#genres.section { padding: var(--space-8) var(--space-6) 0; }
.section-title, .genre-section-wrapper .section-title {
  font-family: var(--font-display); font-weight: 500; font-size: 40px; line-height: 46px; color: var(--label);
  margin: 0 0 var(--space-5); padding: 0; border: 0; text-align: left; letter-spacing: 0; text-wrap: balance;
}
.narrative, .genre-narrative {
  background: none; border: 0; padding: 0; border-radius: 0; text-align: left;
  max-width: var(--width-reading); margin: 0 0 var(--space-6);
}
.narrative p, .genre-narrative { font-size: 19px; line-height: 31px; color: var(--label); }
.narrative strong, .genre-narrative strong { font-weight: 600; color: var(--label); }

.context-note {
  background: var(--bg-grouped); border: 0; border-radius: var(--radius-m);
  padding: var(--space-4) var(--space-5); margin: 0 0 var(--space-3); max-width: var(--width-reading);
  font-size: 15px; line-height: 22px; color: var(--label-secondary);
}
.context-note strong { color: var(--label); font-weight: 600; }
.context-note + :not(.context-note) { margin-top: var(--space-6); }

/* ---------- Stats ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-5); margin: var(--space-6) 0 var(--space-7); }
.stat-cards.centered-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
.stat-card {
  background: none; border: 0; border-top: 1px solid var(--separator); border-radius: 0;
  padding: var(--space-4) 0 0; text-align: left; box-shadow: none; transform: none;
}
.stat-card:hover { transform: none; border-color: var(--separator); }
.stat-card .value, .stat-card.negative .value, .stat-card.warning .value {
  font-family: var(--font-display); font-weight: 500; font-size: 48px; line-height: 52px; color: var(--label);
  font-variant-numeric: lining-nums; margin: 0; letter-spacing: 0;
}
.stat-card .label { margin-top: var(--space-2); font-size: 15px; line-height: 22px; color: var(--label-secondary); }
.stat-card-tooltip { position: relative; cursor: help; }
.stat-card-tooltip .label::after { content: " ⓘ"; color: var(--label-tertiary); }
.stat-card-tooltip .tooltip-content {
  visibility: hidden; opacity: 0; position: absolute; bottom: calc(100% + 10px); left: 0;
  background: var(--bg-raised); border: 1px solid var(--separator); border-radius: var(--radius-m);
  box-shadow: var(--shadow-float); padding: var(--space-4); min-width: 240px; z-index: 200;
  transition: opacity .2s ease-out, visibility .2s ease-out; transform: none;
}
.stat-card-tooltip .tooltip-content::after { display: none; }
.stat-card-tooltip:hover .tooltip-content, .stat-card-tooltip:focus-within .tooltip-content { visibility: visible; opacity: 1; }
.tooltip-content h5 { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: var(--space-3); }
.tooltip-breakdown { display: flex; flex-direction: column; gap: 6px; }
.tooltip-row { display: flex; justify-content: space-between; gap: var(--space-4); font-size: 13px; line-height: 18px; }
.tooltip-row .category { color: var(--label-secondary); }
.tooltip-row .amount { color: var(--label); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Figures ---------- */
.chart-container {
  background: var(--bg-raised); border: 1px solid var(--separator); border-radius: var(--radius-l);
  padding: var(--space-5); margin: 0 0 var(--space-5); width: 100%; overflow: hidden;
}
.chart-title { font-family: var(--font-text); font-size: 17px; line-height: 24px; font-weight: 600; color: var(--label); margin: 0 0 var(--space-3); letter-spacing: 0; }
.chart-wrapper { width: 100%; height: 400px; }
.chart-container .chart-div { width: 100%; }
#neighborhood-map { height: 500px !important; min-height: 500px; border-radius: var(--radius-m); overflow: hidden; }
#neighborhood-map .js-plotly-plot, #neighborhood-map .plot-container, #neighborhood-map .svg-container { width: 100% !important; height: 100% !important; }
.chart-row { display: flex; gap: var(--space-5); margin-bottom: var(--space-5); width: 100%; }
.chart-row .chart-container { margin-bottom: 0; }
.chart-row .chart-container.narrow { flex: 1; min-width: 0; }
.chart-row .chart-container.wide { flex: 2; min-width: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-5); margin: 0 0 var(--space-5); }
.two-col .chart-container, .two-col .insight-box { margin: 0; }
.chart-note { font-size: 13px; line-height: 18px; color: var(--label-tertiary); margin: var(--space-2) 0 0; }

/* ---------- Callouts ---------- */
.insight-box, .insight-box.negative {
  background: var(--accent-tint); border: 1px solid var(--accent-tint-border); border-radius: var(--radius-l);
  padding: var(--space-5); margin: var(--space-5) 0;
}
.insight-box h4, .insight-box.negative h4 { font-family: var(--font-text); font-size: 17px; line-height: 24px; font-weight: 600; color: var(--accent); margin: 0 0 var(--space-2); display: block; }
.insight-box p { font-size: 17px; line-height: 27px; color: var(--label); }
.insight-box strong { font-weight: 600; }

/* The one sentence to remember: a pull quote, not a box */
.takeaway {
  background: none; border: 0; border-top: 1px solid var(--separator); border-radius: 0;
  padding: var(--space-7) 0 0; margin: var(--space-8) 0 0; text-align: left; color: var(--label);
}
.takeaway h3 { font-family: var(--font-text); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--space-4); }
.takeaway p {
  font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 32px; line-height: 42px;
  color: var(--label); max-width: 860px; margin: 0; text-wrap: balance;
}
.takeaway p strong { font-weight: 500; color: var(--accent); }

/* ---------- Action rows ---------- */
.action-list, .action-cards { display: grid; gap: var(--space-3); margin: var(--space-6) 0 0; grid-template-columns: 1fr; }
.action-card {
  display: grid; grid-template-columns: 1fr auto; gap: var(--space-3) var(--space-6); align-items: center;
  background: var(--bg-raised); border: 1px solid var(--separator); border-radius: var(--radius-l); padding: var(--space-5);
}
.action-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 30px; color: var(--label); margin: 0 0 var(--space-2); }
.action-card p { font-size: 15px; line-height: 22px; color: var(--label-secondary); }
.action-card p + p { margin-top: var(--space-2); color: var(--label-tertiary); font-size: 13px; line-height: 18px; }
.ad-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 44px; padding: 0 var(--space-5);
  border-radius: var(--radius-pill); border: 1px solid transparent; font-size: 15px; font-weight: 500; white-space: nowrap;
  transition: background-color .2s ease-out;
}
.ad-btn:hover { text-decoration: none; }
.ad-btn-filled { background: var(--accent-fill); color: var(--on-accent); }
.ad-btn-filled:hover { background: var(--accent-fill-pressed); }
.ad-btn-tinted { background: var(--accent-tint); color: var(--accent); border-color: var(--accent-tint-border); }
.ad-btn-tinted:hover { background: var(--fill-hover); }

/* ---------- Spotify genre cards ---------- */
.genre-badges-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); margin-bottom: var(--space-5); }
.genre-card {
  background: var(--bg-raised); border: 1px solid var(--separator); border-radius: var(--radius-m);
  padding: var(--space-4); text-align: left; cursor: default;
  transition: opacity .2s ease-out, border-color .2s ease-out, box-shadow .2s ease-out, transform .2s ease-out;
}
.genre-card.pop, .genre-card.rap, .genre-card.rock, .genre-card.latin, .genre-card.rb, .genre-card.edm { border-left-width: 1px; }
.genre-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-raised); border-color: var(--separator); }
.genre-card.highlighted { transform: translateY(-2px); box-shadow: var(--shadow-raised); border-color: var(--accent); }
.genre-card.dimmed { opacity: 0.35; }
.genre-card .value { display: flex; align-items: center; gap: var(--space-2); font-family: var(--font-display); font-weight: 500; font-size: 24px; line-height: 30px; color: var(--label); margin-bottom: var(--space-1); }
.genre-card .label { font-size: 13px; line-height: 18px; color: var(--label-secondary); }
.genre-swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.genre-charts-row { display: flex; gap: var(--space-5); }
.genre-charts-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-5); }
.genre-charts-right { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.genre-charts-row .chart-container { margin: 0; }
.genre-charts-right .chart-container { flex: 1; }

/* ---------- Footer ---------- */
.footer {
  max-width: var(--width-content); margin: var(--space-9) auto 0; padding: var(--space-6);
  border-top: 1px solid var(--separator); background: none; text-align: left;
  font-size: 13px; line-height: 18px; color: var(--label-tertiary);
}
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-4); }
.footer p { margin: 0; }
.footer p + p { margin-top: var(--space-2); }
.footer a { color: var(--label-secondary); }
.footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stat-cards, .stat-cards.centered-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-row, .genre-charts-row { flex-direction: column; }
  .genre-badges-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .site-nav-inner { padding: 0 var(--space-4); }
  .site-links { display: none; }
  .header, .hero { padding: calc(var(--height-nav) + var(--space-7)) var(--space-4) var(--space-5); }
  .header h1, .hero h1 { font-size: 40px; line-height: 44px; }
  .nav-slicer, .nav-tabs { padding: var(--space-2) var(--space-4); }
  .section, #genres.section { padding: var(--space-7) var(--space-4) 0; }
  .section-title, .genre-section-wrapper .section-title { font-size: 32px; line-height: 38px; }
  .narrative p, .genre-narrative { font-size: 18px; line-height: 29px; }
  .stat-card .value, .stat-card.negative .value, .stat-card.warning .value { font-size: 40px; line-height: 44px; }
  .two-col { grid-template-columns: 1fr; }
  .chart-container { padding: var(--space-4); }
  .action-card { grid-template-columns: 1fr; }
  .action-card .ad-btn { justify-self: start; }
  .takeaway p { font-size: 26px; line-height: 34px; }
  .genre-badges-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer { padding: var(--space-5) var(--space-4); }
}
@media (max-width: 500px) {
  .stat-cards, .stat-cards.centered-3 { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
