/* ==========================================================================
   WAVE — Water Access & Venues for Everyone
   Design system + components. Single stylesheet, no build step.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --deep:        #0B2942;
  --deep-2:      #123A5C;
  --deep-3:      #1B4E77;
  --pool:        #0C7291;
  --pool-bright: #16A6C9;
  --pool-light:  #B8E6F2;
  --pool-wash:   #EDF7FA;
  --sun:         #B0590A;
  --sun-bright:  #F0932E;
  --sun-soft:    #FFF6EC;
  --alert:       #B3261E;
  --ok:          #1F7A4D;
  --ok-soft:     #E8F5EE;

  /* Text that sits on the deep/navy sections. These were hardcoded hex
     values until themes arrived; they have to be tokens or a green theme
     ends up with blue-grey text on it. */
  --on-deep:        #C6DFEC;
  --on-deep-strong: #E6F2F8;
  --on-deep-muted:  #93B3C4;
  --accent-on-deep: #FFC489;
  --link-on-deep:   #B8E6F2;

  --ink:         #14212C;
  --ink-2:       #3D4F5C;
  --muted:       #63757F;
  --bg:          #FFFFFF;
  --surface:     #F5F9FB;
  --surface-2:   #EAF2F6;
  --line:        #D9E4EA;
  --line-strong: #B9CBD5;

  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 2px rgba(11,41,66,.06), 0 2px 6px rgba(11,41,66,.05);
  --shadow-md:   0 2px 6px rgba(11,41,66,.07), 0 10px 28px rgba(11,41,66,.09);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --wrap: 1120px;
  --wrap-narrow: 760px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --deep:        #041726;
    --deep-2:      #0A2438;
    --deep-3:      #17547E;
    --pool:        #3FBEDC;
    --pool-bright: #5BD0EA;
    --pool-light:  #1D4E60;
    --pool-wash:   #0E2836;
    --sun:         #F0A055;
    --sun-bright:  #F0A055;
    --sun-soft:    #35240F;
    --alert:       #F08A82;
    --ok:          #6BCB98;
    --ok-soft:     #10301F;

    --on-deep:        #C6DFEC;
    --on-deep-strong: #E6F2F8;
    --on-deep-muted:  #93B3C4;
    --accent-on-deep: #FFC489;
    --link-on-deep:   #8FD9EC;

    --ink:         #E8F1F6;
    --ink-2:       #B9CCD8;
    --muted:       #8FA6B3;
    --bg:          #071A28;
    --surface:     #0C2434;
    --surface-2:   #123044;
    --line:        #1D3E53;
    --line-strong: #2A566F;

    --shadow-sm:   0 1px 2px rgba(0,0,0,.3), 0 2px 6px rgba(0,0,0,.25);
    --shadow-md:   0 2px 6px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.4);
  }
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; color: var(--ink); }
h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2.1rem); letter-spacing: -.02em; }
h3 { font-size: 1.2rem; }
h4 { font-size: 1.02rem; }
p  { margin: 0 0 1.1em; }
ul, ol { margin: 0 0 1.1em; padding-left: 1.3em; }
li { margin-bottom: .4em; }
li::marker { color: var(--pool); }

a { color: var(--pool); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--deep-3); }

:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Dark grounds need a lighter ring to keep 3:1 against their background. */
.hero :focus-visible,
.section--deep :focus-visible,
.site-footer :focus-visible,
.election-bar :focus-visible { outline-color: var(--accent-on-deep); }

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--sun); color: #fff; padding: .7rem 1.1rem;
  font-weight: 600; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.25rem; }
