/* =========================================================================
 * our-town.css — Wasaga by the Numbers
 * Page-specific styles for the scroll-driven census infographic.
 * Scoped under .ot-body / .ot-* to avoid cascading into the rest of the site.
 * Relies on brand tokens from styles.css (--navy, --maple-red, --gold, --cream,
 * --ink, --ease-out, --font-display, --font-head, --font-body).
 * ========================================================================== */

.ot-body { background: var(--ink); color: var(--cream); }

.ot-main {
  /* override the site-wide container defaults — scenes are full-bleed here */
  width: 100%;
}

/* Shared scene scaffolding */
.ot-scene {
  position: relative;
  min-height: 100svh;
  padding: clamp(72px, 12vh, 140px) clamp(20px, 4vw, 48px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(28px, 4vh, 56px);
  overflow: hidden;
  isolation: isolate;
}
.ot-scene-body {
  width: 100%; max-width: 880px; margin: 0 auto;
  text-align: center;
  display: flex; flex-direction: column; gap: clamp(12px, 2vh, 22px);
}
.ot-scene-body .ot-display,
.ot-scene-body .ot-lede { margin: 0; }

/* Reveal animation — used on every scene body */
.ot-scene-body { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.ot-scene.in .ot-scene-body { opacity: 1; transform: none; }

.ot-eyebrow {
  display: inline-block; align-self: center;
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .22em;
  font-size: .78rem;
  color: var(--maple-red);
  padding: 5px 0;
  border-top: 3px solid var(--gold);
}
.ot-eyebrow-gold { color: var(--gold); border-top-color: var(--maple-red); }

.ot-display {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw + .4rem, 5.25rem);
  line-height: .94;
  letter-spacing: -.01em;
  color: var(--cream);
  text-wrap: balance;
}
.ot-lede {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, .6vw + .95rem, 1.3rem);
  line-height: 1.5;
  color: rgba(255, 248, 236, .82);
  max-width: 62ch;
  /* .ot-scene-body is a flex column — use align-self to center horizontally
   * on the cross-axis, since auto margins don't reliably center flex items
   * that are also constrained by max-width. */
  align-self: center;
  text-align: center;
}
.ot-lede strong { color: var(--cream); font-weight: 600; }

.ot-caption {
  font-family: var(--font-body);
  font-size: .78rem;
  color: rgba(255, 248, 236, .5);
  max-width: 62ch;
  text-align: center;
  margin: clamp(8px, 1vh, 20px) auto 0;
  line-height: 1.45;
}

/* Accessibility: data table mirror for screen readers only */
.ot-a11y-table {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* =========================================================================
 * SCENE 1 — Hero tick
 * Content anchors near the top of the viewport (not dead-center) so the
 * giant numeral reads as a headline, not a floating slide. Scroll cue lives
 * at the bottom.
 * ========================================================================== */
.ot-scene-hero {
  background:
    radial-gradient(1200px 600px at 80% 110%, rgba(196, 30, 42, .12), transparent 60%),
    radial-gradient(900px 500px at 10% -10%, rgba(245, 183, 31, .10), transparent 70%),
    var(--ink);
  min-height: 100svh;
  /* Content is vertically centered (inherited) so the giant numeral anchors
   * the viewport. Padding-top intentionally minimal — the scroll cue lives
   * absolutely at bottom, so we don't reserve extra headroom for it. */
}
.ot-scene-hero .ot-scene-body { gap: clamp(10px, 1.6vh, 20px); }

.ot-hero-label {
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  font-size: clamp(.95rem, .6vw + .7rem, 1.2rem);
  color: rgba(255, 248, 236, .7);
  margin: 0;
}

.ot-bignum {
  margin: 0;
  line-height: .82;
  font-family: var(--font-display);
  font-size: clamp(5rem, 22vw, 16rem);
  letter-spacing: -.02em;
  color: var(--cream);
  text-shadow: 0 2px 40px rgba(15, 26, 51, .55);
}
.ot-bignum-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  /* Tabular-nums keeps the width steady while the tick increments */
}

.ot-hero-year {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4.8rem);
  line-height: 1;
  letter-spacing: -.01em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.ot-hero-tagline {
  font-family: var(--font-body);
  font-size: clamp(1rem, .5vw + .85rem, 1.2rem);
  line-height: 1.5;
  color: rgba(255, 248, 236, .78);
  max-width: 48ch; margin: 0 auto;
}
.ot-hero-tagline em { font-style: italic; color: var(--gold); }

