/* ============================================================
   Tonight — design tokens
   ============================================================ */
:root {
  /* Palette */
  --bg: #0a0d1a;
  --bg-glow: #11183a;
  --surface: #131829;
  --surface-2: #1c2238;
  --border: #2a3150;
  --text: #eef0f6;
  --text-muted: #8b93ad;
  --amber: #f5b942;
  --amber-soft: #f5b94222;

  /* Type */
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  /* Layout */
  --max-width: 480px;
  --radius: 14px;
  --gap: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ============================================================
   Starfield backdrop — echoes the logo's night-sky motif
   ============================================================ */
.stars {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image: url("../assets/bg-stars.jpg");
  background-size: cover;
  background-position: center;
}

/* ============================================================
   Header
   ============================================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: var(--max-width);
  background: rgba(10, 13, 26, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#logo-img {
  display: block;
  width: 420px;
  max-width: 92%;
  height: auto;
  position: relative;
  z-index: 1;
}

.date-strip {
  width: 100%;
  max-width: var(--max-width);
  text-align: center;
  padding: 6px 18px 2px;
}

.date {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--amber);
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

/* ============================================================
   Filter chip rows
   ============================================================ */
.filter-row {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  gap: 8px;
  padding: 6px 18px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip:hover {
  border-color: var(--amber);
  color: var(--text);
}

.chip.active {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1306;
  font-weight: 600;
}

/* ============================================================
   Event feed
   ============================================================ */
.event-list {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: 14px 18px 8px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  isolation: isolate;
}

/* Full-bleed image banner across the top of the card. The mask gradient
   fades the image to nothing before it reaches the venue/time block, so the
   title can sit over the image while the info below stays on clean surface. */
.card-art {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200px;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 78%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 30%, transparent 78%);
}

.card-art svg {
  width: 44px;
  height: 44px;
  stroke: rgba(255,255,255,0.85);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Category gradients — used as image placeholder until image_url is set */
.cat-music     { background: linear-gradient(145deg, #3a3a78, #2a6fb0); }
.cat-trivia    { background: linear-gradient(145deg, #1f6f5c, #36a87f); }
.cat-comedy    { background: linear-gradient(145deg, #a8431f, #e2922c); }
.cat-film      { background: linear-gradient(145deg, #2b2d52, #5a5aa8); }
.cat-market    { background: linear-gradient(145deg, #5a6e2f, #a8b13a); }
.cat-karaoke   { background: linear-gradient(145deg, #8c2f5e, #d1487f); }
.cat-community { background: linear-gradient(145deg, #2f4858, #5a8ca0); }

.card-body {
  position: relative;
  z-index: 1;
  flex: 1;
  /* Large top padding drops the title into the lower, faded part of the
     image; everything below it then sits on solid surface. */
  padding: 128px 14px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Soft dark band behind the title only. The image mask lives on .card-art,
   so this scrim is unaffected by it and guarantees title contrast even over
   bright artwork. Fades in and out so it never shows a hard edge. */
.card-body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 175px;
  background: linear-gradient(
    to bottom,
    transparent 55%,
    rgba(6, 9, 18, 0.5) 90%,
    transparent 100%
  );
  pointer-events: none;
}

.cost {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--amber);
  flex-shrink: 0;
  white-space: nowrap;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.8);
}

/* Venue name + cost share a line; venue truncates, cost stays pinned right. */
.card-venue-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-top: 8px;   /* breathing room below the title */
}

/* Venue leads the info block — brighter and heavier than the time below it. */
.card-venue {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-time {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);   /* recedes beneath the venue */
  margin: 2px 0 0;
}

/* ============================================================
   Transit badge — the signature element.
   Styled like a station sign: line color + stop + walk time.
   ============================================================ */
.transit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 3px 10px 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-color, var(--border));
}

.transit-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-color, var(--text-muted));
  flex-shrink: 0;
}

.transit-text {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text);
  white-space: nowrap;
}

/* Transit badge + locality pill share one row at the bottom of the card.
   Transit anchors the left, the locality chip is pinned to the right. */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

/* In the card, the locality chip matches the transit badge: same height,
   same rounded-rectangle shape. Color (not shape) carries the distinction. */
.card-footer .locality-pill {
  margin-top: 0;
  border-radius: 6px;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  line-height: normal;
  padding: 3px 10px 3px 8px;
}

/* ============================================================
   Empty state & footer
   ============================================================ */
.empty-state {
  width: 100%;
  max-width: var(--max-width);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 40px 18px;
}

.footer {
  width: 100%;
  max-width: var(--max-width);
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 18px 18px 32px;
}

/* ============================================================
   Focus visibility
   ============================================================ */
.chip:focus-visible,
a:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ============================================================
   Detail overlay — full-screen panel for event details
   ============================================================ */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 7, 15, 0.7);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.detail-overlay[hidden] {
  display: none;
}

.detail-panel {
  width: 100%;
  max-width: var(--max-width);
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  position: relative;
  animation: slide-up 0.2s ease-out;
}

@keyframes slide-up {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 13, 26, 0.65);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-art {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  transition: height 0.25s ease;
}

/* Tap the event image to expand it to full (uncropped) view */
.detail-art.expandable {
  cursor: zoom-in;
}

.detail-art.expanded {
  height: auto;
  cursor: zoom-out;
}

.detail-art.expanded img {
  height: auto;
  object-fit: contain;
}

.detail-art svg {
  width: 56px;
  height: 56px;
  stroke: rgba(255,255,255,0.85);
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px 18px 0 0;
}

.detail-body {
  padding: 16px 18px 28px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.25;
}

/* Transit badge + locality chip share a row, transit anchored left and the
   locality chip pinned right — same as the cards. */
.detail-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-description {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  margin: 6px 0 4px;
}

.detail-artist-link {
  display: inline-block;
  margin: 2px 0 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--amber);
  text-decoration: none;
}
.detail-artist-link:hover { text-decoration: underline; }

/* Venue row */
.venue-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-top: 4px;
}

.venue-avatar {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--amber);
  overflow: hidden;
}
.venue-avatar img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.venue-info { min-width: 0; }

.venue-name {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
}

.venue-address {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Action buttons */
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.btn {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover { border-color: var(--amber); }

.btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Icon-only actions: square, centered, same height as the text buttons. */
.btn-icon {
  padding: 9px 13px;
  justify-content: center;
}

.btn-icon:hover svg { stroke: var(--amber); }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #1a1306;
  font-weight: 600;
}

/* More from venue / artist */
.detail-more {
  margin-top: 10px;
}

.detail-more h3 {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.more-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.more-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  color: var(--text);
}

.more-item:hover { border-color: var(--amber); }

.more-item .more-title {
  font-size: 0.86rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.more-item .more-date {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Cards are now interactive */
.card {
  cursor: pointer;
}

/* ============================================================
   Locality badges + sponsored frame
   ============================================================ */

/* Ended events — shown at bottom, dimmed */
.card.is-ended {
  opacity: 0.45;
}

/* Sponsored frame — wraps the whole card */
.card.is-sponsored {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber), 0 0 12px rgba(245, 185, 66, 0.18);
  position: relative;
}

/* "Featured" corner tag on sponsored cards */
.sponsored-tag {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--amber);
  color: #1a1306;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 0 var(--radius) 0 8px;
  z-index: 2;
}

/* Locality pill — sits below the transit badge */
.locality-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  align-self: flex-start;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
  margin-top: 4px;
}

.locality-pill svg {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* venue only */
.pill-venue {
  color: #7ec8c8;
  border-color: rgba(126, 200, 200, 0.45);
}

/* performer only */
.pill-performer {
  color: #b09ef5;
  border-color: rgba(176, 158, 245, 0.45);
}

/* both — slightly brighter amber to read as "more special" */
.pill-both {
  color: var(--amber);
  border-color: rgba(245, 185, 66, 0.55);
}

/* locality pill in detail panel — same logic, slightly larger */
.detail-locality-pill {
  margin-top: 0;   /* reset base pill's margin so it aligns with the transit badge */
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  line-height: normal;
  border-radius: 6px;
  padding: 3px 10px 3px 8px;
}


/* New category gradients */
.cat-sports   { background: linear-gradient(145deg, #1a4a2e, #2d7a4a); }
.cat-fitness  { background: linear-gradient(145deg, #3d2060, #7b4fa6); }
.cat-food     { background: linear-gradient(145deg, #5a2d0c, #c4622d); }

/* ============================================================
   Line dots — one colored dot per MBTA line, reused by the
   indicator, the line tabs, and transfer stops. Color comes in
   via --line-color (derived from the line name in JS).
   ============================================================ */
.line-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--line-color, var(--text-muted));
  box-shadow: 0 0 7px var(--line-color, transparent);
  flex-shrink: 0;
}
/* The "all squares" dot has no single line, so it reads as amber. */
.line-dot-all {
  background: radial-gradient(circle at 35% 35%, #ffd98a, var(--amber) 60%, #b9762a);
  box-shadow: 0 0 8px rgba(245, 185, 66, 0.6);
}

/* ============================================================
   Square indicator — the destination board pinned up top.
   Tapping it opens the metro overlay.
   ============================================================ */
.square-bar {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  justify-content: center;
  padding: 8px 18px 4px;
}

.square-indicator {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 230px;
  max-width: 100%;
  padding: 9px 14px 9px 15px;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.square-indicator:hover { border-color: var(--amber); }
.square-indicator:active { transform: scale(0.99); }

.si-dots {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
/* Multi-line hubs cluster their dots into a little stack. */
.si-dots .line-dot { width: 13px; height: 13px; }
.si-dots .line-dot + .line-dot { margin-left: -4px; }

.si-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  flex: 1;
  min-width: 0;
}
.si-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.si-sub {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 3px;
}
.si-chevron { display: inline-flex; flex-shrink: 0; }
.si-chevron svg {
  width: 18px;
  height: 18px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.square-indicator:hover .si-chevron svg { stroke: var(--amber); }

/* ============================================================
   Metro overlay — the "get on the train" location picker.
   Bottom sheet, like the detail panel.
   ============================================================ */
.metro-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 7, 15, 0.72);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: center;
  align-items: flex-end;
}
.metro-overlay[hidden] { display: none; }

.metro-panel {
  width: 100%;
  max-width: var(--max-width);
  /* Fill almost the whole screen — a near-full sheet, not a bottom half. The
     stage (flex: 1) soaks up the extra height for a big map. */
  height: 96vh;
  height: 96dvh;
  max-height: 96vh;
  max-height: 96dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 18px 18px 0 0;
  position: relative;
  overflow: hidden;
  animation: slide-up 0.22s ease-out;
}

.metro-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.metro-head { padding: 18px 18px 12px; }
.metro-kicker {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  margin: 0 0 12px;
}
.metro-nearme {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
.metro-nearme:hover { border-color: var(--amber); }

/* The canvas network map. Fills the panel below the header; the train
   and stations are drawn by MetroMap in js/app.js, so there are no
   per-stop DOM nodes here — just the stage, the canvas, and a hint. */
.metro-stage {
  position: relative;
  flex: 1;
  min-height: 320px;
  border-top: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.03), transparent 60%),
    var(--bg);
  overflow: hidden;
  touch-action: none; /* we handle pan/pinch ourselves */
}
.metro-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.metro-canvas:active { cursor: grabbing; }

.metro-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  margin: 0;
  text-align: center;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