.wrap--narrow { max-width: var(--wrap-narrow); }
.section { padding-block: clamp(2.75rem, 5vw, 4.5rem); }
.section--surface { background: var(--surface); border-block: 1px solid var(--line); }
.section--deep { background: var(--deep); color: var(--on-deep-strong); }
.section--deep h2, .section--deep h3 { color: #fff; }
.section--deep p { color: var(--on-deep); }
/* .lede and .stat-note carry their own light-mode colours; inside a deep
   section they need the on-dark tokens instead. This replaces a pile of
   inline style="color:#..." attributes that themes could not reach. */
.section--deep .lede,
.section--deep li { color: var(--on-deep); }
.section--deep .small-print,
.section--deep .stat-note { color: var(--on-deep-muted); }
.section--deep a { color: var(--link-on-deep); }
.section--deep strong { color: var(--on-deep-strong); }

.lede { font-size: 1.15rem; color: var(--ink-2); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 68px; }

.brand { display: flex; align-items: center; gap: .65rem; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand:hover { color: var(--ink); }
.brand-mark { width: 34px; height: 34px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-weight: 800; font-size: 1.02rem; letter-spacing: -.02em; }
.brand-sub { font-size: .72rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }

.nav { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.nav a {
  padding: .5rem .7rem; border-radius: 7px; text-decoration: none;
  color: var(--ink-2); font-weight: 550; font-size: .93rem; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--pool); background: var(--pool-wash); font-weight: 650; }
/* .nav a would otherwise override the button's own colour and radius. */
.nav a.btn { border-radius: 8px; }
.nav a.btn--primary, .nav a.btn--primary:hover { color: #FFFFFF; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav a.btn--primary,
  :root:not([data-theme="light"]) .nav a.btn--primary:hover { color: #2A1704; }
}

.nav-toggle {
  margin-left: auto; display: none; align-items: center; gap: .5rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: .45rem .75rem; border-radius: 8px; cursor: pointer;
}

@media (max-width: 900px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: .5rem 1.25rem 1rem; box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .75rem .5rem; border-radius: 0; border-bottom: 1px solid var(--line); }
  .nav .btn { margin-top: .75rem; justify-content: center; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .7rem 1.25rem; border-radius: 8px;
  font-weight: 650; font-size: .96rem; text-decoration: none;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  transition: transform .12s ease, background-color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--sun); color: #FFFFFF; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: #8E4707; color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--primary { color: #2A1704; }
  :root:not([data-theme="light"]) .btn--primary:hover { background: #FFB672; color: #2A1704; }
}

.btn--pool { background: var(--pool); color: #fff; box-shadow: var(--shadow-sm); }
.btn--pool:hover { background: var(--deep-3); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn--pool { color: #041726; }
  :root:not([data-theme="light"]) .btn--pool:hover { background: var(--pool-bright); color: #041726; }
}

.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn--on-deep { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.35); color: #fff; }
.btn--on-deep:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn--sm { padding: .45rem .85rem; font-size: .87rem; }

.btn-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

/* ---------- Election banner ---------- */
.election-bar {
  background: var(--deep); color: var(--on-deep-strong);
  font-size: .88rem; border-bottom: 1px solid rgba(255,255,255,.1);
}
.election-bar .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center; padding-block: .55rem; }
.election-bar strong { color: #fff; }
.election-bar .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sun-bright); flex-shrink: 0; }
.election-bar a { color: var(--link-on-deep); font-weight: 600; }

/* ---------- Hero ---------- */
.hero { position: relative; background: var(--deep); color: #fff; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(1000px 420px at 82% -10%, rgba(22,166,201,.45), transparent 62%),
    radial-gradient(700px 360px at 8% 110%, rgba(27,78,119,.6), transparent 60%);
  pointer-events: none;
}
/* Lane lines sit in the lower band of the hero only, so they never stripe
   across the headline on narrow screens. */
.hero-lanes {
  position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
  opacity: .15; pointer-events: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 70%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 70%);
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 62px,
    rgba(255,255,255,.55) 62px 63px
  );
}
.hero .wrap { position: relative; z-index: 2; padding-block: clamp(3rem, 7vw, 5.5rem); }
.hero h1 { color: #fff; max-width: 17ch; }
.hero .lede { color: var(--on-deep); font-size: clamp(1.05rem, 1rem + .4vw, 1.28rem); max-width: 56ch; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .78rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--sun); margin-bottom: 1rem;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--sun); }
.hero .eyebrow { color: var(--accent-on-deep); }
.hero .eyebrow::before { background: var(--accent-on-deep); }

/* ---------- Countdown ---------- */
.countdown {
  display: inline-flex; align-items: baseline; gap: .5rem;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.2);
  border-radius: var(--radius); padding: .7rem 1.1rem; margin-top: 1.75rem;
  color: var(--on-deep); font-size: .95rem;
}
.countdown-num { font-size: 1.9rem; font-weight: 800; color: #fff; line-height: 1; letter-spacing: -.02em; }

/* ---------- Stats ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
}
.stat { background: var(--bg); padding: 1.5rem 1.35rem; }
.stat-num {
  font-size: clamp(2rem, 1.6rem + 1.6vw, 2.7rem); font-weight: 800;
  color: var(--pool); line-height: 1; letter-spacing: -.03em; margin-bottom: .45rem;
}
.stat-label { font-weight: 650; font-size: .97rem; margin-bottom: .3rem; }
.stat-note { font-size: .84rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 1.6rem; box-shadow: var(--shadow-sm);
}
.card h3 { margin-bottom: .5rem; }
.card p:last-child { margin-bottom: 0; }
.card-icon {
  width: 42px; height: 42px; border-radius: 10px; background: var(--pool-wash);
  color: var(--pool); display: grid; place-items: center; margin-bottom: 1rem;
}
.card-icon svg { width: 22px; height: 22px; }

a.card { text-decoration: none; color: inherit; display: block; transition: border-color .15s, transform .15s, box-shadow .15s; }
a.card:hover { border-color: var(--pool); transform: translateY(-2px); box-shadow: var(--shadow-md); color: inherit; }
.card-more { color: var(--pool); font-weight: 650; font-size: .93rem; display: inline-flex; gap: .35rem; align-items: center; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 10px; bottom: 10px;
  width: 2px; background: var(--line-strong);
}
.timeline li { position: relative; padding-left: 2.1rem; margin-bottom: 1.6rem; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 8px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--line-strong);
}
.timeline li.is-now::before { border-color: var(--sun-bright); background: var(--sun-bright); }
.timeline li.is-future::before { border-color: var(--pool); }
.timeline-date { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.timeline-title { font-weight: 650; margin: .1rem 0 .25rem; }
.timeline p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* ---------- Callouts ---------- */
.callout {
  border-left: 4px solid var(--pool); background: var(--pool-wash);
  padding: 1.15rem 1.35rem; border-radius: 0 var(--radius) var(--radius) 0; margin-block: 1.75rem;
}
.callout p:last-child { margin-bottom: 0; }
.callout--warn { border-left-color: var(--sun); background: var(--sun-soft); }
.callout-title { font-weight: 700; margin-bottom: .35rem; display: block; }

.note-unverified {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--sun); background: var(--sun-soft);
  border: 1px solid color-mix(in srgb, var(--sun) 35%, transparent);
  padding: .1rem .45rem; border-radius: 4px; vertical-align: middle; margin-left: .35rem;
}

