/* ============================================================
   Happenings – styles
   Light, map-first layout. Tokens match the Pixso design file.
   ============================================================ */

:root {
  --ink: #17161F;
  --muted: #6B6878;
  --faint: #B3B0C0;
  --line: #E7E5EE;
  --bg: #F5F4EF;
  --surface: #FFFFFF;
  --surface-2: #F4F3FA;
  --chip-bg: #F0EFF4;
  --accent: #3B3BF5;
  --accent-soft: #F1F1FF;
  --heart: #F0454D;
  --success: #2BB673;
  --brand-yellow: #FFD166;

  --font-display: "Outfit", "Trebuchet MS", system-ui, sans-serif;
  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius-sm: 10px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-panel: 0 10px 30px rgba(23, 22, 31, .12), 0 1px 2px rgba(23, 22, 31, .06);
  --shadow-pop: 0 18px 40px rgba(23, 22, 31, .22), 0 2px 6px rgba(23, 22, 31, .08);
  --topbar-h: 72px;
  --panel-w: 384px;
  --drawer-w: 400px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 2000;
  background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Icons */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.accent { color: var(--accent); }
.i.muted { color: var(--muted); }
.heart.filled { color: var(--heart); fill: var(--heart); }

/* ---------------- Top bar ---------------- */
.topbar {
  position: relative; z-index: 1000;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); margin-right: 4px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); display: grid; place-items: center; }
.brand-mark svg { width: 17px; height: 17px; fill: none; stroke: var(--brand-yellow); stroke-width: 2.4; }
.brand-name { font: 700 21px var(--font-display); letter-spacing: -.3px; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  height: 42px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  font-weight: 700; font-size: 14px; white-space: nowrap;
}
.btn-outline:hover { background: var(--surface-2); }
.btn-outline.small { height: 34px; padding: 0 11px; font-size: 12.5px; font-weight: 600; border-radius: var(--radius-sm); }
.btn-outline[aria-expanded="true"], .btn-outline[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }

.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border: 0; border-radius: var(--radius);
  background: var(--ink); color: #fff; font-weight: 700; font-size: 14px;
}

.field {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.field:focus-within { border-color: var(--accent); background: var(--surface); }
.field input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; font-weight: 500; }
.field input::placeholder { color: var(--muted); }
.search { flex: 1 1 360px; max-width: 440px; min-width: 0; }

.date-presets { display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: var(--chip-bg); }
.seg {
  border: 0; background: transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.seg[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(23, 22, 31, .14); }
.seg-wrap { position: relative; }

.saved-button { margin-left: auto; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: inline-grid; place-items: center;
  background: var(--heart); color: #fff; font-size: 11px; font-weight: 800;
}

/* Popovers */
.popover {
  position: absolute; z-index: 1200;
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-pop);
  padding: 12px;
}
.city-picker { position: relative; }
.city-menu { top: calc(100% + 8px); left: 0; width: 340px; display: flex; flex-direction: column; gap: 6px; }
.menu-action {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; background: transparent;
  color: var(--accent); font-weight: 700; font-size: 13.5px; border-radius: var(--radius-sm); text-align: left;
}
.menu-action:hover { background: var(--accent-soft); }
.menu-divider { height: 1px; background: var(--line); margin: 2px 0; }
.menu-heading { margin: 6px 12px 2px; font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.city-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.city-option {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px;
  border: 0; background: transparent; border-radius: var(--radius-sm); text-align: left;
}
.city-option:hover, .city-option[aria-selected="true"] { background: var(--accent-soft); }
.city-option .checkbox {
  flex: none; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--faint); background: var(--surface);
  display: grid; place-items: center; color: transparent;
}
.city-option .checkbox .i { width: 14px; height: 14px; stroke-width: 3; }
.city-option[aria-selected="true"] .checkbox { background: var(--accent); border-color: var(--accent); color: #fff; }
.city-option[aria-disabled="true"] { cursor: default; }
.city-option .names { display: flex; flex-direction: column; flex: 1; }
.city-option strong { font-size: 14px; }
.city-option small { font-size: 12px; color: var(--muted); font-weight: 500; }
.menu-heading-row { display: flex; align-items: baseline; justify-content: space-between; padding-right: 12px; }
.menu-heading .hint { text-transform: none; letter-spacing: 0; font-weight: 600; }
.small-link { font-size: 12.5px; }
.menu-done { margin-top: 4px; }
.city-button { max-width: 260px; }
.city-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.link-note { margin: -6px 0 0; font-size: 12.5px; font-weight: 500; color: var(--muted); }

.date-popover { top: calc(100% + 10px); right: 0; width: 250px; display: flex; flex-direction: column; gap: 10px; }
.date-popover label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.date-popover input { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); font-weight: 600; }