.ot-scroll-cue {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  margin: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  font-family: var(--font-head); font-weight: 700; text-transform: uppercase;
  letter-spacing: .22em; font-size: .7rem;
  color: rgba(255, 248, 236, .5);
  animation: ot-bob 2.2s ease-in-out infinite;
}
@keyframes ot-bob {
  0%, 100% { transform: translate(-50%, 0); opacity: .6; }
  50%      { transform: translate(-50%, 6px); opacity: .9; }
}

/* =========================================================================
 * SCENE 2 — Doubling dot matrix
 * ========================================================================== */
.ot-scene-doubling {
  background: var(--cream);
  color: var(--ink);
}
.ot-scene-doubling .ot-eyebrow { color: var(--maple-red); border-top-color: var(--navy); }
.ot-scene-doubling .ot-display { color: var(--ink); }
.ot-scene-doubling .ot-lede { color: rgba(15, 26, 51, .78); }
.ot-scene-doubling .ot-lede strong { color: var(--navy); }
.ot-scene-doubling .ot-lede strong.gold { color: var(--gold-deep, #D79A0E); }
.ot-scene-doubling .ot-caption { color: rgba(15, 26, 51, .55); }

.ot-dotmatrix-wrap { width: 100%; max-width: 960px; margin: 0 auto; }
.ot-dotmatrix {
  display: grid;
  gap: clamp(6px, .9vw, 10px);
  grid-template-columns: repeat(21, 1fr);
  padding: clamp(12px, 2vw, 24px);
}
@media (max-width: 640px) {
  .ot-dotmatrix { grid-template-columns: repeat(15, 1fr); }
}
.ot-dot {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--navy);
  opacity: 0; transform: scale(.2);
  transition: opacity .32s ease-out, transform .32s cubic-bezier(.2, .8, .2, 1.2);
}
.ot-dot.gold { background: var(--gold); }
.ot-dot.show { opacity: 1; transform: scale(1); }

/* =========================================================================
 * SCENE 3 — Growth bars
 * ========================================================================== */
.ot-scene-growth {
  background:
    linear-gradient(180deg, transparent 0%, rgba(245, 183, 31, .06) 100%),
    var(--navy);
  color: var(--cream);
}
.ot-scene-growth .ot-display { color: var(--cream); }

.ot-bars-wrap {
  width: 100%; max-width: 960px; margin: 0 auto;
  /* Extra bottom padding so the larger pop-number labels (and projection
   * text-shadow halos) don't get clipped. */
  padding: clamp(20px, 4vh, 40px) 0 clamp(80px, 12vh, 120px);
}
.ot-bars {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: clamp(8px, 1.5vw, 18px);
  align-items: end;
  height: clamp(260px, 38vh, 400px);
  border-bottom: 2px solid rgba(255, 248, 236, .18);
  padding-bottom: 6px;
}
.ot-bar {
  position: relative;
  display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end;
  height: 100%;
}
.ot-bar-fill {
  background: var(--cream);
  height: 0%;
  transition: height 1.1s cubic-bezier(.2, .8, .2, 1);
  position: relative;
}
.ot-bar.is-hero .ot-bar-fill { background: var(--maple-red); }

/* Projection bars (2026, 2031) — outline-only, softer colour, to signal
 * they're not real census counts yet. */
.ot-bar.is-projection .ot-bar-fill {
  background: transparent;
  border: 2px dashed var(--gold);
  border-bottom: none;
}

/* Projection bars pulse a few times on reveal to draw the eye to the
 * 2026/2031 end-figures. The pulse fades after three cycles so it
 * doesn't distract once the reader has arrived. */
@keyframes ot-projection-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 183, 31, 0); }
  50%      { box-shadow: 0 0 22px 3px rgba(245, 183, 31, .45); }
}
.ot-bar.is-projection.ot-is-highlighted .ot-bar-fill {
  animation: ot-projection-pulse 1.6s ease-in-out 0s 3;
}