/* ---------- Questionnaire accordion ---------- */
.qa { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg); }
.qa details { border-bottom: 1px solid var(--line); }
.qa details:last-child { border-bottom: 0; }
.qa summary {
  display: flex; align-items: flex-start; gap: .9rem; cursor: pointer;
  padding: 1.1rem 1.35rem; font-weight: 650; list-style: none;
}
.qa summary::-webkit-details-marker { display: none; }
.qa summary:hover { background: var(--surface); }
.qa summary::after {
  content: ""; margin-left: auto; flex-shrink: 0; width: 10px; height: 10px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(45deg); transition: transform .2s ease; margin-top: .35rem;
}
.qa details[open] summary::after { transform: rotate(-135deg); margin-top: .6rem; }
.qa-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 6px;
  background: var(--pool); color: #fff; font-size: .82rem; font-weight: 700;
  display: grid; place-items: center; margin-top: .1rem;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .qa-num { color: #041726; } }
.qa-body { padding: 0 1.35rem 1.35rem 3.6rem; }
.qa-body p:last-child, .qa-body ul:last-child { margin-bottom: 0; }
.qa-body ul { color: var(--ink-2); }

/* ---------- Candidate tracker ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: .85rem; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 1.15rem 1.25rem; margin-bottom: 1.5rem;
}
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .8rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.field select, .field input {
  font: inherit; font-size: .94rem; padding: .5rem .7rem; min-width: 180px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--bg); color: var(--ink);
}
.filter-count { margin-left: auto; font-size: .9rem; color: var(--muted); padding-bottom: .55rem; }

.muni-group { margin-bottom: 2.25rem; }
.muni-head {
  display: flex; align-items: baseline; gap: .75rem;
  border-bottom: 2px solid var(--line-strong); padding-bottom: .5rem; margin-bottom: 1rem;
}
.muni-head h3 { margin: 0; }
.muni-head span { font-size: .88rem; color: var(--muted); }

.cand-list { display: grid; gap: .6rem; }
.cand {
  display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1.1rem;
}
.cand-name { font-weight: 650; }
.cand-role { font-size: .85rem; color: var(--muted); }
.cand-actions { margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.pill {
  display: inline-flex; align-items: center; gap: .38rem;
  font-size: .8rem; font-weight: 700; padding: .22rem .6rem; border-radius: 100px;
  border: 1px solid transparent; white-space: nowrap;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill--responded { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.pill--awaiting  { color: var(--muted); background: var(--surface-2); border-color: var(--line-strong); }
.pill--declined  { color: var(--alert); background: color-mix(in srgb, var(--alert) 10%, transparent); border-color: color-mix(in srgb, var(--alert) 30%, transparent); }
.pill--mayor     { color: var(--deep-3); background: var(--pool-wash); border-color: color-mix(in srgb, var(--pool) 30%, transparent); }
.pill--mayor::before { display: none; }

.empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--muted);
  border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); background: var(--surface);
}

/* ---------- Response detail ---------- */
.answer-block { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 1rem; }
.answer-q { font-weight: 650; margin-bottom: .35rem; }
.answer-a { color: var(--ink-2); margin: 0; white-space: pre-wrap; }

/* ---------- Email template ---------- */
.template {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); overflow: hidden;
}
.template-head {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .85rem 1.15rem; border-bottom: 1px solid var(--line); background: var(--surface-2);
}
.template-head h3 { margin: 0; font-size: 1rem; }
.template-head .btn { margin-left: auto; }
.template-body {
  padding: 1.25rem; font-family: var(--mono); font-size: .87rem;
  line-height: 1.7; white-space: pre-wrap; margin: 0; color: var(--ink-2);
  max-height: 420px; overflow-y: auto;
}
.copy-flash { font-size: .85rem; font-weight: 650; color: var(--ok); }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); }
table.data { border-collapse: collapse; width: 100%; font-size: .93rem; min-width: 560px; }
table.data th, table.data td { text-align: left; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
table.data thead th { background: var(--surface-2); font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
table.data tbody tr:last-child td { border-bottom: 0; }

/* ---------- Footer ---------- */
.site-footer { background: var(--deep); color: var(--on-deep); padding-block: 3rem 2rem; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 2.5rem; margin-bottom: 2.5rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; gap: 1.75rem; } }
.site-footer h3 { color: #fff; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .85rem; }
.site-footer a { color: var(--on-deep); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: .5rem; }
.footer-brand { display: flex; align-items: center; gap: .6rem; margin-bottom: .85rem; }
.footer-brand .brand-name { color: #fff; font-size: 1.05rem; font-weight: 800; }
.footer-note { font-size: .88rem; line-height: 1.6; color: var(--on-deep-muted); max-width: 46ch; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.14); padding-top: 1.5rem;
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; font-size: .84rem; color: var(--on-deep-muted);
}
.footer-bottom .nonpartisan { font-weight: 650; color: var(--on-deep); }

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1.5rem; } .mt-3 { margin-top: 2.25rem; }
.text-center { text-align: center; }
.small-print { font-size: .9rem; color: var(--muted); }
.max-60 { max-width: 60ch; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; }

/* ==========================================================================
   Reasons + photography (added for the "Why it matters" page)
   Images are Creative Commons licensed; attribution is displayed with each
   one and must not be removed. Several carry ND / SA terms — see
   credits at the foot of that page before cropping or editing any of them.
   ========================================================================== */

.reason {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  padding-block: clamp(2rem, 4vw, 3.25rem);
  border-top: 1px solid var(--line);
}
.reason:first-of-type { border-top: 0; padding-top: .5rem; }
.reason:nth-child(even) .reason-media { order: -1; }

@media (max-width: 760px) {
  .reason { grid-template-columns: 1fr; gap: 1.5rem; }
  .reason:nth-child(even) .reason-media { order: 0; }
}

.reason-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--pool); color: #fff;
  font-weight: 800; font-size: .95rem; margin-bottom: .9rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .reason-num { color: #041726; }
}
.reason h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.75rem); margin-bottom: .6rem; }
.reason p:last-child { margin-bottom: 0; }

