/* People Map GA: base.css
   Tokens, reset, typography, motion primitives, focus, accessibility.
   Visual identity: Atlanta civic soul meets clear public information.
*/

:root {
  /* Brand palette */
  --color-primary: #2F6B3D;      /* deep civic green */
  --color-primary-700: #245430;
  --color-primary-300: #8FBE96;
  --color-secondary: #6FAF73;    /* mid green */
  --color-bg: #F8F7F2;           /* warm cream */
  --color-surface: #FFFFFF;
  --color-surface-2: #F1EFE7;
  --color-accent: #F2B38D;       /* restrained peach */
  --color-accent-soft: #FBE6D6;
  --color-ink: #1E2320;
  --color-ink-soft: #2C332E;
  --color-muted: #667167;
  --color-line: #DCD8CC;
  --color-line-strong: #BFBBAE;
  --color-focus: #2F6B3D;
  --color-danger: #B5443A;

  /* Layered map / panel tints */
  --map-land: #EFE9DB;
  --map-stroke: #C8C2B2;
  --map-route: #2F6B3D;
  --map-route-soft: #6FAF73;
  --map-dot: #2F6B3D;
  --map-grid: rgba(30, 35, 32, 0.06);

  /* Typography */
  --font-display: "Fraunces", "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-body: "Inter", "Helvetica Neue", Arial, system-ui, -apple-system, sans-serif;

  --text-xs: 0.78rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.375rem;
  --text-4xl: 3rem;
  --text-hero: 3.75rem;

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.55;
  --leading-relaxed: 1.7;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius / elevation */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(30, 35, 32, 0.06);
  --shadow-md: 0 6px 18px -8px rgba(30, 35, 32, 0.18), 0 2px 4px rgba(30, 35, 32, 0.06);
  --shadow-lg: 0 18px 40px -16px rgba(30, 35, 32, 0.22);

  /* Motion */
  --ease-standard: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 420ms;

  /* Layout */
  --content-max: 1180px;
  --header-h: 68px;
}

/* Dark theme override */
:root.theme-dark {
  --color-primary: #8FBE96;
  --color-primary-700: #6FAF73;
  --color-primary-300: #2F6B3D;
  --color-secondary: #6FAF73;
  --color-bg: #14171A;
  --color-surface: #1B1F1D;
  --color-surface-2: #232826;
  --color-accent: #F2B38D;
  --color-accent-soft: #3A2E25;
  --color-ink: #ECECE6;
  --color-ink-soft: #D6D6CF;
  --color-muted: #9BA59C;
  --color-line: #2C3330;
  --color-line-strong: #3D4641;

  --map-land: #232826;
  --map-stroke: #3D4641;
  --map-route: #8FBE96;
  --map-route-soft: #6FAF73;
  --map-dot: #8FBE96;
  --map-grid: rgba(236, 236, 230, 0.06);

  --shadow-md: 0 6px 18px -8px rgba(0,0,0,0.5), 0 2px 4px rgba(0,0,0,0.3);
  --shadow-lg: 0 18px 40px -16px rgba(0,0,0,0.55);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body, h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding-left: 1.1rem; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--color-primary); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:root.theme-dark a { color: var(--color-primary-300); }

/* Base */
body {
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--color-ink);
  background-color: var(--color-bg);
  background-image:
    radial-gradient(1200px 600px at 88% -120px, rgba(242, 179, 141, 0.18), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(111, 175, 115, 0.10), transparent 65%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 480;
  line-height: var(--leading-tight);
  color: var(--color-ink);
  letter-spacing: -0.012em;
}

h1 { font-size: clamp(2.25rem, 5vw, var(--text-hero)); font-weight: 460; }
h2 { font-size: clamp(1.625rem, 3vw, var(--text-3xl)); }
h3 { font-size: clamp(1.2rem, 2vw, var(--text-xl)); }
h4 { font-size: var(--text-lg); font-weight: 520; }

p { color: var(--color-ink-soft); }
small, .text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--color-muted); }
.eyebrow {
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  font-weight: 600;
}
:root.theme-dark .eyebrow { color: var(--color-primary-300); }

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-4);
  background: var(--color-ink);
  color: var(--color-bg);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  z-index: 1000;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: var(--space-4); }

