/* Split view (wip/split-view, 2026-11-20; app.js "Split view"): Tiles and Map at once.
   body.split-side   wide screens, Tiles view: the map sits in a sticky panel to the right of the tiles.
   body.split-sheet  narrow screens, Map view: the map fills the screen under the toolbar, the tiles ride in a sheet
                     along the bottom that the visitor drags (data-sheet = peek | half).
   Colours reuse the page's variables, so light and dark both keep their checked contrast. */

/* ---------- wide: tiles | map ---------- */
body.split-side main {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 40vw, 820px);
  column-gap: 14px; align-items: start;
}
body.split-side main > * { grid-column: 1; min-width: 0; }
body.split-side main > #map-view {
  grid-column: 2; grid-row: 1 / span 40;
  position: sticky; top: 8px; height: calc(100vh - 16px);
  display: flex; flex-direction: column; padding-top: 0; margin-inline-end: 10px;
}
body.split-side #map-view .map-bar { flex: none; }
body.split-side #map { flex: 1 1 auto; height: auto; min-height: 0; }
/* The whole-map extras crowd a half-width map: the date buttons stay in Map options; "Not on the map" stays a button. */
body.split-side #map-view .map-note .map-note-btn { white-space: nowrap; }

/* "Show map" in the tile settings row once the visitor closed the panel. */
.split-show {
  font: inherit; font-size: 0.85rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--hairline); background: var(--page); color: var(--ink); cursor: pointer;
}
.split-show:hover { background: var(--hover); }
.split-show[hidden] { display: none; }

/* The map's own controls for the split (top left): Hide map, Full map, follow the map. */
#map .split-ctl { display: none; flex-direction: column; align-items: flex-start; gap: 6px; }
#map .split-ctl[data-mode="side"], #map .split-ctl[data-mode="sheet"] { display: flex; }
#map .split-ctl[data-mode="sheet"] [data-split="hide"], #map .split-ctl[data-mode="sheet"] [data-split="full"] { display: none; }
#map .split-ctl .split-row { display: flex; gap: 6px; }
#map .split-act {
  font: inherit; font-size: 0.8rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2rem;
  padding: 0.25rem 0.7rem; border-radius: 999px; border: 1px solid var(--ink-secondary); background: var(--surface); color: var(--ink);
  box-shadow: var(--map-shadow, 0 2px 8px rgba(0,0,0,.18)); cursor: pointer;
}
#map button.split-act:hover { background: var(--hover); }
#map .split-follow { font-weight: 500; cursor: pointer; }
#map .split-follow input { margin: 0; width: 1rem; height: 1rem; accent-color: var(--blue); }

/* Tile -> map: the pulse at the hovered tile's place, and a one-line "where" over the map. */
.split-pulse { pointer-events: none; }
.split-pulse::before, .split-pulse::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--map-glow, #f59e0b); border: 3px solid #fff; box-shadow: 0 0 0 2px #1f2937, 0 3px 10px rgba(0,0,0,.35);
}
.split-pulse::before { inset: 6px; }
.split-pulse::after { background: transparent; border-color: var(--map-glow, #f59e0b); box-shadow: none; animation: split-ring 1.3s ease-out infinite; }
.split-pulse.is-area::before { inset: 0; opacity: .45; border-style: dashed; }
@keyframes split-ring { from { transform: scale(.6); opacity: 1; } to { transform: scale(2.2); opacity: 0; } }
#map .split-hint {
  position: absolute; z-index: 650; left: 50%; top: 10px; transform: translateX(-50%); max-width: calc(100% - 24px);
  padding: 0.3rem 0.75rem; border-radius: 999px; background: var(--ink); color: var(--page);
  font-size: 0.82rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
body.split-side #map .split-hint { top: auto; bottom: 58px; } /* above "Not on the map" and the attribution */
#map .split-hint[hidden] { display: none; }

/* Map -> tiles: the tiles of the pin whose popup is open. */
#all-list .list-event.split-lit { outline: 3px solid var(--map-glow, #f59e0b); outline-offset: 2px; border-radius: 12px; z-index: 2; }

/* ---------- narrow: map with a sheet of tiles ---------- */
body.split-sheet { overflow: hidden; }
body.split-sheet main > #map-view {
  position: fixed; left: 0; right: 0; top: var(--sheet-top, 0px); bottom: calc(var(--sheet-map, 50vh) - 18px);
  padding: 0; z-index: 1;
}
body.split-sheet #map-view .map-bar { display: none; }
body.split-sheet #map { height: 100%; border: 0; border-radius: 0; }
body.split-sheet #tile-controls, body.split-sheet .site-foot, body.split-sheet #all-legend { display: none !important; }
body.split-sheet #panel-all {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; height: var(--sheet-h, 50vh);
  overflow-y: auto; overscroll-behavior: contain; background: var(--page); color: var(--ink);
  border-radius: 18px 18px 0 0; box-shadow: 0 -8px 28px rgba(0,0,0,.28); padding: 0 8px env(safe-area-inset-bottom, 0px);
  transition: height .28s cubic-bezier(.2,.8,.2,1);
}
body.split-sheet.sheet-dragging #panel-all { transition: none; }
body.split-sheet[data-sheet="peek"] #panel-all { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { body.split-sheet #panel-all { transition: none; } .split-pulse::after { animation: none; } }

