/* ============================================
   HEAT-HEALTH RISK INDEX — styles.css
   Shared across Homepage, Data, Resources
   ============================================ */

/* VARIABLES */
:root {
  --coral: #D85A30;
  --coral-light: #F0997B;
  --coral-pale: #FAECE7;
  --slate: #2C3E50;
  --slate-mid: #4A5E70;
  --slate-light: #8DA0B0;
  --slate-pale: #EEF2F5;
  --white: #FFFFFF;
  --text: #1A2530;
  --text-muted: #5A6E7E;
  --border: #D8E2E9;
}

/* RESET */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* BODY */
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--white);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

/* ============================================
   NAV — all pages
   ============================================ */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--slate);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 3rem;
  height: 64px;
  border-bottom: 3px solid var(--coral);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.nav-logo img { height: 36px; width: auto; }
.nav-logo span {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: var(--white);
  letter-spacing: 0.01em;
}
.nav-links { display: flex; gap: 2.5rem; list-style: none; }
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.nav-links a:hover,
.nav-links a.active { color: var(--coral-light); }

/* ============================================
   FOOTER — all pages
   ============================================ */
footer {
  background: var(--slate);
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 2.5rem;
  font-size: 13px;
  margin-top: 4rem;
}
footer strong { color: rgba(255,255,255,0.85); }

/* ============================================
   HOMEPAGE — hero
   ============================================ */
.hero {
  background: var(--slate);
  padding: 7rem 3rem 5rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, rgba(216,90,48,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero-inner {
  max-width: 860px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.hero-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral-light);
  border: 1px solid rgba(216,90,48,0.5);
  padding: 4px 12px;
  border-radius: 2px;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.6rem, 5vw, 4rem);
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 1.5rem;
}
.hero h1 em { font-style: italic; color: var(--coral-light); }
.hero-sub {
  font-size: 1.15rem;
  color: rgba(255,255,255,0.65);
  max-width: 580px;
  margin-bottom: 2.5rem;
}
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--coral);
  color: var(--white);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: 3px;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: background 0.2s;
}
.hero-cta:hover { background: #bf4f28; }

/* HOMEPAGE — stat strip */
.stat-strip {
  background: var(--coral);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.stat-item {
  padding: 2rem 2.5rem;
  border-right: 1px solid rgba(255,255,255,0.2);
  text-align: center;
}
.stat-item:last-child { border-right: none; }
.stat-num {
  font-family: 'DM Serif Display', serif;
  font-size: 2.6rem;
  color: var(--white);
  line-height: 1;
  display: block;
}
.stat-label {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  margin-top: 4px;
}

/* HOMEPAGE — purpose section */
section {
  max-width: 900px;
  margin: 0 auto;
  padding: 5rem 2rem;
}
h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 2rem;
  color: var(--slate);
  margin-bottom: 1.25rem;
  line-height: 1.25;
}
p { color: var(--text-muted); margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ============================================
   DATA + RESOURCES — shared page header
   ============================================ */
.page-header {
  background: var(--slate);
  padding: 4rem 3rem 3.5rem;
  position: relative;
  overflow: hidden;
}
.page-header::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(216,90,48,0.15) 0%, transparent 70%);
  pointer-events: none;
}
.page-header-inner {
  max-width: 960px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.page-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral-light);
  display: block;
  margin-bottom: 0.75rem;
}
.page-header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 2.6rem;
  color: var(--white);
  line-height: 1.15;
  margin-bottom: 0.75rem;
}
.page-header p {
  color: rgba(255,255,255,0.6);
  max-width: 560px;
  margin: 0;
}
.page-header a {
  color: var(--coral-light);
  text-decoration: none;
  font-weight: 500;
}
.page-header a:hover {
  text-decoration: underline;
  color: var(--coral);
}

/* SHARED — main content wrapper */
.content {
  max-width: 960px;
  margin: 0 auto;
  padding: 4rem 2rem 6rem;
}

/* ============================================
   DATA PAGE
   ============================================ */
