:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --ink: #2a211c;
  --muted: #6f625a;
  --line: #eadfd4;
  --accent: #c2410c;
  --accent-ink: #ffffff;
  --accent-soft: #fde7d7;
  --on: #15803d;
  --on-soft: #dcfce7;
  --soon: #b45309;
  --soon-soft: #fef3c7;
  --off: #6f625a;
  --off-soft: #f1ebe5;
  --low: #b91c1c;
  --low-soft: #fee2e2;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(42 33 28 / 6%), 0 4px 14px rgb(42 33 28 / 5%);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17120f;
    --surface: #211a16;
    --ink: #f4ece5;
    --muted: #b3a59b;
    --line: #3a2f28;
    --accent: #fb923c;
    --accent-ink: #1c120c;
    --accent-soft: #3d2416;
    --on: #4ade80;
    --on-soft: #14321f;
    --soon: #fbbf24;
    --soon-soft: #3a2c0d;
    --off: #b3a59b;
    --off-soft: #2c241f;
    --low: #f87171;
    --low-soft: #3b1717;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }

/* Header */
.site-header { padding: 18px 0 6px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font: 700 1.4rem/1.1 ui-serif, Georgia, "Times New Roman", serif;
  letter-spacing: -0.01em;
}
.brand img { border-radius: 7px; }
.tagline { margin: 4px 0 0; color: var(--muted); }

/* Controls */
.controls {
  position: sticky; top: 0; z-index: 5;
  display: grid; gap: 10px;
  padding: 12px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.search input, .select select {
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font: inherit;
}
.search input:focus, .select select:focus, .chip:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.chip-row {
  display: flex; gap: 8px; overflow-x: auto;
  scrollbar-width: none; margin: 0 -16px; padding: 0 16px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px;
  padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
  font: 500 0.92rem/1 inherit; font-family: inherit;
  cursor: pointer;
}
.chip[aria-checked="true"], .chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: var(--accent-ink);
}

.summary { margin: 14px 0 10px; color: var(--muted); font-size: 0.95rem; }
.summary button {
  border: 0; background: none; padding: 0; color: var(--accent);
  font: inherit; text-decoration: underline; cursor: pointer;
}

/* Cards */
.cards { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 220px;
}
.card:target { outline: 2px solid var(--accent); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card h2 { margin: 0; font-size: 1.08rem; line-height: 1.25; }
.card h2 a { color: inherit; text-decoration: none; }
.place { margin: 2px 0 0; color: var(--muted); font-size: 0.88rem; }
.hook { margin: 0; font-weight: 600; }

.pill {
  flex: none; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 600;
  background: var(--off-soft); color: var(--off);
}
.pill.on { background: var(--on-soft); color: var(--on); }
.pill.soon, .pill.later { background: var(--soon-soft); color: var(--soon); }
.pill.unknown { background: var(--low-soft); color: var(--low); }

.windows { list-style: none; margin: 0; padding: 0; font-size: 0.92rem; }
.windows li { display: flex; gap: 8px; padding: 2px 0; }
.windows .when { font-variant-numeric: tabular-nums; white-space: nowrap; }
.windows .label { color: var(--muted); }
.windows li.today .when { font-weight: 700; }
.windows li.active .when { color: var(--on); }

.deals { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.deals li {
  padding: 3px 8px; border-radius: 8px;
  background: var(--accent-soft); font-size: 0.82rem;
}
.deals b { font-weight: 600; }

/* Venue item photos: thumbnail at the top right of the card */
.card-top > div:first-child { min-width: 0; }
.thumb { flex: none; width: 88px; margin: 0; }
.thumb img {
  display: block; width: 88px; height: 88px; object-fit: cover;
  border-radius: 10px; background: var(--off-soft);
}
.thumb figcaption {
  margin-top: 3px; font-size: 0.72rem; line-height: 1.2; color: var(--muted); text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.thumb.ph-empty {
  height: 88px; display: grid; place-items: center; text-align: center; padding: 6px;
  border-radius: 10px; border: 1px dashed color-mix(in srgb, var(--cat) 55%, transparent);
  background: color-mix(in srgb, var(--cat) 8%, transparent);
  color: color-mix(in srgb, var(--cat) 80%, var(--muted)); font-weight: 600; font-size: 0.72rem;
}
.more-photos { display: flex; gap: 8px; margin: 10px 0 0; overflow-x: auto; }
.ph-note { margin: 6px 0 0; font-size: 0.75rem; color: var(--muted); }
.ph-note a { color: inherit; }

details { font-size: 0.9rem; }
details summary { cursor: pointer; color: var(--accent); font-weight: 500; }
details h3 { margin: 10px 0 2px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
details p { margin: 0 0 6px; }

.card-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  margin-top: auto; padding-top: 8px;
  border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--muted);
}
.card-foot a { font-weight: 500; }
.conf { font-weight: 600; }
.conf.high { color: var(--on); }
.conf.medium { color: var(--soon); }
.conf.low { color: var(--low); }

.empty {
  padding: 28px 16px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted);
}

.unclear { margin-top: 28px; }
.unclear h2 { margin: 0 0 4px; font-size: 1.1rem; }
.unclear > p { margin: 0 0 12px; font-size: 0.92rem; }

.sponsor { margin-top: 24px; }

.site-footer { margin-top: 40px; padding: 20px 0 40px; border-top: 1px solid var(--line); font-size: 0.88rem; color: var(--muted); }

/* List / map toggle: floating so it's reachable at any scroll position on phones */
.view-toggle {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1000;
  min-height: 44px; padding: 10px 22px;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font: 600 0.95rem/1 inherit; font-family: inherit;
  box-shadow: 0 4px 16px rgb(0 0 0 / 25%);
  cursor: pointer;
}
.view-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Map */
.map-wrap { margin-bottom: 8px; }
.map {
  height: calc(100svh - 300px); min-height: 380px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--off-soft);
  z-index: 0;
}
@media (min-width: 720px) { .map { height: calc(100vh - 280px); min-height: 520px; } }
.map-note { margin: 8px 0 0; font-size: 0.85rem; }
/* On phones the filters scroll away in map view so the map gets the screen. */
@media (max-width: 719px) { .map-view .controls { position: static; } }

