:root {
  /* Deep Pacific Northwest palette — deep pine-teal on cool coastal mist, with a
     warm terracotta accent. Cooler and deeper than a warm-cream wellness look. */
  --bg: #e8edeb;          /* cool coastal mist — page background */
  --surface: #fbfdfc;     /* crisp near-white — cards and panels */
  --border: #d3ddd9;      /* cool grey-green edge */
  --text: #17211f;        /* deep spruce charcoal */
  --text-muted: #52605c;  /* cool slate-green (readable contrast) */
  --primary: #1f5f56;     /* deep pine-teal — main color */
  --primary-dark: #143f39; /* darker teal — gradients, hovers */
  --primary-soft: #d9e6e2; /* cool pale teal highlight */
  --link: #1a544c;         /* link/heading text — goes light in dark mode */
  --accent: #cf6a4a;      /* warm terracotta — the pop against deep teal */
  --accent-text: #9c4327; /* darker terracotta for text/fills needing contrast */
  --danger: #a23a2f;      /* clear brick red (distinct from the terracotta accent) */
  --danger-soft: #f6e8e5;
  --ok: #4f7a45;          /* fern green (fills, borders) */
  --ok-soft: #e2ecdd;
  --ok-text: #3c6132;     /* darker fern for LABEL TEXT on tints (WCAG AA) */
  --warn: #b1832f;        /* amber ochre (fills, borders) */
  --warn-soft: #f2ecda;
  --warn-text: #795310;   /* darker amber for LABEL TEXT on tints (WCAG AA) */
  --radius: 12px;
  --shadow: 0 8px 26px rgba(20, 40, 38, 0.10);
  --shadow-sm: 0 2px 8px rgba(20, 40, 38, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  /* Dyslexia-friendly, highly legible sans-serif stack. "Atkinson Hyperlegible"
     (a free accessibility font) is used if installed; otherwise it falls back to
     wide, clear system sans-serifs recommended by the British Dyslexia Association.
     Generous size and spacing, plus the off-white (not pure-white) background,
     all improve readability for dyslexic and low-vision readers. */
  font-family: "Atkinson Hyperlegible", Verdana, Tahoma, "Trebuchet MS", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: 0.012em;
  word-spacing: 0.02em;
}

a { color: var(--link); }
/* Links inside body prose are underlined so they don't rely on color alone
   to be distinguishable from surrounding text (WCAG 1.4.1). */
.land-ack a, .site-footer a, .refs a, .give-list a, .card-desc a, .callout a { text-decoration: underline; }

/* Headings: confident weight + tight tracking (kept in the accessible Atkinson
   sans rather than a decorative serif, so dyslexia-friendliness is preserved). */
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.018em; line-height: 1.18; }

/* Clear, high-visibility focus ring for keyboard and screen-reader users. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.group-card:focus-visible,
.cal-event:focus-visible {
  /* Dark ring (high contrast on light surfaces) + a light halo so the indicator
     also stands out against dark/teal buttons — WCAG 1.4.11 / 2.4.11. */
  outline: 3px solid var(--text);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(255, 253, 247, 0.9);
  border-radius: 4px;
}

