/* /srv/docker/fotr-map/public/css/app.css — mobile-first. */

:root {
  --card-bg: #ffffff;
  --text: #111827;
  --text-muted: #6b7280;
  --accent: #2563eb;
  --pin-default: #2563eb;
  --chip-bg: #f3f4f6;
}

html, body { height: 100%; margin: 0; }
body {
  overflow: hidden;                 /* no horizontal scroll on mobile */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}

#map { position: absolute; inset: 0; }

/* ---- Top bar (top-right): menu | logo | theme toggle ---- */
.topbar {
  position: absolute; top: 12px; right: 12px; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  background: var(--card-bg);
  padding: 6px; border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
.topbar-btn {
  width: 44px; height: 44px;            /* 44px min touch target */
  font-size: 20px; line-height: 1;
  border: 0; background: transparent; border-radius: 8px; cursor: pointer;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.topbar-btn:hover { background: rgba(0,0,0,.06); }
.logo {                                 /* placeholder — ~2 buttons wide, 2:1 */
  width: 88px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1rem; letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--chip-bg); border-radius: 8px;
}

/* ---- Menu / search panel (mobile = top-sheet, desktop = dropdown) ---- */
.menu-panel {
  position: absolute; left: 0; right: 0; top: 0; z-index: 25;
  background: var(--card-bg); color: var(--text);
  padding: 14px; padding-top: 16px;
  border-bottom-left-radius: 18px; border-bottom-right-radius: 18px;
  box-shadow: 0 8px 22px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(-100%); visibility: hidden; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, visibility .25s ease;
}
.menu-panel.open { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; }
.menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.menu-close {
  width: 40px; height: 40px; font-size: 24px; line-height: 1;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer; border-radius: 8px;
}
.menu-search input {
  width: 100%; box-sizing: border-box; font-size: 1rem;
  padding: 11px 13px; border: 1px solid #d1d5db; border-radius: 9px;
  background: #fff; color: var(--text);
}
.search-results { list-style: none; margin: 10px 0 0; padding: 0; max-height: 50vh; overflow-y: auto; }
.search-results li { padding: 10px 8px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.search-results li:hover { background: var(--chip-bg); }
.sr-title { font-weight: 600; }
.sr-city { font-size: .82rem; color: var(--text-muted); }
.search-empty { padding: 12px 8px; color: var(--text-muted); font-size: .9rem; }

/* Desktop: menu becomes a dropdown under the top bar */
@media (min-width: 768px) {
  .menu-panel {
    left: auto; right: 12px; top: 76px;
    width: 340px;
    border-radius: 14px;
    transform: translateY(-12px);
  }
  .menu-panel.open { transform: translateY(0); }
}

/* ---- Navigation control (added bottom-right in JS for thumb reach) ---- */
.maplibregl-ctrl-group { border-radius: 10px; overflow: hidden; }

/* ---- deltaweb Δ on the attribution ⓘ (additive overlay only) ----
   The button itself is LEFT UNTOUCHED (no background/position/structure
   changes), so MapLibre's original icon, circle shape and placement stay
   intact. A single hidden Δ overlay is appended; it fades in ~1×/30s to
   cover the ⓘ, then fades out. Default state = the stock attribution button. */
/* Δ overlay = a white cover (hides the ⓘ) + the Δ glyph on top that flickers.
   The flicker is the quantum state from delta_signature_constalation.html
   (quantumFlicker), adapted to a COLOR shift instead of opacity — opacity
   flicker would fade the green into the white background. Two readable greens:
   base (#007a4f, dark) pulses to accent (#00a85a, brighter). */
@keyframes deltaQuantum {
  0%, 100% { color: #007a4f; }
  2% { color: #00a85a; }
  4% { color: #007a4f; }
  6% { color: #00a85a; }
  8% { color: #007a4f; }
  10%, 90% { color: #007a4f; }
  92% { color: #00a85a; }
  94% { color: #007a4f; }
  96% { color: #00a85a; }
  98% { color: #007a4f; }
}
.maplibregl-ctrl-attrib-button > .attrib-delta {
  position: absolute; inset: 0; pointer-events: none;
}
.maplibregl-ctrl-attrib-button .attrib-delta-bg {
  position: absolute; inset: 0; background: #fff; border-radius: 12px;
  opacity: 0; transition: opacity .35s ease;
}
.maplibregl-ctrl-attrib-button .attrib-delta-glyph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Times New Roman', serif; font-weight: 600; font-size: 20px;
  color: #007a4f; opacity: 0;
}
.maplibregl-ctrl-attrib-button.delta-on .attrib-delta-bg { opacity: 1; }
.maplibregl-ctrl-attrib-button.delta-on .attrib-delta-glyph {
  opacity: 1;
  animation: deltaQuantum 1.5s linear infinite;
}

/* Center the (24px) attribution under the (28px) zoom instead of leaving it
   right-aligned (which made the narrower button look shifted right). The button
   keeps its original size/position; only the box's right margin is nudged by
   half the width difference. Applied to both collapsed and expanded so the box
   doesn't shift when toggled open. */
.maplibregl-ctrl-attrib.maplibregl-compact {
  margin-right: 12px;          /* 10px stock + (28-24)/2 to center under the zoom */
}

/* No focus/selection ring on the attribution ⓘ — match the zoom controls,
   which don't show one on click. */
.maplibregl-ctrl-attrib-button:focus { outline: none; box-shadow: none; }

/* Δ + deltaweb credit inside the expanded attribution. On hover the Δ gets the
   signature's quantum/cosmic effect: orbiting particles (::before) + a pulsing
   ring (::after) + a glow, ported from delta_signature_constalation.html. */
.delta-qm {
  position: relative; display: inline-block;
  font-family: 'Times New Roman', serif; font-weight: 600;
  color: #007a4f; font-size: 13px; line-height: 1;
  transition: color .5s ease, transform .5s ease, text-shadow .5s ease;
}
.delta-qm::before {                       /* orbiting particles (box-shadow dots) */
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 1px; height: 1px; border-radius: 50%; background: #00a85a;
  transform: translate(-50%, -50%) scale(1.5);
  opacity: 0; transition: opacity .5s ease; pointer-events: none;
  box-shadow:
    -13px -13px 0 0 #00a85a,
    13px -9px 0 0 rgba(0,168,90,.75),
    -7px 11px 0 0 rgba(0,168,90,.6),
    10px 7px 0 0 rgba(0,168,90,.8),
    0 -17px 0 0 rgba(0,168,90,.5);
}
.delta-qm::after {                        /* pulsing ring */
  content: ''; position: absolute; top: 50%; left: 50%;
  width: 30px; height: 30px; border: 1px solid #00a85a; border-radius: 50%;
  transform: translate(-50%, -50%) scale(.4);
  opacity: 0; transition: opacity .5s ease, transform .5s ease; pointer-events: none;
}
.delta-link:hover .delta-qm {
  color: #00a85a;
  transform: scale(1.08);
  text-shadow: 0 0 16px rgba(0,168,90,.6);
}
.delta-link:hover .delta-qm::before {
  opacity: 1;
  animation: deltaOrbit 3s ease-in-out infinite;
}
.delta-link:hover .delta-qm::after {
  opacity: .45;
  transform: translate(-50%, -50%) scale(1);
  animation: deltaOrbitPulse 2s ease-in-out infinite;
}
@keyframes deltaOrbit {
  0%, 100% { transform: translate(-50%, -50%) scale(1.5) rotate(0deg); }
  33% { transform: translate(-50%, -50%) scale(1.7) rotate(120deg); }
  66% { transform: translate(-50%, -50%) scale(1.35) rotate(240deg); }
}
@keyframes deltaOrbitPulse {
  0%, 100% { opacity: .45; border-width: 1px; }
  50% { opacity: .15; border-width: .5px; }
}

/* ---- Custom teardrop pins ---- */
.pin-marker {
  width: 44px; height: 44px;            /* generous tap area */
  display: flex; align-items: flex-end; justify-content: center;
  cursor: pointer;
}
.pin-pin {
  display: block; width: 28px; height: 28px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);            /* tip points down */
  background: var(--pin-default);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,.45);
  transition: transform .12s ease;
}
.pin-marker:hover .pin-pin { transform: rotate(-45deg) scale(1.12); }

/* ---- Pin detail panel ---- */
.pin-detail {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-height: 72vh; overflow-y: auto;
  background: var(--card-bg); color: var(--text);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  padding: 16px; padding-top: 20px;
  box-shadow: 0 -6px 22px rgba(0,0,0,.22);
  z-index: 30;
}
.pin-detail[hidden] { display: none; }
.detail-close {
  position: absolute; top: 8px; right: 10px;
  width: 40px; height: 40px; font-size: 24px; line-height: 1;
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
}
.pin-detail h2 { margin: 0 40px 4px 0; font-size: 1.25rem; }
.detail-meta { color: var(--text-muted); font-size: .9rem; margin-bottom: 6px; }
.detail-note { line-height: 1.5; margin: 10px 0; }
.detail-addr { color: var(--text-muted); font-size: .85rem; margin-top: 10px; }
.detail-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.detail-links a {
  display: inline-block; padding: 9px 14px;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 9px; font-size: .9rem;
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  font-size: .78rem; padding: 3px 9px; border-radius: 999px;
  background: var(--chip-bg);
  border-left: 4px solid var(--c, var(--pin-default));
}
.stars { color: #f59e0b; letter-spacing: 1px; }
.rating-num { color: var(--text-muted); font-size: .85rem; }

/* ---- Desktop: sidebar instead of bottom-sheet ---- */
@media (min-width: 768px) {
  .pin-detail {
    left: 12px; right: auto; top: 12px; bottom: 12px;
    width: 360px; max-height: none;
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0,0,0,.25);
  }
  .pin-detail h2 { font-size: 1.4rem; }
}

/* ---- MapLibre popup (used if popups are added later; harmless now) ---- */
.maplibregl-popup-content { border-radius: 10px; padding: 10px 12px; }
