:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --ink: #1b1714;
  --muted: #5f574e;
  --line: #e4d9cc;
  --accent: #b4532a;
  --accent-ink: #fffaf6;
  --header: #1b1714;
  --header-ink: #f7f1e8;
  --card: #fffdf9;
  --chip: #f6e7dc;
  --shadow: 0 1px 0 rgba(27, 23, 20, 0.04), 0 10px 28px rgba(27, 23, 20, 0.06);
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
}

body.theme-stark {
  --bg: #eef3f2;
  --ink: #121817;
  --muted: #52605c;
  --line: #d4e0dc;
  --accent: #0f766e;
  --accent-ink: #f3fffc;
  --header: #101615;
  --header-ink: #eef6f4;
  --card: #fbfefd;
  --chip: #e5f3f0;
  --shadow: 0 1px 0 rgba(16, 22, 21, 0.04), 0 10px 28px rgba(16, 22, 21, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; }

img { max-width: 100%; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  z-index: 5;
}

.skip:focus { top: 12px; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: var(--header);
  color: var(--header-ink);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand strong {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand span {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.site-header nav a {
  color: var(--header-ink);
  text-decoration: none;
  font-size: 0.92rem;
}

.site-header nav a[aria-current="page"],
.site-header nav a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.finder {
  padding: 22px 22px 8px;
  max-width: 1280px;
  margin: 0 auto;
}

.lede {
  max-width: 42rem;
  margin: 0 0 16px;
}

.lede h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.05;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

.lede p { margin: 0; color: var(--muted); }

.search-form {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

input, select, button {
  font: inherit;
  color: var(--ink);
}

input, select {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 12px;
  min-height: 48px;
}

input:focus, select:focus, button:focus, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button, .button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 0;
  border-radius: 10px;
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button.ghost, a.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.status {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
  padding: 8px 22px 28px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: start;
}

.map-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: sticky;
  top: 78px;
}

#map {
  height: calc(100vh - 120px);
  min-height: 520px;
  background: #d9e2df;
}

.map-fallback {
  padding: 24px;
  color: var(--muted);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 120px);
  overflow: auto;
  padding-right: 2px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 14px 12px;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.card h2 {
  font-size: 1.05rem;
  margin: 0;
  letter-spacing: -0.01em;
}

.place {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.miles {
  flex: none;
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.badge {
  display: inline-block;
  margin-bottom: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.address, .hours {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.hours { color: var(--muted); font-size: 0.85rem; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.actions a {
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.88rem;
  background: #fff;
}

.actions a:hover { border-color: var(--accent); }

.empty, .loading, .error {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
}

.error { border-style: solid; color: #8a2b1b; }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 36px 22px 64px;
}

.page h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 12px;
}

.page p { font-size: 1.05rem; }

.page a.mail {
  color: var(--accent);
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 1280px;
  margin: 0 auto;
}

.site-footer p { margin: 0 0 8px; }

.leaflet-container { font-family: var(--sans); }

@media (max-width: 860px) {
  .site-header { align-items: flex-start; flex-direction: column; gap: 8px; }
  .search-form { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .map-wrap { position: static; }
  #map { height: 240px; min-height: 220px; }
  .results { max-height: none; overflow: visible; }
}
