/* SoCalREN-aligned chrome — colors from socalren.org theme (e.g. #14425b, #051822, #f8f8f8) */

:root {
  --scr-bg: #f8f8f8;
  --scr-white: #ffffff;
  --scr-navy: var(--socal-ren-navy, #14425b);
  --scr-navy-dark: #051822;
  --scr-text: #333333;
  --scr-muted: #555555;
  --scr-border: #dddddd;
  --scr-link: var(--socal-ren-navy, #14425b);
  --scr-link-hover: #0d3145;
  /* Map chrome only — choropleth fills stay in JS */
  --map-canvas: #e8eef2;
  --map-stroke: rgba(20, 66, 91, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-variant-ligatures: none;
  font-feature-settings: "liga" 0;
  background: var(--scr-bg);
  color: var(--scr-text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

header {
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
  background: var(--scr-white);
  border-bottom: 4px solid var(--scr-navy);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

header h1 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  color: var(--scr-navy);
  letter-spacing: -0.02em;
}

header p {
  margin: 0;
  color: var(--scr-muted);
  font-size: 0.95rem;
  max-width: 52rem;
}

a {
  color: var(--scr-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--scr-link-hover);
}

header code {
  font-size: 0.88em;
  padding: 0.12em 0.35em;
  background: var(--scr-bg);
  border: 1px solid var(--scr-border);
  border-radius: 3px;
  color: var(--scr-navy-dark);
}

main {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 1.75rem clamp(1rem, 4vw, 2.5rem) 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

section.map-section {
  background: var(--scr-white);
  border-radius: 4px;
  padding: 1.35rem 1.35rem 1.6rem;
  border: 1px solid var(--scr-border);
  box-shadow: 0 2px 8px rgba(5, 24, 34, 0.06);
}

section.map-section h2 {
  margin: 0 0 0.3rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--scr-navy);
}

section.map-section .subtitle {
  margin: 0 0 1.1rem;
  font-size: 0.875rem;
  color: var(--scr-muted);
}

/* Map uses 50% of section width; centered; full width on small screens */
.map-figure {
  width: 50%;
  max-width: 100%;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .map-figure {
    width: 100%;
  }
}

.map-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 4px;
  background: var(--map-canvas);
  border: 1px solid var(--scr-border);
}

.map-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  cursor: default;
}

.map-wrap path.state,
.map-wrap path.county {
  stroke: var(--map-stroke);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.map-wrap path.state:hover,
.map-wrap path.county:hover {
  filter: brightness(1.06);
}

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  padding: 0.5rem 0.65rem;
  font-size: 0.8rem;
  font-family: "Lato", sans-serif;
  background: var(--scr-white);
  color: var(--scr-text);
  border: 1px solid var(--scr-border);
  border-left: 3px solid var(--scr-navy);
  border-radius: 4px;
  box-shadow: 0 6px 20px rgba(5, 24, 34, 0.15);
  opacity: 0;
  transition: opacity 0.12s ease;
  max-width: 220px;
}

.tooltip.visible {
  opacity: 1;
}

.tooltip strong {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.15;
}

.tooltip__meta {
  display: block;
  font-size: 0.8rem;
  line-height: 1.15;
  margin-top: 0.125rem;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.85rem;
  font-size: 0.75rem;
  color: var(--scr-muted);
  justify-content: flex-start;
}

.legend-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.legend-swatch {
  width: 1.05rem;
  height: 0.6rem;
  border-radius: 2px;
  border: 1px solid rgba(20, 66, 91, 0.25);
}

.loading,
.error-msg {
  padding: 2rem;
  text-align: center;
  color: var(--scr-muted);
  font-size: 0.9rem;
}

.error-msg {
  color: #c0392b;
}

footer {
  padding: 1.25rem 1.5rem 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.85);
  background: var(--scr-navy-dark);
}

footer a {
  color: #a8d4e8;
  text-decoration: underline;
}

footer a:hover {
  color: #ffffff;
}