.ot-bar-fill::after {
  content: attr(data-pct);
  position: absolute; top: -40px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  line-height: 1;
  color: var(--cream);
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s ease-out .5s, transform .5s ease-out .5s;
}
.ot-bar.in .ot-bar-fill::after { opacity: 1; transform: none; }
.ot-bar.is-hero .ot-bar-fill::after { color: var(--gold); }
.ot-bar.is-projection .ot-bar-fill::after { color: var(--gold); }

/* Population value under the year — e.g. "24,862" */
.ot-bar-pop {
  position: absolute; bottom: -60px; left: -8px; right: -8px;
  text-align: center;
  font-family: var(--font-display);
  font-size: clamp(1rem, 1.3vw + .3rem, 1.35rem);
  line-height: 1;
  color: var(--cream);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
/* Projection pop numbers: bigger, gold, with a soft halo so the 2026/2031
 * end-figures punch out. */
.ot-bar.is-projection .ot-bar-pop {
  font-size: clamp(1.2rem, 2vw + .4rem, 1.75rem);
  color: var(--gold);
  text-shadow: 0 0 14px rgba(245, 183, 31, .45);
}
.ot-bar-year {
  position: absolute; bottom: -30px; left: 0; right: 0;
  text-align: center;
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  font-size: .72rem;
  color: rgba(255, 248, 236, .55);
}
.ot-bar.is-projection .ot-bar-year { color: rgba(245, 183, 31, .7); }
.ot-bar-year-note {
  display: block; font-size: .62rem; font-weight: 600;
  letter-spacing: .1em; opacity: .7;
}

.ot-callout {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  margin: clamp(20px, 4vh, 40px) auto 0;
  padding: 18px 26px;
  border: 1px solid rgba(245, 183, 31, .35);
  border-radius: var(--radius-md);
  max-width: 520px;
}
.ot-callout-pct {
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1;
  color: var(--gold);
}
.ot-callout-sub {
  font-family: var(--font-body); font-weight: 600;
  color: var(--cream); font-size: .95rem;
  max-width: 34ch;
}
.ot-callout-cmp {
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  font-size: .72rem;
  color: rgba(255, 248, 236, .65);
}

/* =========================================================================
 * SCENE 4 — Infrastructure pressure
 * Four outline-SVG categories (roads, bridges, sidewalks, water) laid out
 * as a 2×2 editorial grid. Each category is a card with icon + label + short
 * gloss, revealed in sequence as the scene enters. Closes with a rhetorical
 * callout.
 * ========================================================================== */
.ot-scene-infra {
  background: var(--sand-soft);
  color: var(--ink);
}
.ot-scene-infra .ot-eyebrow { color: var(--maple-red); border-top-color: var(--navy); }
.ot-scene-infra .ot-display { color: var(--ink); }
.ot-scene-infra .ot-lede { color: rgba(15, 26, 51, .78); }
.ot-scene-infra .ot-lede strong { color: var(--navy); }
.ot-scene-infra .ot-caption { color: rgba(15, 26, 51, .55); }

/* Visually-hidden helper for SR-only prose (keeps the stat band aria-hidden
 * while giving screen readers the full sentence). */
.ot-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;
}

/* Stat band: two huge counters that tick up on reveal. Sits between the
 * lede and the category cards, anchoring the "infrastructure hasn't kept
 * up" argument in concrete population deltas. */
