/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0e0e0f;
  --surface:   #1a1a1c;
  --surface2:  #242427;
  --border:    #2e2e32;
  --text:      #f0ede8;
  --mid:       #888;
  --muted:     #555;
  --accent:    #e8863a;
  --accent2:   #c86a22;
  --vic:       #4a9eff;
  --nan:       #a78bfa;
  --radius:    12px;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

  --flex-weekday:  1;
  --flex-weekend:  2.67;
  --flex-expanded: 3.5;
  --flex-shrunk:   0.65;

  --basis-weekday: calc(100% / 12.01);
  --basis-weekend: calc(100% * 2.67 / 12.01);

  --header-h:    52px;
  --colheader-h: 32px;
}

html { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 16px; }
body { min-height: 100dvh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ── Header ──────────────────────────────────────────────────────── */
header {
  position: sticky; top: 0; z-index: 200;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.logo {
  font-size: 13px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  white-space: nowrap;
}
.header-actions {
  display: flex; align-items: center; gap: 10px;
  overflow-x: auto; scrollbar-width: none;
}
.header-actions::-webkit-scrollbar { display: none; }

/* ── City Filter ─────────────────────────────────────────────────── */
.city-filter { display: flex; gap: 6px; }
.filter-btn {
  padding: 5px 13px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--mid);
  white-space: nowrap; transition: all .15s;
}
.filter-btn.active  { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-btn:hover:not(.active) { border-color: var(--muted); color: var(--text); }

/* ── View Toggle ─────────────────────────────────────────────────── */
.view-toggle {
  display: flex; gap: 2px;
  background: var(--surface); border-radius: 8px; padding: 2px; flex-shrink: 0;
}
.toggle-btn {
  padding: 5px 10px; border-radius: 6px; font-size: 12px; border: none;
  background: transparent; color: var(--mid); transition: all .15s;
}
.toggle-btn.active { background: var(--surface2); color: var(--text); }

/* ── Main Views ──────────────────────────────────────────────────── */
.main-view { display: none; }
.main-view.active { display: block; }

/* ── Week Column Headers ─────────────────────────────────────────── */
.week-col-headers {
  display: flex;
  position: sticky;
  top: var(--header-h);
  z-index: 190;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  height: var(--colheader-h);
}
.wch-cell {
  flex: 1 1 var(--basis-weekday);
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 900; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  transition: flex .25s ease;
  border-right: 2px solid #3a3a40;
}
.wch-cell:last-child { border-right: none; }
.wch-cell.weekend { flex: 2.67 1 var(--basis-weekend); color: var(--accent); }

/* ── Calendar Body ───────────────────────────────────────────────── */
#cal-body { padding-bottom: 80px; }

/* ── Month Break & Label ─────────────────────────────────────────── */
.month-break {
  height: 28px;
  background: linear-gradient(to bottom, var(--surface2), var(--bg));
}
.month-label {
  font-size: 17px; font-weight: 900; letter-spacing: .2em;
  text-transform: uppercase; color: var(--accent);
  padding: 14px 16px 12px;
  position: sticky;
  top: calc(var(--header-h) + var(--colheader-h));
  z-index: 180;
  background: var(--bg);
  border-top: 2px solid var(--accent);
  border-bottom: 1px solid var(--border);
}

/* ── Week Row ────────────────────────────────────────────────────── */
.week-row {
  display: flex;
  min-height: 80px;
  position: relative;
}
.week-row::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to right, transparent 0%, var(--border) 10%, var(--accent) 50%, var(--border) 90%, transparent 100%);
}

/* ── Day Column ──────────────────────────────────────────────────── */
.day-col {
  flex: 1 1 var(--basis-weekday);
  min-width: 0;
  border-right: 2px solid #3a3a40;
  overflow: hidden;
  transition: flex .25s ease;
  position: relative;
}
.day-col:last-child { border-right: none; }
.day-col.weekend { flex: 2.67 1 var(--basis-weekend); }
.day-col.has-events { cursor: pointer; }

