:root {
  color-scheme: light;
  --cream: #fbf7ed;
  --paper: #fffdf8;
  --sand: #f3ebdc;
  --ink: #282019;
  --muted: #685b4e;
  --line: #dfd3c0;
  --control: #988773;
  --red: #a53024;
  --red-dk: #792019;
  --hero: #621b20;
  --hero-text: #fff5dd;
  --saffron: #f5c56b;
  --green: #2b6d50;
  --focus: #1d625b;
  --radius: 12px;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "DM Sans", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 60px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--cream); font: 1rem/1.5 var(--body); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.07; }
button, input, select, textarea { font: inherit; color: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.shell { width: min(100%, 1500px); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: absolute; z-index: 1001; inset: 8px auto auto 8px; padding: 10px; background: var(--paper); color: var(--red-dk); }

.top { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--hero); text-decoration: none; white-space: nowrap; }
.brand span { font: 800 clamp(1.65rem, 3.2vw, 2.45rem)/.9 var(--display); text-transform: uppercase; letter-spacing: .012em; }
.brand-mark { flex: none; width: clamp(26px, 3.4vw, 38px); height: auto; }
.auth-area { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.auth-name { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sand); color: var(--red-dk); font-weight: 700; }
.banner { padding-block: 8px; color: var(--red-dk); font-size: .875rem; }

.hero { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); background: var(--hero); color: var(--hero-text); overflow: hidden; border-radius: 16px; }
.hero-copy { align-self: center; padding: clamp(26px, 3vw, 42px) clamp(24px, 4vw, 64px); }
.hero h1 { font: 800 clamp(3.1rem, 6.2vw, 5.9rem)/.88 var(--display); letter-spacing: -.014em; }
.hero p { max-width: 32ch; margin-block: 18px 16px; font-size: clamp(.97rem, 1.4vw, 1.15rem); }
.hero-link { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--hero-text); text-underline-offset: 4px; font-weight: 700; }
.hero-link:hover { color: var(--saffron); }
.hero-link:focus-visible { outline-color: var(--saffron); }
.hero-link svg, .btn svg, .search-field svg { width: 20px; height: 20px; flex: none; }
.hero-photo { width: 100%; height: 0; min-height: 100%; display: block; object-fit: cover; object-position: center 48%; }