.ot-infra-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 56px);
  width: 100%; max-width: 980px; margin: 0 auto;
  padding: clamp(12px, 2vw, 24px) clamp(12px, 2vw, 24px) 0;
}
@media (max-width: 640px) {
  .ot-infra-stats { grid-template-columns: 1fr; gap: 20px; }
}
.ot-stat {
  display: flex; flex-direction: column; gap: 8px;
  align-items: center; text-align: center;
  padding: clamp(14px, 2vw, 22px) 8px;
  border-top: 3px solid var(--navy);
  opacity: 0; transform: translateY(18px);
  transition: opacity .6s ease-out, transform .6s cubic-bezier(.2, .8, .2, 1);
}
.ot-stat.ot-stat-alt { border-top-color: var(--gold); }
.ot-stat.show { opacity: 1; transform: none; }
.ot-stat-num {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: .9;
  letter-spacing: -.02em;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 rgba(255, 248, 236, .6);
}
.ot-stat-alt .ot-stat-num { color: var(--gold-deep, #A87A0A); }
.ot-stat-label {
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .14em;
  font-size: clamp(.78rem, .3vw + .7rem, .92rem);
  color: rgba(15, 26, 51, .72);
  max-width: 28ch;
}

.ot-infra {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 2vw, 28px);
  width: 100%; max-width: 980px; margin: 0 auto;
  padding: clamp(12px, 2vw, 20px);
}
@media (max-width: 760px) { .ot-infra { grid-template-columns: repeat(2, 1fr); } }

.ot-infra-card {
  background: rgba(255, 248, 236, .5);
  border: 1px solid rgba(22, 48, 110, .15);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius-md);
  padding: clamp(18px, 2.4vw, 28px) clamp(14px, 2vw, 22px);
  display: flex; flex-direction: column; gap: 12px;
  color: var(--ink);
  opacity: 0; transform: translateY(16px);
  transition: opacity .55s ease-out, transform .55s cubic-bezier(.2, .8, .2, 1);
}
.ot-infra-card.show { opacity: 1; transform: none; }
.ot-infra-card:nth-child(2) { border-top-color: var(--gold); }
.ot-infra-card:nth-child(3) { border-top-color: var(--maple-red); }
.ot-infra-card:nth-child(4) { border-top-color: var(--navy); }

.ot-infra-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  color: var(--navy);
}
.ot-infra-card:nth-child(2) .ot-infra-icon { color: var(--gold-deep); }
.ot-infra-card:nth-child(3) .ot-infra-icon { color: var(--maple-red); }
.ot-infra-icon svg { width: 100%; height: 100%; display: block; }

.ot-infra-label {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 1.3vw + .6rem, 1.6rem);
  line-height: 1;
  margin: 0; color: var(--ink);
}
.ot-infra-gloss {
  font-family: var(--font-body);
  font-size: .92rem; line-height: 1.45;
  margin: 0; color: rgba(15, 26, 51, .72);
}

.ot-callout-prompt {
  background: var(--cream);
  border: 1px solid rgba(22, 48, 110, .2);
  border-left: 4px solid var(--maple-red);
  padding: clamp(16px, 2.4vw, 22px) clamp(18px, 3vw, 28px);
  max-width: 620px; margin: clamp(18px, 3vh, 32px) auto 0;
  text-align: left;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.ot-callout-prompt .ot-callout-sub {
  font-family: var(--font-body);
  font-size: 1rem; line-height: 1.5;
  color: var(--ink);
  max-width: none; text-align: left;
}
.ot-callout-prompt .ot-callout-sub strong { color: var(--navy); }
.ot-callout-prompt .ot-callout-sub em { font-style: italic; color: var(--maple-red); font-weight: 600; }

/* =========================================================================
 * SCENE 5 — One in three (age skew)
 * ========================================================================== */
.ot-scene-age {
  background: var(--cream);
  color: var(--ink);
}
.ot-scene-age .ot-eyebrow { color: var(--maple-red); border-top-color: var(--navy); }
.ot-scene-age .ot-display { color: var(--ink); }
.ot-scene-age .ot-lede { color: rgba(15, 26, 51, .78); }
.ot-scene-age .ot-caption { color: rgba(15, 26, 51, .55); }

.ot-people {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 3vw, 40px);
  width: 100%; max-width: 720px; margin: 0 auto;
}
.ot-person {
  aspect-ratio: 5 / 8;
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s ease-out, transform .6s cubic-bezier(.2, .8, .2, 1);
}
.ot-person.show { opacity: 1; transform: none; }
.ot-person svg { width: 100%; height: 100%; display: block; }
.ot-person-ink   { color: var(--ink); }
.ot-person-gold  { color: var(--gold); }

/* =========================================================================
 * SCENE 6 — Voice close
 * ========================================================================== */
.ot-scene-close {
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(196, 30, 42, .18), transparent 60%),
    radial-gradient(1200px 700px at 85% 110%, rgba(245, 183, 31, .12), transparent 60%),
    var(--navy-deep, #0E2250);
  color: var(--cream);
}
.ot-scene-close .ot-display { color: var(--cream); }

