/* ─────────────────────────────────────────────────
   California Clemency Dashboard — Design System
   ───────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Colors */
  --bg:            #F7F6F1;
  --bg-card:       #FFFFFF;
  --bg-header:     #1A2B4A;
  --bg-section-alt:#EFF3F8;

  --gold:          #C8952A;
  --gold-light:    #F5DFA0;
  --teal:          #0E7490;
  --teal-light:    #CFFAFE;

  --text-primary:  #1C1C1E;
  --text-secondary:#6B7280;
  --text-muted:    #9CA3AF;
  --text-on-dark:  #F1F5F9;

  --border:        #E5E7EB;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:     0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg:     0 12px 32px rgba(0,0,0,0.12);

  /* Data Series */
  --color-pardons:       #2563EB;
  --color-commutations:  #059669;
  --color-reprieves:     #D97706;
  --color-denied:        #DC2626;
  --color-applications:  #6366F1;

  /* Race palette */
  --race-white:    #3B82F6;
  --race-hispanic: #10B981;
  --race-black:    #8B5CF6;
  --race-asian:    #F59E0B;
  --race-other:    #9CA3AF;

  /* Layout */
  --max-width:     1280px;
  --section-pad:   80px 24px;
  --card-radius:   12px;
  --nav-height:    60px;

  /* Typography */
  --font:          'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }

/* ── Layout helpers ── */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Navigation ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-header);
  height: var(--nav-height);
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.nav .container {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav .container::-webkit-scrollbar { display: none; }
.nav-link {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  white-space: nowrap;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.nav-link:hover  { color: #fff; background: rgba(255,255,255,0.12); }
.nav-link.active { color: var(--bg-header); background: var(--gold); font-weight: 600; }

/* ── Hero ── */
.hero {
  background: var(--bg-header);
  padding: 72px 24px 80px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 70% 50%, rgba(200,149,42,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 10% 80%, rgba(14,116,144,0.12) 0%, transparent 50%);
}
.hero .container { position: relative; }
.hero-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 800;
  color: var(--text-on-dark);
  line-height: 1.15;
  max-width: 700px;
  margin-bottom: 20px;
}
.hero h1 span { color: var(--gold); }
.hero-sub {
  font-size: 17px;
  color: rgba(255,255,255,0.65);
  max-width: 560px;
  margin-bottom: 56px;
  line-height: 1.7;
}
.hero-stats {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}
.hero-stat-item {}
.hero-stat-value {
  font-size: clamp(40px, 6vw, 64px);
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.hero-stat-label {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  font-weight: 500;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Sections ── */
section {
  padding: var(--section-pad);
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
section.visible { opacity: 1; transform: none; }
section:nth-child(even) { background: var(--bg-section-alt); }

.section-header { margin-bottom: 40px; }
.section-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.section-title {
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.25;
}
.section-question {
  font-size: 15px;
  color: var(--text-secondary);
  font-style: italic;
  margin-bottom: 16px;
}
.section-answer {
  font-size: 15px;
  color: var(--text-primary);
  background: #EEF4FF;
  border-left: 3px solid var(--color-pardons);
  padding: 14px 18px;
  border-radius: 0 8px 8px 0;
  max-width: 720px;
  line-height: 1.7;
  margin-top: 24px;
}
.section-answer strong { color: var(--color-pardons); }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 24px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* ── Chart wrappers ── */
.chart-wrapper {
  position: relative;
  width: 100%;
}
.chart-wrapper canvas { width: 100% !important; }
.chart-tall  .chart-wrapper { height: 340px; }
.chart-short .chart-wrapper { height: 260px; }
.chart-wide  .chart-wrapper { height: 400px; }

/* ── KPI cards (small callout stats) ── */
.kpi-card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}
.kpi-note {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}
.kpi-blue   .kpi-value { color: var(--color-pardons); }
.kpi-green  .kpi-value { color: var(--color-commutations); }
.kpi-amber  .kpi-value { color: var(--color-reprieves); }
.kpi-purple .kpi-value { color: var(--race-black); }

/* ── Case study cards ── */
.case-card {
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.case-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.case-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}
.case-type-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-pardon   { background: #DBEAFE; color: #1E40AF; }
.badge-reprieve { background: #FEF3C7; color: #92400E; }
.badge-commutation { background: #D1FAE5; color: #065F46; }
.case-offense {
  font-size: 13px;
  color: var(--text-secondary);
}
.case-key-factor {
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.5;
}
.case-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.case-tag {
  font-size: 11px;
  background: var(--bg-section-alt);
  color: var(--text-secondary);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}
.case-years {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.case-years strong { color: var(--gold); font-size: 18px; font-weight: 700; }

/* ── Policy event timeline ── */
.policy-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  margin-top: 32px;
}
.policy-timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.policy-event {
  display: flex;
  gap: 20px;
  padding: 0 0 28px 52px;
  position: relative;
}
.policy-event::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 5px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 3px var(--gold-light);
}
.policy-year {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold);
  flex-shrink: 0;
  line-height: 1.2;
}
.policy-label { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.policy-detail { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

/* ── Estimate disclaimer ── */
.estimate-note {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.estimate-note::before { content: '* '; font-style: normal; }

/* ── Map section ── */
#geography { padding: 80px 0; }
#geography .container { padding: 0 24px; }
.map-container {
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
}
#map-svg { width: 100%; height: 480px; }
.map-tooltip {
  position: fixed;
  background: rgba(26, 43, 74, 0.95);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  pointer-events: none;
  display: none;
  z-index: 9999;
  box-shadow: var(--shadow-md);
  min-width: 160px;
}
.map-tooltip strong { display: block; font-size: 14px; margin-bottom: 4px; }

/* ── Community impact ── */
.community-stat {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  background: var(--bg-card);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.community-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #EEF4FF;
  color: var(--color-pardons);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.community-value { font-size: 24px; font-weight: 800; color: var(--color-pardons); }
.community-label { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ── Footer ── */
.footer {
  background: var(--bg-header);
  color: rgba(255,255,255,0.5);
  padding: 40px 24px;
  font-size: 13px;
  line-height: 1.7;
}
.footer a { color: rgba(255,255,255,0.7); }
.footer-title { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.8); margin-bottom: 8px; }
.footer-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 40px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid     { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  :root { --section-pad: 56px 16px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero-stats { gap: 32px; }
  .footer-grid { grid-template-columns: 1fr; }
  section { opacity: 1; transform: none; } /* disable animation on mobile */
  .chart-wide .chart-wrapper { height: 300px; }
}

/* ── Utility ── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
