:root {
  color-scheme: light;
  --ink: #202a22;
  --muted: #536153;
  --paper: #f9f7ef;
  --line: #dcded1;
  --accent: #285443;
  --night: #0e2524;
  --serif: Georgia, 'Times New Roman', serif;
  font: 1rem/1.45 system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 36.25rem; height: 100svh; display: flex; flex-direction: column; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid #568f66; outline-offset: 4px; }
[hidden] { display: none !important; }

.topbar {
  min-height: 4.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .65rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}
.brand { font: bold clamp(1.45rem, 3.5vw, 2.1rem)/1 var(--serif); letter-spacing: -.045em; }
.topbar a { text-decoration: none; }
.topbar nav { display: flex; gap: clamp(.65rem, 2.2vw, 1.65rem); font-size: .9rem; font-weight: 650; }
.topbar a:hover, .topbar [aria-current] { text-decoration: underline; text-underline-offset: .35em; }
.layout { display: grid; flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) clamp(18rem, 28vw, 26rem); }
.map { position: relative; isolation: isolate; overflow: hidden; color: #f4f7eb; background: var(--night); }
.heading { position: absolute; top: 0; left: 0; z-index: 2; width: 100%; padding: clamp(1rem, 3vw, 2.6rem); background: linear-gradient(180deg, #0e2524c7, transparent); pointer-events: none; }
.heading h1 { margin: 0; font: 600 clamp(1.8rem, 4vw, 3.4rem)/1.03 var(--serif); letter-spacing: -.04em; text-shadow: 0 1px 12px var(--night); }
.heading p { margin: .55rem 0 0; color: #dce8da; font-size: .9rem; text-shadow: 0 1px 8px var(--night); }
#viewport, canvas, #markers { position: absolute; inset: 0; width: 100%; height: 100%; }
#viewport { cursor: grab; touch-action: none; overscroll-behavior: contain; }
#viewport:focus-visible { outline-offset: -3px; outline-color: #c8e69a; }
#viewport[data-dragging] { cursor: grabbing; }
canvas, #markers { pointer-events: none; }
.marker {
  position: absolute;
  top: 0;
  left: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border: 0;
  padding: 0;
  border-radius: 50%;
  color: #eff7d7;
  background: transparent;
}
.marker::before { content: ''; width: .55rem; height: .55rem; border: 2px solid #1a3b29; background: #d5ee8e; border-radius: 50%; box-shadow: 0 0 0 4px #cbeb9039; }
.marker[aria-pressed="true"], .marker[data-hover], .marker:focus-visible { z-index: 1; }
.marker[aria-pressed="true"]::before, .marker[data-hover]::before, .marker:focus-visible::before { background: #f5ffdb; box-shadow: 0 0 0 5px #e1f6ae7a; }
.marker span { display: none; position: absolute; left: 50%; top: 100%; transform: translateX(-50%); white-space: nowrap; padding: .2rem .5rem; color: #f5f8ef; background: #142b27; border-radius: .3rem; font-size: .78rem; font-weight: 650; }
.marker[aria-pressed="true"] span, .marker[data-hover] span, .marker:focus-visible span { display: block; }
#viewport[data-marker] { cursor: pointer; }
.controls { position: absolute; right: clamp(1rem, 2vw, 1.5rem); bottom: 1.4rem; display: flex; gap: .35rem; }
.controls button { min-height: 2.75rem; min-width: 2.75rem; padding: .35rem .7rem; border: 1px solid #6a8b79; border-radius: .5rem; background: #193936; color: #f4f8ef; font-weight: 650; }
.controls button:hover { background: #29514a; }
.controls button:focus-visible { outline-color: #c8e69a; }
.credit { position: absolute; bottom: .45rem; left: .75rem; color: #c6d5c8; font-size: .71rem; }
#map-error { position: absolute; inset: 44% 10% auto; text-align: center; }

.reader { overflow-y: auto; padding: clamp(1rem, 2.4vw, 2rem); }
.reader label { display: block; margin-bottom: .4rem; font-size: .875rem; font-weight: 700; }
.reader input { display: block; width: 100%; padding: .65rem .85rem; border: 1px solid #aeb8a9; border-radius: .5rem; color: inherit; background: #fffdf7; }
.reader-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-top: 1.5rem; }
.reader h2 { margin: 0; font: 600 clamp(1.4rem, 2.8vw, 2.25rem)/1.15 var(--serif); letter-spacing: -.04em; }
#all-places { flex-shrink: 0; color: var(--accent); border: 0; background: transparent; padding: .25rem 0; text-decoration: underline; font-size: .875rem; }
.count { min-height: 1.2em; margin: .25rem 0 1rem; color: var(--muted); font-size: .875rem; }
#results { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
#results a, #results button { display: grid; gap: .15rem; width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: .75rem .2rem; text-align: left; text-decoration: none; color: inherit; }
#results a:hover, #results button:hover { background: #eef1e7; }
#results span { color: var(--muted); font-size: .79rem; }
#results strong { font-weight: 650; }

@media (max-width: 700px) {
  body { height: auto; min-height: 100svh; }
  .topbar { min-height: 3.5rem; }
  .layout { grid-template-columns: 1fr; }
  .map { min-height: 22rem; height: 60svh; max-height: 33rem; }
}

@media (max-width: 360px) {
  .brand { font-size: 1.3rem; }
  .topbar { gap: .5rem; padding-inline: .65rem; }
  .topbar nav { gap: .55rem; }
}