.leaflet-container .leaflet-popup-content-wrapper, .leaflet-container .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-container .leaflet-popup-content { margin: 12px 14px; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.pop strong { font-size: 1rem; }
.pop .pill { display: inline-block; margin-top: 6px; }
.pop p { margin: 6px 0; font-weight: 600; }
.pop ul { margin: 4px 0 8px; padding-left: 16px; }
.pop-links { display: flex; gap: 12px; flex-wrap: wrap; }
.pop-links a { font-weight: 600; }
.leaflet-container { font-family: inherit; }
.site-footer { padding-bottom: 90px; }
/* Plain light base map in every theme: OSM streets/labels, drained of color so the pins stand out. */
.leaflet-tile-pane { filter: grayscale(1) brightness(1.08) contrast(0.85); }
.map { background: #f2f2f0; }

/* Brand header + category tabs */
.site-header { padding-bottom: 0; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 10px 14px 9px;
  color: var(--muted); text-decoration: none; font-weight: 600;
  border-bottom: 3px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }

/* City picker + zip/city search (app/city.js) */
.city-pick { margin-top: 6px; font-size: 0.95rem; }
.city-pick summary { cursor: pointer; color: var(--muted); list-style: none; width: fit-content; }
.city-pick summary::-webkit-details-marker { display: none; }
.city-pick summary strong { color: var(--ink); }
.city-pick .change { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.city-pick[open] summary .change { text-decoration: none; }
.city-search { display: flex; gap: 6px; margin-top: 8px; max-width: 420px; }
.city-search input {
  flex: 1; min-width: 0; padding: 9px 12px; font: inherit; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.city-search button {
  padding: 9px 14px; font: inherit; font-weight: 600; color: var(--accent-ink);
  background: var(--accent); border: 0; border-radius: 10px; cursor: pointer;
}
.city-results { list-style: none; margin: 6px 0 0; padding: 0; max-width: 420px; }
.city-results li { border-bottom: 1px solid var(--line); }
.city-results li.muted { padding: 8px 2px; }
.city-results button {
  display: block; width: 100%; padding: 9px 2px; text-align: left;
  font: inherit; color: var(--ink); background: none; border: 0; cursor: pointer;
}
.city-results button:hover { color: var(--accent); }
.city-pick p { margin: 8px 0 4px; }
.city-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.city-list a {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.city-list a[aria-current="page"] { border-color: var(--accent); color: var(--accent); }
.city-pick-footer { margin: 0 0 18px; }
.city-pick-footer summary { color: var(--muted); }
.city-pick-footer summary .button { margin: 0 8px 6px 0; }
.city-pick a[aria-current="page"] { font-weight: 700; }
.near-note {
  margin: 12px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
}
.near-note button {
  font: inherit; color: var(--accent); font-weight: 600; background: none; border: 0; padding: 0 4px; cursor: pointer;
}
.soon { padding-top: 12px; padding-bottom: 32px; }
.soon h1 { font: 700 1.6rem/1.2 ui-serif, Georgia, "Times New Roman", serif; margin: 12px 0 8px; }
.soon h2 { font-size: 1.05rem; margin: 28px 0 0; }
.soon .city-pick summary { display: none; }
.soon .button, .city-pick-footer .button {
  display: inline-block; padding: 10px 16px; color: var(--accent-ink); background: var(--accent);
  border-radius: 10px; text-decoration: none; font-weight: 600;
}

/* Map legend, locate button, status toast */
.map-legend {
  padding: 6px 9px; border-radius: 8px;
  background: rgb(255 255 255 / 92%); color: #2a211c;
  box-shadow: 0 1px 4px rgb(0 0 0 / 20%);
  font: 12px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.map-legend .sw { justify-self: center; display: inline-block; box-sizing: border-box; border-radius: 50%; }
.locate-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  background: #fff; color: #2563eb; cursor: pointer;
}
.locate-btn:hover { background: #f4f4f4; }
.locate-btn.busy svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 1001;
  width: max-content; max-width: calc(100vw - 32px);
  margin: 0; padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: var(--bg);
  font-size: 0.9rem; box-shadow: 0 4px 16px rgb(0 0 0 / 25%);
}

/* Category buttons (multi-select) */
.cats .cat-chip { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.cat-chip .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cat); }
.cats .cat-chip[aria-pressed="true"] { background: var(--cat); border-color: var(--cat); color: #fff; }
.cats .cat-chip[aria-pressed="true"] .dot { background: #fff; }

/* Color = category, brightness = status. --cat is set per card/popup. */
.card { border-left: 5px solid color-mix(in srgb, var(--cat, var(--line)) 30%, var(--surface)); }
.card.is-on, .card.is-food { border-left-color: var(--cat); }
.card.is-unclear { border-left-style: dashed; }
/* Medium / low confidence: shadowed, listed last */
.card.is-unverified { opacity: 0.68; filter: grayscale(0.55); border-left-style: dashed; }
.card.is-unverified:hover, .card.is-unverified:focus-within { opacity: 0.92; filter: none; }
.unverified-note { margin: 4px 0 0; font-size: 0.8rem; font-weight: 600; color: var(--low); }
.pill {
  background: color-mix(in srgb, var(--cat, var(--muted)) 14%, var(--surface));
  color: color-mix(in srgb, var(--cat, var(--muted)) 60%, var(--muted));
}
.pill.on { background: var(--cat, var(--on)); color: #fff; }
.pill.soon, .pill.later, .pill.off {
  background: color-mix(in srgb, var(--cat, var(--muted)) 14%, var(--surface));
  color: color-mix(in srgb, var(--cat, var(--muted)) 60%, var(--muted));
}
.pill.unknown { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
.pill.food { background: var(--cat); color: #fff; }
.windows li.active .when { color: var(--cat, var(--on)); }
.cat-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cat-tags li {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.78rem; color: var(--muted);
}
.cat-tags li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--cat); }
.cat-tags li.sel { color: var(--ink); font-weight: 600; }

/* Legend v3 */
.map-legend .lg-title { font-weight: 700; margin-bottom: 2px; }
.map-legend .lg-types { display: flex; flex-wrap: wrap; gap: 2px 10px; max-width: 200px; margin-bottom: 4px; }
.map-legend .lg-type { display: inline-flex; align-items: center; gap: 4px; }
.map-legend .lg-row { display: grid; grid-template-columns: 18px auto; align-items: center; gap: 7px; min-height: 19px; }
.chip-row.cats { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }

/* Status label sits on its own line under the venue name (labels are full sentences). */
.card .status { margin: 0; }
.pill { white-space: normal; display: inline-block; line-height: 1.3; }
