/* Layout: list panel left + full-bleed map right on desktop; on phones the map fills the screen
   with a Map/List switcher and a bottom sheet for each spot. */
:root {
  /* Matches kelati.media: black + cream, gold accents, Bebas Neue / Space Mono.
     Brand red is #B22222 (official). Dark is the default, like the main site. */
  --brand: #B22222;       /* fills: pins, primary buttons, 5-star scores */
  --on-brand: #F4F0E8;    /* cream on brand red (5.9:1) */
  --accent: #DE5454;      /* red text on dark: #B22222 lifted to stay readable (5.1:1) */
  --bg: #0D0D0D;
  --surface: #111111;
  --surface-hover: #222222;
  --ink: #F4F0E8;         /* cream */
  --muted: #9C9A95;
  --line: #2A2A2A;
  --chip: #1C1C1B;
  --mustard: #E8A020;     /* kelati.media gold, used for stars */
  --ok: #6FBF8B;
  --shadow: 0 10px 30px rgba(0, 0, 0, .55);
  --backdrop: rgba(0, 0, 0, .65);

  --display: "Bebas Neue", "Oswald", "Arial Narrow", Impact, sans-serif;
  --body: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --mono: "Space Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --accent-serif: "Cormorant Garamond", Georgia, serif;

  --panel-w: 400px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --accent: #B22222;      /* exact brand red works on cream (5.9:1) */
  --bg: #F4F0E8; --surface: #FBF9F4; --surface-hover: #EBE6DC;
  --ink: #0D0D0D; --muted: #65635F; --line: #CFC7B8; --chip: #EBE6DC;
  --mustard: #8A5A00; --ok: #2F7A4A;
  --shadow: 0 10px 30px rgba(13, 13, 13, .14); --backdrop: rgba(13, 13, 13, .45);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 13.5px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }

.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
}

/* ---------- Panel ---------- */
.panel {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border-right: 1px solid var(--line);
  background: var(--bg);
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}
.brand { position: relative; padding: 20px 20px 8px; }
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
h1 {
  margin: 0; font: 400 44px/.9 var(--display); letter-spacing: .01em;
}
h1 span { color: var(--accent); }
.tagline { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface);
}
.icon-btn:hover { border-color: var(--muted); }

.menu {
  position: absolute; right: 20px; top: 64px; z-index: 900;
  display: flex; flex-direction: column; min-width: 220px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.menu button, .menu-file {
  text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.menu button:hover, .menu-file:hover, .menu-link:hover { background: var(--chip); }
.menu-link { padding: 10px 12px; border-radius: 8px; font-size: 14px; text-decoration: none; color: var(--ink); }
.menu-file input { display: none; }
.menu .danger { color: var(--accent); }

.filters { display: flex; flex-direction: column; gap: 10px; padding: 8px 20px 4px; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted);
}
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 11px 0; outline: none; color: var(--ink); }
.search:focus-within { border-color: var(--ink); }

.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid transparent;
  background: var(--chip); font-size: 13px; font-weight: 500;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.filter-row { display: flex; gap: 8px; }
.filter-row > * { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span {
  font: 400 10.5px/1 var(--mono); text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
}
select, .field input, .field textarea {
  width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.field textarea { resize: vertical; }

.count-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px 6px; }
.count { margin: 0; font: 500 12px var(--mono); color: var(--muted); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.text-btn { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0; }

.list {
  list-style: none; margin: 0; padding: 4px 12px 24px;
  overflow-y: auto; flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 2px;
}
.card {
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start;
  width: 100%; text-align: left; padding: 12px 8px; border: 0; border-radius: 12px; background: none;
}
.card:hover, .card[aria-current="true"] { background: var(--surface-hover); }
.card[aria-current="true"] { box-shadow: inset 0 0 0 1.5px var(--ink); }
.score {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  font: 400 22px/1 var(--display); color: var(--on-brand); font-variant-numeric: tabular-nums;
}
.card-body { min-width: 0; }
.card-title { margin: 0; font: 400 24px/1.05 var(--display); letter-spacing: .02em; }
.meta { margin: 3px 0 0; color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.meta .price { font-family: var(--mono); }
.snippet {
  margin: 6px 0 0; font-size: 14px; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.badges { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font: 500 11px/1 var(--mono); letter-spacing: .03em; padding: 4px 7px; border-radius: 6px;
  background: var(--chip); color: var(--muted);
}
.badge.sample { background: none; border: 1px dashed var(--line); }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font: 400 24px var(--display); margin-bottom: 4px; letter-spacing: .02em; }

/* ---------- Map ---------- */
.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--chip); }
.leaflet-container { font-family: var(--body); }
#map.no-tiles {
  background-color: var(--chip);
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
}
.leaflet-control-attribution { font-size: 10px; }

