/* Welstandskaart Utrecht: the one stylesheet for every page. Plain CSS,
   served through the STATIC_ASSETS whitelist in map.ts. */

:root {
  --ink: #1f1b24;
  --muted: #5e5866;
  --faint: #8a8492;
  --line: #e6e1ea;
  --bg: #f8f6f9;
  --surface: #fff;
  /* The map markers' purple, chosen to stand out on the PDOK tiles. */
  --accent: #6a1b9a;
  --accent-dark: #4b1270;
  --accent-soft: #f2e9f7;
  --approx-bg: #fff2cc;
  --approx-ink: #6b4d00;
  --exact-ink: #1f6136;
  --ai-bg: #eef2f8;
  --ai-line: #c9d4e6;
  --ai-ink: #34445e;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(31, 27, 36, 0.06), 0 2px 8px rgba(31, 27, 36, 0.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 16px/1.55 var(--font);
  color: var(--ink);
  background: var(--bg);
}

a { color: var(--accent-dark); text-underline-offset: 0.15em; }
a:hover { color: var(--accent); }
/* Every link to another website gets an arrow, so a visitor knows it
   leaves this site. Screen readers hear "externe link" instead of the arrow. */
a[href^="http"]::after {
  content: "\00a0↗";
  content: "\00a0↗" / " (externe link)";
  display: inline-block; text-decoration: none;
}
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; }

.unknown { color: var(--faint); font-style: italic; }
.nowrap { white-space: nowrap; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Header and footer ------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  display: flex; align-items: center; gap: 0.5rem;
  max-width: 64rem; margin: 0 auto; padding: 0 1rem; min-height: 56px;
}
.brand {
  display: flex; align-items: center; gap: 0.5rem; min-height: 44px;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem; white-space: nowrap;
}
.brand:hover { color: var(--ink); }
.brand-mark { flex: none; }
.brand-city { font-weight: 400; color: var(--muted); }
.nav { display: flex; margin-left: auto; }
.nav a {
  display: flex; align-items: center; min-height: 44px; padding: 0 0.65rem;
  color: var(--muted); text-decoration: none; font-weight: 500; border-radius: 8px;
}
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current] { color: var(--accent-dark); box-shadow: inset 0 -3px 0 var(--accent); border-radius: 0; }

.site-footer {
  max-width: 64rem; margin: 3rem auto 0; padding: 1.5rem 1rem 2.5rem;
  border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem;
}
.site-footer p { margin: 0.25rem 0; }

/* --- Page container ---------------------------------------------------- */

.container { max-width: 64rem; margin: 0 auto; padding: 1.75rem 1rem 0; }
.narrow { max-width: 44rem; }
.page-title { font-size: 1.75rem; }
.lede { color: var(--muted); font-size: 1.05rem; margin: 0.5rem 0 0; max-width: 40rem; }

/* --- Badges ------------------------------------------------------------ */