/* Hover only on days that have events */
.week-row:has(.day-col.weekday.has-events:hover) .day-col.weekday:not(:hover) {
  flex: var(--flex-shrunk);
}
.week-row:has(.day-col.weekday.has-events:hover) .day-col.weekend {
  flex: calc(var(--flex-weekend) * 0.75);
}
.day-col.weekday.has-events:hover {
  flex: var(--flex-expanded);
}

/* Header sync on hover */
.week-col-headers.day-hover-0 .wch-cell:nth-child(1) { flex: var(--flex-expanded); }
.week-col-headers.day-hover-0 .wch-cell:nth-child(2),
.week-col-headers.day-hover-0 .wch-cell:nth-child(3),
.week-col-headers.day-hover-0 .wch-cell:nth-child(4) { flex: var(--flex-shrunk); }
.week-col-headers.day-hover-0 .wch-cell:nth-child(5),
.week-col-headers.day-hover-0 .wch-cell:nth-child(6),
.week-col-headers.day-hover-0 .wch-cell:nth-child(7) { flex: calc(var(--flex-weekend) * 0.75); }

.week-col-headers.day-hover-1 .wch-cell:nth-child(2) { flex: var(--flex-expanded); }
.week-col-headers.day-hover-1 .wch-cell:nth-child(1),
.week-col-headers.day-hover-1 .wch-cell:nth-child(3),
.week-col-headers.day-hover-1 .wch-cell:nth-child(4) { flex: var(--flex-shrunk); }
.week-col-headers.day-hover-1 .wch-cell:nth-child(5),
.week-col-headers.day-hover-1 .wch-cell:nth-child(6),
.week-col-headers.day-hover-1 .wch-cell:nth-child(7) { flex: calc(var(--flex-weekend) * 0.75); }

.week-col-headers.day-hover-2 .wch-cell:nth-child(3) { flex: var(--flex-expanded); }
.week-col-headers.day-hover-2 .wch-cell:nth-child(1),
.week-col-headers.day-hover-2 .wch-cell:nth-child(2),
.week-col-headers.day-hover-2 .wch-cell:nth-child(4) { flex: var(--flex-shrunk); }
.week-col-headers.day-hover-2 .wch-cell:nth-child(5),
.week-col-headers.day-hover-2 .wch-cell:nth-child(6),
.week-col-headers.day-hover-2 .wch-cell:nth-child(7) { flex: calc(var(--flex-weekend) * 0.75); }

.week-col-headers.day-hover-3 .wch-cell:nth-child(4) { flex: var(--flex-expanded); }
.week-col-headers.day-hover-3 .wch-cell:nth-child(1),
.week-col-headers.day-hover-3 .wch-cell:nth-child(2),
.week-col-headers.day-hover-3 .wch-cell:nth-child(3) { flex: var(--flex-shrunk); }
.week-col-headers.day-hover-3 .wch-cell:nth-child(5),
.week-col-headers.day-hover-3 .wch-cell:nth-child(6),
.week-col-headers.day-hover-3 .wch-cell:nth-child(7) { flex: calc(var(--flex-weekend) * 0.75); }

/* ── Out-of-month blank cell ─────────────────────────────────────── */
.day-col.out-of-month { background: var(--surface); cursor: default; }

/* ── Featured cell ───────────────────────────────────────────────── */
.day-col.featured { min-height: 160px; }

.day-thumb {
  width: 100%; aspect-ratio: 3/2;
  object-fit: cover; object-position: center;
  display: block;
}

/* Jazz cup filler — SVG fills the container */
.jazz-cup-filler {
  width: 100%; aspect-ratio: 3/2;
  display: block; overflow: hidden;
}
.jazz-cup-filler svg {
  width: 100%; height: 100%; display: block;
}

/* Hover overlay showing event count */
.day-col.featured .day-thumb-wrap {
  position: relative; overflow: hidden;
}
.day-col.featured .day-thumb-wrap::after {
  content: attr(data-count);
  position: absolute; inset: 0;
  background: rgba(0,0,0,.65);
  color: #fff;
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
}
.day-col.featured.has-events:hover .day-thumb-wrap::after { opacity: 1; }