.section-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  display: block;
  margin-bottom: 0.6rem;
}
.section-intro {
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 2rem;
}
.data-section { margin-bottom: 5rem; }
.data-section + .data-section {
  border-top: 1px solid var(--border);
  padding-top: 4rem;
}

/* Visualization placeholder */
.viz-placeholder {
  background: var(--slate-pale);
  border: 2px dashed var(--border);
  border-radius: 8px;
  min-height: 420px;
  margin: 1.5rem 0 2rem;
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 1.5rem 0;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead { background: var(--slate); color: var(--white); }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--slate-pale); }
tbody td { padding: 11px 16px; color: var(--text-muted); }
tbody td:first-child { color: var(--text); font-weight: 500; }
.risk-high { color: #993C1D; font-weight: 600; }
.risk-med  { color: #854F0B; font-weight: 600; }
.risk-low  { color: #3B6D11; font-weight: 600; }

/* Conclusion box */
.conclusion-box {
  background: var(--slate);
  border-radius: 8px;
  padding: 2.5rem 3rem;
  margin-top: 2rem;
}
.conclusion-box h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.4rem;
  color: var(--white);
  margin-bottom: 1rem;
}
.conclusion-box p { color: rgba(255,255,255,0.65); margin-bottom: 0.75rem; }
.conclusion-box p:last-child { margin-bottom: 0; }

/* ============================================
   RESOURCES PAGE
   ============================================ */
.resources-group { margin-bottom: 3.5rem; }
.group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--coral);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 1.5rem;
}
.resource-card {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.resource-card:last-child { border-bottom: none; }
.resource-body h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  color: var(--slate);
  margin-bottom: 0.35rem;
}
.resource-body h3 a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: border-color 0.2s, color 0.2s;
}
.resource-body h3 a:hover { color: var(--coral); border-color: var(--coral); }
.resource-meta {
  font-size: 12px;
  color: var(--slate-light);
  margin-bottom: 0.5rem;
}
.resource-summary { font-size: 14px; color: var(--text-muted); }