.ot-blockquote {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, .7vw + .95rem, 1.4rem);
  line-height: 1.6;
  color: rgba(255, 248, 236, .92);
  max-width: 62ch; margin: 0 auto;
  padding: 0 clamp(14px, 3vw, 28px);
  border-left: 3px solid var(--gold);
  text-align: left;
}
.ot-blockquote p { margin: 0 0 1em; }
.ot-blockquote em { font-style: italic; color: var(--gold); }
.ot-blockquote-foot {
  margin-top: .6em;
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .8rem;
  color: var(--gold);
}

.ot-close-ctas {
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  margin-top: clamp(12px, 2vh, 22px);
}

.ot-sources-link {
  margin: clamp(16px, 3vh, 30px) 0 0;
  font-family: var(--font-head); font-weight: 700;
  text-transform: uppercase; letter-spacing: .18em;
  font-size: .75rem;
}
.ot-sources-link a { color: rgba(255, 248, 236, .7); text-decoration: none; border-bottom: 1px solid rgba(245, 183, 31, .4); padding-bottom: 2px; }
.ot-sources-link a:hover { color: var(--gold); border-bottom-color: var(--gold); }

/* =========================================================================
 * Sources block (static, bottom of page)
 * The inner wrapper reuses the .ot-scene-body class for layout reuse, but
 * this section isn't a .ot-scene — it isn't observed, so the default
 * opacity: 0 would never flip to 1. Force it visible here.
 * ========================================================================== */
.ot-sources {
  background: var(--ink);
  color: rgba(255, 248, 236, .75);
  padding: clamp(60px, 10vh, 100px) clamp(20px, 4vw, 48px);
}
.ot-sources .ot-scene-body { opacity: 1; transform: none; transition: none; }
.ot-sources-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  color: var(--cream);
  margin: 0 0 clamp(16px, 3vh, 26px);
  text-align: center;
}
.ot-sources-list {
  list-style: none; padding: 0; margin: 0 auto 20px;
  max-width: 720px;
  display: grid; gap: 12px;
  font-family: var(--font-body);
  font-size: .92rem; line-height: 1.5;
}
.ot-sources-list li { padding-left: 18px; position: relative; }
.ot-sources-list li::before {
  content: ""; position: absolute; left: 0; top: .65em;
  width: 8px; height: 2px; background: var(--gold);
}
.ot-sources-list a {
  color: var(--cream); text-decoration: none;
  border-bottom: 1px dotted rgba(245, 183, 31, .5);
}
.ot-sources-list a:hover { color: var(--gold); border-bottom-style: solid; }
.ot-sources-note {
  max-width: 620px; margin: 22px auto 0;
  font-size: .85rem; color: rgba(255, 248, 236, .55);
  text-align: center; line-height: 1.5;
}
.ot-sources-note a { color: var(--gold); }

/* =========================================================================
 * Reduced motion — no surprises, no scroll reveals, no bob.
 * All content remains readable; static state is the same as the "in" state.
 * ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .ot-scene-body { opacity: 1; transform: none; transition: none; }
  .ot-scroll-cue { animation: none; }
  .ot-dot { opacity: 1; transform: none; transition: none; }
  .ot-bar-fill { transition: none; }
  .ot-bar.is-projection.ot-is-highlighted .ot-bar-fill { animation: none; }
  .ot-bar-fill::after { opacity: 1; transform: none; transition: none; }
  .ot-infra-card { opacity: 1; transform: none; transition: none; }
  .ot-stat { opacity: 1; transform: none; transition: none; }
  .ot-person { opacity: 1; transform: none; transition: none; }
  /* In reduced-motion mode the bars should be at their correct heights immediately;
     our-town.js detects prefers-reduced-motion and sets final heights without animation. */
}

/* =========================================================================
 * Small-screen polish
 * ========================================================================== */
@media (max-width: 540px) {
  .ot-scene { padding-block: clamp(60px, 10vh, 90px); }
  .ot-scene-body { gap: 14px; }
  .ot-scene-hero { padding-top: clamp(60px, 10vh, 100px); }
  .ot-callout { padding: 14px 18px; }
  .ot-bars {
    height: 220px;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
  }
  .ot-bar-fill::after { font-size: .78rem; top: -28px; }
  .ot-bar-year { font-size: .58rem; letter-spacing: .08em; }
  .ot-bar-pop { font-size: .8rem; bottom: -48px; }
  .ot-bar.is-projection .ot-bar-pop { font-size: 1rem; bottom: -52px; }
  .ot-blockquote { padding: 0 14px; }
}