.reason-media { margin: 0; }
.reason-media img {
  /* Natural aspect ratio, scaled to fit. Several of these carry NoDerivatives
     terms, so nothing is cropped — and letterboxing them into a fixed box
     looked worse than simply letting each one be its own shape. */
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.reason-media figcaption {
  font-size: .78rem; color: var(--muted);
  margin-top: .5rem; line-height: 1.5;
}
.reason-media figcaption a { color: var(--muted); text-decoration: underline; }
.reason-media figcaption a:hover { color: var(--ink); }

.photo-pending {
  display: grid; place-items: center; text-align: center;
  aspect-ratio: 4 / 3; border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong); background: var(--surface);
  color: var(--muted); font-size: .85rem; padding: 1.5rem;
}

/* ---- Asks ---- */
.ask {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg); padding: 1.6rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.ask-head { display: flex; align-items: baseline; gap: .8rem; flex-wrap: wrap; margin-bottom: .6rem; }
.ask-tag {
  flex-shrink: 0; font-size: .72rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--pool);
  background: var(--pool-wash); border: 1px solid color-mix(in srgb, var(--pool) 25%, transparent);
  padding: .2rem .55rem; border-radius: 5px;
}
.ask-head h2 { margin: 0; font-size: 1.25rem; }
.ask-horizon { font-size: .82rem; color: var(--muted); font-weight: 600; }
.ask p:last-child { margin-bottom: 0; }

