/* Styles follow the PlanningforConservation.ca design system:
   https://claude.ai/artifact/Pn52xSHvuXL9D1nTQ6E3wY (tokens copied below). */

@font-face { font-family: "Public Sans"; src: url("assets/fonts/PublicSans-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Public Sans"; src: url("assets/fonts/PublicSans-Italic-Variable.woff2") format("woff2"); font-weight: 100 900; font-style: italic; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("assets/fonts/SourceSerif4-Variable.woff2") format("woff2"); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("assets/fonts/SourceSerif4-Italic-Variable.woff2") format("woff2"); font-weight: 200 900; font-style: italic; font-display: swap; }

:root {
  /* colour scales */
  --sage-50: #f4f8f3; --sage-100: #e8efe6; --sage-200: #d1dbce; --sage-500: #8a9a86; --sage-700: #596856; --sage-900: #2e392b;
  --slate-50: #f3f8fa; --slate-100: #e7eef1; --slate-200: #cedade; --slate-500: #687980; --slate-700: #415056; --slate-900: #1c262a;
  --ochre-100: #f6ebdc; --ochre-200: #e7d9c3; --ochre-500: #b18a4a; --ochre-700: #805c16;
  --white: #ffffff; --paper: #f7f6f2; --black: #1a1f21;
  --grey-600: #4a5559; --grey-400: #7d8784; --grey-200: #d8dcd9;
  /* semantic */
  --surface: var(--white); --surface-alt: var(--paper); --surface-tint: var(--sage-50); --surface-inverse: var(--slate-900);
  --ink: var(--black); --ink-muted: var(--grey-600); --ink-inverse: var(--white); --ink-inverse-muted: var(--slate-200);
  --line: var(--grey-200); --line-strong: var(--grey-400);
  --action: var(--slate-700); --action-hover: var(--slate-900); --on-action: var(--white);
  --link: var(--slate-700); --accent: var(--ochre-500); --accent-text: var(--ochre-700); --notice: var(--ochre-100);
  /* type */
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  /* space, shape */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px;
  --radius-sm: 2px; --radius-md: 4px;
  --stroke-hairline: 1px; --stroke-rule: 4px;
  --shadow-float: 0 8px 24px #1c262a26;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #805c16;
  --sidebar-w: 400px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh; overflow: hidden;
  background: var(--surface); color: var(--ink);
  font-family: var(--font-sans); font-size: 16px; line-height: 24px; -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, .segmented input:focus-visible + span {
  outline: 2px solid transparent; box-shadow: var(--focus-ring);
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.eyebrow {
  margin: 0 0 var(--space-2); font-size: 13px; line-height: 16px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-text);
}
.caption { font-size: 14px; line-height: 20px; color: var(--ink-muted); }

/* ---------- sidebar ---------- */
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  border-right: var(--stroke-hairline) solid var(--line-strong); background: var(--surface);
}
.sb-head { padding: var(--space-5) var(--space-5) var(--space-4); border-bottom: var(--stroke-hairline) solid var(--line); }
.brand { display: inline-block; margin-bottom: var(--space-5); }
.brand img { display: block; height: 24px; width: auto; }
.sb-head h1 {
  margin: 0 0 var(--space-4); font-family: var(--font-serif); font-weight: 600;
  font-size: 28px; line-height: 36px; font-variation-settings: "opsz" 28; letter-spacing: -0.005em;
}
.sb-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); }
.sb-section { margin: 0; }
.section-title {
  margin: 0 0 var(--space-3); font-size: 13px; line-height: 16px; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-muted);
}
.field-label { display: block; margin-bottom: var(--space-2); font-size: 16px; line-height: 20px; font-weight: 600; }

