/* =========================================================================
   EconoPlus — Base
   Modern reset, typography, layout primitives, accessibility helpers.
   Mobile-first. Depends on tokens.css.
   ========================================================================= */

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--ep-header-h) + 16px);
}

body {
  font-family: var(--ep-font-ui);
  font-size: var(--ep-fs-body);
  line-height: var(--ep-lh-body);
  color: var(--ep-text);
  background: var(--ep-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
  overflow-x: hidden;            /* guard against accidental horizontal scroll */
}

img, picture, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: 0; cursor: pointer; }

a { color: inherit; text-decoration: none; }

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

/* The hidden attribute had no author rule anywhere on this site, so it relied
   on the browser's own default sheet — and any author rule that sets display
   beats a user-agent one whatever its specificity. .wi-legend (pages.css) is
   display:inline-flex, so the map's "neighbourhoods served" chip stayed on
   screen with hidden set on it. That matters because the blocks carrying the
   attribute are the ones holding live numbers: they ship hidden and data.js
   only reveals them once the feed has a real count, so a failure here shows a
   visitor "0 neighbourhoods served" instead of nothing at all. !important so
   the attribute keeps winning against whatever display a component adds later. */
[hidden] { display: none !important; }

:target { scroll-margin-top: calc(var(--ep-header-h) + 16px); }

/* ---- Typography -------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--ep-font-display);
  line-height: var(--ep-lh-tight);
  letter-spacing: var(--ep-ls-display);
  font-weight: 800;
  color: var(--ep-text);
  text-wrap: balance;          /* nicer headline wrapping where supported */
}

h1 { font-size: var(--ep-fs-h1); }
h2 { font-size: var(--ep-fs-h2); }
h3 { font-size: var(--ep-fs-h3); line-height: var(--ep-lh-snug); }

p { text-wrap: pretty; }

.ep-lead {
  font-size: var(--ep-fs-lead);
  line-height: var(--ep-lh-snug);
  color: var(--ep-text-muted);
}

strong, b { font-weight: 700; }

small { font-size: var(--ep-fs-sm); }

/* ---- Layout primitives ------------------------------------------------- */
.ep-container {
  width: 100%;
  max-width: var(--ep-maxw);
  margin-inline: auto;
  padding-inline: var(--ep-gutter);
}
.ep-container--wide { max-width: var(--ep-maxw-wide); }
.ep-container--prose { max-width: var(--ep-maxw-prose); }

.ep-section { padding-block: var(--ep-section-y); }
.ep-section--tight { padding-block: clamp(2rem, 1rem + 4vw, 4rem); }
.ep-section--alt { background: var(--ep-bg-alt); }
/* On the charcoal band the muted token is #6E6E73 on #1F1F23 — 3.24:1, well
   under AA. One grey cannot serve a white ground and a near-black one, so the
   dark section redefines it for everything inside: 5.05:1. Scoped to the
   section rather than set on each element, so anything added here inherits it
   instead of quietly failing. */
.ep-section--dark {
  background: var(--ep-charcoal);
  color: var(--ep-white);
  --ep-text-muted: var(--ep-muted-dark);
}
.cta-band { --ep-text-muted: var(--ep-muted-dark); }
.ep-section--dark h1,
.ep-section--dark h2,
.ep-section--dark h3 { color: var(--ep-white); }

/* Section heading block (eyebrow + title + subtitle) */
.ep-section-head {
  max-width: 46rem;
  margin-bottom: clamp(2rem, 1rem + 3vw, 3.5rem);
}
.ep-section-head--center { margin-inline: auto; text-align: center; }

.ep-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--ep-fs-sm);
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ep-red-ink);
  margin-bottom: var(--ep-space-3);
}
.ep-section-head p { margin-top: var(--ep-space-4); color: var(--ep-text-muted); font-size: var(--ep-fs-lead); }

/* Generic responsive grid helpers */
.ep-grid { display: grid; gap: var(--ep-gutter); }
.ep-grid--auto {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

/* ---- Accessibility helpers -------------------------------------------- */
.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;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: -100px;
  transform: translateX(-50%);
  z-index: var(--ep-z-toast);
  background: var(--ep-charcoal);
  color: var(--ep-white);
  padding: .75rem 1.25rem;
  border-radius: 0 0 var(--ep-radius) var(--ep-radius);
  font-weight: 600;
  transition: top var(--ep-dur) var(--ep-ease);
}
.skip-link:focus { top: 0; }

/* Visible, on-brand focus ring for keyboard users */
:focus-visible {
  outline: 3px solid var(--ep-red);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Scroll-reveal (progressively enhanced) --------------------------- */
/* Elements opt in with [data-reveal]; main.js adds .is-visible when in view.
   If JS never runs, the fallback below keeps content fully visible. */
[data-reveal] {
  opacity: 1;
  transform: none;
}
.js [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s var(--ep-ease), transform .6s var(--ep-ease);
  will-change: opacity, transform;
}
.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
.js [data-reveal][data-reveal-delay="1"] { transition-delay: .08s; }
.js [data-reveal][data-reveal-delay="2"] { transition-delay: .16s; }
.js [data-reveal][data-reveal-delay="3"] { transition-delay: .24s; }
.js [data-reveal][data-reveal-delay="4"] { transition-delay: .32s; }

/* ---- Utilities -------------------------------------------------------- */
.ep-text-center { text-align: center; }
.ep-text-muted  { color: var(--ep-text-muted); }
.ep-mt-0 { margin-top: 0; }
.ep-stack > * + * { margin-top: var(--ep-space-4); }
.ep-hide { display: none !important; }
.ep-no-wrap { white-space: nowrap; }

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
}
