/* Search panel (search.js). One DOM, two designs (Tarik, 2026-10-09):
   - phone (narrower than 821 px, or a touch screen): a bottom sheet. It slides up, and is
     swiped down, closed with Cancel or by tapping outside it.
   - desktop: a popover under the top-bar search box. Esc or a click outside closes it.
   Deep black glass. Live blur only on the desktop popover, and never on a map page (it would sit
   over MapLibre, which redraws every frame). The phone sheet has no live blur: it slides most of
   the screen over the page, and a moving blurred surface is re-blurred on every frame, the cost
   that made phones stutter (2026-10-11). The dark layer behind it does the job instead.
   Animations move transform and opacity only. Colours come from tokens.css: cyan = action,
   purple = identity (the venue pin). */

.sx { position: fixed; inset: 0; z-index: 95; pointer-events: none; visibility: hidden; transition: visibility 0s linear 280ms; font-family: var(--body); color: var(--text); }
.sx.is-open { visibility: visible; transition: none; }
html.sx-lock, html.sx-lock body { overflow: hidden; }

/* Tap outside (phone): a plain dark layer, no blur. */
.sx-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); opacity: 0; transition: opacity 220ms ease; touch-action: none; }
.sx.is-open .sx-scrim { opacity: 1; pointer-events: auto; }

.sx-panel {
  position: absolute; display: flex; flex-direction: column; overflow: hidden; pointer-events: none;
  background: rgba(14, 14, 18, 0.84);
  -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 20px 60px rgba(0, 0, 0, 0.6);
}
.sx.is-open .sx-panel { pointer-events: auto; }
/* Without blur the panel is solid, or the page's text would show through faintly. */
.sx.sx-flat .sx-panel, .sx[data-mode="sheet"] .sx-panel { -webkit-backdrop-filter: none; backdrop-filter: none; background: #0e0e12; }

/* ---- Phone: the bottom sheet. A band of page stays visible on top, so there is "outside" to tap. ---- */
.sx[data-mode="sheet"] .sx-panel {
  left: 0; right: 0; bottom: 0; top: max(calc(env(safe-area-inset-top) + 48px), 9vh);
  border-radius: 28px 28px 0 0; border-bottom: 0;
  transform: translate3d(0, 105%, 0); transition: transform 260ms cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.sx[data-mode="sheet"].is-open .sx-panel { transform: translate3d(0, 0, 0); }
/* A touch tablet: a sheet of phone width, centred, not a stretched one. */
@media (min-width: 680px) { .sx[data-mode="sheet"] .sx-panel { left: calc(50% - 320px); right: calc(50% - 320px); } }
.sx-panel.is-dragging { transition: none !important; }

.sx-grab { display: none; }
.sx[data-mode="sheet"] .sx-grab { display: flex; justify-content: center; padding: 8px 0 8px; touch-action: none; cursor: grab; }
.sx-grab span { width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.25); }

/* ---- Desktop: the popover. Its place and size are set by search.js from the search box. ---- */
.sx[data-mode="pop"] .sx-scrim { display: none; }
.sx[data-mode="pop"] .sx-panel {
  border-radius: 22px; transform-origin: 50% 0;
  opacity: 0; transform: translate3d(0, -6px, 0) scale(0.98);
  transition: transform 160ms ease, opacity 160ms ease;
}
.sx[data-mode="pop"].sx-up .sx-panel { transform-origin: 50% 100%; transform: translate3d(0, 6px, 0) scale(0.98); }
.sx[data-mode="pop"].is-open .sx-panel { opacity: 1; transform: none; }

/* ---- The field ---- */
.sx-head { display: flex; align-items: center; gap: 10px; padding: 2px 16px 12px; flex: 0 0 auto; }
.sx[data-mode="sheet"] .sx-head { touch-action: none; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.sx[data-mode="pop"] .sx-head { padding: 12px 12px 8px; }
.sx-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 8px 0 14px;
  border-radius: var(--pill); background: rgba(255, 255, 255, 0.07); border: 1px solid var(--stroke);
}
.sx[data-mode="pop"] .sx-field { height: 44px; }
.sx-field:focus-within { border-color: rgba(0, 229, 255, 0.55); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.14); }
.sx-field > svg { width: 18px; height: 18px; flex: 0 0 auto; stroke: var(--text-3); fill: none; stroke-width: 2; stroke-linecap: round; }
/* min-width: 0, or Safari lets a flex input push the row wider than the sheet. 17 px stops iOS zooming in on focus. */
.sx-field input {
  flex: 1; min-width: 0; width: 100%; height: 100%; padding: 0; background: none; border: 0; outline: 0; border-radius: 0;
  color: var(--text); font: 17px var(--body); -webkit-appearance: none; appearance: none;
}
.sx[data-mode="pop"] .sx-field input { font-size: 16px; }
.sx-field input::placeholder { color: var(--text-3); opacity: 1; }
.sx-field input::-webkit-search-cancel-button, .sx-field input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.sx-clear { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, 0.10); }
.sx-clear:hover { background: rgba(255, 255, 255, 0.16); }
.sx-clear svg { width: 12px; height: 12px; stroke: var(--text); fill: none; stroke-width: 2.4; stroke-linecap: round; }
.sx-close { height: 44px; padding: 0 2px; flex: 0 0 auto; font-size: 16px; font-weight: 500; color: var(--cyan); }
.sx[data-mode="pop"] .sx-close { display: none; }

