/* Shared styles for the board + map prototypes. Theme tokens live at the top. */

:root,
[data-theme="dark"] {
  --bg: #080b10;
  --panel: #0e131a;
  --panel-2: #131a23;
  --line: #1d2733;
  --ink: #eef2f6;
  --mute: #8795a6;
  --faint: #556272;
  --signal: #ffb938;        /* amber: the board's own colour */
  --signal-ink: #1a1203;
  --live: #4fe08a;
  --sel-bg: #172231;
  --head-bg: #0a0e14;
  --clock-bg: #0e131a;
  --clock-ink: #ffb938;
  --map-water: #070c12;
  --map-land: #131c27;
  --map-park: #12261e;
  --map-minor: #1b2633;
  --map-major: #2a3a4d;
  --map-tram: #3fae9c;
  --map-label: #4b5a6c;
  --pin-bg: #0e131a;
  --pin-ink: #eef2f6;
  --pin-line: #3a4a5e;
  --c-music: #ff7a59; --c-theatre: #c78bff; --c-art: #4fd1c5; --c-family: #ffd166;
  --c-learning: #6ea8ff; --c-community: #9be564; --c-sports: #7dd3fc; --c-food: #ff9ecb;
  --c-film: #b8b8ff; --c-other: #94a3b8;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
}