.badge {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.85rem; font-weight: 500; line-height: 1.3;
  padding: 0.15rem 0.5rem; border-radius: 999px; white-space: nowrap;
}
.badge-approx { background: var(--approx-bg); color: var(--approx-ink); border: 1px dashed #c9a23a; }
.badge-exact { color: var(--exact-ink); background: #e8f4ec; }

/* --- Project list ------------------------------------------------------ */

#projecten { padding-top: 2rem; }

.project-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 0.75rem; }
.project-card {
  position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem 1rem; box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.project-card:hover { border-color: #cdb6dc; }
.project-card h3 { font-size: 1.1rem; }
.project-card h3 a { text-decoration: none; color: var(--ink); }
/* The whole card is the tap target for its project link. */
.project-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.project-card h3 a:focus-visible { outline: none; }
.project-card:has(h3 a:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.project-desc {
  margin: 0.3rem 0 0; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.project-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem;
  margin: 0.7rem 0 0; padding: 0; list-style: none; font-size: 0.9rem; color: var(--muted);
}
.project-meta strong { font-weight: 600; color: var(--ink); }
.empty { color: var(--muted); padding: 2rem 0; }

@media (min-width: 720px) {
  .project-list { grid-template-columns: 1fr 1fr; }
}

/* --- Project detail ---------------------------------------------------- */

.back {
  display: inline-flex; align-items: center; min-height: 44px; margin: -0.5rem 0 0.25rem;
  text-decoration: none; font-weight: 500;
}
.detail-title { font-size: 1.85rem; overflow-wrap: anywhere; }

.facts {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.6rem 1.25rem;
  margin: 1.5rem 0 0; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.facts { align-items: baseline; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.coords { font-variant-numeric: tabular-nums; }
.location-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.map-link { display: inline-flex; align-items: center; min-height: 44px; font-weight: 500; }

@media (max-width: 479px) {
  .facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .facts dd { margin-bottom: 0.6rem; }
  .facts dd:last-child { margin-bottom: 0; }
}

.section-title { font-size: 1.3rem; margin: 2.5rem 0 1rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.meeting { position: relative; padding: 0 0 2rem 1.75rem; }
.meeting::before {
  content: ""; position: absolute; left: 6px; top: 0.6rem; bottom: 0; width: 2px; background: var(--line);
}
.meeting:last-child::before { display: none; }
.meeting::after {
  content: ""; position: absolute; left: 0; top: 0.35rem; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent);
}
.meeting-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 1rem; }
.meeting-head h3 { font-size: 1.15rem; }
/* Not inline-flex: that makes the external-link arrow a flex item, which
   gets underlined, unlike the arrow on every other external link. Padding
   gives it the 44 px tap height instead. */
.meeting-source { display: inline-block; padding: 0.625rem 0; font-weight: 500; }
.meeting-desc { margin: 0.1rem 0 0.9rem; }

.block-label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 0.4rem; }

.source-block {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: 6px; padding: 0.8rem 1rem;
}
.source-text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; font-size: 0.95rem; line-height: 1.6; }
/* detail.js clamps a long source text to its first lines until it's opened. */
.source-text.is-clamped {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 7; line-clamp: 7; overflow: hidden;
}
/* A "Toon …" / "Verberg …" toggle. Only the label is underlined: in an
   inline-flex box the arrow is a flex item of its own, and underlining the
   whole box left a gap in the line between the text and the arrow. */
.toggle {
  display: inline-flex; align-items: center; min-height: 44px; cursor: pointer; list-style: none;
  color: var(--accent-dark); font-weight: 500;
}
.toggle:hover { color: var(--accent); }
button.toggle { padding: 0; border: 0; background: none; font: inherit; font-weight: 500; text-align: left; }
.toggle[hidden] { display: none; }
.toggle::marker { content: ""; }
.toggle::-webkit-details-marker { display: none; }
.toggle-label { text-decoration: underline; text-underline-offset: 0.15em; }
.toggle::after { content: "▾"; margin-left: 0.35rem; }
[open] > .toggle::after, .toggle[aria-expanded="true"]::after { content: "▴"; }
[open] > .toggle .when-closed, .toggle .when-open { display: none; }
[open] > .toggle .when-open { display: inline; }

.meeting-more { margin-top: -0.6rem; }
.meeting-more[open] > .toggle { margin-bottom: 0.4rem; }

.ai-summary {
  margin-bottom: 0.9rem; background: var(--ai-bg); border: 1px dashed var(--ai-line);
  border-radius: 6px; padding: 0.8rem 1rem; color: var(--ai-ink);
}
.ai-summary .block-label { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; }
.ai-icon { flex: none; color: var(--accent); }
.ai-summary p { margin: 0.3rem 0 0; }

.meeting-details {
  display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 1rem;
  margin: 0.9rem 0 0; font-size: 0.9rem; color: var(--muted);
}
.meeting-details dd { margin: 0; overflow-wrap: anywhere; }
.meeting-details dt { color: var(--faint); }
@media (max-width: 479px) {
  .meeting-details { grid-template-columns: 1fr; gap: 0; }
  .meeting-details dd { margin-bottom: 0.4rem; }
}

/* --- About page -------------------------------------------------------- */

.prose h2 { font-size: 1.2rem; margin: 2rem 0 0.5rem; }
.prose p, .prose li { max-width: 40rem; }
.prose ul { padding-left: 1.25rem; }

/* --- Home: intro and map ---------------------------------------------- */

/* One block above the map: the intro sentence and the year filter. The
   sentence spans the container, like the project cards below, so both
   edges line up; it's one sentence, so it needs no reading-width cap. */
.intro { background: var(--surface); }
.intro-inner { max-width: 64rem; margin: 0 auto; padding: 0.75rem 1rem 0.25rem; }
.intro-text { margin: 0; color: var(--muted); font-size: 0.95rem; }
@media (min-width: 640px) {
  .intro-inner { padding-top: 1rem; }
  .intro-text { font-size: 1.05rem; }
}
/* On a phone the map is the screen minus ~120px: once scrolled to, it
   nearly fills it, and since a swipe on the map pans it there's always a
   strip left to scroll the page with. On a wide screen it runs to the
   bottom of the window on first load (header + intro + filter ≈ 190px). */
.map-wrap {
  position: relative; height: calc(100svh - 120px); min-height: 320px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
@media (min-width: 640px) {
  .map-wrap { height: calc(100svh - 190px); min-height: 420px; }
}
#map { position: absolute; inset: 0; background: #eceae4; }
#projecten { scroll-margin-top: 1rem; }

/* The year filter, in the intro block since it governs both the map and
   the list. Shown by map.js. On a phone the label sits right above the
   slider; from 720px it takes the left column and the slider the right,
   the same two columns as the project cards. The years flank the slider,
   with a tick per year tucked under the track. */
.year-filter { margin-top: 0.4rem; }
.year-filter[hidden] { display: none; }
.year-label { margin: 0; }
.year-filter label { font-weight: 500; }
.year-filter strong { font-variant-numeric: tabular-nums; }
.year-count { color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.year-count::before { content: "· "; }

/* Custom-drawn, because the native fill colours min -> thumb: the years
   that are hidden. Here the track is coloured from the thumb to the right
   end, the years that are shown. `--p` (0-1, set by map.js) is
   the thumb's position; the thumb's centre travels from 11px to 100% - 11px. */
#year-slider {
  --thumb: 22px;
  display: block; width: 100%; height: 44px; margin: 0; background: none; cursor: pointer;
  -webkit-appearance: none; appearance: none;
}
#year-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--line) calc(var(--thumb) / 2 + var(--p) * (100% - var(--thumb))), var(--accent) 0);
}
#year-slider::-moz-range-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right, var(--line) calc(var(--thumb) / 2 + var(--p) * (100% - var(--thumb))), var(--accent) 0);
}
#year-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: var(--thumb); height: var(--thumb); margin-top: -8px;
  border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--accent), 0 1px 4px rgba(0, 0, 0, 0.3);
}
#year-slider::-moz-range-thumb {
  width: var(--thumb); height: var(--thumb); box-sizing: border-box;
  border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 1px var(--accent), 0 1px 4px rgba(0, 0, 0, 0.3);
}
#year-slider:focus-visible { outline: none; }
#year-slider:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px rgba(106, 27, 154, 0.35); }
#year-slider:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 1px var(--accent), 0 0 0 5px rgba(106, 27, 154, 0.35); }