/* ---------- search ---------- */
.search { position: relative; }
#search-input {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4);
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: var(--stroke-hairline) solid var(--line-strong); border-radius: var(--radius-sm);
}
#search-input::placeholder { color: var(--ink-muted); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + var(--space-1)); z-index: 20;
  list-style: none; margin: 0; padding: var(--space-1) 0; max-height: min(420px, 60vh); overflow-y: auto;
  background: var(--surface); border: var(--stroke-hairline) solid var(--line-strong);
  border-radius: var(--radius-md); box-shadow: var(--shadow-float);
}
.search-results li { padding: var(--space-2) var(--space-4); cursor: pointer; border-left: var(--stroke-rule) solid transparent; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--slate-100); border-left-color: var(--accent); }
.r-name { font-weight: 600; }
.r-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-3); font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.search-results .r-empty { color: var(--ink-muted); cursor: default; }
.search-results .r-empty:hover { background: none; border-left-color: transparent; }
.tag { display: inline-flex; align-items: center; gap: var(--space-1); }

/* ---------- swatches ---------- */
.swatch {
  flex: none; display: inline-block; width: 24px; height: 18px;
  border: var(--stroke-hairline) solid var(--grey-400); background: var(--c, transparent);
}
.swatch.sm { width: 12px; height: 12px; }
.swatch.outline { background: transparent; border: 2px solid var(--slate-900); }

/* ---------- details card (TopicCard pattern) ---------- */
.card {
  position: relative; padding: var(--space-5);
  border: var(--stroke-hairline) solid var(--line); border-top: var(--stroke-rule) solid var(--accent);
}
.card h2 {
  margin: 0 var(--space-7) var(--space-1) 0; font-family: var(--font-serif); font-weight: 600;
  font-size: 22px; line-height: 30px; font-variation-settings: "opsz" 20;
}
.card .meta { margin: 0 0 var(--space-4); }
.card .meta div { margin: 0; }
.card h3 { margin: 0 0 var(--space-3); font-size: 16px; line-height: 20px; font-weight: 600; }
.card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-4); }
.card li { display: grid; grid-template-columns: auto 1fr; gap: 0 var(--space-3); align-items: start; }
.card li .swatch { width: 18px; height: 18px; margin-top: 3px; }
.card .t-name { font-weight: 600; }
.card .t-desc { grid-column: 2; color: var(--ink-muted); }
.card .t-basis { grid-column: 2; margin-top: var(--space-1); }
.card .none { margin: 0; }
.icon-button {
  position: absolute; top: var(--space-3); right: var(--space-3);
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color 120ms ease;
}
.icon-button:hover { background: var(--slate-100); }

/* ---------- segmented control & select ---------- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 0; padding: 0; margin: 0; }
.segmented label { position: relative; display: block; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: var(--space-3) var(--space-4);
  border: var(--stroke-hairline) solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; line-height: 20px; transition: background-color 120ms ease, color 120ms ease;
}
.segmented label:first-child span { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.segmented label:last-child span { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: 0; }
.segmented label:hover span { background: var(--slate-100); }
.segmented input:checked + span { background: var(--action); border-color: var(--action); color: var(--on-action); }
.trust-picker { margin-top: var(--space-4); }
.trust-picker select {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4); font: inherit; color: var(--ink);
  background: var(--surface); border: var(--stroke-hairline) solid var(--line-strong); border-radius: var(--radius-sm);
}

/* ---------- legend ---------- */
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--space-2); }
.legend li { display: flex; align-items: center; gap: var(--space-3); }
.legend .l-label { flex: 1; }
.legend .l-count { font-size: 14px; line-height: 20px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.legend .l-heading { margin-top: var(--space-3); font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink-muted); }
.legend-note { margin: var(--space-3) 0 0; }

/* ---------- notice callout ---------- */
/* Slim disclaimer bar across the bottom of the page (sidebar and map). */
.site-footer {
  grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-1) var(--space-5); padding: var(--space-2) var(--space-5);
  background: var(--notice); border-top: var(--stroke-hairline) solid var(--ochre-200);
  font-size: 14px; line-height: 20px;
}
.site-footer p { margin: 0; }
.site-footer-links { display: flex; gap: var(--space-4); white-space: nowrap; }
.site-footer .text-button { font-weight: 600; }
.callout-title { font-weight: 700; color: var(--accent-text); }
.text-button {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--link); cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.text-button:hover { text-decoration-thickness: 2px; }