[data-theme="light"] {
  --bg: #e9ebe6;
  --panel: #ffffff;
  --panel-2: #f6f7f3;
  --line: #d9dcd3;
  --ink: #0d120f;
  --mute: #5c665f;
  --faint: #8d968f;
  --signal: #ffd400;        /* road-sign yellow */
  --signal-ink: #0d120f;
  --live: #0d7a43;
  --sel-bg: #fff7c2;
  --head-bg: #f0f2ec;
  --clock-bg: #0d120f;
  --clock-ink: #ffd400;
  --map-water: #bcd3e0;
  --map-land: #f4f4ee;
  --map-park: #d3e5c8;
  --map-minor: #e3e4dc;
  --map-major: #cfd1c6;
  --map-tram: #1f4fe0;
  --map-label: #8a9389;
  --pin-bg: #ffffff;
  --pin-ink: #0d120f;
  --pin-line: #0d120f;
  --c-music: #d9441f; --c-theatre: #8a3ffc; --c-art: #0a8f87; --c-family: #c98a00;
  --c-learning: #1f4fe0; --c-community: #3d8f1d; --c-sports: #0b78b8; --c-food: #cc2f7a;
  --c-film: #5a5ad6; --c-other: #6b7686;
  --shadow: 0 10px 30px rgba(13, 18, 15, .18);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 "Familjen Grotesk", system-ui, sans-serif;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.mono { font-family: "Martian Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.logo { font-weight: 700; font-size: 21px; letter-spacing: -.03em; text-decoration: none; }
.logo i { font-style: normal; color: var(--signal); }
[data-theme="light"] .logo i { background: var(--signal); color: var(--ink); padding: 0 3px; margin: 0 1px; }
.top nav { display: flex; gap: 8px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--mute); text-decoration: none; font-size: 14px; }
.pill:hover { color: var(--ink); border-color: var(--faint); }
.pill.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.pill.solid:hover { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }

/* status bar */
.status { display: flex; align-items: center; gap: 18px; padding: 10px 20px; background: var(--clock-bg); color: #fff; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.clock { font-size: 30px; font-weight: 600; color: var(--clock-ink); letter-spacing: -.02em; line-height: 1; }
.date { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: #aab5c2; }
.origin { position: relative; }
.origin > button { display: inline-flex; gap: 6px; align-items: center; height: 32px; padding: 0 12px; border: 1px solid #2c3948; border-radius: 6px; color: #e6ebf1; font-size: 14px; }
.origin > button:hover { border-color: var(--signal); }
.origin-menu { position: absolute; z-index: 40; top: 38px; left: 0; min-width: 210px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 6px; display: none; }
.origin-menu.open { display: block; }
.origin-menu button { display: block; width: 100%; padding: 8px 10px; border-radius: 5px; font-size: 14px; }
.origin-menu button:hover, .origin-menu button[aria-checked="true"] { background: var(--panel-2); }
.origin-menu button[aria-checked="true"]::after { content: "  ✓"; color: var(--signal); }
.summary { margin-left: auto; font-size: 13px; color: #aab5c2; }
.summary b { color: #fff; font-weight: 600; }

/* main layout */
.main { display: grid; grid-template-columns: minmax(440px, 540px) 1fr; min-height: 0; }
.board { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--panel); border-right: 1px solid var(--line); }

.search { padding: 12px 16px 0; flex: none; }
.search input { width: 100%; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--ink); font: inherit; font-size: 16px; }
.search input::placeholder { color: var(--faint); }
.search input:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.chips { display: flex; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; flex: none; }
.chips::-webkit-scrollbar { display: none; }
/* more filters beyond the right edge: fade them in */
.chips.has-more { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent); }
.chip { flex: none; height: 32px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--mute); background: var(--panel); white-space: nowrap; }
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); font-weight: 600; }
.chip.sep { margin-left: 4px; }
input.chip.day { font: inherit; font-size: 14px; }
input.chip.day[data-active="true"] { border-color: var(--signal); color: var(--ink); }
details.type { position: relative; flex: none; }
details.type > summary { list-style: none; display: inline-flex; align-items: center; height: 32px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--mute); cursor: pointer; font-size: 14px; white-space: nowrap; }
details.type > summary::-webkit-details-marker { display: none; }
details.type[data-active="true"] > summary { border-color: var(--signal); color: var(--ink); }
.type-menu { position: fixed; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); padding: 8px; width: 210px; }
.type-menu label { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.type-menu label:hover { background: var(--panel-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--c-other); }
.dot[data-cat="music"] { background: var(--c-music); } .dot[data-cat="theatre"] { background: var(--c-theatre); }
.dot[data-cat="art"] { background: var(--c-art); } .dot[data-cat="family"] { background: var(--c-family); }
.dot[data-cat="learning"] { background: var(--c-learning); } .dot[data-cat="community"] { background: var(--c-community); }
.dot[data-cat="sports"] { background: var(--c-sports); } .dot[data-cat="food"] { background: var(--c-food); }
.dot[data-cat="film"] { background: var(--c-film); }

.thead, .row { display: grid; grid-template-columns: 98px 1fr 70px 104px; gap: 12px; align-items: center; padding: 0 16px; }
.thead { flex: none; height: 28px; font-size: 11px; letter-spacing: .1em; color: var(--faint); background: var(--head-bg); border-bottom: 1px solid var(--line); text-transform: uppercase; }
.thead span:nth-child(3), .thead span:nth-child(4) { text-align: right; }

.rows { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; overscroll-behavior: contain; }
.rows li { border-bottom: 1px solid var(--line); }
.row { width: 100%; min-height: 76px; padding-top: 10px; padding-bottom: 10px; position: relative; }
.row:hover, .row.hover { background: var(--panel-2); }
.row[aria-current="true"] { background: var(--sel-bg); box-shadow: inset 4px 0 0 var(--signal); }
.row .time { font-size: 21px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.row .day { display: block; margin-top: 5px; font-size: 10px; letter-spacing: .1em; color: var(--faint); font-family: "Familjen Grotesk", sans-serif; font-weight: 500; text-transform: uppercase; }
.row > span { min-width: 0; }
.row .title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; font-size: 15px; line-height: 1.25; }
.row .meta { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 13px; color: var(--mute); min-width: 0; }
.row .meta span:not(.dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-mark { flex: none; padding: 1px 5px; border-radius: 4px; background: var(--signal); color: var(--signal-ink); font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.row .meta .price { color: var(--ink); flex: none; }
.row .meta .more { flex: none; }
.row .walk { text-align: right; font-size: 15px; font-weight: 600; }
.row .walk small { display: block; font-size: 10px; font-weight: 500; color: var(--faint); letter-spacing: .08em; font-family: "Familjen Grotesk", sans-serif; text-transform: uppercase; }
.row .st { text-align: right; font-size: 13px; color: var(--mute); }
.row .st.soon { color: var(--signal); font-weight: 600; }
[data-theme="light"] .row .st.soon { color: #a05a00; }
.row .st.live { color: var(--live); font-weight: 600; }
.row .st.live::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--live); animation: pulse 1.8s infinite; }
.row .st-m { display: none; }
.row .saved { position: absolute; top: 8px; right: 10px; width: 10px; height: 14px; background: var(--signal); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%); }
@keyframes pulse { 50% { opacity: .35; } }

.empty { padding: 36px 24px; color: var(--mute); }
.empty b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.empty .chips { padding: 12px 0 0; border: 0; }

.fold { flex: none; width: 100%; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--head-bg); color: var(--mute); font-size: 13px; display: flex; justify-content: space-between; }
.fold:hover { color: var(--ink); }
.fold[hidden] { display: none; }
.fold-rows { list-style: none; margin: 0; padding: 0; flex: none; max-height: 40%; overflow-y: auto; background: var(--head-bg); }
.fold-rows[hidden] { display: none; }
.fold-rows .row { grid-template-columns: 98px 1fr 70px; min-height: 60px; }
.fold-rows .row .time { font-size: 11px; letter-spacing: .08em; color: var(--mute); font-weight: 500; }