.split-grip { position: sticky; top: 0; z-index: 3; background: var(--page); margin: 0 -8px; padding: 0 8px; }
.split-grip[hidden] { display: none; }
.split-grip-btn {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 0 .35rem; width: 100%;
  font: inherit; color: var(--ink); background: none; border: 0; padding: 22px 8px 12px; position: relative;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.split-grip-btn:active { cursor: grabbing; }
.split-bar { position: absolute; top: 8px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--ink-secondary); }
.split-grip-n { font-weight: 700; font-size: 0.98rem; }
.split-grip-sub { font-size: 0.85rem; color: var(--ink-secondary); }
.split-grip-sub::before { content: "· "; }
.split-grip-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; border-radius: 14px; }
body.split-sheet #find-pills { padding-inline: 2px; }

/* Tiles on a phone: a floating Map button back to the map and its sheet. */
.split-fab {
  position: fixed; z-index: 40; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.7rem 1.2rem; min-height: 2.75rem;
  font: inherit; font-size: 0.95rem; font-weight: 700; color: var(--page); background: var(--ink);
  border: 0; border-radius: 999px; box-shadow: 0 6px 20px rgba(0,0,0,.35); cursor: pointer;
}
.split-fab svg { width: 1.1rem; height: 1.1rem; }
.split-fab[hidden] { display: none; }
.split-fab:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* The welcome box's result line ("312 events for comedy · New search") floats over the top of the map on a phone. */
body.split-sheet #welcome.wl-compact:not([hidden]) {
  position: fixed; z-index: 5; top: calc(var(--sheet-top, 0px) + 8px); left: 8px; right: 8px; margin: 0;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}

/* ---------- wip/split-sleek (Jon, 2026-11-20) ---------- */
/* The toolbar's count line moves under the map (app.js splitSyncGrip), so the tiles start right under the filters. */
body.split-side .toolbar .find-controls .count, body.split-side .toolbar .find-sources-slot { display: none; }
/* The map's line goes under the map: the map's top lines up with the first tiles. */
body.split-side #map-view .map-bar { order: 2; padding: 6px 2px 0; }
body.split-side #map-view .map-note { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .3rem; margin: 0; }
body.split-side #map-view .split-total { font-weight: 600; color: var(--ink); }
body.split-side #map-view .split-src { margin-inline-start: auto; }
body.split-side #map-view .split-src .find-sources { padding: 0; }
.map-view .split-total, .map-view .split-src { display: none; }
body.split-side #map-view .split-total, body.split-side #map-view .split-src { display: inline; }
body.split-side main > #map-view { height: var(--split-h, calc(100vh - 16px)); }
body.split-side #map-view .split-total::after { content: " ·"; font-weight: 400; color: var(--ink-secondary); }
/* Closed, "Map options" is only as wide as its words, so it doesn't run over Hide map / Full map on a half-width map. */
body.split-side #map .map-card:not([open]) { width: auto; }