/* NEW HOMEPAGE*/
 /* ── CSS VARIABLES (scoped to .hhi-root) ── */
  .hhi-root {
    --hhi-red:    #c0392b;
    --hhi-orange: #e67e22;
    --hhi-amber:  #f39c12;
    --hhi-cream:  #fdf6ec;
    --hhi-ink:    #1a1208;
    --hhi-mid:    #6b4f2a;
    --hhi-border: rgba(192,57,43,0.18);
    font-family: 'DM Sans', sans-serif;
    color: var(--hhi-ink);
    overflow-x: hidden;
  }

  /* ── SECTION 1: HERO ── */
  .hhi-root #hhi-section-hero {
    min-height: 100vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    padding: 2rem 2rem 4rem;
    position: relative;
  }
  .hhi-root #hhi-section-hero::before {
    content: '';
    position: absolute; inset: 0; z-index: 0;
    background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(230,126,34,.07) 0%, transparent 70%);
    pointer-events: none;
  }
  .hhi-root #hhi-section-hero > * { position: relative; z-index: 1; }

  .hhi-root .hhi-eyebrow {
    font-family: 'DM Sans', sans-serif;
    font-size: .8rem; font-weight: 500; letter-spacing: .18em; text-transform: uppercase;
    color: var(--hhi-red); margin-bottom: 2rem;
    opacity: 0; animation: hhiFadeUp .8s .3s forwards;
  }

  .hhi-root #hhi-reveal-btn {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1rem, 2vw, 1.3rem);
    letter-spacing: .06em; text-transform: uppercase;
    background: var(--hhi-ink); color: var(--hhi-cream);
    border: none; cursor: pointer;
    padding: 1.1rem 3rem; border-radius: 2px;
    transition: background .25s, transform .1s;
    opacity: 0; animation: hhiFadeUp .8s .6s forwards;
    position: relative; overflow: hidden;
  }
  .hhi-root #hhi-reveal-btn::after {
    content: ''; position: absolute; inset: 0;
    background: var(--hhi-red);
    transform: scaleX(0); transform-origin: left;
    transition: transform .35s ease;
  }
  .hhi-root #hhi-reveal-btn:hover::after { transform: scaleX(1); }
  .hhi-root #hhi-reveal-btn span { position: relative; z-index: 1; }
  .hhi-root #hhi-reveal-btn:active { transform: scale(.97); }

  .hhi-root #hhi-hero-title-wrap {
    overflow: hidden; max-height: 0;
    opacity: 0; transition: max-height .01s, opacity .01s;
    text-align: center; margin-top: 2.5rem;
  }
  .hhi-root #hhi-hero-title-wrap.visible { max-height: 600px; opacity: 1; }

  .hhi-root #hhi-hero-title-wrap h1 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1.12; color: var(--hhi-ink);
  }
  .hhi-root #hhi-hero-title-wrap h1 em { color: var(--hhi-red); font-style: italic; }
  .hhi-root #hhi-hero-title-wrap .hhi-hero-sub {
    margin-top: 1.2rem;
    font-size: 1.05rem; color: var(--hhi-mid);
    max-width: 52ch; margin-left: auto; margin-right: auto;
    line-height: 1.65;
  }

  /* Screen shake — applied to .hhi-root, not body */
  @keyframes hhiShake {
    0%   { transform: translate(0,0) rotate(0); }
    15%  { transform: translate(-12px, 6px) rotate(-.8deg); }
    30%  { transform: translate(12px, -6px) rotate(.8deg); }
    45%  { transform: translate(-8px, 4px) rotate(-.5deg); }
    60%  { transform: translate(8px, -4px) rotate(.5deg); }
    75%  { transform: translate(-4px, 2px) rotate(-.2deg); }
    100% { transform: translate(0,0) rotate(0); }
  }
  .hhi-root.hhi-shaking { animation: hhiShake .5s ease; }

  @keyframes hhiFadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ── BLINKING ARROW ── */
  .hhi-root .hhi-scroll-arrow {
    display: none; flex-direction: column; align-items: center; gap: .5rem;
    cursor: pointer; margin-top: 3rem;
    color: var(--hhi-mid);
    font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
    animation: hhiArrowPulse 2s ease-in-out infinite;
    user-select: none;
    background: white;
    border: 2px solid var(--hhi-border);
    border-radius: 40px;
    padding: .7rem 1.6rem;
    box-shadow: 0 2px 12px rgba(192,57,43,.10);
    transition: border-color .2s, box-shadow .2s, color .2s;
  }
  .hhi-root .hhi-scroll-arrow:hover {
    border-color: var(--hhi-red);
    box-shadow: 0 4px 20px rgba(192,57,43,.22);
    color: var(--hhi-red);
  }
  .hhi-root .hhi-scroll-arrow.visible { display: flex; }
  .hhi-root .hhi-scroll-arrow svg { width: 20px; height: 20px; }
  @keyframes hhiArrowPulse {
    0%, 100% { opacity: .3; transform: translateY(0); }
    50%       { opacity: 1;  transform: translateY(6px); }
  }

  /* ── SECTION 2: STORY ── */
  .hhi-root #hhi-section-story {
    min-height: 90vh;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 8rem 2rem 5rem;
    opacity: 0; transition: opacity .9s ease;
    pointer-events: none;
  }
  .hhi-root #hhi-section-story.visible { opacity: 1; pointer-events: auto; }

  .hhi-root .hhi-story-inner { max-width: 680px; text-align: center; }
  .hhi-root .hhi-story-tag {
    display: inline-block;
    font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
    color: var(--hhi-orange); margin-bottom: 1.4rem;
  }
  .hhi-root .hhi-story-inner h2 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    line-height: 1.18; margin-bottom: 1.5rem;
  }
  .hhi-root .hhi-story-inner h2 em { color: var(--hhi-red); font-style: italic; }
  .hhi-root .hhi-story-inner p {
    font-size: 1.05rem; line-height: 1.75; color: var(--hhi-mid);
    margin-bottom: 1.2rem;
  }
  .hhi-root .hhi-story-inner p strong { color: var(--hhi-ink); font-weight: 600; }

  .hhi-root .hhi-story-stats {
    display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap;
    margin: 2rem 0;
  }
  .hhi-root .hhi-story-stat {
    background: white; border: 1px solid var(--hhi-border);
    border-radius: 8px; padding: 1rem 1.5rem; text-align: center; min-width: 130px;
  }
  .hhi-root .hhi-story-stat .num {
    display: block; font-family: 'DM Serif Display', serif;
    font-size: 2rem; color: var(--hhi-red); line-height: 1;
  }
  .hhi-root .hhi-story-stat .lbl {
    font-size: .78rem; color: var(--hhi-mid); margin-top: .4rem;
    text-transform: uppercase; letter-spacing: .08em;
  }

  .hhi-root .hhi-section-divider {
    width: 48px; height: 2px; background: var(--hhi-red);
    margin: 0 auto 1.6rem; opacity: .5;
  }

  /* ── SECTION 3: GRAPHS ── */
  .hhi-root #hhi-section-graphs {
    min-height: 80vh;
    display: flex; flex-direction: column; align-items: center;
    padding: 6rem 2rem 5rem;
    opacity: 0; transition: opacity .9s ease;
    pointer-events: none;
  }
  .hhi-root #hhi-section-graphs.visible { opacity: 1; pointer-events: auto; }

  .hhi-root .hhi-graphs-header { text-align: center; margin-bottom: 3rem; max-width: 560px; }
  .hhi-root .hhi-graphs-header h2 {
    font-family: 'DM Serif Display', serif;
    font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: .8rem;
  }
  .hhi-root .hhi-graphs-header p { color: var(--hhi-mid); font-size: .95rem; line-height: 1.6; }

  .hhi-root .hhi-graphs-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem; width: 100%; max-width: 900px;
  }
  .hhi-root .hhi-graph-placeholder {
    background: white; border: 1px solid var(--hhi-border);
    border-radius: 10px; padding: 2rem; min-height: 240px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 1rem; color: var(--hhi-mid);
    position: relative; overflow: hidden;
  }
  .hhi-root .hhi-graph-placeholder::before {
    content: ''; position: absolute; inset: 0;
    background: repeating-linear-gradient(
      135deg, transparent, transparent 10px,
      rgba(192,57,43,.03) 10px, rgba(192,57,43,.03) 20px
    );
  }
  .hhi-root .hhi-graph-placeholder .ph-label {
    font-size: .85rem; letter-spacing: .06em; text-transform: uppercase;
    font-weight: 500; opacity: .6; position: relative;
  }
  .hhi-root .hhi-graph-placeholder .ph-sub {
    font-size: .75rem; opacity: .4; position: relative; text-align: center;
  }
  .hhi-root .hhi-fake-bars {
    display: flex; align-items: flex-end; gap: 8px; height: 80px; position: relative;
  }
  .hhi-root .hhi-fake-bar {
    width: 20px; border-radius: 3px 3px 0 0;
    background: linear-gradient(to top, var(--hhi-red), var(--hhi-amber)); opacity: .35;
  }
  .hhi-root .hhi-fake-scatter { position: relative; width: 120px; height: 80px; }
  .hhi-root .hhi-fake-dot {
    position: absolute; width: 8px; height: 8px;
    border-radius: 50%; background: var(--hhi-red); opacity: .3;
  }

  /* ── SECTION 4: CTA ── */
  .hhi-root #hhi-section-cta {
    padding: 5rem 2rem 8rem;
    display: flex; flex-direction: column; align-items: center;
    opacity: 0; transition: opacity .9s ease;
    pointer-events: none;
  }
  .hhi-root #hhi-section-cta.visible { opacity: 1; pointer-events: auto; }
  .hhi-root .hhi-cta-inner { text-align: center; }
  .hhi-root .hhi-cta-inner p {
    font-size: 1rem; color: var(--hhi-mid); margin-bottom: 2rem; letter-spacing: .02em;
  }
  .hhi-root .hhi-map-btn {
    display: inline-flex; align-items: center; gap: .8rem;
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem; letter-spacing: .04em;
    background: var(--hhi-red); color: white;
    border: none; cursor: pointer;
    padding: 1.2rem 3rem; border-radius: 3px;
    transition: background .25s, transform .15s, box-shadow .25s;
    box-shadow: 0 4px 24px rgba(192,57,43,.3);
    text-decoration: none;
  }
  .hhi-root .hhi-map-btn:hover {
    background: var(--hhi-ink); transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(26,18,8,.25);
  }
  .hhi-root .hhi-map-btn:active { transform: translateY(0); }
  .hhi-root .hhi-map-btn svg { width: 20px; height: 20px; }


  

  /*MAP MAP MAP*/


    * { margin: 0; padding: 0; box-sizing: border-box; }
    body { font-family: 'Space Mono', monospace; }
    #map { position: absolute; inset: 0; width: 100%; height: 100%; }

    /* HUD */
    #hud {
      position: absolute; top: 20px; left: 20px; z-index: 10;
      width: 210px; pointer-events: none;
    }
    .hud-title {
      font-family: 'Bebas Neue', sans-serif; font-size: 26px;
      letter-spacing: 3px; color: #fff; line-height: 1; margin-bottom: 2px;
      text-shadow: 0 0 20px rgba(255,80,20,0.9);
    }
    .hud-sub { font-size: 9px; color: #bbb; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 14px; }
    .legend-label { font-size: 9px; color: #999; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 5px; }
    .gradient-bar {
      height: 8px; border-radius: 2px; margin-bottom: 4px;
      background: linear-gradient(to right, #0d0221, #3d0066, #cc00ff, #ff3300, #ffaa00, #ffff00);
    }
    .legend-ticks { display: flex; justify-content: space-between; margin-bottom: 14px; }
    .legend-ticks span { font-size: 8px; color: #888; }
    .stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
    .stat-box {
      background: rgba(0,0,0,0.7); border: 1px solid rgba(255,255,255,0.1);
      border-radius: 3px; padding: 8px; backdrop-filter: blur(6px);
    }
    .stat-box .val {
      font-family: 'Bebas Neue', sans-serif; font-size: 18px;
      color: #ff5014; line-height: 1;
    }
    .stat-box .lbl { font-size: 8px; color: #666; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }

    /* Popup */
    .mapboxgl-popup-content {
      background: rgba(8,8,8,0.97) !important;
      border: 1px solid rgba(255,80,20,0.6) !important;
      border-radius: 4px !important;
      padding: 0 !important;
      box-shadow: 0 4px 24px rgba(255,80,20,0.25) !important;
      font-family: 'Space Mono', monospace !important;
      min-width: 200px;
    }
    .mapboxgl-popup-tip { display: none !important; }
    .mapboxgl-popup-close-button {
      color: #ff5014 !important; font-size: 16px !important;
      padding: 6px 8px !important; line-height: 1 !important;
    }
    .p-inner { padding: 14px 16px; }
    .p-tract { font-size: 9px; color: #666; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }
    .p-score { font-family: 'Bebas Neue', sans-serif; font-size: 32px; color: #ff5014; line-height: 1; margin-bottom: 4px; }
    .p-bar-bg { height: 3px; background: #222; border-radius: 2px; margin-bottom: 12px; }
    .p-bar { height: 3px; border-radius: 2px; background: linear-gradient(to right, #cc00ff, #ff3300, #ffaa00); }
    .p-row { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #1a1a1a; }
    .p-row:last-child { border-bottom: none; }
    .p-lbl { color: #666; font-size: 10px; }
    .p-val { font-weight: bold; color: #ddd; font-size: 10px; }