.pin {
  --c: var(--accent);
  position: relative; width: 34px; height: 34px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--c); border: 2px solid #fff; box-shadow: 0 3px 8px rgba(0,0,0,.3);
  transition: transform .15s ease;
}
.pin b {
  position: absolute; inset: 0; display: grid; place-items: center; transform: rotate(45deg);
  font: 400 15px/1 var(--display); color: #fff; font-variant-numeric: tabular-nums;
}
.pin.active { transform: rotate(-45deg) scale(1.25); border-color: var(--ink); }
.pin-icon { background: none; border: 0; }
.you-dot { width: 16px; height: 16px; border-radius: 50%; background: #2F6FED; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(47,111,237,.25); }

.fab {
  position: absolute; z-index: 800;
  right: calc(16px + env(safe-area-inset-right, 0px));
  top: calc(16px + env(safe-area-inset-top, 0px));
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}

/* ---------- Detail sheet ---------- */
.sheet {
  position: absolute; z-index: 1000;
  left: calc(var(--panel-w) + 16px); top: 16px; bottom: 16px;
  width: min(420px, calc(100% - var(--panel-w) - 32px));
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  overflow: hidden; display: flex;
}
.sheet-inner { overflow-y: auto; padding: 20px; width: 100%; }
.sheet-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.sheet h2 { margin: 0; font: 400 40px/1 var(--display); letter-spacing: .02em; text-wrap: balance; }
.sheet .meta { font-size: 14px; }
.stars { display: flex; align-items: center; gap: 2px; margin-top: 10px; color: var(--mustard); }
.stars svg { width: 18px; height: 18px; }
.stars .num { margin-left: 6px; font: 500 13px var(--mono); color: var(--muted); }
.sheet-section { margin-top: 18px; }
.sheet-section h3 {
  margin: 0 0 8px; font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.review-text { margin: 0; font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; max-width: 65ch; }
.dish-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.dish-list li { padding: 5px 10px; border-radius: 999px; background: var(--chip); font-size: 13px; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink);
}
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); border-color: var(--brand); }
.btn.ghost { background: transparent; }
.btn.danger-ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn svg { width: 16px; height: 16px; }