/* ---------- map ---------- */
#map { position: relative; min-width: 0; min-height: 0; }
.tooltip {
  position: fixed; z-index: 30; pointer-events: none; padding: var(--space-1) var(--space-2);
  background: var(--surface-inverse); color: var(--ink-inverse); font-size: 14px; line-height: 20px; white-space: nowrap;
  transform: translate(14px, 14px);
}
.maplibregl-ctrl-group { border-radius: var(--radius-sm); box-shadow: none !important; border: var(--stroke-hairline) solid var(--line-strong); }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
.maplibregl-ctrl-group button:focus-visible { box-shadow: var(--focus-ring); }
.maplibregl-ctrl-attrib { font-family: var(--font-sans); font-size: 12px; }
.maplibregl-ctrl-scale { font-family: var(--font-sans); border-color: var(--slate-700); color: var(--ink); }

/* ---------- about dialog ---------- */
.about {
  max-width: 640px; width: calc(100% - 32px); max-height: calc(100dvh - 32px);
  padding: var(--space-6); border: var(--stroke-hairline) solid var(--line-strong); border-top: var(--stroke-rule) solid var(--accent);
  border-radius: 0; color: var(--ink); background: var(--surface); line-height: 24px;
}
.about::backdrop { background: #1c262a8c; }
.about h2 { margin: 0 0 var(--space-4); font-family: var(--font-serif); font-weight: 600; font-size: 30px; line-height: 38px; }
.about h3 { margin: var(--space-5) 0 var(--space-2); font-family: var(--font-serif); font-weight: 600; font-size: 22px; line-height: 30px; }
.about p, .about li { max-width: 68ch; }
.about ul { padding-left: var(--space-5); }
.button-primary {
  display: inline-flex; align-items: center; min-height: 48px; padding: var(--space-3) var(--space-5);
  border: var(--stroke-hairline) solid var(--action); border-radius: var(--radius-sm);
  background: var(--action); color: var(--on-action); font: inherit; font-weight: 600; cursor: pointer;
  transition: background-color 120ms ease;
}
.button-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }

/* ---------- login page (login.html) ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--space-4);
  background: var(--surface-alt); overflow-y: auto;
}
.gate-card {
  width: 100%; max-width: 440px; padding: var(--space-6); background: var(--surface);
  border: var(--stroke-hairline) solid var(--line); border-top: var(--stroke-rule) solid var(--accent);
}
.gate-card img { display: block; height: 24px; width: auto; margin-bottom: var(--space-5); }
.gate-card h1 { margin: 0 0 var(--space-2); font-family: var(--font-serif); font-weight: 600; font-size: 28px; line-height: 36px; }
.gate-card p { margin: 0 0 var(--space-5); }
.gate-card input {
  width: 100%; min-height: 48px; padding: var(--space-3) var(--space-4); margin-bottom: var(--space-4);
  font: inherit; color: var(--ink); background: var(--surface);
  border: var(--stroke-hairline) solid var(--line-strong); border-radius: var(--radius-sm);
}
.gate-card input[aria-invalid="true"] { border-color: #a3362a; }
.gate-card .gate-error { margin: calc(-1 * var(--space-2)) 0 var(--space-4); color: #a3362a; font-weight: 600; }
.gate-card .button-primary { width: 100%; justify-content: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- phones: header + search, map, then details ---------- */
@media (max-width: 767px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto minmax(240px, 44dvh) minmax(0, 1fr) auto; }
  .site-footer { grid-row: 4; padding: var(--space-2) var(--space-4); }
  .sidebar { display: contents; }
  .sb-head { grid-row: 1; padding: var(--space-4); border-bottom: var(--stroke-hairline) solid var(--line-strong); }
  .brand { margin-bottom: var(--space-3); }
  .brand img { height: 20px; }
  .sb-head h1 { font-size: 22px; line-height: 30px; margin-bottom: var(--space-3); }
  #map { grid-row: 2; }
  .sb-body { grid-row: 3; padding: var(--space-4); border-top: var(--stroke-hairline) solid var(--line-strong); }
  .search-results { max-height: 50dvh; }
}
