/*
  Public site styles. Mobile-first: the base rules are for a 360px phone,
  and the media queries at the bottom add columns on bigger screens.
  All colors come from tokens.css so the brand stays in one place.
*/

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

html { -webkit-text-size-adjust: 100%; }
html.menu-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--navy);
  line-height: 1.15;
  margin: 0 0 var(--space-16);
}
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3, .h3 { font-size: 1.2rem; }
p { margin: 0 0 var(--space-16); }

a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--navy); }

img { max-width: 100%; height: auto; }

/* Visible keyboard focus on everything (WCAG 2.4.7). Mouse clicks don't show it. */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.on-dark :focus-visible { outline-color: var(--focus-on-dark); }

/* Hidden but still read by screen readers */
.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: first thing a keyboard user reaches */
.skip-link {
  position: absolute;
  left: var(--space-16);
  top: -100px;
  background: var(--navy);
  color: var(--white);
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-sm);
  z-index: 1200;
}
.skip-link:focus { top: var(--space-16); color: var(--white); }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-16);
}

/* ---------- Header (option A) ---------- */
.site-header {
  container: none;
  position: sticky;
  top: 0;
  z-index: 1100;
  background: var(--white);
  border-bottom: var(--border-hairline) solid var(--rule);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-16);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.brand picture {
  display: block;
  line-height: 0;
}
.brand img {
  display: block;
  height: 44px;
  width: auto;
  max-width: none;
}

/* Desktop nav: hidden below 1100px */
.primary-nav { display: none; }
.primary-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--space-24);
}
.primary-nav__list > li { max-width: none; }
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  min-height: 44px;
  padding: var(--space-8) 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-label);
  letter-spacing: var(--tracking-label);
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover { color: var(--navy); }
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: var(--space-4);
  height: 2px;
  background: var(--navy);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--motion-fast) var(--motion-ease);
}
.nav-link:hover::after,
.nav-link:focus-visible::after,
.nav-link[aria-current="page"]::after,
.nav-link[aria-expanded="true"]::after,
.nav-link.is-current::after {
  transform: scaleX(1);
}
.nav-chev {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  transition: transform var(--motion-fast) var(--motion-ease);
}
.nav-work-btn[aria-expanded="true"] .nav-chev { transform: rotate(180deg); }

/* No-JS fallback vs JS button for "Our Work" */
.js .nav-work-link { display: none; }
.nav-work-btn { display: none; }
.js .nav-work-btn { display: inline-flex; }

/* "Our Work" dropdown panel */
.nav-dropdown { position: relative; }
.dropdown[hidden] { display: none; }
.dropdown {
  position: absolute;
  top: calc(100% + var(--space-8));
  left: 0;
  min-width: 15rem;
  margin: 0;
  padding: var(--space-8);
  list-style: none;
  background: var(--white);
  border: var(--border-hairline) solid var(--rule);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
  z-index: 1110;
}
.dropdown li { max-width: none; }
.dropdown__link {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: 44px;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-label);
  color: var(--navy);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--motion-fast) var(--motion-ease);
}
.dropdown__link:hover,
.dropdown__link:focus-visible {
  background: var(--sand);
  color: var(--navy);
}
.dropdown__link[aria-current="page"] {
  background: var(--sand);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

/* Pillar color squares (dropdown + phone menu) */
.pillar-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}
.pillar-swatch--edu { background: var(--pillar-education); }
.pillar-swatch--water { background: var(--pillar-water); }
.pillar-swatch--jobs { background: var(--pillar-jobs); }

/* Yellow Donate button inside header and phone panel (uses v2 tokens.css .btn--donate) */
.site-header .btn--donate,
.mobile-panel .btn--donate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap-min);
  padding: var(--space-8) var(--space-24);
  background: var(--sun);
  color: var(--navy);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-button);
  font-weight: var(--weight-bold);
  line-height: var(--leading-button);
  letter-spacing: var(--tracking-button);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--motion-fast) var(--motion-ease);
}
.site-header .btn--donate:hover,
.mobile-panel .btn--donate:hover {
  background: var(--sun-hover);
  color: var(--navy);
}
.mobile-panel .btn--donate.btn--block {
  display: flex;
  width: 100%;
}