/* map */
.mapwrap { position: relative; overflow: hidden; background: var(--map-water); min-height: 0; touch-action: none; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; }
#map canvas { outline: none; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; padding: 3px 7px 3px 6px; border-radius: 6px; background: var(--pin-bg); color: var(--pin-ink); border: 1.5px solid var(--pin-line); font-size: 11.5px; font-weight: 600; display: flex; align-items: center; gap: 5px; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); }
.pin::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; background: inherit; border: inherit; border-top: 0; border-left: 0; transform: translateX(-50%) rotate(45deg); }
.pin .dot { width: 7px; height: 7px; }
.pin.hover { z-index: 3; border-color: var(--signal); }
.pin.sel { z-index: 5; background: var(--signal); color: var(--signal-ink); border-color: var(--signal); font-size: 13px; padding: 4px 9px; }
.pin.live { border-color: var(--live); }
.pin.small { padding: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--faint); border: 0; }
.pin.small::after { display: none; }
.you { position: absolute; left: 0; top: 0; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #3b82f6; border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(59, 130, 246, .6); animation: ring 2.2s infinite; will-change: transform; }
@keyframes ring { 70% { box-shadow: 0 0 0 16px rgba(59, 130, 246, 0); } 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); } }
.zoom { position: absolute; top: 14px; right: 14px; display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); box-shadow: var(--shadow); }
.zoom button { width: 36px; height: 36px; text-align: center; font-size: 18px; color: var(--ink); }
.zoom button + button { border-top: 1px solid var(--line); }
.zoom button:hover { background: var(--panel-2); }
.attr { position: absolute; left: 8px; bottom: 4px; font-size: 10px; color: var(--map-label); }

/* detail card */
.card { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 20; display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; align-items: end; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-width: 640px; }
.card[hidden] { display: none; }
.card .kicker { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.card h2 { margin: 4px 0 2px; font-size: 19px; line-height: 1.2; letter-spacing: -.01em; }
.card .facts { font-size: 14px; color: var(--ink); }
.card .facts span + span::before { content: "·"; margin: 0 7px; color: var(--faint); }
.card .src { font-size: 12px; color: var(--mute); margin-top: 2px; }
.card .acts { display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.pri { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.btn.pri:hover { filter: brightness(1.06); }
.btn[aria-pressed="true"] { border-color: var(--signal); color: var(--signal); }
.card.has-cover { grid-template-columns: 132px 1fr auto; align-items: center; max-width: 760px; }
.card .shot { width: 132px; height: 100px; object-fit: cover; border-radius: 8px; background: var(--panel-2); display: block; }
.card .x { position: absolute; top: 6px; right: 8px; width: 28px; height: 28px; color: var(--mute); font-size: 18px; text-align: center; display: none; }

.toggle { display: none; }
dialog { border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--ink); padding: 24px; max-width: 420px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h3 { margin: 0 0 8px; font-size: 20px; }
dialog p { margin: 0 0 12px; color: var(--mute); }
dialog ul { margin: 0 0 18px; padding-left: 18px; color: var(--mute); }

/* mobile */
@media (max-width: 860px) {
  body { grid-template-rows: auto auto 1fr; }
  .top { height: 48px; padding: 0 14px; }
  .top .hide-m { display: none; }
  .status { padding: 8px 14px; gap: 4px 12px; }
  .clock { font-size: 24px; }
  .summary { margin-left: 0; width: 100%; font-size: 12.5px; }
  .main { grid-template-columns: minmax(0, 1fr); position: relative; }
  .board { border-right: 0; }
  /* hidden, not display:none, so the fixed detail card inside it still shows over the list */
  .mapwrap { position: absolute; inset: 0; z-index: 10; visibility: hidden; }
  body.show-map .mapwrap { visibility: visible; }
  .card { visibility: visible; }
  .search { padding: 10px 14px 0; }
  .chips { padding: 10px 14px; }
  .thead { display: none; }
  .row, .fold-rows .row { grid-template-columns: 62px 1fr 56px; gap: 10px; padding: 12px 14px; min-height: 78px; }
  .row .time { font-size: 18px; }
  .row .st { display: none; }
  .row .st-m { display: block; margin-top: 3px; font-size: 12.5px; color: var(--mute); }
  .row .st-m.soon { color: var(--signal); font-weight: 600; }
  [data-theme="light"] .row .st-m.soon { color: #a05a00; }
  .row .st-m.live { color: var(--live); font-weight: 600; }
  .rows { padding-bottom: 150px; }
  .toggle { display: flex; position: fixed; z-index: 60; left: 50%; bottom: calc(var(--card-h, 0px) + 14px); transform: translateX(-50%); height: 44px; padding: 0 24px; align-items: center; gap: 8px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 700; box-shadow: var(--shadow); }
  body.no-sel .toggle { bottom: 22px; }
  /* the all-day bar sits at the bottom of the list: stay above it */
  body.no-sel:has(.fold:not([hidden])) .toggle { bottom: 66px; }
  .card { position: fixed; left: 0; right: 0; bottom: 0; max-width: none; border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding: 14px 14px 18px; grid-template-columns: 1fr; z-index: 55; }
  .card.has-cover { grid-template-columns: 76px 1fr; align-items: start; }
  .card.has-cover .shot { width: 76px; height: 76px; }
  .card.has-cover .acts { grid-column: 1 / -1; }
  .card .acts { margin-top: 8px; }
  .card .acts .btn { flex: 1; }
  .card .x { display: block; }
  .zoom { top: 10px; right: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .row .st.live::before, .you { animation: none; }
}

.zoom-home { font-size: 14px; }
.row .more { color: var(--mute); font-size: 12px; white-space: nowrap; }
.card .dates { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--mute); }