/* "Skip to main content" link — hidden until a keyboard user tabs to it. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary-dark);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 100;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus {
  left: 0;
}

/* Respect users who ask the system to reduce motion. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Header / nav ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}
.site-header .inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  color: var(--link);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.brand-name { font-weight: 700; font-size: 18px; white-space: nowrap; }
.brand-tagline { font-size: 12px; font-weight: 400; color: var(--text-muted); }
.brand .dot { color: var(--accent); }
.nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.nav a {
  text-decoration: none;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.active { color: var(--link); background: var(--primary-soft); }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}
.narrow { max-width: 720px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--link); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(0.95); }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.block { display: block; width: 100%; text-align: center; }

/* ---------- Hero ---------- */
/* ---------- Image placeholders ---------- */
.img-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  background: var(--primary-soft);
  background-image: repeating-linear-gradient(
    45deg,
    transparent, transparent 14px,
    rgba(47, 125, 118, 0.06) 14px, rgba(47, 125, 118, 0.06) 28px
  );
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.img-placeholder .ph-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.img-placeholder svg { width: 44px; height: 44px; opacity: 0.55; }
.img-placeholder .ph-label { font-weight: 700; font-size: 16px; letter-spacing: 0.02em; }
.img-placeholder .ph-hint { font-size: 12.5px; opacity: 0.9; max-width: 340px; }
/* Header banner shape */
.header-img {
  width: 100%;
  aspect-ratio: 16 / 5;
  min-height: 170px;
  margin-bottom: 20px;
}
/* Group photo on a detail page (placeholder box or real image share this shape) */
.detail-photo {
  width: 100%;
  aspect-ratio: 16 / 7;
  min-height: 150px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
img.detail-photo {
  object-fit: cover;
  display: block;
  box-shadow: var(--shadow-sm);
}

.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 48px 40px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 34px; margin: 0 0 12px; line-height: 1.2; }
.hero p { font-size: 17px; margin: 0 0 24px; max-width: 640px; opacity: 0.95; }
.hero .btn { margin-right: 12px; margin-bottom: 8px; }
.hero .btn.ghost { background: rgba(255,255,255,0.14); border-color: rgba(255,255,255,0.4); color: #fff; }
.hero .btn.ghost:hover { background: rgba(255,255,255,0.24); }
.hero .btn.white { background: #fff; color: var(--primary-dark); border-color: #fff; }

/* Two side-by-side calls to action: "Find a group" (primary) and "List your group". */
.hero-split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: stretch;
}
.hero-split .hero {
  margin: 0;
  padding: 34px 32px;
  display: flex;
  flex-direction: column;
}
.hero-split .hero h1 { font-size: 30px; }
.hero-split .hero p { flex: 1; }          /* pushes the button to the bottom so both align */
.hero-split .hero .btn { align-self: flex-start; margin-bottom: 0; }
/* The secondary box (list your group) is a lighter card, not the teal gradient. */
.hero-secondary {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
}
.hero-secondary h2 { font-size: 24px; margin: 0 0 12px; line-height: 1.2; color: var(--link); }
.hero-secondary p { opacity: 1; }

@media (max-width: 720px) {
  .hero-split { grid-template-columns: 1fr; }
}

/* ---------- Land & labor acknowledgement ---------- */
.land-ack {
  margin-top: 20px;
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-left: 6px solid var(--primary);
  border-radius: var(--radius);
  padding: 28px 32px;
  scroll-margin-top: 84px; /* so the sticky header doesn't cover the heading on jump */
}
.land-ack h2 {
  margin: 0 0 14px;
  font-size: 22px;
  color: var(--link);
}
/* Collapsible: only the heading shows until expanded, so the page isn't overwhelmed. */
.land-ack > details { scroll-margin-top: 84px; }
.land-ack-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
}
.land-ack-summary::-webkit-details-marker { display: none; }
.land-ack-summary::before {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 2.5px solid var(--link);
  border-bottom: 2.5px solid var(--link);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}
details[open] > .land-ack-summary::before { transform: rotate(45deg); }
.land-ack-summary h2 { margin: 0; }
.land-ack-hint { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.land-ack-body { margin-top: 18px; }
.land-ack p { margin: 0 0 14px; max-width: 70ch; }
.land-ack p:last-child { margin-bottom: 0; }
.tribe-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 24px;
}
.tribe-list li {
  font-size: 14px;
  padding: 3px 0 3px 16px;
  position: relative;
}
.tribe-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.give-box {
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  scroll-margin-top: 84px; /* clears the sticky header when linked to directly */
}
.give-box h3 { margin: 0 0 12px; font-size: 17px; color: var(--link); }
.give-list { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 12px; }
.give-list li { font-size: 14.5px; line-height: 1.55; padding-left: 18px; position: relative; }
.give-list li::before {
  content: "";
  position: absolute; left: 0; top: 9px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.give-list a { font-weight: 700; color: var(--link); }
.give-box .hint { margin: 0; }

/* Donation buttons on the Support page */
.support-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0 4px; }
.support-buttons .btn { font-size: 15px; padding: 12px 20px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 40px;
  padding: 24px 20px;
  background: var(--surface);
}
.site-footer p {
  max-width: 960px;
  margin: 0 auto;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.6;
}
.site-footer a { color: var(--link); font-weight: 600; }
.site-footer .footer-action {
  margin-top: 10px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--text);
}
.site-footer .footer-links { margin-top: 10px; }

