/* Catchment Showcase — section styles
   Drops into any GrammarBound page. Scoped to .cs- prefix. */

@keyframes gb-tier-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

.catchment-section {
  background: #fff;
  padding: 88px 24px 96px;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.cs-wrap {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.cs-head { max-width: 760px; }

.cs-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #1F3A8A;
  background: #F4EFE2; border: 1px solid #E4D5A8;
  padding: 5px 12px; border-radius: 999px;
}
.cs-badge-dot {
  width: 6px; height: 6px; border-radius: 999px; background: #1F3A8A;
}

.cs-title {
  font-size: 42px; line-height: 1.08; font-weight: 800;
  letter-spacing: -0.02em; color: #0F172A;
  margin: 18px 0 14px;
  text-wrap: balance;
}
.cs-title em {
  font-style: italic; color: #1F3A8A;
  font-weight: 800;
}
.cs-lede {
  font-size: 17px; line-height: 1.6; color: #475569;
  margin: 0;
  text-wrap: pretty;
}

.cs-grid {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 36px;
  align-items: stretch;
}

/* Steps column */
.cs-steps {
  display: flex; flex-direction: column; gap: 10px;
}
.cs-step {
  --c: #64748B;
  text-align: left;
  background: #FAFAF7;
  border: 1.5px solid #E2E8F0;
  border-left: 3px solid #E2E8F0;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all 0.18s ease;
}
.cs-step:hover {
  border-color: var(--c);
  background: #fff;
}
.cs-step.is-active {
  background: #fff;
  border-color: var(--c);
  border-left: 3px solid var(--c);
  box-shadow: 0 6px 22px -14px rgba(15, 23, 42, 0.18);
}
.cs-step.is-active .cs-step-num {
  background: var(--c); color: #fff;
}
.cs-step.is-active .cs-step-title {
  color: #0F172A;
}
.cs-step-num {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1.5px solid var(--c);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px; font-weight: 800;
  color: var(--c);
  background: #fff;
}
.cs-step.is-active .cs-step-num {
  background: var(--c);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent);
}
.cs-step-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.cs-step-title {
  font-size: 15px; font-weight: 700; color: #334155;
  line-height: 1.3;
}
.cs-step.is-active .cs-step-title { color: #0F172A; }
.cs-step-sub {
  font-size: 13px; color: #64748B; line-height: 1.45;
}
.cs-step-caption {
  font-size: 13px; color: #475569; line-height: 1.55;
  margin-top: 8px;
  display: block;
  opacity: 0.78;
}
.cs-step.is-active .cs-step-caption {
  opacity: 1;
  color: #334155;
}

.cs-progress {
  margin-top: 6px;
  display: flex; align-items: center; gap: 10px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11.5px; color: #94A3B8;
}
.cs-progress-label b { color: #334155; font-weight: 700; }
.cs-progress-bar {
  flex: 1;
  height: 3px; background: #E2E8F0; border-radius: 2px; overflow: hidden;
}
.cs-progress-bar > span {
  display: block; height: 100%; background: #1F3A8A;
  width: 20%; transition: width 0.4s ease, background 0.18s;
  border-radius: 2px;
}
.cs-autoplay {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid #CBD5E1;
  padding: 5px 12px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; color: #475569;
  cursor: pointer; font-family: inherit;
}
.cs-autoplay-dot {
  width: 8px; height: 8px; border-radius: 999px; background: #94A3B8;
}
.cs-autoplay.is-on .cs-autoplay-dot { background: #16A34A; }

/* Map column */
.cs-map {
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  background: #FCFCFA;
  padding: 22px;
  display: flex; flex-direction: column; gap: 14px;
  min-height: 540px;
}
.cs-map-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px;
}
.cs-map-title {
  font-weight: 700; color: #64748B;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.cs-map-url {
  color: #94A3B8;
  font-family: ui-monospace, SFMono-Regular, monospace;
}
/* Map container — Leaflet takes over */
.cs-map-svg, .cs-map-leaflet {
  flex: 1; min-height: 460px;
  border-radius: 12px;
  overflow: hidden;
  background: #F6F4EE;
}
.cs-map-leaflet { position: relative; }
.cs-map-svg > svg { width: 100%; height: 100%; }

.cs-map-cta {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  align-self: flex-start;
  background: #C99B43;
  color: #fff; font-weight: 700; font-size: 14px;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: 10px;
}
.cs-map-cta:hover { filter: brightness(1.06); }

@media (max-width: 920px) {
  .cs-grid { grid-template-columns: 360px 1fr; gap: 24px; }
}
@media (max-width: 780px) {
  .catchment-section { padding: 56px 18px 64px; }
  .cs-title { font-size: 30px; }
  .cs-lede { font-size: 15px; }
  .cs-grid { grid-template-columns: 1fr; gap: 24px; }
  .cs-map { min-height: 460px; padding: 16px; }
  .cs-map-svg { min-height: 360px; }
}

/* ────────────────────────────────────────────────────────────────
   Catchment Schools (cs2-) — tabbed showcase
   ──────────────────────────────────────────────────────────────── */

.cs2-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: #F1F5F9;
  border: 1px solid #E2E8F0; border-radius: 999px;
  align-self: flex-start; flex-wrap: wrap;
}
.cs2-tab {
  padding: 9px 18px; font-size: 13.5px; font-weight: 600;
  border-radius: 999px; border: 0; background: transparent;
  color: #64748B; cursor: pointer; font-family: inherit;
}
.cs2-tab:hover { color: #0F172A; background: rgba(255,255,255,0.6); }
.cs2-tab.is-active {
  background: #fff; color: #0F172A;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.18);
}

.cs2-grid {
  display: grid; grid-template-columns: 1.25fr 1fr;
  gap: 32px; align-items: stretch;
}
@media (max-width: 920px) {
  .cs2-grid { grid-template-columns: 1fr; gap: 24px; }
}

.cs2-map-card {
  border: 1px solid #E2E8F0; border-radius: 18px;
  background: #FCFCFA; padding: 22px;
  display: flex; flex-direction: column; gap: 12px;
  min-height: 520px;
}
.cs2-map { flex: 1; min-height: 460px; border-radius: 12px; overflow: hidden; background: #F6F4EE; position: relative; }
.cs2-map > svg { width: 100%; height: 100%; }

.cs2-text { display: flex; flex-direction: column; gap: 18px; }
.cs2-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #64748B;
}
.cs2-shape {
  font-size: 30px; line-height: 1.12; font-weight: 800;
  letter-spacing: -0.015em; color: #0F172A;
  text-wrap: balance;
}
.cs2-summary {
  font-size: 16px; line-height: 1.6; color: #475569; margin: 0;
  text-wrap: pretty;
}

.cs2-tiers {
  border: 1px solid #E2E8F0; border-radius: 14px; background: #fff;
  overflow: hidden;
}
.cs2-tier {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 14px 18px;
}
.cs2-tier + .cs2-tier { border-top: 1px solid #F1F5F9; }
.cs2-tier-dot {
  flex-shrink: 0; margin-top: 4px;
  width: 14px; height: 14px; border-radius: 4px;
  opacity: 0.85;
}
.cs2-tier-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cs2-tier-label { font-size: 14px; font-weight: 700; color: #0F172A; }
.cs2-tier-val { font-size: 13px; color: #64748B; line-height: 1.5; }

/* ────────────────────────────────────────────────────────────────
   Leaflet marker / label styles (used by divIcon)
   ──────────────────────────────────────────────────────────────── */

.gb-pin { background: transparent; border: 0; }

.gb-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  color: #334155;
  white-space: nowrap;
  text-align: center;
  box-shadow: 0 4px 12px -8px rgba(15, 23, 42, 0.30);
  display: inline-block;
  pointer-events: none;
}
.gb-label span {
  display: block;
  font-weight: 500; letter-spacing: 0;
  text-transform: none;
  font-size: 10px; color: #64748B;
  margin-top: 2px;
}
.gb-label-muted    { color: #64748B; }
.gb-label-outer    { color: #0E7490; border-color: #7C8AA0; }
.gb-label-outer span { color: #0E7490; opacity: 0.85; }
.gb-label-pp       { color: #B45309; border-color: #C99B43; }
.gb-label-pp span  { color: #B45309; opacity: 0.85; }
.gb-label-cranbrook { color: #0E7490; border-color: #7C8AA0; }
.gb-label-score-in {
  color: #9F1239; border-color: #9C5570;
  text-align: left; padding: 5px 9px; font-size: 10.5px;
}
.gb-label-score-out {
  color: #64748B; border-color: #CBD5E1;
  text-align: left; padding: 5px 9px; font-size: 10.5px;
}

.gb-person-wrap { background: transparent; border: 0; }
.gb-person {
  width: 22px; height: 22px; border-radius: 50%;
  background: #1F3A8A; border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.30);
}
.gb-person-in  { background: #1F3A8A; }
.gb-person-out { background: #fff; border-color: #94A3B8; border-width: 2px; }

.gb-legend {
  background: #fff; border: 1px solid #E2E8F0; border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 6px 18px -10px rgba(15, 23, 42, 0.25);
  pointer-events: none;
  width: 180px;
}
.gb-legend-title {
  font-size: 11px; font-weight: 700; color: #0F172A;
  letter-spacing: 0.06em; margin-bottom: 8px;
}
.gb-legend-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 600; color: #334155;
  margin-top: 4px;
}
.gb-legend-sw { width: 12px; height: 12px; border-radius: 2px; flex-shrink: 0; }

/* Loading state shown while geojson fetches */
.cs2-loading {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #94A3B8;
  background: #F6F4EE; border-radius: 12px;
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  letter-spacing: 0.04em;
}

/* Leaflet container — kill the default font so divIcons inherit ours */
.leaflet-container { font-family: system-ui, -apple-system, sans-serif !important; background: #F6F4EE !important; }

/* ────────────────────────────────────────────────────────────────
   Catchment Comparison (cs3-) — side-by-side simple vs layered
   ──────────────────────────────────────────────────────────────── */

.cs3-wrap {
  max-width: 1240px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 36px;
}
.cs3-head { max-width: 760px; }
.cs3-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #1F3A8A;
  background: #F4EFE2; border: 1px solid #E4D5A8;
  padding: 5px 12px; border-radius: 999px;
}
.cs3-badge-dot { width: 6px; height: 6px; border-radius: 999px; background: #1F3A8A; }
.cs3-title {
  font-size: 42px; line-height: 1.08; font-weight: 800;
  letter-spacing: -0.02em; color: #0F172A;
  margin: 18px 0 14px; text-wrap: balance;
}
.cs3-title em { font-style: italic; color: #1F3A8A; font-weight: 800; }
/* On wide desktops keep the headline on a single line (it sits above the
   760px head, so let it run to its natural width rather than wrap). */
@media (min-width: 1040px) {
  .cs3-title { white-space: nowrap; text-wrap: nowrap; }
}
.cs3-lede {
  font-size: 17px; line-height: 1.6; color: #475569;
  margin: 0; text-wrap: pretty;
}

.cs3-grid {
  display: grid; grid-template-columns: 1fr 1.18fr;
  gap: 24px; align-items: stretch;
}
@media (max-width: 920px) {
  .cs3-grid { grid-template-columns: 1fr; }
}

.cs3-card {
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  background: #FCFCFA;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cs3-card-new {
  border: 1.5px solid #1F3A8A;
  background: #fff;
  box-shadow: 0 14px 40px -22px rgba(31, 58, 138, 0.40);
}

.cs3-card-head {
  padding: 22px 24px 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.cs3-card-eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: #64748B;
}
.cs3-card-eyebrow-brand { color: #1F3A8A; }
.cs3-card-head h3 {
  font-size: 20px; line-height: 1.25; font-weight: 700;
  letter-spacing: -0.01em; color: #0F172A;
  margin: 0;
}
.cs3-card-old .cs3-card-head h3 { color: #475569; }

.cs3-map {
  height: 360px;
  background: #F6F4EE;
}

.cs3-card-foot {
  padding: 16px 22px 22px;
  display: flex; flex-direction: column; gap: 9px;
}
.cs3-foot-row {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; line-height: 1.5; color: #475569;
}
.cs3-foot-row b { color: #0F172A; font-weight: 700; }
.cs3-dot {
  flex-shrink: 0; margin-top: 6px;
  width: 10px; height: 10px; border-radius: 3px;
  opacity: 0.95;
}

.cs3-foot-cta {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(135deg, rgba(31, 58, 138, 0.06) 0%, rgba(124, 138, 160, 0.06) 100%);
  border: 1px solid #E4D5A8;
  border-radius: 14px;
  padding: 18px 22px;
  font-size: 14.5px; line-height: 1.55; color: #334155;
  flex-wrap: wrap;
}
.cs3-cta {
  display: inline-flex; align-items: center; gap: 8px;
  flex-shrink: 0;
  background: #C99B43;
  color: #fff; font-weight: 700; font-size: 14px;
  text-decoration: none;
  padding: 11px 18px; border-radius: 10px;
}
.cs3-cta:hover { filter: brightness(1.06); }

@media (max-width: 780px) {
  .cs3-title { font-size: 30px; }
  .cs3-lede { font-size: 15px; }
  .cs3-map { height: 280px; }
}

/* ────────────────────────────────────────────────────────────────
   Mobile-first overrides — single-screen-ish layout for each section
   so people can take in the feature without endless scrolling.
   ──────────────────────────────────────────────────────────────── */

@media (max-width: 780px) {
  /* ── Deep dive (cs-) — map first, only active step expanded ─── */
  .catchment-section { padding: 40px 16px 48px; }
  .cs-wrap { gap: 22px; }
  .cs-title { font-size: 26px; line-height: 1.12; }
  .cs-lede  { font-size: 14.5px; }
  .cs-grid  { grid-template-columns: 1fr; gap: 14px; }

  /* Map pulled to the top so tapping a step updates a visible map. */
  .cs-map {
    order: -1;
    min-height: auto;
    padding: 14px;
    gap: 10px;
    position: sticky;
    top: 8px;
    z-index: 3;
    box-shadow: 0 6px 16px -10px rgba(15, 23, 42, 0.18);
  }
  .cs-map-leaflet { min-height: 260px; height: 260px; }

  /* Steps — only the active card shows its full caption; others
     collapse to title + sub. Keeps the list short on small screens. */
  .cs-steps { gap: 8px; }
  .cs-step { padding: 10px 12px; gap: 12px; }
  .cs-step-num {
    width: 26px; height: 26px;
    border-radius: 7px;
    font-size: 11px;
  }
  .cs-step-title { font-size: 14px; }
  .cs-step-sub   { font-size: 12px; }
  .cs-step:not(.is-active) .cs-step-sub { display: none; }
  .cs-step:not(.is-active) .cs-step-caption { display: none; }
  .cs-step.is-active .cs-step-caption { font-size: 12.5px; margin-top: 6px; }

  .cs-progress { font-size: 10.5px; padding-top: 4px; }
  .cs-autoplay { padding: 4px 10px; font-size: 10.5px; }

  /* Mid-map CTA wraps */
  .cs-map-cta { font-size: 13px; padding: 10px 14px; }

  /* ── Schools switcher (cs2-) — sticky scrollable tab strip ──── */
  .cs2-grid { grid-template-columns: 1fr; gap: 16px; }
  .cs2-tabs {
    align-self: stretch;
    position: sticky; top: 8px; z-index: 4;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    background: #F1F5F9;
    box-shadow: 0 4px 12px -8px rgba(15, 23, 42, 0.18);
  }
  .cs2-tabs::-webkit-scrollbar { display: none; }
  .cs2-tab { white-space: nowrap; padding: 8px 14px; font-size: 12.5px; flex-shrink: 0; }

  .cs2-map-card { min-height: auto; padding: 14px; gap: 10px; }
  .cs2-map { min-height: 280px; }
  .cs2-text { gap: 12px; }
  .cs2-shape { font-size: 22px; }
  .cs2-summary { font-size: 14.5px; line-height: 1.55; }
  .cs2-tier { padding: 11px 14px; gap: 10px; }
  .cs2-tier-label { font-size: 13px; }
  .cs2-tier-val   { font-size: 12px; }

  /* ── Comparison (cs3-) — vertical stack with tighter maps ───── */
  .cs3-wrap { gap: 22px; }
  .cs3-grid { gap: 16px; }
  .cs3-card-head { padding: 16px 16px 12px; gap: 4px; }
  .cs3-card-head h3 { font-size: 17px; }
  .cs3-card-eyebrow { font-size: 10.5px; }
  .cs3-map { height: 240px; }
  .cs3-card-foot { padding: 12px 16px 16px; gap: 8px; }
  .cs3-foot-row { font-size: 12.5px; }
  .cs3-foot-cta { padding: 14px 16px; font-size: 13.5px; gap: 12px; }
  .cs3-cta { font-size: 13px; padding: 9px 14px; }
}

@media (max-width: 480px) {
  .cs-map-leaflet { min-height: 230px; height: 230px; }
  .cs2-map        { min-height: 240px; }
  .cs3-map        { height: 210px; }
  .cs-title, .cs3-title { font-size: 23px; }
  .cs2-shape { font-size: 20px; }
}
