/* Apple system colours. Safari gets the real dynamic system colours,
   other browsers get the published light and dark values. */
:root {
  color-scheme: light dark;
  --red: #ff3b30;
  --green: #34c759;
  --orange: #ff9500;
  --yellow: #ffcc00;
  --gray: #8e8e93;
  --blue: #007aff;
  --indigo: #5856d6;
  --teal: #30b0c7;
  --label: CanvasText;
  --secondary: color-mix(in srgb, CanvasText 60%, transparent);
  --separator: color-mix(in srgb, CanvasText 15%, transparent);
  --fill: color-mix(in srgb, CanvasText 8%, transparent);
  --material: color-mix(in srgb, Canvas 78%, transparent);
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red: #ff453a;
    --green: #30d158;
    --orange: #ff9f0a;
    --yellow: #ffd60a;
    --blue: #0a84ff;
    --indigo: #5e5ce6;
    --teal: #40c8e0;
  }
}
@supports (color: -apple-system-red) {
  :root {
    --red: -apple-system-red;
    --green: -apple-system-green;
    --orange: -apple-system-orange;
    --yellow: -apple-system-yellow;
    --gray: -apple-system-gray;
    --blue: -apple-system-blue;
    --indigo: -apple-system-indigo;
    --teal: -apple-system-teal;
    --label: -apple-system-label;
    --secondary: -apple-system-secondary-label;
    --separator: -apple-system-separator;
    --fill: -apple-system-quaternary-fill;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: Canvas;
  color: var(--label);
  font: -apple-system-body;
  font-family: system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#map { position: absolute; inset: 0; }

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border-radius: 50%;
  border: 3px solid var(--label);
  box-shadow: 0 0 0 2px Canvas;
  pointer-events: none;
}
.crosshair[hidden] { display: none; }
/* The same mark, left on the map where the mouse last checked. */
.crosshair.pin { position: absolute; left: 0; top: 0; margin: 0; }
.crosshair::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--label);
}

.card {
  position: absolute;
  left: max(var(--gutter), env(safe-area-inset-left));
  right: max(var(--gutter), env(safe-area-inset-right));
  max-width: 34rem;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 20px;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0 0 0.5px var(--separator), 0 8px 30px color-mix(in srgb, CanvasText 12%, transparent);
}

.verdict {
  top: max(var(--gutter), env(safe-area-inset-top));
  /* Never taller than what's visible, keyboard included; the results scroll inside. */
  max-height: calc(var(--visible-height, 100dvh) - 2 * max(var(--gutter), env(safe-area-inset-top)));
  display: flex;
  flex-direction: column;
  z-index: 3; /* search results drop over the controls card and map credit */
}
.verdict > * { flex: none; }
.verdict-row { display: flex; align-items: center; gap: 10px; }
.verdict h1 { margin: 0; font: -apple-system-headline; font-family: system-ui, -apple-system, sans-serif; font-size: 1.25rem; font-weight: 700; }
.verdict p { margin: 6px 0 0; color: var(--secondary); font: -apple-system-subheadline; font-family: system-ui, -apple-system, sans-serif; font-size: 0.9375rem; line-height: 1.35; }
.verdict-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gray); }
.verdict[data-tone="yes"] .verdict-dot { background: var(--green); }
.verdict[data-tone="no"] .verdict-dot { background: var(--red); }
.verdict[data-tone="maybe"] .verdict-dot { background: var(--orange); }
.verdict[data-tone="none"] .verdict-dot { background: var(--gray); }

.controls {
  bottom: max(var(--gutter), env(safe-area-inset-bottom));
  display: grid;
  gap: 10px;
}
.row { display: flex; align-items: center; gap: 8px; }
.chips { flex-wrap: wrap; }

.time { flex: 1; min-width: 0; display: grid; }
.time output { font-size: 0.9375rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--blue); }
.time .label { color: var(--secondary); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }

button { font: inherit; color: inherit; cursor: pointer; }

.pill, .chip, .icon {
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  padding: 8px 14px;
  font-size: 0.9375rem;
  font-weight: 600;
}
.pill[aria-pressed="true"] { background: var(--blue); color: white; }