/* ---------------- Layout ---------------- */
.layout { position: relative; height: calc(100% - var(--topbar-h)); overflow: hidden; }
.map { position: absolute; inset: 0; background: #E9EEF0; }
.leaflet-container { font-family: var(--font-ui); }
.leaflet-control-attribution { font-size: 10.5px; }

/* Panel */
.panel {
  position: absolute; z-index: 500; left: 16px; top: 16px; bottom: 16px; width: var(--panel-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-panel); overflow: hidden;
}
.panel-head { padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.panel-title { margin: 0; font: 700 20px var(--font-display); }
.panel-sub { margin: 2px 0 0; font-size: 13px; font-weight: 500; color: var(--muted); }
.filters-wrap { position: relative; }
.filters-popover { top: calc(100% + 8px); right: 0; width: 240px; display: flex; flex-direction: column; gap: 6px; }
.dot-indicator { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; }
.check:hover { background: var(--surface-2); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.check small { margin-left: auto; color: var(--muted); font-weight: 500; font-size: 12px; }
.tod { display: flex; flex-direction: column; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 12.5px; white-space: nowrap;
}
.chip .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .count { color: #B9B7C6; }
.chip:disabled { opacity: .45; cursor: default; }

.event-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.event-list:focus { outline: none; }
.event-row {
  display: flex; gap: 12px; padding: 10px; border-radius: 14px; border: 1px solid transparent; cursor: pointer;
}
.event-row:hover, .event-row.is-active { background: var(--surface-2); border-color: var(--line); }
.event-row .info { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.cat-label { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--c); }
.event-row h3 { margin: 0; font-size: 14.5px; font-weight: 700; line-height: 1.25; }
.event-row h3 button { all: unset; cursor: pointer; }
.event-row h3 button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.meta { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.heart-btn {
  flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; color: var(--faint);
}
.heart-btn:hover { background: rgba(240, 69, 77, .08); color: var(--heart); }
.heart-btn[aria-pressed="true"] { color: var(--heart); }
.heart-btn[aria-pressed="true"] .i { fill: var(--heart); }

.empty { padding: 28px 18px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty strong { color: var(--ink); font-size: 15px; }

/* Event art (used when an event has no photo) */
.art {
  position: relative; flex: none; overflow: hidden; border-radius: 10px;
  background: linear-gradient(135deg, var(--c) 0%, var(--t) 100%);
  display: grid; place-items: center;
}
.art::before, .art::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .16); }
.art::before { width: 80%; aspect-ratio: 1; right: -16%; bottom: -25%; }
.art::after { width: 45%; aspect-ratio: 1; left: -12%; top: -20%; background: rgba(255, 255, 255, .12); }
.art svg { position: relative; z-index: 1; width: 55%; height: 55%; fill: none; stroke: rgba(255, 255, 255, .92); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.thumb { width: 64px; height: 64px; }

/* ---------------- Map pins ---------------- */
.pin-icon { background: none; border: 0; }
.pin {
  width: 34px; height: 34px; border-radius: 50%; background: var(--c);
  display: grid; place-items: center;
  box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(23, 22, 31, .22);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pin svg { width: 16px; height: 16px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.pin.is-hot { transform: scale(1.3); box-shadow: 0 0 0 3px #fff, 0 0 0 8px color-mix(in srgb, var(--c) 25%, transparent), 0 8px 18px rgba(23, 22, 31, .28); }
.pin.is-saved::after {
  content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; transform: translate(12px, -12px);
  background: var(--heart); box-shadow: 0 0 0 2px #fff;
}
.leaflet-marker-icon:focus-visible { outline: none; }
.leaflet-marker-icon:focus-visible .pin { outline: 3px solid var(--accent); outline-offset: 3px; }

.cluster-icon { background: none; border: 0; }
.cluster {
  width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .9), 0 0 0 10px rgba(23, 22, 31, .10);
}
.you-are-here { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px #fff, 0 0 0 12px rgba(59, 59, 245, .18); }

/* Hover card */
.hover-card {
  position: fixed; z-index: 1100; width: 304px;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  overflow: visible;
}
.hover-card::after {
  content: ""; position: absolute; left: var(--arrow-x, 50%); width: 16px; height: 16px; background: var(--surface);
  transform: translateX(-50%) rotate(45deg);
}
.hover-card[data-side="above"]::after { bottom: -7px; }
.hover-card[data-side="below"]::after { top: -7px; }
.hover-card .media { position: relative; height: 148px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; overflow: hidden; }
.hover-card .media .art { position: absolute; inset: 0; border-radius: 0; }
.hover-card .media .art svg { width: 30%; height: 60%; }
.tag-pill {
  position: absolute; left: 12px; top: 12px; z-index: 3; padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .95); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--c);
}
.price-pill { position: absolute; right: 12px; bottom: 12px; z-index: 3; padding: 5px 10px; border-radius: 8px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; }
.media .heart-btn { position: absolute; right: 12px; top: 10px; z-index: 3; background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.media .heart-btn[aria-pressed="true"] { color: var(--heart); }
.hover-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.hover-card h2 { margin: 0; font: 700 19px/1.2 var(--font-display); }
.line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.line.muted { color: var(--muted); font-weight: 500; }
.line .i { width: 15px; height: 15px; color: var(--muted); }
.card-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13.5px; color: var(--accent); text-decoration: none; background: none; border: 0; padding: 0; }
.link .i { width: 15px; height: 15px; }
.link.quiet { color: var(--muted); font-weight: 600; font-size: 12.5px; }

/* Active filters bar */
.filter-bar {
  position: absolute; z-index: 450; top: 16px; left: calc(var(--panel-w) + 32px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; max-width: calc(100% - var(--panel-w) - 120px);
  background: var(--surface); border-radius: 14px; box-shadow: 0 6px 18px rgba(23, 22, 31, .12); font-size: 13px; font-weight: 600;
}
.filter-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; background: var(--chip-bg); border: 0; font-weight: 600; font-size: 12.5px; }
.filter-pill .i { width: 13px; height: 13px; color: var(--muted); }
.filter-bar .link { font-size: 13px; }

/* Map controls */
.map-controls { position: absolute; z-index: 450; right: 20px; bottom: 36px; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.drawer-open .map-controls { right: calc(var(--drawer-w) + 36px); }
.ctrl-group { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(23, 22, 31, .14); overflow: hidden; }
.ctrl-group .ctrl { border-radius: 0; box-shadow: none; }
.ctrl-group .ctrl + .ctrl { border-top: 1px solid var(--line); }
.ctrl { width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: var(--surface); border-radius: var(--radius); box-shadow: 0 4px 14px rgba(23, 22, 31, .14); }
.ctrl:hover { background: var(--surface-2); }

/* ---------------- Drawer ---------------- */
.drawer {
  position: absolute; z-index: 600; right: 16px; top: 16px; bottom: 16px; width: var(--drawer-w);
  display: flex; flex-direction: column; overflow-y: auto;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: 0 14px 36px rgba(23, 22, 31, .16);
}
.drawer .media { position: relative; height: 210px; flex: none; }
.drawer .media .art { position: absolute; inset: 0; border-radius: 0; }
.drawer .media .art svg { width: 30%; height: 60%; }
.drawer .tag-pill { top: auto; bottom: 14px; left: 16px; }
.close-btn { position: absolute; right: 14px; top: 14px; z-index: 3; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .95); display: grid; place-items: center; }
.drawer .content { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 14px; }
.drawer h2 { margin: 0; font: 700 26px/1.15 var(--font-display); }
.drawer .facts { display: flex; flex-direction: column; gap: 10px; }
.drawer .facts .line { font-size: 14px; }
.drawer .facts .i { width: 17px; height: 17px; }
.drawer p.desc { margin: 0; font-size: 14px; line-height: 1.6; color: var(--muted); font-weight: 500; }
.drawer .actions { display: flex; gap: 10px; }
.btn-save {
  flex: 1; height: 46px; border-radius: var(--radius); border: 1.5px solid var(--heart); background: var(--surface); color: var(--heart);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 14.5px;
}
.btn-save .i { fill: none; }
.btn-save[aria-pressed="true"] { background: var(--heart); color: #fff; }
.btn-save[aria-pressed="true"] .i { fill: #fff; }
.cal-wrap { position: relative; flex: 1; }
.drawer .actions .btn-save { flex: 0 0 128px; }
.btn-cal {
  width: 100%; height: 46px; white-space: nowrap; padding: 0 12px; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 14.5px;
}
.btn-cal[aria-expanded="true"] { background: var(--surface-2); }
.cal-menu { top: calc(100% + 8px); right: 0; width: 240px; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.cal-option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); border: 0; background: transparent; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; text-align: left; }
.cal-option:hover, .cal-option:focus-visible { background: var(--surface-2); }
.cal-option .logo { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--bg-logo, #F3F2F7); color: #fff; }
.cal-option .logo .i { width: 15px; height: 15px; }

/* Toast */
.toast {
  position: fixed; z-index: 1500; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; padding: 12px 14px 12px 16px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; box-shadow: 0 12px 28px rgba(23, 22, 31, .3);
}
.toast .ok { width: 24px; height: 24px; border-radius: 50%; background: var(--success); display: grid; place-items: center; }
.toast .ok .i { width: 14px; height: 14px; stroke-width: 3; color: #fff; }
.toast button { border: 0; background: none; color: var(--brand-yellow); font-weight: 700; padding: 0; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .search { flex-basis: 220px; }
  .brand-name { display: none; }
}
@media (max-width: 900px) {
  :root { --topbar-h: auto; }
  .topbar { height: auto; flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .brand-name { display: inline; }
  .saved-button { margin-left: auto; order: 2; }
  .city-picker { order: 3; }
  .search { order: 4; flex: 1 1 100%; max-width: none; }
  .date-presets { order: 5; }
  .layout { height: auto; overflow: visible; display: flex; flex-direction: column; }
  .map { position: relative; height: 56vh; min-height: 320px; }
  .panel { position: relative; left: auto; top: auto; bottom: auto; width: auto; margin: -24px 0 0; border-radius: 22px 22px 0 0; }
  .event-list { overflow: visible; }
  .filter-bar { left: 12px; right: 12px; top: 12px; max-width: none; }
  .map-controls { top: calc(56vh - 150px); bottom: auto; right: 12px; }
  .drawer { position: fixed; inset: 0; width: auto; border-radius: 0; z-index: 1300; }
  .drawer-open .map-controls { right: 12px; }
  .city-menu { width: min(340px, calc(100vw - 32px)); }
}
@media (prefers-reduced-motion: reduce) {
  .pin { transition: none; }
}
