:root {
  color-scheme: light;
  --paper: #f2f1e7; --ink: #252a1e; --muted: #5a604e; --line: #d7d8c6; --field: #fbfaf3;
  --dot: #bfc1aa; --brand: #3e5a2e; --brandfg: #fbfaf3; --sheet: #f7f6ee; --scrim: rgba(37, 42, 30, .45);
  --l1: #3e7a2a; --l1fg: #fff; --l1t: #dbe8cf;
  --l2: #b4592b; --l2fg: #fff; --l2t: #f5dccd;
  --l3: #d4b24e; --l3fg: #252a1e; --l3t: #efe6c6;
  --l4: #4d7a80; --l4fg: #fff; --l4t: #d6e6e7;
  --l5: #74736a; --l5fg: #fff; --l5t: #e3e2d8;
  --serif: 'DM Serif Display', Georgia, serif;
  --sans: 'Work Sans', system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --paper: #191c15; --ink: #ecebdf; --muted: #adb19c; --line: #363c2e; --field: #21251c;
    --dot: #4d5342; --brand: #a9c98f; --brandfg: #191c15; --sheet: #20241b; --scrim: rgba(0, 0, 0, .6);
    --l1: #8fc46f; --l1fg: #13200c; --l1t: #27361e;
    --l2: #ec9466; --l2fg: #241106; --l2t: #3c2619;
    --l3: #d9bb5a; --l3fg: #1f1906; --l3t: #36301a;
    --l4: #8bbcc1; --l4fg: #0c1b1d; --l4t: #1f3234;
    --l5: #9a998e; --l5fg: #17170f; --l5t: #2c2c26;
  }
}
:root[data-theme=dark] {
  color-scheme: dark;
  --paper: #191c15; --ink: #ecebdf; --muted: #adb19c; --line: #363c2e; --field: #21251c;
  --dot: #4d5342; --brand: #a9c98f; --brandfg: #191c15; --sheet: #20241b; --scrim: rgba(0, 0, 0, .6);
  --l1: #8fc46f; --l1fg: #13200c; --l1t: #27361e;
  --l2: #ec9466; --l2fg: #241106; --l2t: #3c2619;
  --l3: #d9bb5a; --l3fg: #1f1906; --l3t: #36301a;
  --l4: #8bbcc1; --l4fg: #0c1b1d; --l4t: #1f3234;
  --l5: #9a998e; --l5fg: #17170f; --l5t: #2c2c26;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; padding-bottom: 90px; }
a { color: var(--brand); }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
button { font-family: var(--sans); cursor: pointer; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -9999px; top: 8px; z-index: 3000; background: var(--brand); color: var(--brandfg); padding: 10px 14px; border-radius: 8px; }
.skip:focus { left: 12px; }

.wrap { max-width: 1440px; margin: 0 auto; padding-left: 18px; padding-right: 18px; }

/* Header */
.site-head { padding-top: 22px; }
.head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.brand-row { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.logo { font: 400 40px/1 var(--serif); letter-spacing: -.01em; color: var(--brand); text-decoration: none; }
.tagline { margin: 0; font: italic 400 18px/1.35 var(--serif); color: var(--muted); }
.head-nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.om-link { color: var(--muted); text-underline-offset: 3px; }

.pill-btn { font: 500 13px var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; min-height: 36px; }
.link-btn { background: none; border: 0; padding: 6px 0; color: var(--brand); font: 500 14px var(--sans); text-decoration: underline; text-underline-offset: 3px; }
.brand-btn { background: var(--brand); color: var(--brandfg); border: 0; border-radius: 999px; padding: 10px 18px; font: 600 14px var(--sans); }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; align-items: start; }
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 14px; padding-top: 16px; }