.icon { display: grid; place-items: center; padding: 9px; }
.icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; font-size: 0.875rem; }
.chip[aria-pressed="false"] { color: var(--secondary); }
.chip[aria-pressed="false"] .swatch { opacity: 0.35; }

.swatch { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--gray); }
.swatch.no { background: var(--red); border-radius: 3px; }
.swatch.timed { background: var(--green); border-radius: 3px; }
.swatch.maybe { background: var(--orange); border-radius: 3px; }
.swatch.none { background: repeating-linear-gradient(135deg, var(--gray) 0 2px, transparent 2px 5px); border-radius: 3px; box-shadow: inset 0 0 0 1px var(--gray); }
.swatch.venue, .swatch.likely { background: var(--teal); }
.swatch.confirmed { background: var(--green); }
.swatch.unknown { background: var(--gray); }
.swatch.seated { background: var(--orange); }
.swatch.toilet { background: var(--indigo); border-radius: 3px; }

/* ------------------------------------------------------------ dialog */

dialog {
  width: min(36rem, calc(100% - 2 * var(--gutter)));
  max-height: calc(100% - 2 * var(--gutter));
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: Canvas;
  color: var(--label);
}
dialog::backdrop { background: color-mix(in srgb, black 35%, transparent); }
.sheet { padding: 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet h2 { margin: 0; font-size: 1.375rem; }
.sheet h3 { margin: 22px 0 6px; font-size: 1.0625rem; }
.sheet p { margin: 6px 0; line-height: 1.45; }
.legend, .sources { margin: 8px 0; padding: 0; list-style: none; display: grid; gap: 8px; line-height: 1.4; }
.legend li { display: flex; gap: 10px; align-items: baseline; }
.legend .swatch { transform: translateY(1px); }
.sources { padding-left: 1.1em; list-style: disc; }
.fine { color: var(--secondary); font-size: 0.8125rem; }
a { color: var(--blue); }

/* ------------------------------------------------------------ popups */

.maplibregl-popup-content {
  background: Canvas;
  color: var(--label);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 0 0 0.5px var(--separator), 0 6px 24px color-mix(in srgb, CanvasText 18%, transparent);
  font-family: system-ui, -apple-system, sans-serif;
  max-width: 280px;
}
.maplibregl-popup-close-button { font-size: 1.25rem; padding: 2px 8px; color: var(--secondary); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: Canvas; }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: Canvas; }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: Canvas; }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: Canvas; }
.pop h4 { margin: 0 24px 2px 0; font-size: 1rem; }
.pop .sub { margin: 0 0 8px; color: var(--secondary); font-size: 0.8125rem; }
.pop .status { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.9375rem; }
.pop p { margin: 4px 0; font-size: 0.875rem; line-height: 1.4; }
.pop .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.pop .tags span { background: var(--fill); border-radius: 6px; padding: 2px 6px; font-size: 0.75rem; }
.maplibregl-ctrl-attrib { font-family: system-ui, -apple-system, sans-serif; }
.maplibregl-ctrl-top-right { top: var(--top-inset, 0); }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: var(--bottom-inset, 0); }
/* The locate button in the controls card drives this; hide the duplicate. */
.maplibregl-ctrl-group:has(.maplibregl-ctrl-geolocate) { display: none; }
@media (max-width: 600px) {
  /* Pinch to zoom on phones; the zoom buttons just crowd the map. */
  .maplibregl-ctrl-top-right { display: none; }
}

/* ------------------------------------------------------------ search */

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px -6px 12px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--fill);
}
.search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: var(--secondary); stroke-width: 2; stroke-linecap: round; }
.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 1rem;
  outline: none;
}
.results { list-style: none; margin: -6px -6px 12px; padding: 0; }
.verdict > .results { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.results li { padding: 9px 10px; border-radius: 10px; cursor: pointer; line-height: 1.3; }
.results li[aria-selected="true"], .results li:hover { background: var(--fill); }
.results .where { display: block; color: var(--secondary); font-size: 0.8125rem; }
.results .empty { color: var(--secondary); cursor: default; }
.results .empty:hover { background: none; }

.coverage { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; font-size: 0.9375rem; }
.coverage li { display: flex; gap: 10px; align-items: baseline; }
.coverage .how { display: block; margin-top: 2px; color: var(--secondary); font-size: 0.8125rem; line-height: 1.35; }
.coverage li { line-height: 1.3; }

/* ------------------------------------------------------------ disclaimer and data date */

.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  margin: 0;
  color: var(--secondary);
  font-size: 0.8125rem;
}
.link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--blue);
  font-size: inherit;
  text-align: left;
}
.link[data-stale="true"] { color: var(--orange); font-weight: 600; }