/* ---- Credits ---- */
.credits { font-size: .86rem; color: var(--ink-2); }
.credits li { margin-bottom: .7rem; }
.credits a { color: var(--pool); }

/* ==========================================================================
   THEMES
   --------------------------------------------------------------------------
   Three palettes. The active one is set by assets/js/theme.js, which puts a
   data-palette attribute on <html> before the page paints.

   To change the site's theme:   edit the SITE_THEME line in assets/js/theme.js
   To compare them side by side: open theme-admin.html

   Every colour below is checked against WCAG AA for text contrast in both
   light and dark mode. If you change one, re-check it. The failure that bit
   us was muted grey on table headers, not anything eye-catching.
   ========================================================================== */

/* ---- Tide: Deep navy, pool teal and amber. Calm and civic - the original look. ---- */
[data-palette="tide"] {
  --deep:             #0B2942;
  --deep-2:           #123A5C;
  --deep-3:           #1B4E77;
  --pool:             #0C7291;
  --pool-bright:      #16A6C9;
  --pool-light:       #B8E6F2;
  --pool-wash:        #EDF7FA;
  --sun:              #B0590A;
  --sun-bright:       #F0932E;
  --sun-soft:         #FFF6EC;
  --on-deep:          #C6DFEC;
  --on-deep-strong:   #E6F2F8;
  --on-deep-muted:    #93B3C4;
  --accent-on-deep:   #FFC489;
  --link-on-deep:     #B8E6F2;
  --bg:               #FFFFFF;
  --surface:          #F5F9FB;
  --surface-2:        #EAF2F6;
  --ink:              #14212C;
  --ink-2:            #3D4F5C;
  --muted:            #5D6D77;
  --line:             #D9E4EA;
  --line-strong:      #B9CBD5;
}