/* Filters */
.filters { display: flex; flex-direction: column; gap: 14px; }
.search { position: relative; display: block; }
.search input { width: 100%; font: 400 16px var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 999px; padding: 13px 18px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rchip { display: flex; align-items: center; gap: 7px; padding: 5px 12px 5px 5px; min-height: 36px; border-radius: 999px; background: transparent; border: 1.5px solid var(--line); color: var(--ink); font: 500 13px var(--sans); }
.rchip[aria-pressed=true] { background: var(--ct); border-color: var(--c); }
.rchip .count { color: var(--muted); font-weight: 400; }
.badge { width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: var(--cfg); display: grid; place-items: center; font: 400 15px/1 var(--serif); flex: none; }
.tchip { padding: 7px 13px; min-height: 36px; border-radius: 999px; background: transparent; color: var(--ink); border: 1.5px solid var(--line); font: 500 13px var(--sans); }
.tchip[aria-pressed=true] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.row-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.row-gap { display: flex; gap: 14px; align-items: center; }
.switch { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 0; color: var(--ink); font: 400 14px var(--sans); min-height: 36px; text-align: left; }
.track { width: 40px; height: 24px; border-radius: 12px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.knob { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch[aria-checked=true] .track { background: var(--brand); }
.switch[aria-checked=true] .knob { left: 19px; }
.more-filters { display: none; flex-direction: column; gap: 12px; padding: 14px 0 4px; border-top: 1px dotted var(--dot); }
.filters.more-open .more-filters { display: flex; }
.cuisine-label { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cuisine-label select { font: 400 14px var(--sans); color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 38px; max-width: 220px; }
.status-row { font-size: 14px; color: var(--muted); }
.status-row p { margin: 0; }
.map-btn { display: none; }

/* Results */
#resultat { outline: none; }
.loading { margin: 24px 0; font: italic 400 20px var(--serif); color: var(--muted); }
.error { margin: 16px 0; padding: 16px 18px; border-radius: 14px; background: var(--l2t); font-size: 15px; line-height: 1.5; }
.empty { padding: 32px 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty .big { margin: 0; font: italic 400 22px var(--serif); }
.empty .small { margin: 0; color: var(--muted); font-size: 15px; }
.empty .brand-btn { margin-top: 4px; }
.group { display: flex; flex-direction: column; padding-top: 10px; }
.group h2 { margin: 0; display: flex; align-items: baseline; gap: 10px; padding: 10px 0 8px; font-weight: 400; }
.group .gn { font: 400 32px/1 var(--serif); color: var(--c); }
.group .gl { font: italic 400 21px/1.2 var(--serif); }
.group .gi { font-size: 16px; color: var(--c); }
.group .leader { flex: 1; min-width: 16px; border-bottom: 2px dotted var(--dot); transform: translateY(-5px); }
.group .gc { font: 400 13px var(--sans); color: var(--muted); }
.group ul { list-style: none; margin: 0; padding: 0; }
.group li { border-top: 1px solid var(--line); }
.item { display: flex; flex-direction: column; gap: 3px; padding: 12px 4px; color: var(--ink); text-decoration: none; border-radius: 8px; }
.item:hover { background: var(--field); color: var(--ink); }
.item-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.item-name { font: 400 21px/1.2 var(--serif); }
.ver { font-size: 12px; color: var(--muted); white-space: nowrap; }
.ver.yes { color: var(--l1); font-weight: 600; }
.item-meta { font-size: 13px; color: var(--muted); }
.item-note { font-size: 14px; line-height: 1.45; text-wrap: pretty; }
.more5 { align-self: flex-start; margin: 10px 0; background: var(--field); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; color: var(--ink); font: 500 14px var(--sans); }

/* About */
.about { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; max-width: 720px; }
.about h2 { margin: 0; font: 400 34px/1.1 var(--serif); }
.about h3 { margin: 8px 0 0; font: italic 400 22px var(--serif); }
.about p { margin: 0; font-size: 15px; line-height: 1.55; }
.about > p:first-of-type { font-size: 16px; line-height: 1.6; text-wrap: pretty; }
.about .muted { color: var(--muted); }
.about .muted strong { color: var(--ink); }
.scale { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.scale li { display: flex; gap: 14px; padding: 12px 0; border-top: 1px dotted var(--dot); align-items: flex-start; }
.scale .sb { flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: var(--cfg); display: grid; place-items: center; font: 400 20px/1 var(--serif); }
.scale .st { display: flex; flex-direction: column; gap: 2px; }
.scale strong { font-weight: 600; font-size: 16px; }
.scale .sd { font-size: 15px; line-height: 1.5; color: var(--muted); }
.method { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.55; }

.site-foot { margin: 40px 0 24px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--muted); }

/* Map */
.map-aside { display: none; position: relative; height: calc(100dvh - 300px); min-height: 360px; margin-top: 16px; }
.map { width: 100%; height: 100%; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.legend { position: absolute; left: 10px; top: 10px; margin: 0 0 0 44px; padding: 8px 10px; list-style: none; z-index: 500; background: var(--sheet); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .lb { width: 18px; height: 18px; border-radius: 50%; background: var(--c); color: var(--cfg); display: grid; place-items: center; font: 600 11px/1 var(--sans); }
.leaflet-container { font-family: var(--sans); background: var(--paper); }
/* Everything outside the covered area is faded out. */
.vk-mask { fill: var(--paper); fill-opacity: .72; stroke: var(--brand); stroke-width: 2; stroke-dasharray: 1 6; stroke-linecap: round; stroke-opacity: .8; }
.back-btn { position: absolute; right: 10px; top: 10px; z-index: 600; display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 0; background: var(--brand); color: var(--brandfg); font: 600 13px var(--sans); box-shadow: 0 3px 12px rgba(0, 0, 0, .25); white-space: nowrap; }
.back-btn::before { content: '←'; font-weight: 400; }
:root[data-mode=dark] .leaflet-control-attribution,
:root[data-mode=dark] .leaflet-bar a { background: #20241b; color: #ecebdf; }
:root[data-mode=dark] .leaflet-control-attribution a { color: #a9c98f; }

/* Mobile list/map toggle */
body.view-karta #resultat { display: none; }
body.view-karta .map-aside { display: block; }
.mobile-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 18px calc(14px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); }
.mobile-nav button { padding: 12px; min-height: 46px; border-radius: 999px; border: 0; background: transparent; color: var(--ink); font: 600 15px var(--sans); }
.mobile-nav button[aria-pressed=true] { background: var(--brand); color: var(--brandfg); }

/* Detail sheet */
.detail { position: fixed; inset: 0; z-index: 2000; }
.scrim { position: absolute; inset: 0; background: var(--scrim); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 90dvh; border-radius: 24px 24px 0 0; background: var(--sheet); color: var(--ink); overflow-y: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .25); display: flex; flex-direction: column; }
.sheet-top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 8px; background: var(--sheet); }
.grabber { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.close-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--field); color: var(--ink); font: 400 22px/1 var(--sans); }
.sheet-body { padding: 0 24px 32px; display: flex; flex-direction: column; gap: 18px; }
.d-head { display: flex; flex-direction: column; gap: 10px; }
.d-pill { align-self: flex-start; display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 5px; border-radius: 999px; background: var(--ct); font-size: 14px; font-weight: 600; }
.d-pill .badge { width: 30px; height: 30px; font-size: 18px; }
.d-head h2 { margin: 0; font: 400 36px/1.08 var(--serif); text-wrap: balance; }
.d-meta { margin: 0; font-size: 14px; color: var(--muted); }
.d-head .ver { font-size: 13px; margin: 0; }
.d-desc { margin: 0; font-size: 16px; line-height: 1.55; text-wrap: pretty; }
.d-note { padding: 14px 16px; border-radius: 14px; background: var(--ct); display: flex; flex-direction: column; gap: 4px; }
.d-note strong { font-size: 13px; font-weight: 600; }
.d-note span { font-size: 15px; line-height: 1.5; }
.d-notes { font-size: 15px; line-height: 1.6; text-wrap: pretty; }
.d-notes p { margin: 0 0 10px; }
.d-notes ul { margin: 0 0 10px; padding-left: 20px; }
.d-info { margin: 0; display: flex; flex-direction: column; gap: 14px; border-top: 1px dotted var(--dot); padding-top: 16px; }
.d-info > div { display: flex; flex-direction: column; gap: 3px; }
.d-info dt { font: italic 400 17px var(--serif); color: var(--muted); }
.d-info dd { margin: 0; font-size: 15px; }
.d-links { display: flex; flex-wrap: wrap; gap: 8px; }
.d-links a { display: flex; align-items: center; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--field); color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.mini { height: 190px; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); flex: none; }
.d-fix { display: flex; flex-direction: column; gap: 10px; padding-top: 6px; border-top: 1px dotted var(--dot); }
.d-fix .osm-link { font-size: 13px; color: var(--muted); }

/* Wide screens: list + map side by side, filters always open, side drawer */
@media (min-width: 960px) {
  body { padding-bottom: 0; }
  .wrap { padding-left: 32px; padding-right: 32px; }
  .site-head { padding-top: 28px; }
  .layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  body.map-closed .layout { grid-template-columns: minmax(0, 1fr); }
  .map-aside, body.view-karta .map-aside { display: block; position: sticky; top: 16px; height: calc(100vh - 32px); }
  body.map-closed .map-aside { display: none; }
  body.view-karta #resultat { display: block; }
  .more-btn, .mobile-nav { display: none; }
  .more-filters { display: flex; }
  .map-btn { display: inline-block; }
  .sheet { top: 0; left: auto; width: min(460px, 100%); max-height: 100%; border-radius: 0; }
  .grabber { background: transparent; }
}