/* ---- Messages: the hint, nothing found, offline, not answering ---- */
.sx-msg { padding: 14px 12px 20px; color: var(--text-2); font-size: 15px; line-height: 1.45; }
.sx-msg b { display: block; margin-bottom: 2px; color: var(--text); font-weight: 600; }
.sx-msg .sx-retry { display: flex; margin-top: 14px; height: 40px; font-size: 14px; }

/* ---- Results: the message, the list and the "may be more" note scroll together. ---- */
.sx-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 8px 10px; }
/* Phone: room under the last row for the home indicator, or the keyboard when it is up. */
.sx[data-mode="sheet"] .sx-scroll { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); padding-bottom: calc(16px + max(env(safe-area-inset-bottom), var(--sx-kb, 0px))); }
.sx-list { transition: opacity 160ms ease; }
.sx-list:empty { display: none; }
.sx-list.is-busy { opacity: 0.55; }
.sx-h { padding: 12px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.sx-row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 7px 10px; border-radius: 14px; -webkit-tap-highlight-color: transparent; }
.sx-row[aria-selected="true"], .sx-row:active { background: var(--glass-2); }
.sx-th { position: relative; width: 40px; height: 50px; flex: 0 0 auto; border-radius: 9px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--stroke); }
.sx-th img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* No flyer: the event's accent colour with the venue's initial (MotionClock.noArt), small. */
.sx-th .noart { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 0; gap: 0;
  background: var(--accent, #16161b); color: var(--accent-ink, var(--text-2)); }
.sx-th .noart b { font: 800 18px/1 var(--display); letter-spacing: -0.02em; opacity: 0.9; }
.sx-th .noart span { display: none; }
/* A venue: a purple pin (purple = identity). */
.sx-th.sx-pin { height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(168, 85, 247, 0.16); border-color: rgba(168, 85, 247, 0.35); }
.sx-pin svg { width: 18px; height: 18px; stroke: var(--purple-soft); fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.sx-t { flex: 1; min-width: 0; }
.sx-t b { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sx-m { display: flex; min-width: 0; margin-top: 2px; font-size: 13px; color: var(--text-2); }
.sx-m .v { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sx-m .w { flex: 0 0 auto; white-space: pre; font-variant-numeric: tabular-nums; }
.sx-tag { flex: 0 0 auto; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #ff3b6b; }
.sx-more { margin: 0; padding: 10px 10px 4px; font-size: 13px; color: var(--text-3); }

/* Desktop: the keys, in a quiet line at the bottom. */
.sx-foot { display: none; }
.sx[data-mode="pop"] .sx-foot { display: flex; gap: 16px; flex: 0 0 auto; padding: 10px 16px; border-top: 1px solid var(--stroke); font-size: 12px; color: var(--text-3); }
.sx-foot kbd { display: inline-block; min-width: 18px; margin-right: 4px; padding: 0 5px; border: 1px solid var(--stroke); border-radius: 5px; font: 11px/16px var(--body); text-align: center; color: var(--text-2); }
.sx-foot kbd + kbd { margin-left: -1px; }

/* Read by screen readers, not drawn. */
.sx-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
