/* Mobile-first, single column, system fonts. Colours are variables so that dark mode only
   needs to redefine them. */
:root {
  --bg: #f7f7f5;
  --card: #ffffff;
  --text: #1d1f21;
  --muted: #6b6f73;
  --line: #dcdedf;
  --accent: #2a6f97;
  --accent-text: #ffffff;
  --error: #b8432f;
  --radius: 10px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171a;
    --card: #1e2125;
    --text: #e8e9ea;
    --muted: #9aa0a6;
    --line: #30353a;
    --accent: #6fb1d8;
    --accent-text: #0e1114;
    --error: #f0806b;
  }
}

/* Base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.35rem; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 0.5rem; }
p { margin: 0 0 0.5rem; }

/* Layout: one column, 16 px gutters, cards stacked with a small gap */
.top, main, footer { max-width: 42rem; margin: 0 auto; padding: 0 1rem; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding-top: 1.25rem; padding-bottom: 0.5rem; }
.tagline { color: var(--muted); font-size: 0.95rem; margin: 0.25rem 0 0; }
main { display: grid; gap: 0.9rem; padding-bottom: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
footer { color: var(--muted); font-size: 0.85rem; padding-top: 0.5rem; padding-bottom: 2rem; }

/* Form controls: at least 2.6 rem high so they are easy to tap */
label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0; }
input, select, button {
  font: inherit; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.75rem; min-height: 2.6rem;
}
input[type="search"] { flex: 1 1 14rem; min-width: 0; -webkit-appearance: none; }
select { flex: 1 1 8rem; }
button { cursor: pointer; }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); flex: 1 1 auto; }
button.ghost { border-color: transparent; background: transparent; color: var(--muted); padding: 0.3rem 0.5rem; min-height: 0; white-space: nowrap; }
button.ghost:hover { color: var(--accent); }

/* Status line and the boundary candidates */
.status { color: var(--muted); font-size: 0.95rem; padding: 0 0.25rem; }
.status.error { color: var(--error); }
.candidates { display: grid; gap: 0.4rem; }
.candidate { display: flex; justify-content: space-between; gap: 0.75rem; text-align: left; width: 100%; }
.candidate-meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; }

/* Result card, map and lists */
.place { color: var(--muted); font-size: 0.9rem; }
.summary { font-weight: 500; }
.map { height: 60vh; min-height: 18rem; border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--line); }
details.card summary { cursor: pointer; font-weight: 500; }
.atm-list, .ready-list { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.atm, .ready { display: grid; gap: 0.1rem; padding: 0.55rem 0; border-top: 1px solid var(--line); font-size: 0.95rem; }
.atm-address, .ready-meta { color: var(--muted); }
.atm-links { display: flex; gap: 0.9rem; font-size: 0.9rem; }

/* From tablet width on: links of a list entry on the right of its text */
@media (min-width: 40rem) {
  h1 { font-size: 1.6rem; }
  .atm, .ready { grid-template-columns: 1fr auto; align-items: center; }
  .atm strong, .ready strong { grid-column: 1; }
  .atm-address, .ready-meta { grid-column: 1; }
  .atm-links { grid-column: 2; grid-row: 1 / span 2; }
}

/* Leaflet controls and popups in dark mode */
@media (prefers-color-scheme: dark) {
  .leaflet-container { background: #202327; }
  .leaflet-bar a, .leaflet-control-attribution { background: var(--card); color: var(--text); }
  .leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--card); color: var(--text); }
}