.explore { margin-block: clamp(24px, 3vw, 42px) 40px; scroll-margin-top: 16px; }
.explore-head, .results-head, .form-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.explore-head { margin-bottom: 14px; flex-wrap: wrap; }
.explore-head h2 { font: 800 clamp(2.15rem, 4vw, 3.45rem)/.95 var(--display); letter-spacing: -.01em; }
.explore-actions, .location-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn, .admin-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--sand);
  color: var(--ink);
  text-decoration: none;
  text-align: center;
  font-size: .93rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .16s, border-color .16s, color .16s;
}
.btn:hover, .admin-link:hover { background: #eadfca; }
.btn:active { background: var(--line); }
.btn.primary { background: var(--red); color: var(--paper); }
.btn.primary:hover, .btn.primary:active { background: var(--red-dk); }
.btn.ghost { background: transparent; color: var(--red-dk); }
.btn.ghost:hover { background: var(--sand); }
.btn.outline, .admin-link { background: transparent; border-color: var(--control); }
.btn.outline:hover, .admin-link:hover { background: var(--sand); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .62; cursor: wait; }
a.link { color: var(--red-dk); font-size: .875rem; font-weight: 700; text-underline-offset: 3px; }

.tools { display: grid; grid-template-columns: minmax(0, 1fr) minmax(9rem, 14rem); gap: 10px; margin-bottom: 14px; }
.search-field { position: relative; min-width: 0; }
.search-field svg { position: absolute; inset: 50% auto auto 13px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
input:not([type=checkbox]), select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--control);
  border-radius: 8px;
  background: var(--paper);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
.search-field input { padding-inline-start: 42px; }
textarea { resize: vertical; }

.layout {
  display: grid;
  grid-template-columns: minmax(300px, .75fr) minmax(0, 1.55fr);
  grid-template-areas: "results map";
  grid-template-rows: clamp(470px, 60vh, 660px);
  gap: 14px;
}
.side { grid-area: results; min-width: 0; overflow-y: auto; padding: clamp(14px, 2vw, 24px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.map-wrap { position: relative; grid-area: map; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); isolation: isolate; scroll-margin-top: 12px; }
#map { position: absolute; inset: 0; background: #dbe8e7; }
#map.leaflet-container { font-family: var(--body); }
#map .leaflet-bar { border: 0; border-radius: 8px; box-shadow: 0 1px 6px #28201928; }
#map .leaflet-bar a { width: 44px; height: 44px; line-height: 44px; font-family: var(--body); color: var(--ink); }
#map .leaflet-bar a:focus-visible { outline-offset: -3px; }
.pick-hint { position: absolute; z-index: 500; top: 12px; right: 12px; max-width: calc(100% - 72px); display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px; border-radius: 8px; background: var(--ink); color: white; font-size: .875rem; }
.pick-hint span { padding-inline: 4px; }
.results-head { flex-wrap: wrap; gap: 4px 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.results-head h3 { font-size: 1.12rem; }
.list { list-style: none; padding: 0; margin: 0; }
.card { padding-block: 16px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.card.sel { box-shadow: inset 3px 0 var(--red); padding-inline: 10px; background: var(--cream); }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; align-items: baseline; }
.card h3 { font-size: 1.08rem; }
.spot-select { min-height: 44px; padding: 4px 0; text-align: left; border: 0; background: transparent; font-weight: 700; }
.spot-select:hover { color: var(--red-dk); text-decoration: underline; text-underline-offset: 4px; }
.meta, .by { color: var(--muted); font-size: .875rem; }
.meta { margin-block: 2px 6px; }
.chips, .card .actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin-top: 8px; }
.chip { padding: 3px 8px; border-radius: 5px; background: var(--sand); color: var(--red-dk); font-size: .82rem; font-weight: 600; }
.card p { margin-block: 6px 0; font-size: .92rem; }
.card .actions a, .rate-row a { display: inline-flex; align-items: center; min-height: 44px; }
.by { margin-top: 8px; }
.empty { padding: 24px 0; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 1.1rem; }
.empty p { max-width: 30ch; }

.form-head { flex-wrap: wrap; margin-bottom: 12px; }
.form-head h2, .dialog h2 { font: 800 2rem/1 var(--display); }
.field { margin-bottom: 16px; }
.field label, .field .lbl { display: block; margin-bottom: 5px; font-size: .91rem; font-weight: 700; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.loc-box, .info { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--cream); font-size: .91rem; }
.loc-box.ok { border-color: var(--green); background: #edf5eb; }
.coords { margin-block: 4px; font-variant-numeric: tabular-nums; }
.info { margin-bottom: 16px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: 0; padding: 4px 9px; border: 1px solid var(--control); border-radius: 8px; cursor: pointer; }
.checks input { accent-color: var(--red); }
.checks label:has(input:checked) { border-color: var(--red); background: var(--sand); }
.form-actions .btn { width: 100%; }
.err { color: var(--red-dk); font-size: .9rem; margin-block: 8px; }
.err:empty { margin: 0; }

.dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--paper); }
.dialog::backdrop { background: #211715b8; }
.dialog-content { position: relative; padding: clamp(18px, 4vw, 28px); }
.dialog h2 { margin: 0 44px 8px 0; }
.x { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; background: transparent; color: var(--ink); border: 0; border-radius: 8px; font-size: 1.65rem; line-height: 1; }
.x:hover { background: var(--sand); }
.tabs { display: flex; gap: 8px; margin-block: 18px; padding: 4px; border-radius: 10px; background: var(--sand); }
.tabs button { flex: 1; min-height: 44px; border: 1px solid transparent; border-radius: 7px; background: transparent; font-weight: 700; color: var(--muted); }
.tabs button.on { border-color: var(--line); background: var(--paper); color: var(--red-dk); }
.toast { position: fixed; z-index: 1000; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 8px; background: var(--ink); color: white; font-size: .9rem; }

.pin-wrap svg { display: block; filter: drop-shadow(0 2px 2px #0005); }
.town span { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 11px; font-weight: 700; color: #38422e; text-shadow: 0 0 4px white; pointer-events: none; }
.forks, .fork-input { display: inline-flex; align-items: center; gap: 2px; }
.fork { flex: none; width: 16px; height: 16px; fill: #cbbda8; }
.fork.on { fill: var(--red); }
.forks .num { color: var(--muted); margin-left: 4px; font-size: .875rem; }
.fork-input { flex-wrap: wrap; gap: 0; }
.fork-input button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 6px; background: none; }
.fork-input button:hover { background: var(--sand); }
.fork-input .fork { width: 23px; height: 23px; }
.fork-input.big .fork { width: 28px; height: 28px; }
.rate-row { display: flex; align-items: center; flex-wrap: wrap; column-gap: 8px; margin-top: 8px; border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.rating-label { display: block; color: var(--muted); font-size: .875rem; }
.pill, .count-dot { padding: 3px 8px; border-radius: 5px; font-size: .8rem; font-weight: 700; }
.pill.pending, .count-dot { background: #faebc8; color: #61450f; }
.pill.approved { background: #e1f0e5; color: #225a3b; }
.pill.rejected { background: #f9e2dd; color: var(--red-dk); }

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "map" "results"; grid-template-rows: clamp(300px, 56vmin, 480px) auto; }
  .side { overflow: visible; }
  .auth-name { display: none; }
}

@media (max-width: 560px) {
  .top { min-height: 64px; }
  .top .btn, .top .admin-link { padding-inline: 9px; font-size: .875rem; }
  .auth-area { gap: 4px; }
  .avatar { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { font-size: clamp(2.75rem, 12vw, 4.1rem); }
  .hero p { margin-block: 12px 6px; }
  .hero-copy { padding: 22px 20px 12px; }
  .hero-photo { height: clamp(126px, 35vw, 190px); min-height: 0; object-position: center 51%; }
  .explore-head { column-gap: 8px; }
  .explore-head h2 { font-size: 1.95rem; }
  .explore-actions { gap: 6px; }
  .explore-actions .btn { padding-inline: 10px; }
  .tools { grid-template-columns: minmax(0, 1fr) minmax(0, 8.1rem); }
  .search-field input { padding-inline-start: 36px; }
  .search-field svg { left: 10px; }
}

@media (max-width: 350px) {
  .explore-head h2 { font-size: 1.7rem; }
  .explore-actions .btn svg { display: none; }
  .tools { grid-template-columns: minmax(0, 1fr) minmax(0, 7.75rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0s !important; }
}