/* ---- Harbour: Midnight blue, bright cyan and rust. Cooler, with more urgency. ---- */
[data-palette="harbour"] {
  --deep:             #082433;
  --deep-2:           #0E3850;
  --deep-3:           #14567A;
  --pool:             #0A6E85;
  --pool-bright:      #23B3CE;
  --pool-light:       #A9E2EE;
  --pool-wash:        #E9F6F9;
  --sun:              #A8443A;
  --sun-bright:       #F07A64;
  --sun-soft:         #FFF1EE;
  --on-deep:          #C4DDE8;
  --on-deep-strong:   #E4F1F7;
  --on-deep-muted:    #8FAFBF;
  --accent-on-deep:   #FFB199;
  --link-on-deep:     #A9E2EE;
  --bg:               #FFFFFF;
  --surface:          #F4F9FB;
  --surface-2:        #E7F1F5;
  --ink:              #111E28;
  --ink-2:            #3A4C57;
  --muted:            #596B74;
  --line:             #D6E3E9;
  --line-strong:      #B4C8D2;
}

/* ---- Cedar: Forest green, warm teal and terracotta. Pacific Northwest, less corporate. ---- */
[data-palette="cedar"] {
  --deep:             #10312A;
  --deep-2:           #17453B;
  --deep-3:           #1F5E4F;
  --pool:             #0E6B58;
  --pool-bright:      #2FA98C;
  --pool-light:       #B3E3D5;
  --pool-wash:        #ECF7F3;
  --sun:              #9C5320;
  --sun-bright:       #E08A46;
  --sun-soft:         #FDF3EA;
  --on-deep:          #C3DFD6;
  --on-deep-strong:   #E4F2EC;
  --on-deep-muted:    #8FB3A7;
  --accent-on-deep:   #F5C08A;
  --link-on-deep:     #B3E3D5;
  --bg:               #FFFFFF;
  --surface:          #F4FAF7;
  --surface-2:        #E7F2ED;
  --ink:              #132420;
  --ink-2:            #3B504A;
  --muted:            #596E69;
  --line:             #D7E5DF;
  --line-strong:      #B6CCC4;
}

/* Dark mode, per palette. Without these, switching palette would leave the
   previous theme's colours behind whenever the reader's OS is in dark mode. */
@media (prefers-color-scheme: dark) {

  [data-palette="tide"]:not([data-theme="light"]) {
    --deep:             #041726;
    --deep-2:           #0A2438;
    --deep-3:           #17547E;
    --pool:             #3FBEDC;
    --pool-bright:      #5BD0EA;
    --pool-light:       #1D4E60;
    --pool-wash:        #0E2836;
    --sun:              #F0A055;
    --sun-bright:       #F0A055;
    --sun-soft:         #35240F;
    --on-deep:          #C6DFEC;
    --on-deep-strong:   #E6F2F8;
    --on-deep-muted:    #93B3C4;
    --accent-on-deep:   #FFC489;
    --link-on-deep:     #8FD9EC;
    --bg:               #071A28;
    --surface:          #0C2434;
    --surface-2:        #123044;
    --ink:              #E8F1F6;
    --ink-2:            #B9CCD8;
    --muted:            #8FA6B3;
    --line:             #1D3E53;
    --line-strong:      #2A566F;
  }

  [data-palette="harbour"]:not([data-theme="light"]) {
    --deep:             #03151F;
    --deep-2:           #0A2836;
    --deep-3:           #14607F;
    --pool:             #3CC0D8;
    --pool-bright:      #5FD5E8;
    --pool-light:       #16505F;
    --pool-wash:        #0B2732;
    --sun:              #F09277;
    --sun-bright:       #F09277;
    --sun-soft:         #33190F;
    --on-deep:          #C4DDE8;
    --on-deep-strong:   #E4F1F7;
    --on-deep-muted:    #8FAFBF;
    --accent-on-deep:   #FFB199;
    --link-on-deep:     #8CDCEC;
    --bg:               #05161F;
    --surface:          #0A2430;
    --surface-2:        #0F3040;
    --ink:              #E6F2F7;
    --ink-2:            #B6CCD6;
    --muted:            #8CA6B1;
    --line:             #1A3D4C;
    --line-strong:      #27566A;
  }

  [data-palette="cedar"]:not([data-theme="light"]) {
    --deep:             #061D17;
    --deep-2:           #0C2C24;
    --deep-3:           #1C6553;
    --pool:             #4CC3A4;
    --pool-bright:      #6FD8BC;
    --pool-light:       #17493C;
    --pool-wash:        #0A2620;
    --sun:              #E9A86A;
    --sun-bright:       #E9A86A;
    --sun-soft:         #2E2113;
    --on-deep:          #C3DFD6;
    --on-deep-strong:   #E4F2EC;
    --on-deep-muted:    #8FB3A7;
    --accent-on-deep:   #F5C08A;
    --link-on-deep:     #8FDCC5;
    --bg:               #071C16;
    --surface:          #0C2A22;
    --surface-2:        #113429;
    --ink:              #E6F3ED;
    --ink-2:            #BACFC5;
    --muted:            #90ACA0;
    --line:             #1B4235;
    --line-strong:      #285C4A;
  }
}