.disclaimer {
  margin-top: 16px;
  padding: 4px 14px 8px;
  border-radius: 14px;
  background: var(--fill);
}
.disclaimer h3 { margin-top: 10px; }

#terms { max-width: 30rem; }
#terms h2 { margin-bottom: 10px; }
.sheet-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.pill.primary { background: var(--blue); color: white; }
#terms::backdrop {
  background: color-mix(in srgb, Canvas 30%, transparent);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
}

/* ------------------------------------------------------------ reports */

.status-links { display: inline-flex; flex-wrap: wrap; gap: 2px 12px; }
.request:not([hidden]) { display: block; margin-top: 8px; font-size: 0.9375rem; font-weight: 600; }
.request:disabled { color: var(--secondary); cursor: default; }
.pop-links { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; }
.pop-links .link { font-size: 0.875rem; }
a.pill { text-decoration: none; color: inherit; display: inline-flex; align-items: center; }
#report, #city { max-width: 30rem; }
.field { display: grid; gap: 4px; margin: 12px 0; font-size: 0.875rem; font-weight: 600; }
.field textarea, .field input, .field select {
  font: inherit;
  font-weight: 400;
  font-size: 1rem;
  color: inherit;
  background: var(--fill);
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
}
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------ terms and privacy pages */

html:has(body.doc), body.doc { height: auto; overflow: auto; }
.doc-body {
  max-width: 40rem;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(var(--gutter), env(safe-area-inset-right)) 48px max(var(--gutter), env(safe-area-inset-left));
  line-height: 1.5;
}
.doc-body h1 { font-size: 2rem; margin: 16px 0 4px; }
.doc-body h2 { font-size: 1.125rem; margin: 28px 0 6px; }
.doc-body p, .doc-body li { margin: 6px 0; }

/* ------------------------------------------------------------ time slider */

/* The date picker hides behind the time label; tapping it opens the picker. */
.pick { position: relative; overflow: hidden; }
.pick input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; padding: 0; cursor: pointer; }

/* 24 hours of the checked spot: green no ban, red ban, orange unsure, grey
   nothing to check; dimmed at night. The thumb is a sun or a moon. */
.timeline { position: relative; padding-bottom: 16px; }
.timeline canvas {
  /* Inset by half the thumb, so each moment sits under the thumb's centre. */
  position: absolute;
  left: 15px;
  top: 11px;
  width: calc(100% - 30px);
  height: 10px;
  border-radius: 5px;
  pointer-events: none;
}
.timeline input[type="range"] {
  position: relative;
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: grab;
}
.timeline input[type="range"]:active { cursor: grabbing; }
.timeline input[type="range"]::-webkit-slider-runnable-track { height: 32px; background: none; }
.timeline input[type="range"]::-moz-range-track { height: 32px; background: none; }
.timeline input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: 1px;
  border-radius: 50%;
  border: 3px solid var(--thumb-ring, var(--gray));
  background: Canvas var(--thumb-icon) center / 18px no-repeat;
  box-shadow: 0 2px 8px color-mix(in srgb, CanvasText 25%, transparent);
  transition: border-color 0.15s, transform 0.15s;
}
.timeline input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.15); }
.timeline input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--thumb-ring, var(--gray));
  background: Canvas var(--thumb-icon) center / 18px no-repeat;
  box-shadow: 0 2px 8px color-mix(in srgb, CanvasText 25%, transparent);
}
.timeline input[type="range"]:focus-visible { outline: none; }
.timeline input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--blue); }
.days { position: absolute; left: 15px; right: 15px; bottom: 0; height: 14px; color: var(--secondary); font-size: 0.6875rem; font-weight: 600; }
.days span { position: absolute; top: 0; padding-left: 4px; border-left: 1px solid var(--separator); line-height: 14px; white-space: nowrap; }
