/* ============================================================
   CEHE — Climate & Environmental Hazards Explorer
   Tokens: NSF NCAR Design System (brand.json, effective 2025-12-04)
   ============================================================ */

:root {
  /* ===== PRIMARY ===== */
  --ncar-blue: #0057C2;   /* PMS 2132 — headlines, primary surfaces */
  --dark-blue: #00357A;   /* PMS 654  — body type on light bg, deep surfaces */

  /* ===== SECONDARY ===== */
  --space: #011837;        /* PMS 282  — darkest surface; sky/night */
  --light-blue: #42C0FF;   /* PMS 2190 — accents on dark, data viz */
  --light-gray: #F1F0EE;   /* Cool Gray 1 @ 37% — page/card neutrals */
  --white: #FFFFFF;

  /* ===== ACCENT (small highlights only) ===== */
  --orange: #FAA119;
  --yellow: #FFDD31;

  /* ===== CO-BRAND ===== */
  --ucar-aqua: #00A2B4;
  --ucar-aqua-contrast: #00818F;
  --light-aqua: #34E1F4;

  /* ===== SEMANTIC FG / BG ===== */
  --fg1: var(--dark-blue);
  --fg2: #2A4D7A;
  --fg-muted: #59667C;   /* darkened for WCAG AA (≈4.7:1 on white / light-gray) */
  --fg-invert: var(--white);
  --link: var(--ncar-blue);
  --link-hover: var(--dark-blue);

  --bg: var(--white);
  --bg-alt: var(--light-gray);
  --bg-dark: var(--space);
  --bg-brand: var(--ncar-blue);

  --border: #D9D8D4;
  --border-strong: #B8B6B0;

  /* ===== FONT FAMILIES ===== */
  --font-sans: 'Poppins', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  /* ===== TYPE SCALE ===== */
  --fs-display: clamp(48px, 6vw, 72px);
  --fs-h1: clamp(36px, 4vw, 56px);
  --fs-h2: clamp(28px, 3vw, 40px);
  --fs-h3: 24px;
  --fs-h4: 20px;
  --fs-body-lg: 18px;
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-eyebrow: 12px;

  --lh-tight: 1.1;
  --lh-snug: 1.2;
  --lh-normal: 1.5;
  --lh-loose: 1.65;

  --ls-tight: -0.01em;
  --ls-normal: 0;
  --ls-eyebrow: 0.12em;

  /* ===== RADII ===== */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 8px;
  --radius-xl: 16px;
  --radius-pill: 999px;

  /* ===== ELEVATION ===== */
  --shadow-0: none;
  --shadow-1: 0 1px 2px rgba(1,24,55,.06), 0 1px 1px rgba(1,24,55,.04);
  --shadow-2: 0 4px 12px rgba(1,24,55,.08), 0 2px 4px rgba(1,24,55,.04);
  --shadow-3: 0 12px 32px rgba(1,24,55,.12), 0 4px 8px rgba(1,24,55,.06);
  --shadow-focus: 0 0 0 3px rgba(0,87,194,.35);

  /* ===== MOTION ===== */
  --ease-standard: cubic-bezier(.2,.0,.0,1);
  --ease-emphasized: cubic-bezier(.3,.0,.1,1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;
}

html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }

body {
  margin: 0;
  background: var(--space);
  color: var(--fg1);
  font-family: var(--font-sans);
  font-weight: 400;
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--fg1);
  margin: 0 0 16px;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  text-wrap: balance;
}
h3 { line-height: var(--lh-snug); }
h4 { line-height: var(--lh-snug); }

p, ul, ol { margin: 0 0 16px; line-height: var(--lh-loose); text-wrap: pretty; }
.lead { font-size: var(--fs-body-lg); line-height: var(--lh-loose); color: var(--fg2); }

.eyebrow {
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--ncar-blue);
  margin: 0 0 12px;
}

a { color: var(--link); text-decoration: none; }

/* ===== Accessible focus ring ===== */
:focus-visible {
  outline: 2px solid var(--ncar-blue);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.on-dark :focus-visible { outline-color: var(--light-blue); }
::selection { background: var(--ncar-blue); color: var(--white); }

button { font-family: var(--font-sans); }

/* ===== CEHE app motion & interaction ===== */
@keyframes cehe-fade { from { opacity:.35; transform:translateY(8px);} to { opacity:1; transform:none;} }
.cehe-view { animation: cehe-fade .26s var(--ease-standard) 1; opacity:1; }
.cehe-card-hover { transition: box-shadow .2s var(--ease-standard), border-color .2s, transform .12s var(--ease-standard); }
.cehe-card-hover:hover { box-shadow: 0 12px 32px rgba(1,24,55,.14), 0 4px 8px rgba(1,24,55,.06) !important; border-color:#B8B6B0 !important; }
.cehe-press { transition: transform .1s var(--ease-standard); }
.cehe-press:active { transform: scale(.985); }

*::-webkit-scrollbar { height:10px; width:10px; }
*::-webkit-scrollbar-thumb { background:#c4cfdd; border-radius:8px; }

@media (prefers-reduced-motion: reduce) {
  .cehe-view { animation: none; }
  *, *::before, *::after { transition-duration: .001ms !important; }
}

/* Featured (lead) hazard card spans two columns only when there's room for them */
@media (min-width: 760px) {
  .cehe-featured { grid-column: span 2; }
}

/* Screen-reader-only utility for accessible chart/table summaries */
.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}
/* Skip link becomes visible when focused (WCAG 2.4.1 / 2.4.7) */
.sr-only:focus, .sr-only:focus-visible {
  position:fixed; top:10px; left:10px; width:auto; height:auto; margin:0;
  padding:10px 16px; clip:auto; overflow:visible; z-index:500;
  background:var(--ncar-blue); color:#fff; border-radius:6px; font-weight:600;
  font-family:var(--font-sans); box-shadow:0 6px 18px rgba(1,24,55,.3);
}