/* ---- Theme preview reminder bar (only ever shown to whoever set a preview) ---- */
.theme-preview-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
  display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem;
  padding: .7rem 1.25rem;
  background: var(--deep); color: var(--on-deep);
  border-top: 3px solid var(--sun-bright);
  font-size: .87rem; box-shadow: 0 -4px 16px rgba(0,0,0,.18);
}
.theme-preview-bar strong { color: var(--on-deep-strong); }
.theme-preview-bar .btn { margin-left: auto; border-color: var(--on-deep-muted); color: var(--on-deep-strong); }
.theme-preview-bar .btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.has-preview-bar { padding-bottom: 4.5rem; }

/* ==========================================================================
   Theme admin page (theme-admin.html only)
   ========================================================================== */
.admin-note {
  border-left: 4px solid var(--sun); background: var(--sun-soft);
  padding: 1.15rem 1.35rem; border-radius: 0 var(--radius) var(--radius) 0; margin-block: 1.75rem;
}
.admin-note p:last-child { margin-bottom: 0; }

.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }

.theme-card {
  border: 2px solid var(--line); border-radius: var(--radius-lg);
  background: var(--bg); padding: 1.35rem; text-align: left;
  font: inherit; cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.theme-card:hover { border-color: var(--pool); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.theme-card[aria-pressed="true"] { border-color: var(--pool); box-shadow: var(--shadow-md); }
.theme-card h3 { margin-bottom: .2rem; display: flex; align-items: center; gap: .6rem; }
.theme-card p { font-size: .9rem; color: var(--muted); margin-bottom: 1rem; }

.swatches { display: flex; gap: 6px; margin-bottom: 1rem; }
.swatches span {
  width: 100%; height: 42px; border-radius: 6px;
  border: 1px solid rgba(0,0,0,.12);
}

.theme-state { font-size: .8rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.theme-state--live { color: var(--ok); }
.theme-state--preview { color: var(--sun); }

.sample {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; margin-top: 1.5rem;
}
.sample-deep { background: var(--deep); padding: 1.75rem 1.5rem; }
.sample-deep h3 { color: var(--on-deep-strong); margin-bottom: .4rem; }
.sample-deep p { color: var(--on-deep); margin-bottom: 1rem; font-size: .95rem; }
.sample-light { background: var(--bg); padding: 1.75rem 1.5rem; border-top: 1px solid var(--line); }
.sample-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.sample-row:last-child { margin-bottom: 0; }

.code-line {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1.1rem; margin-top: .75rem;
}
.code-line code { font-family: var(--mono); font-size: .9rem; color: var(--ink); }
.code-line .btn { margin-left: auto; }

/* The brand mark is inline SVG with hardcoded fills baked into nine pages.
   CSS beats SVG presentation attributes, so this themes it without editing
   every file. (favicon.svg is a separate static file and can't follow the
   theme — swap it by hand if you publish a palette other than Tide.) */
.brand-mark rect { fill: var(--pool); }
.site-footer .brand-mark rect { fill: var(--pool-bright); }
.site-footer .brand-mark g { stroke: var(--deep); }