/* Phone menu control: no-JS anchor to #footer-nav vs JS toggle button */
.menu-link,
.nav-toggle {
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  padding: var(--space-8) var(--space-16);
  background: var(--white);
  color: var(--navy);
  border: var(--border-control) solid var(--border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color var(--motion-fast) var(--motion-ease),
              background-color var(--motion-fast) var(--motion-ease);
}
.menu-link:hover,
.nav-toggle:hover {
  border-color: var(--navy);
  background: var(--sand);
  color: var(--navy);
}
.menu-link { display: inline-flex; }
.js .menu-link { display: none; }
.nav-toggle { display: none; }
.js .nav-toggle { display: inline-flex; }
.nav-toggle__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-menu { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }
.nav-toggle[aria-expanded="true"] {
  border-color: var(--navy);
  background: var(--sand);
}

/* ---------- Phone menu ---------- */
.mobile-panel[hidden] { display: none; }
.mobile-panel {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1090;
  background: var(--sand);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-panel__inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-16) calc(var(--space-24) + env(safe-area-inset-bottom, 0px));
}
.mobile-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-nav__list > li {
  border-bottom: var(--border-hairline) solid var(--rule);
  max-width: none;
}
.mobile-nav__heading,
.mobile-nav__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-16);
  min-height: var(--tap-min);
  padding: var(--space-12) 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: var(--weight-bold);
  line-height: 1.1;
  letter-spacing: var(--tracking-h3);
  color: var(--navy);
  text-decoration: none;
}
.mobile-nav__link:hover,
.mobile-nav__link[aria-current="page"] {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
}
.mobile-nav__idx {
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.08em;
  color: var(--slate);
  flex: 0 0 auto;
}
.mobile-nav__sub {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-12);
  display: grid;
  gap: var(--space-4);
}
.mobile-nav__sub li { max-width: none; }
.mobile-nav__sublink {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  min-height: 44px;
  padding: var(--space-8) 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  color: var(--ink);
  text-decoration: none;
}
.mobile-nav__sublink:hover {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.mobile-nav__sublink[aria-current="page"] {
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
.mobile-panel__foot {
  margin-top: auto;
  padding-top: var(--space-16);
  display: grid;
  gap: var(--space-12);
}
.proof-strip {
  padding-top: 0;
}
.proof {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}
.proof__item {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: 0 var(--space-8);
  border-left: var(--border-hairline) solid var(--rule);
  min-width: 0;
}
.proof__item:first-child {
  padding-left: 0;
  border-left: 0;
}
.proof__item:last-child { padding-right: 0; }
.proof__value {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: var(--weight-bold);
  line-height: 1;
  color: var(--navy);
}
.proof__label {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-micro);
  font-weight: var(--weight-medium);
  line-height: 1.3;
  color: var(--slate);
  overflow-wrap: break-word;
}
.proof__asof {
  margin: var(--space-12) 0 0;
  font-size: var(--text-micro);
  font-weight: var(--weight-medium);
  line-height: var(--leading-micro);
  color: var(--slate);
}
.mobile-panel__staff {
  margin: 0;
  text-align: center;
}
.mobile-panel__staff a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-8) var(--space-12);
  font-size: var(--text-caption);
  font-weight: var(--weight-medium);
  color: var(--slate);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.mobile-panel__staff a:hover { color: var(--navy); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  padding: 0.75rem 1.25rem;
  min-height: 44px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
}
.btn-primary { background: var(--green); color: var(--white); }
.btn-primary:hover { background: var(--navy); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--navy); }
.btn-secondary:hover { background: var(--mist); color: var(--navy); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--space-8); }

/* ---------- Sections ---------- */
.section { padding: var(--space-40) 0; }
.section-mist { background: var(--mist); }
.lead { font-size: 1.1rem; color: var(--slate); }
.eyebrow {
  display: inline-block;
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--green);
  margin-bottom: var(--space-8);
}

/* Hero: navy panel with white text (high contrast) */
.hero {
  background: var(--navy);
  color: var(--white);
  padding: var(--space-64) 0 var(--space-40);
  position: relative;
}
.hero::after {
  /* thin lagoon + sun stripe at the bottom, a nod to the flag */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--lagoon) 0 70%, var(--sun) 70% 100%);
}
.hero h1 { color: var(--white); font-size: 2.2rem; }
.hero p { color: var(--white); font-size: 1.1rem; max-width: 40rem; }
.hero .btn-secondary { background: transparent; color: var(--white); border-color: var(--white); }
.hero .btn-secondary:hover { background: var(--white); color: var(--navy); }

.page-head { background: var(--mist); padding: var(--space-40) 0 var(--space-24); border-bottom: 1px solid var(--line); }

/* ---------- Stat tiles ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-16);
  margin: 0;
  padding: 0;
  list-style: none;
}
.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 5px solid var(--green);
  border-radius: var(--radius);
  padding: var(--space-16);
  box-shadow: var(--shadow);
}
.stat:nth-child(2) { border-top-color: var(--blue); }
.stat:nth-child(3) { border-top-color: var(--lagoon); }
.stat:nth-child(4) { border-top-color: var(--sun); }
.stat-value {
  display: block;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 2rem;
  color: var(--navy);
  line-height: 1.1;
}
.stat-label { display: block; font-size: 0.95rem; color: var(--ink); }
.as-of { font-size: 0.9rem; color: var(--slate); margin-top: var(--space-16); }

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-16); }
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--space-24);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.card h3, .card .h3 { margin-bottom: var(--space-8); }
.card p { color: var(--ink); }
.card .card-link { margin-top: auto; font-weight: 600; }
.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--navy);
  border: 1px solid var(--line);
}

/* Placeholder notice for pages SR&C has not filled in yet */
.notice {
  border-left: 5px solid var(--sun);
  background: #FFFBEA;
  padding: var(--space-16);
  border-radius: var(--radius);
  margin-bottom: var(--space-24);
}