/* References page */
.refs h2 { font-size: 20px; margin: 28px 0 8px; color: var(--link); border-top: 1px solid var(--border); padding-top: 20px; }
.refs h3 { font-size: 15px; margin: 16px 0 6px; }
.refs ul { margin: 0 0 8px; padding-left: 20px; }
.refs li { margin-bottom: 8px; font-size: 14.5px; line-height: 1.55; }
.refs .callout { background: var(--warn-soft); border-radius: var(--radius); padding: 16px 18px; margin: 16px 0; font-size: 14px; }

.feature-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 28px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.feature h3 { margin: 0 0 6px; font-size: 16px; }
.feature p { margin: 0; color: var(--text-muted); font-size: 14px; }

.section-title { font-size: 22px; margin: 36px 0 6px; }
/* Signature: a short terracotta rule under the main page/section headings. */
.section-title::after, .hero h1::after {
  content: "";
  display: block;
  width: 46px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  margin-top: 10px;
}
.hero h1::after { background: rgba(255, 255, 255, 0.85); }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ---------- Browse layout ---------- */
.browse-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 76px;
  /* When the filter list is taller than the screen, let the panel scroll on its
     own so the bottom (Apply/Clear) is always reachable instead of pinned off-screen. */
  max-height: calc(100vh - 92px);
  overflow-y: auto;
}
.filters h2 { font-size: 15px; margin: 0 0 4px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.filter-group { border-top: 1px solid var(--border); padding: 10px 0; }
.filter-group:first-of-type { border-top: none; }
.filter-group > .legend {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}
/* Collapsible filter sections (native <details>/<summary>). */
summary.legend {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  user-select: none;
}
summary.legend::-webkit-details-marker { display: none; }
summary.legend::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  flex: none;
}
details[open] > summary.legend::before { transform: rotate(45deg); }
details.filter-group[open] > summary.legend { margin-bottom: 8px; }
.fcount {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  padding: 3px 0;
  cursor: pointer;
  color: var(--text);
}
.check input { margin-top: 3px; }
.filter-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Applied-filter chips above the results */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--link);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 4px 12px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.4;
}
.chip:hover { background: var(--primary); color: #fff; }
.chip span[aria-hidden] { font-size: 12px; opacity: 0.85; }
.chip.clear-all {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  font-weight: 500;
}
.chip.clear-all:hover { background: var(--bg); color: var(--text); }

/* Honeypot anti-spam field — off-screen and hidden from assistive tech. */
.hp { position: absolute !important; left: -9999px !important; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* Visually hidden but available to screen readers */
.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;
}

/* ---------- Results ---------- */
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.results-head h1 { font-size: 20px; margin: 0; }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.view-toggle a {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--text-muted);
  background: var(--surface);
}
.view-toggle a.active { background: var(--primary); color: #fff; }

.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: box-shadow 0.15s, transform 0.12s, border-color 0.15s;
}
/* Crisp lift on hover, with the deep-teal border, instead of a soft glow. */
.group-card:hover { box-shadow: var(--shadow); border-color: var(--primary); transform: translateY(-2px); }
.group-card h3 { margin: 0 0 4px; font-size: 17px; color: var(--link); letter-spacing: -0.01em; }
.card-meta { color: var(--text-muted); font-size: 13.5px; margin-bottom: 10px; }
.card-desc { font-size: 14px; margin: 0 0 12px; }