/* Caption below thumbnail */
.day-caption { padding: 5px 7px 7px; }
.day-caption-date {
  font-size: 10px; font-weight: 800; color: var(--accent);
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px;
}
.day-caption-acts { display: flex; flex-direction: column; gap: 2px; }
.day-caption-act {
  font-size: 10px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.35;
}
.day-caption-act.featured-act { font-weight: 700; }
.day-caption-more { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ── Compact cell ────────────────────────────────────────────────── */
.day-col.compact { padding: 6px; }
.compact-day-num { font-size: 12px; font-weight: 900; color: var(--accent); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }
.day-col.today .compact-day-num,
.day-col.today .featured-day-num { color: var(--accent); }
.compact-event-list { display: flex; flex-direction: column; gap: 3px; }
.compact-ev {
  font-size: 10px; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3;
}
.compact-ev-time { color: var(--accent); font-weight: 700; margin-right: 3px; }
.compact-ev-more { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Featured day number overlay */
.featured-day-num {
  position: absolute; top: 6px; left: 8px; z-index: 2;
  font-size: 15px; font-weight: 900; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8); line-height: 1;
}
.day-col.today .featured-day-num {
  background: var(--accent);
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; text-shadow: none;
}

/* ── Genre & City Pills ──────────────────────────────────────────── */
.genre-pill {
  font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px;
  background: rgba(232,134,58,.15); color: var(--accent); white-space: nowrap;
}
.city-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; white-space: nowrap;
}
.city-badge.vic   { background: rgba(74,158,255,.15);  color: var(--vic); }
.city-badge.nan   { background: rgba(167,139,250,.15); color: var(--nan); }
.city-badge.other { background: rgba(255,255,255,.07); color: var(--muted); }
.price-tag { font-size: 9px; color: var(--mid); }

/* ── List View ───────────────────────────────────────────────────── */
#list-view { padding-bottom: 80px; }
.list-date-group { margin-bottom: 4px; }
.list-date-label {
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); padding: 14px 16px 6px;
}
.list-event-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  border-top: 1px solid var(--border);
  cursor: pointer; transition: background .1s;
}
.list-event-row:hover { background: var(--surface); }
.list-ev-time { font-size: 12px; font-weight: 700; color: var(--accent); width: 40px; flex-shrink: 0; text-align: right; }
.list-ev-body { flex: 1; min-width: 0; }
.list-ev-title { font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-ev-venue { font-size: 12px; color: var(--mid); }
.list-ev-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.list-ev-price { font-size: 11px; color: var(--muted); }

/* ── Map Placeholder ─────────────────────────────────────────────── */
.map-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: calc(100dvh - var(--header-h)); color: var(--muted);
}
.map-placeholder-inner { text-align: center; }
.map-icon  { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.map-label { font-size: 16px; font-weight: 600; color: var(--mid); }
.map-sub   { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ── Day Detail Panel ────────────────────────────────────────────── */
.day-panel {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateY(100%);
  transition: transform .3s cubic-bezier(.2,.8,.3,1);
}
.day-panel.open { transform: translateY(0); }

.day-panel-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.day-back-btn, .day-close-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; color: var(--text); transition: background .12s;
}
.day-back-btn:hover, .day-close-btn:hover { background: var(--surface2); }
.day-nav-group {
  display: flex; align-items: center; gap: 8px; flex: 1; justify-content: center;
}
.day-panel-title { font-size: 15px; font-weight: 700; white-space: nowrap; }
.day-nav-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 14px;
  font-size: 13px; color: var(--text); transition: background .12s;
}
.day-nav-btn:hover { background: var(--surface2); }

/* ── Bubble Grid ─────────────────────────────────────────────────── */
.bubble-grid {
  flex: 1; overflow-y: auto;
  padding: 20px 20px 40px;
}

/* ── City Sections ───────────────────────────────────────────────── */
.city-section { margin-bottom: 32px; }
.city-section:last-child { margin-bottom: 0; }

