/* ============================================================
   Locus mapping app -- full-screen map, floating search overlay,
   collapse-to-rail. Added 2026-07-05. Header sticky above; Standing
   Watch + footer flow below the map viewport.
   ============================================================ */

/* The app fills the viewport height minus the sticky header (~64px). */
.locus-app {
  position: relative;
  width: 100%;
  height: calc(100vh - 64px);
  min-height: 480px;
  overflow: hidden;
  background: var(--paper-edge);
}

/* Map fills the whole app box. */
.locus-app-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* --- Floating search overlay (default state) --- */
.locus-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: none; /* let map drag through empty space */
}
.locus-overlay[hidden] { display: none; }
.locus-overlay-inner {
  pointer-events: auto;
  width: min(760px, 100%);
  text-align: center;
  background: rgba(247, 244, 237, 0.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 40px 40px 32px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12);
}
html[data-theme="dark"] .locus-overlay-inner {
  background: rgba(18, 22, 20, 0.82);
}
.locus-overlay-inner h1 {
  font-weight: 300;
  font-size: calc(clamp(34px, 5.4vw, 66px) * var(--scale));
  line-height: 1;
  letter-spacing: -.025em;
  margin: 8px 0 14px;
}
.locus-overlay-inner h1 .em { font-style: italic; font-weight: 400; }
.locus-overlay-inner .locus-tagline {
  font-size: calc(clamp(15px, 2vw, 20px) * var(--scale));
  color: var(--muted); font-weight: 300; margin-bottom: 26px;
}
.locus-overlay-inner .locus-find { width: 100%; margin: 0 auto; }
.locus-overlay-inner .locus-covenant {
  margin-top: 22px; font-size: 13px; color: var(--muted); font-style: italic;
}

/* Chips are now buttons -- interactive. */
.locus-scopes { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.locus-scope {
  font-family: system-ui, sans-serif; font-size: 13px;
  padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--muted); cursor: pointer; transition: all .15s;
}
.locus-scope:hover { color: var(--ink); border-color: var(--faint); }
.locus-scope.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* --- Collapsed results rail (after Discover) --- */
.locus-rail {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: min(25%, 380px);
  min-width: 300px;
  z-index: 5;
  background: rgba(247, 244, 237, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-right: 1px solid var(--line);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  display: flex; flex-direction: column;
  transform: translateX(-102%);
  transition: transform .28s ease;
}
.locus-rail[hidden] { display: none; }
.locus-rail.is-open { transform: translateX(0); }
html[data-theme="dark"] .locus-rail { background: rgba(18, 22, 20, 0.94); }

.locus-rail-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.locus-rail-expand {
  display: flex; align-items: center; gap: 8px;
  font-family: system-ui, sans-serif; font-size: 13px; font-weight: 600;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink); border-radius: 9px; padding: 9px 14px; cursor: pointer;
  width: 100%; transition: border-color .15s;
}
.locus-rail-expand:hover { border-color: var(--accent); }

.locus-rail-query { padding: 14px 18px 4px; }
.locus-rail-query .lrq-label {
  display: block; font-family: system-ui, sans-serif; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
}
.locus-rail-query strong { font-size: 17px; color: var(--ink); }
.locus-rail-meta {
  padding: 4px 18px 12px; font-family: system-ui, sans-serif; font-size: 12px;
  color: var(--muted); border-bottom: 1px solid var(--line);
}
.locus-rail-meta .ok { color: var(--accent); }
.locus-rail-meta .dot { margin: 0 6px; color: var(--faint); }

.locus-rail-list { flex: 1; overflow-y: auto; padding: 8px; }
.locus-rail-list .rec {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  text-align: left; padding: 11px 12px; border: 0; background: none;
  border-radius: 10px; cursor: pointer; transition: background .12s;
}
.locus-rail-list .rec:hover { background: var(--paper-edge); }
.locus-rail-list .rec-mark {
  flex: none; width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); margin-top: 5px;
}
.locus-rail-list .rec-name { display: block; font-size: 14px; color: var(--ink); line-height: 1.35; }
.locus-rail-list .rec-coord { display: block; font-family: system-ui, sans-serif; font-size: 11px; color: var(--faint); margin-top: 2px; }
.locus-rail-list .rec-empty { padding: 16px; font-size: 14px; color: var(--muted); line-height: 1.6; }

/* The map must not be centered/padded by .locus-root for the app view. */
.locus-root:has(.locus-app) {
  padding: 0 !important;
  display: block !important;
  max-width: none !important;
}

/* --- Responsive: overlay + rail become bottom sheets on narrow screens --- */
@media (max-width: 760px) {
  .locus-app { height: calc(100vh - 56px); }
  .locus-overlay { align-items: flex-end; padding: 0; }
  .locus-overlay-inner {
    width: 100%; border-radius: 20px 20px 0 0; padding: 24px 20px 28px;
    box-shadow: 0 -8px 32px rgba(0,0,0,.16);
  }
  .locus-rail {
    top: auto; right: 0; width: 100%; min-width: 0; height: 55%;
    border-right: 0; border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    transform: translateY(102%);
  }
  .locus-rail.is-open { transform: translateY(0); }
}