.badges { display: flex; flex-wrap: wrap; gap: 6px; }
/* Squared tags (not pills) for a crisper, more distinct look. */
.badge {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge.format { background: var(--primary-soft); color: var(--link); border-color: transparent; }
.badge.covid { background: var(--warn-soft); color: var(--warn-text); border-color: transparent; }
.badge.cost { background: var(--ok-soft); color: var(--ok-text); border-color: transparent; }
.badge.type { background: #efe8da; }
.badge.ident { background: #efe6ef; color: #6b4d69; border-color: transparent; }
.badge.lang { background: #e7edf2; color: #3f5a70; border-color: transparent; }
.badge.nd { background: #e7efe9; color: #2f6b57; border-color: transparent; }
/* Who leads the group (licensed clinician / peer support / traditional healer …) */
.badge.facil { background: var(--primary); color: #fff; border-color: transparent; font-weight: 600; }

.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head h2 { flex: 1; text-align: center; font-size: 18px; margin: 0; }
.cal-table { width: 100%; border-collapse: separate; border-spacing: 6px; table-layout: fixed; }
.cal-table th {
  text-align: center; font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; padding: 4px 0;
}
.cal-table th abbr { text-decoration: none; }
.cal-cell {
  vertical-align: top;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  height: 92px;
  padding: 6px;
}
.cal-cell.other { opacity: 0.45; }
.cal-cell.today { border-color: var(--primary); background: var(--primary-soft); }
.cal-daynum { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.cal-event {
  display: block;
  font-size: 11px;
  min-height: 24px;        /* WCAG 2.5.8 target size */
  padding: 5px 7px;
  border-radius: 5px;
  background: var(--primary);
  color: #fff;
  margin-bottom: 3px;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Virtual groups: darker fill for AA contrast, plus a dotted underline so the
   in-person/online distinction survives without relying on color (WCAG 1.4.1). */
.cal-event.virtual {
  background: var(--accent-text);
  text-decoration: underline dotted #fff;
  text-underline-offset: 2px;
}
.cal-more { font-size: 11px; color: var(--text-muted); padding-left: 4px; }

/* ---------- Detail page ---------- */
.detail-header { margin-bottom: 8px; }
.detail-header h1 { margin: 0 0 6px; font-size: 26px; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; margin-top: 20px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.panel h2 { font-size: 15px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 14.5px; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; }
.callout { background: var(--warn-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--warn-text); }
.callout.covid { background: var(--warn-soft); color: var(--warn-text); }
.a11y { background: var(--primary-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; color: var(--link); }
.back-link { text-decoration: none; color: var(--text-muted); font-size: 14px; }

/* ---------- Forms ---------- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.field { margin-bottom: 18px; }
/* Applies to both <label class="label"> and <span class="label"> (used as the
   accessible name for checkbox groups). */
.field > .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.label.small { font-size: 13.5px; }
.field .hint { font-weight: 400; color: var(--text-muted); font-size: 13px; }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=time], input[type=date], input[type=number], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
textarea { resize: vertical; }
/* Invalid fields: a red border for sighted users; the linked error summary and
   aria-invalid carry the non-color cue for everyone else (WCAG 3.3.1 / 1.4.1). */
[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
/* Jumps to fields/errors clear the sticky header (WCAG 2.4.11). */
input, select, textarea, #form-errors { scroll-margin-top: 84px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 16px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin: 0 0 18px; }
fieldset legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.facilitator-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }
.required { color: var(--danger); }

/* ---------- Admin ---------- */
.status-pill { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 6px; }
.status-pill.pending { background: var(--warn-soft); color: var(--warn-text); }
.status-pill.approved { background: var(--ok-soft); color: var(--ok-text); }
.status-pill.rejected { background: var(--danger-soft); color: var(--danger); }
.admin-tabs { display: flex; gap: 6px; margin-bottom: 20px; }
.admin-tabs a { text-decoration: none; padding: 8px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); }
.admin-tabs a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.review-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.review-card .top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.review-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.review-actions form { display: inline-flex; gap: 8px; align-items: center; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.flash.ok { background: var(--ok-soft); color: var(--ok-text); }
.flash.err { background: var(--danger-soft); color: var(--danger); }

.contact-line { font-size: 14px; margin: 2px 0; }

@media (max-width: 860px) {
  .browse-layout { grid-template-columns: 1fr; }
  /* On phones the sidebar stacks above results and flows with the page — no cap. */
  .filters { position: static; max-height: none; overflow-y: visible; }
  .detail-grid { grid-template-columns: 1fr; }
  .feature-row { grid-template-columns: 1fr; }
  .tribe-list { grid-template-columns: 1fr; }
  .land-ack { padding: 22px 20px; }
  .brand-tagline { display: none; } /* keep the header compact on phones */
  .row-2, .row-3, .facilitator-row { grid-template-columns: 1fr; }
  .cal-cell { min-height: 70px; }
  .hero { padding: 32px 24px; }
  .hero h1 { font-size: 26px; }
}

/* ---------- Dark theme ---------- */
/* The theme is chosen by a tiny script (localStorage → data-theme on <html>),
   falling back to the OS setting via the media query when JS is off. --primary /
   --primary-dark / --accent / --accent-text stay as-is (they back white text on
   buttons, gradients, and the virtual chip); --link and the tints go lighter.
   Cool teal-black to match the deep-teal light theme. */

:root[data-theme="dark"] {
  --bg: #121a18; --surface: #1b2522; --border: #33413d;
  --text: #e7ede9; --text-muted: #a7b4af;
  --primary-soft: #16302b; --link: #83c9b7;
  --ok-soft: #1f2e1a; --ok-text: #b6d99a;
  --warn-soft: #322910; --warn-text: #e6c67a;
  --danger: #e59b8b; --danger-soft: #34201d;
  --shadow: 0 8px 26px rgba(0, 0, 0, 0.55); --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
}
:root[data-theme="dark"] .badge.type  { background: #2f3a36; color: var(--text); }
:root[data-theme="dark"] .badge.ident { background: #33283a; color: #e6c9e3; }
:root[data-theme="dark"] .badge.lang  { background: #21323b; color: #bcd7e8; }
:root[data-theme="dark"] .badge.nd    { background: #1f322c; color: #9fd4bf; }

/* No-JS fallback: follow the OS setting only when no explicit choice is set. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #121a18; --surface: #1b2522; --border: #33413d;
    --text: #e7ede9; --text-muted: #a7b4af;
    --primary-soft: #16302b; --link: #83c9b7;
    --ok-soft: #1f2e1a; --ok-text: #b6d99a;
    --warn-soft: #322910; --warn-text: #e6c67a;
    --danger: #e59b8b; --danger-soft: #34201d;
    --shadow: 0 8px 26px rgba(0, 0, 0, 0.55); --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.45);
  }
  :root:not([data-theme]) .badge.type  { background: #2f3a36; color: var(--text); }
  :root:not([data-theme]) .badge.ident { background: #33283a; color: #e6c9e3; }
  :root:not([data-theme]) .badge.lang  { background: #21323b; color: #bcd7e8; }
  :root:not([data-theme]) .badge.nd    { background: #1f322c; color: #9fd4bf; }
}

/* Theme toggle button (shown only when JS is available). */
.theme-toggle { display: none; }
html.js .theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 9px;
  cursor: pointer;
  line-height: 0;
}
.theme-toggle:hover { background: var(--primary-soft); color: var(--link); border-color: var(--primary-soft); }
.theme-toggle svg { width: 18px; height: 18px; }
/* Show the sun in dark mode (to switch to light) and the moon in light mode. */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---- Photo review (admin) ---------------------------------------------- */
.review-section { margin-bottom: 32px; }
.photo-review-thumb {
  display: block;
  max-width: 100%;
  width: 360px;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 12px 0;
  background: var(--surface-2);
}
.count-pill {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
  margin-left: 6px;
}
.photo-link {
  display: block;
  overflow-wrap: anywhere;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 14px;
}