.city-section-header {
  font-size: 11px; font-weight: 800; letter-spacing: .2em;
  text-transform: uppercase;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 2px solid;
}
.city-section-header.vic { color: var(--vic); border-color: var(--vic); }
.city-section-header.nan { color: var(--nan); border-color: var(--nan); }
.city-section-header.other { color: var(--mid); border-color: var(--border); }

/* ── Bubble Card ─────────────────────────────────────────────────── */
.bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
  margin-bottom: 8px;
}
.bubble:last-child { margin-bottom: 0; }
.bubble:hover:not(.expanded) {
  border-color: var(--accent2);
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
.bubble.expanded {
  border-color: var(--accent);
  box-shadow: 0 4px 24px rgba(0,0,0,.5);
}

/* ── Compact row (always visible) ──────────────────────────────── */
.bubble-compact-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px 10px 10px;
}

/* Thumbnail */
.bubble-thumb-wrap {
  width: 72px; height: 72px; flex-shrink: 0;
  overflow: hidden; border-radius: 8px;
}
.bubble-thumb {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center;
  display: block;
}
.bubble-thumb-wrap .jazz-cup-filler {
  width: 100%; height: 100%; aspect-ratio: unset;
}

/* Compact text */
.bubble-text { flex: 1; min-width: 0; }
.bubble-time  { font-size: 11px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.bubble-title {
  font-size: 14px; font-weight: 700; color: var(--text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bubble-venue {
  font-size: 12px; color: var(--mid); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bubble-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }

/* ── Expanded body ───────────────────────────────────────────────── */
.bubble-expanded-body {
  display: none;
  border-top: 1px solid var(--border);
}
.bubble.expanded .bubble-expanded-body { display: block; }

/* Expanded image — 216px wide, natural height */
.bubble-full-img-wrap {
  width: 216px; flex-shrink: 0;
  overflow: hidden; border-radius: 10px;
}
.bubble-full-img {
  width: 100%; height: auto;
  display: block;
}
.bubble-full-img-wrap .jazz-cup-filler {
  width: 100%; aspect-ratio: 3/2;
}

/* Expanded layout: image left, details right */
.bubble-expanded-inner {
  display: flex; gap: 16px; align-items: flex-start;
  padding: 14px 16px 18px;
}

/* Expanded details — larger, more prominent */
.bubble-expanded-content { flex: 1; min-width: 0; }

.bubble-exp-time {
  font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 6px;
}
.bubble-exp-title {
  font-size: 22px; font-weight: 800; color: var(--text);
  line-height: 1.2; margin-bottom: 6px;
}
.bubble-exp-venue {
  font-size: 15px; color: var(--mid); margin-bottom: 10px;
}
.bubble-exp-pills { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.bubble-exp-pills .genre-pill { font-size: 10px; padding: 3px 9px; }
.bubble-exp-pills .city-badge { font-size: 10px; padding: 3px 9px; }

.bubble-detail-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  margin-bottom: 14px;
}
.bubble-price { font-size: 16px; font-weight: 600; color: var(--mid); }

.bubble-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bubble-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 700;
  padding: 10px 22px; border-radius: 10px; border: none;
  cursor: pointer; transition: background .12s, color .12s;
  text-decoration: none;
}
.bubble-btn.primary { background: var(--accent); color: #fff; }
.bubble-btn.primary:hover { background: var(--accent2); }
.bubble-btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.bubble-btn.secondary:hover { background: var(--border); }

/* No events */
.no-events-msg {
  text-align: center; color: var(--muted); font-size: 14px; padding: 60px 16px;
}

/* ── Scrollbar ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── Mobile ──────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  :root {
    --flex-weekend: 2;
    --flex-expanded: 2.5;
    --flex-shrunk: 0.5;
  }
  .logo { font-size: 11px; }

  /* 1:1 thumbnails on mobile */
  .day-thumb,
  .jazz-cup-filler { aspect-ratio: 1/1; }
  .bubble-img-wrap { aspect-ratio: 1/1; }
  .bubble-img-wrap .jazz-cup-filler { aspect-ratio: unset; }

  .day-panel-header { gap: 6px; }
  .day-nav-group { order: 3; width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .week-col-headers { display: none; }
}
