:root {
  color-scheme: light;
  --ivory: #faf8f1;
  --paper: #f1eee4;
  --green: #123d35;
  --muted: #626b60;
  --gold: #b48b3e;
  --line: #dedfd2;
  font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--green);
  background: var(--ivory);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-underline-offset: 4px; }
button, input, select { font: inherit; }
button, select, input { border: 1px solid var(--line); border-radius: 5px; }
button { padding: 10px 14px; background: var(--ivory); color: var(--green); cursor: pointer; }
button:hover:not(:disabled) { background: #e9eddf; border-color: var(--green); }
button:disabled, input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid #a77924; outline-offset: 3px; }
[hidden] { display: none !important; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: fixed; top: 10px; left: 10px; z-index: 2000; padding: 12px; background: var(--ivory); }
.header { min-height: 96px; display: flex; align-items: center; gap: 32px; padding: 20px 36px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font: 32px/1 Georgia, "Times New Roman", serif; letter-spacing: -1px; }
.brand-icon { display: grid; place-items: center; width: 43px; height: 48px; border-radius: 9px; background: var(--green); color: #e6c880; font-size: 34px; }
.brand-sub { display: block; margin-top: 8px; font: 9px/1.2 system-ui, sans-serif; letter-spacing: 2px; }
.header-note { margin-left: auto; color: var(--muted); font-size: 12px; }
.header > a:last-child { font-size: 12px; font-weight: 600; }
main { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.sidebar { padding: 32px 27px 22px; border-right: 1px solid var(--line); background: var(--ivory); max-height: max(900px, calc(100vh - 96px)); overflow-y: auto; }
.eyebrow { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 1.5px; }
h1 { margin: 15px 0; font: 58px/.99 Georgia, "Times New Roman", serif; letter-spacing: -2.5px; }
.intro p { max-width: 240px; margin: 19px 0 28px; color: var(--muted); }
h2 { margin: 0 0 13px; font-size: 13px; font-weight: 650; }
.sidebar section { padding: 23px 0; border-top: 1px solid var(--line); }
.field-label { display: block; margin: 17px 0 7px; color: var(--muted); font-size: 11px; }
input[type="search"], select { width: 100%; min-height: 42px; padding: 10px 12px; background: #fffdf7; color: var(--green); }
input::placeholder { color: #74796c; opacity: 1; }
#results { display: grid; gap: 5px; max-height: 230px; overflow-y: auto; }
#results:not(:empty) { margin-top: 8px; padding: 3px; }
button.result { display: grid; gap: 3px; width: 100%; text-align: left; padding: 10px 12px; }
.result strong { font-size: 12px; }
.result small { color: var(--muted); font-size: 10px; }
.badge { float: right; padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; font-size: 9px; color: var(--muted); }
.layer { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 42px; font-size: 11px; cursor: pointer; }
.layer > span { display: flex; align-items: center; gap: 9px; }
.layer input { flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--green); }
.layer.active, .layer:has(input:checked) { color: var(--green); font-weight: 650; }
button.active, button[aria-pressed="true"] { background: var(--green); color: var(--ivory); border-color: var(--green); }
button.active:hover:not(:disabled), button[aria-pressed="true"]:hover:not(:disabled) { background: #24584a; }
.swatch { display: inline-block; flex-shrink: 0; width: 12px; height: 12px; border: 1px solid #577663; border-radius: 2px; vertical-align: middle; }
.swatch.departments { background: #b4c7a3; }
.swatch.municipalities { background: #e3eded; border-color: #527d87; }
.swatch.selected { background: #edbd57; border: 2px solid #93631e; }
.swatch.hydro { border-radius: 50%; background: #166d92; border: 2px solid #fffdf7; box-shadow: 0 0 0 1px #166d92; }
#hydro-list, #reservoir-list { display: grid; gap: 6px; }
.swatch.reservoir { background: #a7d8ee; border-color: #246da0; border-radius: 50%; }
#population-legend { display: grid; gap: 6px; border-bottom: 1px solid var(--line); padding-bottom: 9px; }
#population-legend span { display: flex; align-items: center; gap: 8px; }
#population-legend i { width: 12px; height: 12px; border: 1px solid #626b60; }
#info h3 { margin: 22px 0 10px; font-size: 13px; }
#info .result { margin: 8px 0; }
#info details { margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line); }
#info summary { cursor: pointer; font-size: 12px; font-weight: 650; }
.research { padding: 36px; border-top: 1px solid var(--line); }
.research-heading { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 30px; align-items: center; margin-bottom: 24px; }
.research-heading h2 { margin: 10px 0; font: 30px/1.2 Georgia, serif; }
.research-heading p { max-width: 750px; color: var(--muted); font-size: 13px; }
.document-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.document-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 6px; background: #fffdf7; overflow-wrap: anywhere; }
.document-card > small { color: var(--muted); font-size: 10px; }
.document-card h3 { margin: 13px 0; font: 19px/1.35 Georgia, serif; }
.document-card p { font-size: 12px; line-height: 1.7; }
.document-card p:last-child { color: var(--muted); font-size: 11px; }
#info .document-card { padding: 12px; margin-top: 12px; }
#info .document-card h3 { margin-top: 10px; }
#info .document-card h3 a { margin-top: 0; }
#reservoir-list > p { font-size: 11px; color: var(--muted); }
.data-note, #hydro-list > p { color: var(--muted); font-size: 11px; line-height: 1.6; }
#info .precision-note { padding: 12px; border-left: 3px solid var(--gold); background: var(--paper); }
#info a { display: inline-block; margin-top: 14px; font-size: 11px; overflow-wrap: anywhere; }
.hydro-marker { cursor: pointer; }
#info h2 { margin-top: 10px; font: 23px/1.15 Georgia, "Times New Roman", serif; }
#info p { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
#info dl { margin: 16px 0 0; }
#info dl > div { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-bottom: 1px solid var(--line); }
#info dt { padding-top: 9px; color: var(--muted); font-size: 11px; }
#info dd { margin: 0; padding: 4px 0 9px; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
#info dl > div dd { padding-top: 9px; text-align: right; }
.sidebar-foot { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.map-shell { position: relative; isolation: isolate; min-width: 0; height: max(900px, calc(100vh - 96px)); background: #dfe5d5; }
#map { width: 100%; height: 100%; min-height: 560px; z-index: 0; }
.map-top, .map-tools, .map-bottom { position: absolute; z-index: 500; left: 24px; right: 24px; display: flex; align-items: center; justify-content: space-between; gap: 12px; pointer-events: none; }
.map-top { top: 24px; }
.map-top > *, .map-tools > *, .map-bottom > * { pointer-events: auto; }
.map-chip, .map-top button, .map-tools button, .legend, .coordinates, #status, #retry, #measurement { box-shadow: 0 3px 16px #123d3514; }
.map-chip { padding: 12px 14px; border: 1px solid #ffffffa8; border-radius: 5px; background: var(--ivory); font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.map-chip span { margin: 0 9px; color: var(--gold); }
.map-top button, .map-tools button { font-size: 11px; }
.map-tools { top: 80px; justify-content: flex-end; flex-wrap: wrap; }
.map-bottom { bottom: 38px; align-items: flex-end; }
.legend { display: grid; gap: 8px; padding: 15px 18px; border: 1px solid var(--line); border-radius: 5px; background: var(--ivory); font-size: 10px; }
.legend > span:not(.eyebrow) { display: flex; align-items: center; gap: 9px; }
.coordinates { padding: 7px 10px; border-radius: 4px; background: var(--ivory); color: var(--muted); font: 10px/1.5 ui-monospace, monospace; }
#status { position: absolute; z-index: 550; top: 145px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 100px); padding: 12px 18px; border-radius: 5px; background: var(--ivory); text-align: center; font-size: 12px; }
#status:empty { display: none; }
#retry { position: absolute; z-index: 551; top: 220px; left: 50%; transform: translateX(-50%); }
#measurement { position: absolute; z-index: 550; top: 280px; right: 24px; width: min(260px, calc(100% - 48px)); padding: 18px; border: 1px solid var(--line); border-top: 3px solid var(--gold); border-radius: 5px; background: var(--ivory); }
#distance { font: 30px/1.2 Georgia, "Times New Roman", serif; }
#measurement p { color: var(--muted); font-size: 11px; }
#measurement button { font-size: 11px; }
.measure-mode, .measure-mode .leaflet-interactive, .measure-mode .leaflet-grab { cursor: crosshair; }
.leaflet-top.leaflet-right { top: 130px; right: 14px; }
.leaflet-control-attribution { max-width: 100%; background: #fffdf7 !important; color: #34483d; font-size: 10px; line-height: 1.5; }
.leaflet-control-attribution a { color: #164c40; }
.map-shell noscript { position: absolute; top: 180px; left: 70px; right: 24px; z-index: 600; padding: 15px; background: var(--ivory); }
footer { display: flex; justify-content: space-between; gap: 32px; padding: 30px 36px; border-top: 1px solid var(--line); }
footer strong { font: 22px/1.2 Georgia, "Times New Roman", serif; }
footer p { margin: 8px 0 0; color: var(--muted); font-size: 10px; line-height: 1.8; }
@media (max-width: 1050px) {
  .header-note { display: none; }
  .header > a:last-child { margin-left: auto; }
  .map-chip { font-size: 8px; letter-spacing: .5px; }
  .map-top, .map-tools, .map-bottom { left: 16px; right: 16px; }
  .coordinates { max-width: 160px; overflow-wrap: anywhere; }
  .document-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .header { min-height: 80px; padding: 16px 20px; gap: 16px; }
  .brand { font-size: 28px; }
  .brand-sub { font-size: 8px; letter-spacing: 1.5px; }
  main { grid-template-columns: minmax(0, 1fr); }
  .sidebar { padding: 25px 24px 20px; border-right: 0; max-height: none; overflow-y: visible; }
  h1 { font-size: 48px; }
  h1 br { display: none; }
  .intro p { max-width: none; margin: 14px 0 22px; }
  .sidebar section { padding: 17px 0; }
  .sidebar-foot { margin-top: 0; }
  .map-shell { height: 680px; min-height: 560px; border-top: 1px solid var(--line); }
  .map-top { top: 16px; gap: 8px; }
  .map-chip { max-width: 52%; padding: 9px; font-size: 8px; }
  .map-chip span { margin: 0 3px; }
  .map-top button, .map-tools button { padding: 9px 10px; font-size: 10px; }
  .map-tools { top: 85px; gap: 7px; }
  .map-bottom { bottom: 42px; gap: 8px; }
  .legend { padding: 12px; }
  .coordinates { max-width: 140px; font-size: 9px; }
  footer { flex-direction: column; gap: 12px; padding: 25px 24px; }
  .research { padding: 28px 24px; }
  .research-heading, .document-grid { grid-template-columns: minmax(0, 1fr); }
  .research-heading { gap: 8px; }
  .legend { max-height: 250px; overflow-y: auto; max-width: 230px; }
}