.year-range { display: flex; align-items: center; gap: 0.6rem; }
.year-track { position: relative; flex: 1; min-width: 0; }
.year-end { flex: none; font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
/* Ticks line up with the thumb's centre at each year, inside the input's
   44px tap height so they cost no extra row. */
.year-ticks {
  position: absolute; left: 0; right: 0; top: 30px; pointer-events: none;
  display: flex; justify-content: space-between; padding: 0 10px;
}
.year-ticks span { width: 2px; height: 5px; border-radius: 1px; background: #cfc6d6; }
@media (min-width: 720px) {
  .year-filter { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.75rem; align-items: center; }
}

.list-end {
  margin: 1.25rem 0 0; padding: 1rem 1.1rem; border: 1px dashed #cdb6dc; border-radius: var(--radius);
  background: var(--accent-soft);
}
.list-end[hidden] { display: none; }
.list-end p { margin: 0 0 0.6rem; }
.list-end-button {
  min-height: 44px; padding: 0 1.1rem; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: #fff; font: 600 1rem var(--font);
}
.list-end-button:hover { background: var(--accent-dark); }


.count-badge {
  background: var(--ink); color: #fff; border: 2px solid #fff; border-radius: 10px;
  font: 700 11px/14px var(--font); text-align: center;
}
/* A cluster of nearby points (zoomed out), tapping it zooms in. The
   markers' purple, told apart from a single marker by its size, number and
   halo. It can mix exact and street-level points; zooming in shows which. */
.cluster {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent); color: #fff; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(106, 27, 154, 0.25), 0 1px 4px rgba(0, 0, 0, 0.35);
  font: 700 15px/1 var(--font); cursor: pointer;
}
.cluster:hover { background: var(--accent-dark); }
.locate-button {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; background: #fff; border: 0; border-radius: 4px; cursor: pointer; padding: 0; color: var(--ink);
}
.locate-button:hover { background: #f4f4f4; }
.leaflet-touch .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; }

/* The map key: how precisely a project's location is known — exact, street
   only, or not at all (the last opens those projects in the panel).
   Clusters and count badges explain themselves, so they aren't in it. */
.map-key {
  position: absolute; left: 10px; bottom: 22px; z-index: 1000; max-width: calc(100% - 20px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 0 0.6rem; padding: 0 0.25rem 0 0.6rem;
  background: var(--surface); border-radius: 999px; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.3);
  font-size: 0.8125rem; line-height: 1.2;
}
.key-item { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 32px; white-space: nowrap; }
.key-unmapped {
  position: relative; display: inline-flex; align-items: center; min-height: 32px; padding: 0 0.3rem;
  border: 0; background: none; color: var(--accent-dark); font: 500 0.8125rem var(--font);
  text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer; white-space: nowrap;
}
/* A 44px tap area around the 32px-high strip. */
.key-unmapped::before { content: ""; position: absolute; inset: -6px -4px; }
.key-unmapped:hover { color: var(--accent); }
.key-unmapped[hidden] { display: none; }
.swatch { display: inline-block; flex: none; width: 14px; height: 14px; border-radius: 50%; }
.swatch-exact { background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px #bbb; }
.swatch-street { background: #fff; border: 2px dashed var(--accent); }

.panel {
  position: absolute; z-index: 1100; display: flex; flex-direction: column;
  background: var(--surface); font-size: 16px; box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.25);
}
.panel[hidden] { display: none; }
.panel-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.25rem 0.25rem 1rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { flex: 1; font-size: 1.05rem; }
.panel-close {
  flex: none; width: 48px; height: 48px; border: 0; border-radius: 50%; background: none;
  font-size: 28px; line-height: 1; cursor: pointer; color: var(--muted);
}
.panel-close:hover { background: var(--bg); color: var(--ink); }
.panel-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 1rem calc(0.75rem + env(safe-area-inset-bottom)); }
.panel-body > p { color: var(--muted); }
.panel-project { border-bottom: 1px solid var(--line); padding: 0.5rem 0 0.8rem; }
.panel-project:last-child { border-bottom: 0; }
.panel-project a.address { display: flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 1.05rem; }
.panel-project p { margin: 0.2rem 0; }
.panel-project .panel-desc { color: var(--ink); }
.panel-project .panel-meta { color: var(--muted); font-size: 0.95rem; }

@media (max-width: 479px) {
  .site-header-inner { padding: 0 0.5rem 0 0.75rem; gap: 0.25rem; }
  .nav a { padding: 0 0.5rem; }
}
@media (max-width: 639px) {
  .panel { left: 0; right: 0; bottom: 0; max-height: 85%; border-radius: 16px 16px 0 0; }
  .panel::before {
    content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 8px auto 0;
  }
}
@media (min-width: 640px) {
  .panel { top: 0; right: 0; bottom: 0; width: 380px; box-shadow: -4px 0 20px rgba(0, 0, 0, 0.2); }
}