.video {
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 10px;
}
.video-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.video-head .plat { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.plat-dot { width: 10px; height: 10px; border-radius: 50%; }
.video-frame { position: relative; width: 100%; max-width: 100%; background: #000; }
.video-frame.tall { aspect-ratio: 9 / 16; max-height: 640px; }
.video-frame.wide { aspect-ratio: 16 / 9; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-links { display: flex; gap: 8px; }
.video-links a, .video-links button {
  border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; text-decoration: none;
}

.close-x { flex: none; }

/* ---------- Editor ---------- */
.editor {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
  padding: 0; border: 0; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
.editor::backdrop { background: var(--backdrop); }
.editor form { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.editor-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.editor-head h2 { margin: 0; font: 400 30px/1 var(--display); letter-spacing: .02em; }
.editor-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.editor-foot { display: flex; align-items: center; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.spacer { flex: 1; }
.addr-row { display: flex; gap: 8px; }
.addr-row input { flex: 1; min-width: 0; }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- Toast + switcher ---------- */
.toast {
  position: fixed; z-index: 2000; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 500; box-shadow: var(--shadow);
}
.switcher { display: none; }

/* ---------- Phone layout ---------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .panel, .map-wrap { grid-area: 1 / 1; }
  .panel { border-right: 0; padding-left: 0; padding-bottom: 76px; z-index: 5; }
  .brand, .filters, .count-row {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }
  .list { padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); }
  .app[data-view="map"] .panel { visibility: hidden; }
  .app[data-view="list"] .map-wrap { visibility: hidden; }

  .switcher {
    position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%);
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex; padding: 4px; gap: 4px; border-radius: 999px;
    background: var(--ink); box-shadow: var(--shadow);
  }
  .switcher button {
    border: 0; background: none; color: var(--bg); padding: 10px 20px; border-radius: 999px; font-weight: 600;
  }
  .switcher button[aria-pressed="true"] { background: var(--bg); color: var(--ink); }
  .switcher span { font-family: var(--mono); font-size: 12px; opacity: .7; }

  .sheet {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 78dvh; border-radius: 20px 20px 0 0; z-index: 1200;
  }
  .sheet-inner {
    padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  }
  .sheet-inner::before {
    content: ""; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 12px;
  }
  .menu { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Synced-reviews additions ---------- */
.tagline a { color: var(--accent); font-weight: 600; text-decoration: none; }
.tagline a:hover { text-decoration: underline; }
.menu-check, .check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.menu-check { padding: 10px 12px; }
.check input, .menu-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.menu-note { margin: 4px 12px 8px; font: 400 11px/1.4 var(--mono); color: var(--muted); }
.menu-note:empty { display: none; }

.photos {
  display: flex; gap: 8px; overflow-x: auto; margin-top: 16px; padding-bottom: 4px;
  scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.photos a { flex: none; scroll-snap-align: start; }
.photos img {
  display: block; width: 132px; height: 132px; object-fit: cover; border-radius: 12px; background: var(--chip);
}
.editor-head .hint { margin: 2px 0 0; }
.editor-foot .hint { max-width: 60%; }
.owner-pill {
  display: inline-flex; align-items: center; gap: 6px; font: 500 11px/1 var(--mono); letter-spacing: .04em;
  padding: 4px 8px; border-radius: 999px; background: var(--chip); color: var(--muted);
}
.owner-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.badge.hidden-badge { border: 1px dashed var(--accent); background: none; color: var(--accent); }

/* ---------- Theme toggle ---------- */
.brand-actions { display: flex; gap: 8px; }
#themeBtn .i-sun { display: none; }
#themeBtn.is-dark .i-sun { display: block; }
#themeBtn.is-dark .i-moon { display: none; }
.leaflet-bar a { background: var(--surface); color: var(--ink); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--chip); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--ink); }
#map.osm-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.6); }

/* ---------- kelati.media touches ---------- */
h1 span { color: var(--accent); }
.tagline { font-size: 12.5px; }
.tagline em { font: italic 700 17px/1 var(--accent-serif); color: var(--ink); }
.btn, .switcher button, .chip { text-transform: uppercase; letter-spacing: .06em; font-size: 12px; font-weight: 700; }
.btn.primary { border-color: var(--brand); }
.sheet-section h3, .field > span { color: var(--mustard); }
.card[aria-current="true"] { box-shadow: inset 3px 0 0 var(--brand), inset 0 0 0 1px var(--line); }

/* ---------- 🍔 Seattle Burgers series ---------- */
.badge.burger {
  background: color-mix(in srgb, var(--mustard) 16%, transparent);
  color: var(--mustard); border: 1px solid color-mix(in srgb, var(--mustard) 45%, transparent);
  font-weight: 700; letter-spacing: .04em;
}
.chip-burger span { font-family: var(--mono); font-size: 11px; opacity: .7; margin-left: 2px; }
.chip-burger[aria-pressed="true"] { background: var(--mustard); color: #0D0D0D; }
.pin-burger {
  position: absolute; top: -9px; right: -9px; width: 20px; height: 20px;
  display: grid; place-items: center; transform: rotate(45deg);
  font-style: normal; font-size: 12px; line-height: 1;
  background: var(--bg); border: 1.5px solid var(--mustard); border-radius: 50%;
}
.burger-banner {
  display: flex; align-items: center; gap: 8px; margin: 14px 0 0; padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--mustard) 45%, transparent);
  background: color-mix(in srgb, var(--mustard) 10%, transparent);
  border-radius: 12px; font-size: 12.5px; color: var(--ink);
}
.burger-banner span { font-size: 18px; }
.burger-banner em { font: italic 700 17px/1 var(--accent-serif); color: var(--mustard); }

.meta span + span::before { content: "·"; margin-right: 8px; color: var(--muted); opacity: .6; }
.video-links { gap: 16px; }
