/* Lithium Valley Data Explorer — mobile. Mobile-first; works at 360px.
   Follows the desktop Explorer's look (www/custom.css): green navbar and
   active states, blue page titles, dark-green section headings, orange for
   "have your say" actions, Source Sans. */
:root {
  --lv-green: #21753D;        /* navbar, active tabs/filters, bars (5.6:1 on white) */
  --lv-green-dark: #18685B;   /* section headings */
  --lv-green-soft: #e8f5e9;   /* event-type tags */
  --lv-blue: #26619C;         /* page titles, links */
  --lv-orange: #FF8C00;       /* action buttons (dark text: white on this orange is too faint) */
  --lv-orange-ink: #A84F00;   /* orange for text, e.g. stage labels: 5.3:1 on white */
  --ink: #1f2328;
  --muted: #5c6166;           /* 6.2:1 on white */
  --line: #e0e0e0;
  --bg: #ffffff;
  --bg-soft: #f5f5f5;
}

/* Self-hosted Source Sans 3 (OFL; the current name of Source Sans Pro), one
   variable file for weights 400–700, Latin subset incl. Spanish accents. */
@font-face {
  font-family: "Source Sans 3"; font-weight: 400 700; font-style: normal; font-display: swap;
  src: url("fonts/SourceSans3-latin.woff2") format("woff2");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 "Source Sans 3", "Source Sans Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--lv-blue); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; font-weight: 700; color: var(--lv-blue); }
h2 { font-size: 1.25rem; font-weight: 700; color: var(--lv-green-dark); margin-top: 1.8em; }
h3 { font-size: 1.05rem; font-weight: 700; color: #6A6D6F; }
p { margin: 0 0 .75em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.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;
}
:focus-visible { outline: 3px solid var(--lv-orange); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 0; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---- header + nav: the Explorer's green navbar ---- */
.bar-wrap { background: var(--lv-green); position: sticky; top: 0; z-index: 5; }
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px 2px; max-width: 640px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; min-height: 44px; min-width: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text b { color: #fff; font-size: 1.1rem; font-weight: 700; }
.brand-text small { color: #e8f5e9; font-size: .85rem; }
.lang {
  font: inherit; font-size: .9rem; font-weight: 700; color: #fff;
  background: none; border: 1px solid rgba(255,255,255,.7); border-radius: 22px;
  min-height: 44px; padding: 0 14px; cursor: pointer; white-space: nowrap; flex: none;
}
.tabs { display: flex; max-width: 640px; margin: 0 auto; padding: 0 8px; }
.tabs a {
  flex: 1; text-align: center; padding: 10px 4px; min-height: 44px;
  text-decoration: none; color: rgba(255,255,255,.85); font-weight: 600; font-size: .95rem;
  border-bottom: 3px solid transparent;
}
.tabs a[aria-current="page"] { color: #fff; font-weight: 700; border-bottom-color: #fff; }
.bar-wrap :focus-visible { outline-color: #fff; }

main { max-width: 640px; margin: 0 auto; padding: 16px 16px 8px; }
main:focus, h1:focus { outline: none; }   /* focus moves here on navigation for screen readers */
.intro { color: var(--muted); }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; min-height: 48px; padding: 8px 20px; text-align: center;
  border-radius: 24px; border: 0; cursor: pointer; text-decoration: none;
  background: var(--lv-green); color: #fff; width: 100%;
}
.btn-act { background: var(--lv-orange); color: #1f2328; }
.btn-quiet { background: #fff; color: var(--lv-green); border: 2px solid var(--lv-green); }
.btn + .btn { margin-top: 8px; }
.notice { background: var(--bg-soft); padding: 10px 12px; border-radius: 8px; }

/* ---- topic switch (segmented) ---- */
.seg {
  display: flex; gap: 4px; padding: 4px; margin: 16px 0 4px;
  background: var(--bg-soft); border-radius: 26px;
}
.seg button {
  flex: 1; font: inherit; font-weight: 700; font-size: .95rem; min-height: 44px;
  border: 0; border-radius: 22px; background: none; color: var(--muted); cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--lv-green); color: #fff; }

/* ---- filter chips (scroll sideways instead of wrapping into a wall) ---- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; margin: 4px -16px 0;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font: inherit; font-size: .875rem; font-weight: 700; min-height: 40px; padding: 0 14px;
  border: 2px solid #ddd; border-radius: 20px; background: #fff; color: #555; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--lv-green); border-color: var(--lv-green); color: #fff; }

/* ---- status ("where things stand") ---- */
.status-title { font-size: 1.1rem; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.status-when { color: var(--lv-orange-ink); font-weight: 700; font-size: .9rem; margin: 0 0 12px; }
.status-lead { font-weight: 700; }

/* ---- disclosure (details/summary) ---- */
details.more { margin: 12px 0 0; }
details.more > summary {
  cursor: pointer; font-weight: 700; color: var(--lv-green); min-height: 44px;
  display: flex; align-items: center; list-style: none;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "▾"; margin-left: 6px; transition: transform .15s; }
details.more[open] > summary::after { transform: rotate(180deg); }
details.more > .body { padding-top: 4px; }

/* ---- lists of rows (events, documents, concerns, projects) ---- */
.list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.list > li { border-bottom: 1px solid var(--line); }

.ev > summary, .concern > summary {
  display: block; padding: 12px 28px 12px 0; cursor: pointer; list-style: none; position: relative;
}
.ev > summary::-webkit-details-marker, .concern > summary::-webkit-details-marker { display: none; }
.ev > summary::after, .concern > summary::after {
  content: "+"; position: absolute; right: 4px; top: 12px; font-weight: 700; color: var(--lv-green); font-size: 1.2rem; line-height: 1.2;
}
.ev[open] > summary::after, .concern[open] > summary::after { content: "–"; }
.ev-meta { display: block; font-size: .8rem; color: var(--muted); }
.ev-meta b { color: var(--lv-green); font-weight: 700; }
.tag { display: inline-block; background: var(--lv-green-soft); color: var(--lv-green); border-radius: 12px; padding: 0 8px; margin-left: 4px; font-weight: 600; }
.ev-title, .concern-title { display: block; font-weight: 700; line-height: 1.35; margin-top: 2px; }
.ev .body, .concern .body { padding: 0 0 14px; }
.ev .body p:last-child, .concern .body p:last-child { margin-bottom: 0; }
.ev-links { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ev-links a { font-weight: 700; }
.more-btn { margin-top: 12px; }

.doc {
  display: block; padding: 12px 0; text-decoration: none; color: var(--ink);
}
.doc b { display: block; color: var(--lv-blue); }
.doc small { display: block; color: var(--muted); }
.ext::after { content: " ↗"; font-weight: 400; }

/* ---- community said (bars carry a text count, so color isn't the only cue) ---- */
.issues { list-style: none; margin: 12px 0 0; padding: 0; }
.issues li { margin: 0 0 12px; }
.issue-row { display: flex; justify-content: space-between; gap: 12px; font-size: .9rem; }
.issue-row b { font-weight: 700; }
.issue-row span { color: var(--muted); white-space: nowrap; }
.bar { height: 8px; background: var(--bg-soft); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--lv-green), var(--lv-green-dark)); border-radius: 4px; }

/* ---- projects ---- */
.count { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.proj {
  display: flex; align-items: center; gap: 12px; min-height: 72px; padding: 10px 0;
  text-decoration: none; color: var(--ink);
}
.proj img {
  flex: none; width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: var(--bg-soft);
}
.proj-main { flex: 1; min-width: 0; }
.proj-main b { display: block; line-height: 1.3; overflow-wrap: anywhere; color: var(--lv-green-dark); }
.proj-main small { display: block; color: var(--muted); font-size: .85rem; }
.stage { display: block; font-size: .85rem; font-weight: 700; color: var(--lv-orange-ink); margin-top: 2px; }
.chev { flex: none; color: var(--muted); font-size: 1.3rem; }

.back { color: var(--lv-green); display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; text-decoration: none; margin-bottom: 4px; }
.back::before { content: "‹"; font-size: 1.4rem; margin-right: 6px; line-height: 1; }

.gallery {
  display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 12px -16px 4px; padding: 0 16px; scrollbar-width: none;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery img {
  flex: none; width: 100%; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 8px; scroll-snap-align: center; background: var(--bg-soft);
}
.gallery.multi img { width: 88%; }
.credit { font-size: .75rem; color: var(--muted); margin: 0 0 12px; }

.facts { margin: 16px 0 0; }
.facts div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.facts div:first-child { border-top: 1px solid var(--line); }
.facts dt { font-size: .8rem; font-weight: 700; color: var(--muted); }
.facts dd { margin: 2px 0 0; }

/* ---- footer: one green block, white text, partners centered ---- */
.foot { margin-top: 32px; background: var(--lv-green); color: #fff; font-size: .95rem; }
.foot-inner { max-width: 640px; margin: 0 auto; padding: 20px 16px 28px; text-align: center; }
.foot-partners { margin: 0 0 12px; color: #e8f5e9; }
.logos { display: flex; align-items: center; justify-content: center; gap: 24px; margin: 0 0 18px; }
.logos img { height: 52px; width: auto; }
.foot-more { margin: 0; padding-top: 16px; border-top: 1px solid rgba(255,255,255,.3); font-weight: 600; }
.foot a { color: #fff; font-weight: 700; display: inline-block; min-height: 44px; padding: 10px 0; }
.foot :focus-visible { outline-color: #fff; }

/* ---- map: fills the screen under the header, leaving the top of the footer
   band showing so people can see there's more below and scroll to it ---- */
.on-map main { max-width: none; padding: 0; }
.on-map .foot { margin-top: 0; }
.map-wrap { position: relative; height: calc(100dvh - var(--bar-h, 104px) - 56px); min-height: 360px; overflow: hidden; }
.map-wrap > .map { position: absolute; inset: 0; background: #eef0ee; }   /* beats maplibre-gl.css, which loads later */
.map-themes {
  position: absolute; top: 0; left: 0; right: 0; margin: 0; padding: 10px 12px; z-index: 2;
}
.map-themes .chip { box-shadow: 0 1px 4px rgba(0,0,0,.18); border-color: #fff; }
.map-themes .chip[aria-pressed="true"] { border-color: var(--lv-green); }
.map-btn {
  position: absolute; left: 12px; bottom: 28px; z-index: 2;
  font: inherit; font-weight: 700; min-height: 44px; padding: 0 18px; border-radius: 22px; cursor: pointer;
  background: var(--lv-green); color: #fff; border: 0; box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.map-status {
  position: absolute; left: 50%; top: 64px; transform: translateX(-50%); z-index: 2; margin: 0;
  background: #fff; padding: 6px 14px; border-radius: 16px; font-size: .9rem; box-shadow: 0 1px 4px rgba(0,0,0,.18);
}
.map-status[hidden] { display: none; }
.maplibregl-ctrl-bottom-right { bottom: 16px; }
.maplibregl-ctrl-group button { width: 44px; height: 44px; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; max-height: 62%; overflow-y: auto;
  background: #fff; border-radius: 16px 16px 0 0; padding: 16px 16px 24px;
  box-shadow: 0 -2px 12px rgba(0,0,0,.2);
}
.sheet[hidden] { display: none; }
.sheet:focus { outline: none; }
.sheet h2 { margin-top: 0; padding-right: 40px; }
.sheet-close {
  position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none;
  font-size: 1.8rem; line-height: 1; color: var(--muted); cursor: pointer;
}
.sheet-kicker { font-size: .85rem; font-weight: 700; color: var(--lv-green); margin: 0 0 2px; }
.sheet .facts { margin-top: 8px; }
.sheet-more { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }

.opts { border: 0; padding: 0; margin: 0 0 16px; }
.opts legend { font-weight: 700; color: var(--lv-green-dark); font-size: 1.05rem; padding: 0; margin-bottom: 4px; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.opt input { width: 20px; height: 20px; accent-color: var(--lv-green); flex: none; margin: 0; }
.layer { border-top: 1px solid var(--line); padding-bottom: 6px; }
.key { list-style: none; margin: 0 0 6px 30px; padding: 0; font-size: .9rem; }
.key li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.sw { display: inline-block; flex: none; width: 16px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.2); }
.sw-dot { width: 14px; height: 14px; border-radius: 50%; }
.sw-line { width: 22px; height: 4px; border: 0; border-radius: 2px; }
.ramp-wrap { margin: 4px 0 6px 30px; }
.ramp { display: flex; height: 12px; border-radius: 2px; overflow: hidden; }
.ramp i { flex: 1; }
.ramp-labels { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); }
