/* ============================================================
   MIRROR — Search results layout
   ============================================================ */
.search-shell { background: var(--surface); min-height: 100vh; }

/* sub bar */
.subbar { position: sticky; top: 0; z-index: 40; background: var(--card); border-bottom: 1px solid var(--line); }
.subbar__in { max-width: 1480px; margin: 0 auto; padding: 14px 32px; display: flex; align-items: center; gap: 16px; }
.subbar__count { font-family: var(--font-display); font-weight: 500; font-size: 20px; color: var(--ink); letter-spacing: -0.01em; }
.subbar__count b { font-weight: 600; }
.subbar__sub { font-size: 13px; color: var(--ink-3); margin-top: 1px; }
.subbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.viewtoggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-pill); padding: 3px; gap: 2px; }
.viewtoggle button { display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent; color: var(--ink-2); font-family: var(--font-ui); font-weight: 600; font-size: 13px; padding: 7px 13px; border-radius: var(--r-pill); cursor: pointer; transition: all .15s; }
.viewtoggle button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }

.sortsel { position: relative; display: flex; align-items: center; }
.sortsel select { appearance: none; font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 9px 36px 9px 16px; cursor: pointer; }
.sortsel select:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.sortsel .chev { position: absolute; right: 14px; pointer-events: none; color: var(--ink-3); }

.filterbtn { display: none; }

/* main grid view */
.search-main { max-width: 1480px; margin: 0 auto; padding: 22px 32px 64px; }
.search-grid { display: grid; grid-template-columns: 286px 1fr; gap: 30px; align-items: start; }
.fcol { position: sticky; top: 132px; max-height: calc(100vh - 156px); overflow-y: auto; padding-right: 4px; }

.results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.results-grid--split { grid-template-columns: repeat(2, 1fr); }

.achips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

/* ---------- sidebar ---------- */
.fsidebar { background: transparent; }
.fsidebar__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.fgroup { padding: 18px 0; border-bottom: 1px solid var(--line-2); }
.fgroup:last-child { border-bottom: none; }
.fgroup__h { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 12px; }
.frows { display: flex; flex-direction: column; gap: 2px; }
.frow { display: flex; align-items: center; gap: 10px; width: 100%; border: none; background: transparent; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-family: var(--font-ui); transition: background .12s; text-align: left; }
.frow:hover { background: var(--surface-2); }
.fcheck { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--line); background: var(--card); flex: none; display: flex; align-items: center; justify-content: center; color: #fff; transition: all .12s; }
.frow--on .fcheck { background: var(--accent); border-color: var(--accent); }
.frow__label { flex: 1; font-size: 14px; color: var(--ink); font-weight: 500; }
.fcount { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.miniseg { width: 100%; padding: 3px; }
.miniseg button { flex: 1; padding: 7px 4px; font-size: 13px; }

/* ---------- split view ---------- */
.split { display: flex; height: calc(100vh - 124px); max-width: 100%; }
.split__list { width: 56%; overflow-y: auto; padding: 22px 28px 40px; }
.split__map { flex: 1; position: relative; }

/* NB: these markers are MapLibre Marker({element}) — MapLibre owns the inline `transform`
   for positioning, so the hover "pop" must use a non-transform property (box-shadow), not scale. */
.mappin { z-index: 3; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-pill); padding: 5px 10px; font-family: var(--font-ui); font-weight: 700; font-size: 12px; cursor: pointer; box-shadow: var(--shadow-1); white-space: nowrap; transition: background .12s, color .12s, box-shadow .12s; }
.mappin:hover, .mappin--on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); z-index: 6; box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 28%, transparent), var(--shadow-2); }

/* ---------- real map (MapLibre fills .split__map) ---------- */
#searchMap { position: absolute; inset: 0; width: 100%; height: 100%; }
.split__map .maplibregl-ctrl-group { box-shadow: var(--shadow-1); }

/* no-coordinates fallback (whole page lacks lat/long) */
.mr-nocoords { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px; color: var(--ink-3); font-family: var(--font-ui); font-size: 14px;
  background: var(--surface-2); }

/* card<->pin hover sync */
.pcell { position: relative; border-radius: var(--r-md); transition: box-shadow .12s; }
.pcell--hot { box-shadow: 0 0 0 2px var(--accent); }
.mappin:focus-visible { outline: none; box-shadow: var(--focus); z-index: 6; }

/* mobile list/map switch (only meaningful inside split view, <1024) */
.mapmode-toggle { display: none; }
@media (max-width: 1024px) {
  .split .mapmode-toggle { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
    z-index: 50; display: inline-flex; align-items: center; gap: 7px; box-shadow: var(--shadow-2); }
}

/* ---------- filter sheet (mobile bottom / split-view left) ---------- */
.fsheet { position: fixed; inset: 0; z-index: 80; display: none; }
.fsheet--open { display: block; }
.fsheet__scrim { position: absolute; inset: 0; background: rgba(20,16,12,.5); backdrop-filter: blur(3px); }
.fsheet__panel { position: absolute; background: var(--card); display: flex; flex-direction: column; }
.fsheet__hd { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.fsheet__body { padding: 4px 20px; overflow-y: auto; flex: 1; }
.fsheet__ft { padding: 14px 20px; border-top: 1px solid var(--line); }
/* left drawer (>=1024, split view) */
@media (min-width: 1025px) {
  .fsheet__panel { top: 0; bottom: 0; left: 0; width: 360px; }
}
/* bottom sheet (mobile) */
@media (max-width: 1024px) {
  .fsheet__panel { left: 0; right: 0; bottom: 0; height: 86vh; max-height: 86vh; border-radius: 18px 18px 0 0; }
}
.fsheet--open .fsheet__panel { animation: mr-fade .2s ease; }

/* ---------- responsive ---------- */
@media (max-width: 1240px) { .results-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) {
  .search-grid { grid-template-columns: 1fr; }
  .fcol { display: none; }
  .filterbtn { display: inline-flex; }
  .split__list { width: 100%; }
  .split__map { display: none; }
  .split--mapmode .split__list { display: none; }
  .split--mapmode .split__map { display: block; }
}
@media (max-width: 680px) {
  .subbar__in, .search-main { padding-left: 18px; padding-right: 18px; }
  .results-grid, .results-grid--split { grid-template-columns: 1fr; }
  .subbar__count { font-size: 17px; }
}

/* a11y (Phase 5) — focus rings for filter rows + view toggle */
.frow:focus-visible { outline: none; box-shadow: var(--focus); background: var(--surface-2); }
.viewtoggle button:focus-visible { outline: none; box-shadow: var(--focus); }

/* reduced-motion guard for the filter sheet open animation */
@media (prefers-reduced-motion: reduce) {
  .fsheet--open .fsheet__panel { animation: none; }
}
