:root {
  --brand: #e5473c;
  --bg: #fff;
  --ink: #202124;
  --muted: #5f6368;
  --line: #e8eaed;
  --chip-bg: #f1f3f4;
  --shadow: 0 1px 4px rgba(0,0,0,.18);
  --topbar-h: 104px;
  --panel-w: 372px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { color: var(--ink); overflow: hidden; }

/* ---------- top bar ---------- */

#topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1200;
  background: var(--bg); box-shadow: var(--shadow);
  padding: 8px 12px 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.bar-row { display: flex; align-items: center; gap: 12px; min-width: 0; }

#brand { font-size: 17px; font-weight: 600; white-space: nowrap; display: flex; align-items: baseline; gap: 6px; color: var(--ink); text-decoration: none; }
#brand small { color: var(--muted); font-weight: 400; font-size: 12px; }

#search {
  flex: 1; min-width: 60px; max-width: 420px;
  border: 1px solid var(--line); background: var(--chip-bg);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; outline: none;
}
#search:focus { background: #fff; border-color: #bbb; }

#count {
  margin-left: auto; white-space: nowrap;
  font-size: 13px; font-weight: 600; color: var(--brand);
  background: #fdeceb; border-radius: 999px; padding: 6px 12px;
}

#filters-row { flex-wrap: nowrap; }

/* day chips */
#day-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
#day-chips::-webkit-scrollbar { display: none; }
.chip {
  border: 1px solid var(--line); background: var(--chip-bg); color: var(--ink); text-decoration: none;
  border-radius: 999px; padding: 5px 11px; font-size: 13px; cursor: pointer;
  white-space: nowrap; display: flex; align-items: center; gap: 6px; flex: 0 0 auto;
}
.chip .n { font-size: 11px; color: var(--muted); }
.chip:hover { background: #e8eaed; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.active .n { color: #ccc; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* time slider */
#time-filter { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-left: 8px; }
#time-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; min-width: 118px; text-align: right; }
#slider { position: relative; width: 190px; height: 26px; }
#slider-track {
  position: absolute; top: 11px; left: 0; right: 0; height: 4px;
  border-radius: 2px; background: var(--line);
}
#slider input[type=range] {
  position: absolute; inset: 0; width: 100%; margin: 0;
  -webkit-appearance: none; appearance: none; background: none; pointer-events: none; height: 26px;
}
#slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow); cursor: grab;
}
#slider input[type=range]::-moz-range-thumb {
  pointer-events: auto; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 2px solid var(--brand); box-shadow: var(--shadow); cursor: grab;
}
#slider input[type=range]::-moz-range-track { background: none; }

#free-toggle { font-size: 13px; display: flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer; color: var(--ink); }
#free-toggle input { accent-color: var(--brand); width: 15px; height: 15px; }

/* ---------- layout ---------- */

main { position: fixed; inset: var(--topbar-h) 0 0 0; display: flex; }
#map { flex: 1; height: 100%; z-index: 1; background: #dde5dd; }

/* ---------- list panel ---------- */

#panel {
  width: var(--panel-w); height: 100%; background: var(--bg);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 1100;
}
#panel-head {
  padding: 10px 16px; font-size: 13px; color: var(--muted);
  border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
#event-list { overflow-y: auto; flex: 1; overscroll-behavior: contain; list-style: none; margin: 0; padding: 0; }