/* Focus rings */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Layout helpers */
.container {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.section {
  padding-block: clamp(3rem, 7vw, 5.5rem);
  position: relative;
}
.section--tight { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section-head {
  max-width: 56ch;
  margin-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.section-head__title { margin-top: var(--space-1); }

/* Grid utilities */
.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

/* Visually hidden but accessible */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}

/* Selection */
::selection { background: var(--color-accent-soft); color: var(--color-ink); }

/* ============================================================
   Light-mode background washes (per page) and section accents
   Scoped to :root:not(.theme-dark) so dark mode is untouched.
   ============================================================ */
:root:not(.theme-dark) body[data-page="home"] {
  background-image:
    radial-gradient(1100px 520px at 92% -120px, rgba(242, 179, 141, 0.20), transparent 60%),
    radial-gradient(900px 540px at -8% 18%, rgba(111, 175, 115, 0.10), transparent 65%),
    radial-gradient(1000px 600px at 105% 70%, rgba(242, 179, 141, 0.12), transparent 60%),
    linear-gradient(180deg, var(--color-bg) 0%, color-mix(in srgb, var(--color-accent-soft) 22%, var(--color-bg)) 55%, var(--color-bg) 100%);
}
:root:not(.theme-dark) body[data-page="action"] {
  background-image:
    radial-gradient(900px 480px at 95% -100px, rgba(242, 179, 141, 0.22), transparent 60%),
    radial-gradient(800px 480px at -10% 35%, rgba(111, 175, 115, 0.10), transparent 65%),
    radial-gradient(1000px 600px at 0% 95%, rgba(242, 179, 141, 0.10), transparent 60%);
}
:root:not(.theme-dark) body[data-page="county-insights"] {
  background-image:
    radial-gradient(1000px 540px at 100% -120px, rgba(111, 175, 115, 0.16), transparent 60%),
    radial-gradient(900px 520px at -10% 25%, rgba(242, 179, 141, 0.16), transparent 65%),
    radial-gradient(1100px 700px at 95% 75%, rgba(111, 175, 115, 0.08), transparent 60%);
}
:root:not(.theme-dark) body[data-page="explore"] {
  background-image:
    radial-gradient(1000px 540px at 92% -100px, rgba(111, 175, 115, 0.16), transparent 60%),
    radial-gradient(800px 520px at -10% 35%, rgba(242, 179, 141, 0.16), transparent 65%);
}
:root:not(.theme-dark) body[data-page="timeline"] {
  background-image:
    radial-gradient(900px 480px at 90% -120px, rgba(242, 179, 141, 0.18), transparent 60%),
    radial-gradient(900px 520px at -10% 60%, rgba(111, 175, 115, 0.10), transparent 65%);
}
:root:not(.theme-dark) body[data-page="resources"],
:root:not(.theme-dark) body[data-page="faq"],
:root:not(.theme-dark) body[data-page="representatives"],
:root:not(.theme-dark) body[data-page="community-map"] {
  background-image:
    radial-gradient(900px 480px at 100% -100px, rgba(242, 179, 141, 0.16), transparent 60%),
    radial-gradient(900px 540px at -8% 40%, rgba(111, 175, 115, 0.08), transparent 65%);
}

/* Soft section accent: very subtle peach top-wash on the first section of every page */
:root:not(.theme-dark) main > .section:first-of-type::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 220px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-accent-soft) 28%, transparent), transparent);
  pointer-events: none;
  z-index: 0;
}
:root:not(.theme-dark) main > .section:first-of-type > * { position: relative; z-index: 1; }

/* Alternating subtle section tint: every 2nd .section (light only) */
:root:not(.theme-dark) main > .section:nth-of-type(2n)::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 60% at 100% 0%, color-mix(in srgb, var(--color-accent-soft) 18%, transparent), transparent 70%),
    radial-gradient(50% 60% at 0% 100%, color-mix(in srgb, var(--color-primary) 6%, transparent), transparent 70%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.7;
}
:root:not(.theme-dark) main > .section:nth-of-type(2n) > * { position: relative; z-index: 1; }

/* Card surfaces: very gentle gradient overlay (light only) */
:root:not(.theme-dark) .card,
:root:not(.theme-dark) .action-card,
:root:not(.theme-dark) .resource-card,
:root:not(.theme-dark) .ci-kpi,
:root:not(.theme-dark) .ci-county-card,
:root:not(.theme-dark) .ci-leaderboard,
:root:not(.theme-dark) .hub-compact__card {
  background-image: linear-gradient(180deg, color-mix(in srgb, var(--color-accent-soft) 14%, var(--color-surface)) 0%, var(--color-surface) 70%);
}

/* Page bottom wash (light only): a quiet fade so scroll tail has color */
:root:not(.theme-dark) body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--color-accent-soft) 24%, transparent));
  z-index: -1;
}