/* ---------- Map ---------- */
.map-box {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--mist);
}
.map-list { list-style: none; padding: 0; margin: var(--space-16) 0 0; }
.map-list li { padding: var(--space-8) 0; border-bottom: 1px solid var(--line); }
.map-popup img { display: block; max-width: 220px; margin-top: var(--space-8); border-radius: 6px; }
.map-popup .photo-btn {
  font: inherit; font-size: 0.85rem; font-weight: 600;
  margin-top: var(--space-8);
  background: var(--navy); color: var(--white);
  border: 0; border-radius: 6px; padding: 6px 10px; cursor: pointer;
}

/* ---------- Forms ---------- */
.form { display: grid; gap: var(--space-16); max-width: 40rem; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: var(--space-4); }
.field .hint { display: block; font-size: 0.9rem; color: var(--slate); margin-bottom: var(--space-4); }
.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.75rem;
  min-height: 44px;
  border: 2px solid var(--slate);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
}
.field textarea { min-height: 140px; resize: vertical; }
fieldset.field { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--space-16); margin: 0; }
label.check {
  display: flex;
  gap: var(--space-8);
  align-items: flex-start;
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  margin: var(--space-4) 0;
  font-weight: 400;
}
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
/* Honeypot: hidden from people, but bots fill it in. Not display:none, which some bots skip. */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { font-weight: 600; }
.form-status.ok { color: var(--green); }
.form-status.err { color: #991B1B; }

/* ---------- Tables / lists ---------- */
.plain-list { padding-left: 1.2rem; }

/* ---------- Footer ---------- */
.site-footer {
  container: none;
  background: var(--navy-deep);
  color: var(--text-on-dark);
  padding: var(--space-48) 0 var(--space-32);
  margin-top: var(--space-48);
  font-family: var(--font-body);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}
.footer-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-32);
  padding-bottom: var(--space-32);
  border-bottom: var(--border-hairline) solid var(--rule-on-dark);
}
.footer-brand img {
  display: block;
  height: 44px;
  width: auto;
}
.footer-nav {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-24);
}
.site-footer .footer-head {
  margin: 0 0 var(--space-12);
  font-family: var(--font-body);
  font-size: var(--text-eyebrow);
  font-weight: var(--weight-bold);
  line-height: var(--leading-eyebrow);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
}
.site-footer .footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}
.site-footer .footer-links li { max-width: none; }
.site-footer a {
  color: var(--text-on-dark);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
.site-footer .footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: var(--space-4) 0;
}
.site-footer a:hover {
  color: var(--text-on-dark);
  text-decoration-thickness: 2px;
}
.site-footer a[aria-current="page"] {
  font-weight: var(--weight-bold);
  text-decoration-thickness: 2px;
}
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-16) var(--space-32);
  padding-top: var(--space-24);
}
.footer-meta p {
  margin: 0 0 var(--space-4);
  font-size: var(--text-caption);
  color: var(--text-on-dark-muted);
  max-width: none;
}
.footer-meta p:last-child { margin-bottom: 0; }
.footer-staff {
  margin: 0;
  font-size: var(--text-caption);
}
.footer-staff a { color: var(--text-on-dark-muted); }
.footer-staff a:hover { color: var(--text-on-dark); }

/* ---------- Bigger screens ---------- */
@media (min-width: 640px) {
  h1 { font-size: 2.5rem; }
  .hero h1 { font-size: 3rem; }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .map-box { height: 460px; }
  .footer-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .card-grid.three { grid-template-columns: repeat(3, 1fr); }
  .map-box { height: 540px; }
  .footer-top {
    grid-template-columns: minmax(0, 2fr) minmax(0, 10fr);
    gap: var(--space-48);
    align-items: start;
  }
}

@media (min-width: 1100px) {
  :root { --header-h: 5rem; }
  .brand img { height: 64px; }
  .primary-nav {
    display: flex;
    align-items: center;
    gap: var(--space-32);
    margin-left: auto;
  }
  .menu-link,
  .js .menu-link,
  .nav-toggle,
  .js .nav-toggle,
  .mobile-panel {
    display: none;
  }
}

/* Respect people who ask for less motion */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