.ev {
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  cursor: pointer; display: flex; gap: 10px; align-items: flex-start;
}
.ev .t { text-decoration: none; color: var(--ink); display: block; }
.ev:hover { background: #f8f9fa; }
.ev.active { background: #fdeceb; }
.ev .swatch { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: 0 0 auto; background: var(--brand); }
.ev .body { min-width: 0; }
.ev .t { font-size: 14px; font-weight: 600; line-height: 1.25; }
.ev .when { font-size: 12.5px; color: var(--brand); font-weight: 600; margin-top: 2px; }
.ev .where { font-size: 12.5px; color: var(--muted); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ev .cost { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; margin-top: 4px; background: #e6f4ea; color: #137333; }
.ev .cost.paid { background: #fef7e0; color: #b06000; }
.ev.unmapped { opacity: .62; cursor: default; }
.ev.unmapped .swatch { background: #bbb; }

.list-section {
  padding: 8px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--muted); background: #f8f9fa;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
#empty-msg { padding: 28px 16px; color: var(--muted); font-size: 14px; text-align: center; }

#panel-toggle { display: none; }

/* ---------- map bits ---------- */

.pop { font: 13px/1.4 inherit; min-width: 210px; max-width: 260px; }
.pop-title { font-size: 14.5px; font-weight: 700; color: var(--ink); text-decoration: none; display: block; }
.pop-title:hover { text-decoration: underline; }
.pop-when { color: var(--brand); font-weight: 600; margin-top: 3px; }
.pop-where { color: var(--muted); margin-top: 2px; }
.pop-desc { margin-top: 6px; color: var(--ink); }
.pop-cost { display: inline-block; font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; margin-top: 6px; background: #e6f4ea; color: #137333; }
.pop-cost.paid { background: #fef7e0; color: #b06000; }
.pop-links { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 6px; }
.pop-links a { color: #1a73e8; text-decoration: none; font-weight: 600; margin-right: 10px; }

#legend {
  position: absolute; right: 10px; bottom: 26px; z-index: 1000;
  background: rgba(255,255,255,.94); border-radius: 8px; box-shadow: var(--shadow);
  padding: 8px 12px; font-size: 12px; display: grid; grid-template-columns: repeat(2, auto); gap: 3px 14px;
}
#legend .li { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
#legend .dot { width: 9px; height: 9px; border-radius: 50%; }

.map-btn {
  background: #fff; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  font-size: 17px; cursor: pointer; color: var(--ink);
}
.map-btn:hover { background: #f4f4f4; }

.leaflet-container { font: inherit; }
.marker-cluster-small { background-color: rgba(229, 71, 60, .25); }
.marker-cluster-small div { background-color: rgba(229, 71, 60, .8); }
.marker-cluster-medium { background-color: rgba(214, 55, 44, .3); }
.marker-cluster-medium div { background-color: rgba(214, 55, 44, .85); }
.marker-cluster-large { background-color: rgba(180, 35, 26, .3); }
.marker-cluster-large div { background-color: rgba(180, 35, 26, .9); }
.marker-cluster div { color: #fff; font-weight: 700; }

/* ---------- mobile ---------- */

@media (max-width: 860px) {
  :root { --topbar-h: 190px; } /* fallback; app.js syncs the real height */
  .bar-row { flex-wrap: wrap; }
  #filters-row { flex-wrap: wrap; row-gap: 8px; }
  #brand span { display: none; }
  #search { order: 2; }
  #count { padding: 5px 10px; }
  #day-chips { flex: 1 1 100%; order: -1; } /* chips get their own full-width line */
  #time-filter { margin-left: 0; }
  #time-label { text-align: left; min-width: 0; }
  #slider { width: 150px; flex: 1; max-width: 220px; }

  #panel {
    position: absolute; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; height: 52vh; border-right: 0; border-top-left-radius: 14px; border-top-right-radius: 14px;
    box-shadow: 0 -4px 16px rgba(0,0,0,.2);
    transform: translateY(calc(100% + 10px)); transition: transform .25s ease;
  }
  #panel.open { transform: translateY(0); }

  #panel-toggle {
    display: block; position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
    z-index: 1150; border: 0; background: var(--ink); color: #fff;
    border-radius: 999px; padding: 10px 18px; font-size: 14px; font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,.35); cursor: pointer;
  }
  #legend { bottom: 78px; }
}

/* ---------- SEO content layer (below the app; primarily for crawlers & no-JS) ---------- */

#seo {
  max-width: 860px; margin: 0 auto; padding: 32px 20px 80px;
  font-size: 15px; line-height: 1.6; color: var(--ink);
}
#seo h1 { font-size: 26px; line-height: 1.2; margin: 0 0 12px; }
#seo .lead { font-size: 17px; margin: 0 0 10px; }
#seo .updated { font-size: 13px; color: var(--muted); margin: 0 0 24px; }
#seo a { color: #1a73e8; }
#seo h2 { font-size: 20px; margin: 28px 0 10px; }
#seo h3 { font-size: 16px; margin: 20px 0 6px; }
#seo h4 { font-size: 14px; color: var(--muted); margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .3px; }
.directory .dir-day { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 18px; }
.directory .dir-day h3 a { text-decoration: none; }
.dir-list { list-style: none; margin: 0 0 8px; padding: 0; }
.dir-list .ev { border-bottom: 1px solid var(--line); cursor: default; }
.dir-list .ev .t { font-size: 14px; font-weight: 600; color: var(--ink); }
.dir-list .ev .when { font-size: 12.5px; color: var(--brand); font-weight: 600; margin-top: 2px; }
.dir-list .ev .where { font-size: 12.5px; color: var(--muted); margin-top: 1px; white-space: normal; }
.dir-list .ev[data-unmapped] { opacity: .7; }
.faq { margin-top: 32px; }
.faq .qa { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.faq .qa h3 { margin: 0 0 4px; }
.faq .qa p { margin: 0; color: #33373b; }
.seo-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
