/* =============================================================================
   Store Locator — minimal / Revolut-flavoured UI
   Light by default, dark when the OS asks for it.
============================================================================= */

:root {
  --bg:          #F3F4F6;
  --surface:     #FFFFFF;
  --surface-2:   #F7F8FA;
  --glass:       rgba(255,255,255,.82);
  --line:        rgba(17,19,24,.08);
  --line-strong: rgba(17,19,24,.14);

  --text:        #111318;
  --text-2:      #5B616E;
  --text-3:      #8A909C;

  --accent:      #0666EB;
  --accent-soft: rgba(6,102,235,.10);
  --ok:          #12A150;
  --warn:        #E8452C;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --sh-1: 0 1px 2px rgba(17,19,24,.06), 0 4px 16px rgba(17,19,24,.06);
  --sh-2: 0 2px 6px rgba(17,19,24,.08), 0 18px 48px rgba(17,19,24,.14);
  --sh-pin: 0 2px 6px rgba(17,19,24,.24), 0 8px 22px rgba(17,19,24,.22);

  --ease: cubic-bezier(.22,.61,.36,1);
  --panel-w: 400px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* Light only for now — the palette above is the whole theme. */
:root { color-scheme: light; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- MAP ---- */
.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  cursor: grab;
  touch-action: none;
}
/* Ambient wash so letterboxing around the map reads as intentional. */
.stage::before {
  content: '';
  position: absolute;
  inset: -12%;
  background: var(--map-url) center / cover no-repeat;
  filter: blur(70px) saturate(130%);
  opacity: .45;
  transform: scale(1.15);
  pointer-events: none;
}
.stage.dragging { cursor: grabbing; }
.stage.placing  { cursor: crosshair; }

.canvas {
  position: absolute;
  box-shadow: 0 0 0 1px rgba(0,0,0,.06), 0 40px 120px rgba(0,0,0,.28);
  top: 0; left: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.canvas.animate { transition: transform .58s var(--ease); }
/* Held back until the stage reports a real size, so a viewport that is still
   settling never shows a mis-scaled map. */
.canvas { opacity: 0; }
.stage.ready .canvas { opacity: 1; transition: opacity .35s var(--ease); }

.map-image {
  display: block;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
  image-rendering: auto;
}
.pins { position: absolute; inset: 0; }

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(0,0,0,.22) 100%);
}

/* ---------------------------------------------------------------- PINS --- */
.pin {
  position: absolute;
  width: 0; height: 0;
  /* counter-scale so markers keep a constant on-screen size at any zoom */
  transform: scale(var(--inv, 1));
  transform-origin: center;
}
.pin-halo {
  position: absolute;
  left: 0; top: 0;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  pointer-events: none;
  /* a constant soft glow so the spot reads even between pulses */
  background: radial-gradient(circle, var(--pin-color, var(--accent)) 0%, transparent 68%);
  opacity: .5;
  transform: scale(2.6);
}
.pin-halo::before,
.pin-halo::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pin-color, var(--accent));
  opacity: .5;
  animation: heat 3s var(--ease) infinite;
}
.pin-halo::after { animation-delay: 1.5s; }
@keyframes heat {
  0%   { transform: scale(.42); opacity: .55; }
  70%  { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(1.3); opacity: 0; }
}

.pin-inner {
  position: absolute;
  left: 0; top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-pin);
  white-space: nowrap;
  cursor: pointer;
  /* the dot — not the middle of the pill — sits on the map point */
  transform: translate(-18px, -50%);
  transform-origin: 18px 50%;
  transition: transform .22s var(--ease), opacity .22s var(--ease), box-shadow .22s var(--ease);
}
.pin-inner:hover  { transform: translate(-18px, -50%) scale(1.07); }
.pin-inner:active { transform: translate(-18px, -50%) scale(.98); }

.pin-dot {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--pin-color, var(--accent));
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.22);
}
.pin-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin.is-anchor .pin-halo { width: 32px; height: 32px; margin: -16px 0 0 -16px; }
.pin.is-anchor .pin-dot { width: 32px; height: 32px; font-size: 11px; }
.pin.is-anchor .pin-label { font-size: 13.5px; }
.pin.is-anchor .pin-inner { transform: translate(-21px, -50%); transform-origin: 21px 50%; }
.pin.is-anchor .pin-inner:hover  { transform: translate(-21px, -50%) scale(1.07); }
.pin.is-anchor .pin-inner:active { transform: translate(-21px, -50%) scale(.98); }

.pin.is-dim .pin-inner { opacity: .16; pointer-events: none; filter: grayscale(1); }
.pin.is-dim .pin-halo  { opacity: 0; }
.pin.is-hidden { display: none; }

.pin.is-active .pin-inner {
  background: var(--text);
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(17,19,24,.3), 0 16px 40px rgba(17,19,24,.32);
  transform: translate(-18px, -50%) scale(1.1);
}
.pin.is-active.is-anchor .pin-inner { transform: translate(-21px, -50%) scale(1.1); }
.pin.is-active .pin-label { color: var(--surface); }
.pin.is-active { z-index: 5; }

/* Labels collapse to bare dots when the map is zoomed out */
.zoomed-out .pin:not(.is-active):not(.is-anchor) .pin-label { display: none; }
.zoomed-out .pin:not(.is-active):not(.is-anchor) .pin-inner { padding: 5px; }

/* ------------------------------------------------------------- TOP BAR --- */
.topbar {
  position: fixed;
  top: calc(16px + var(--safe-t));
  left: 16px;
  z-index: 30;
  width: min(380px, calc(100vw - 32px));
  display: flex;
  pointer-events: none;
  flex-direction: column;
  gap: 10px;
}
.search-shell, .chips { pointer-events: auto; }
.search-shell { position: relative; z-index: 2; }

/* The chip rail may run wider than the search field on roomy screens. */
@media (min-width: 761px) {
  .chips { width: min(760px, calc(100vw - 32px)); }
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 8px 0 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.search:focus-within {
  border-color: transparent;
  box-shadow: var(--sh-1), 0 0 0 2px var(--accent);
}
.search-icon { width: 19px; height: 19px; flex: none; color: var(--text-3); }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
}
.search input::placeholder { color: var(--text-3); font-weight: 450; }
.search input:focus { outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear {
  flex: none;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  background: var(--surface-2);
}
.search-clear svg { width: 15px; height: 15px; }
.search-clear:hover { color: var(--text); }

.results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  max-height: min(52vh, 440px);
  overflow-y: auto;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  animation: pop .18s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(-6px); } }

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background .14s var(--ease);
}
.result:hover, .result.is-cursor { background: var(--surface-2); }
.result-name { font-size: 14px; font-weight: 600; }
.result-meta { font-size: 12px; color: var(--text-2); }
.result-empty { padding: 18px 14px; font-size: 13.5px; color: var(--text-2); text-align: center; }

.avatar {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
}

/* -------------------------------------------------------------- CHIPS ---- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  margin: -2px -2px -6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
  transition: transform .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip .chip-icon { font-size: 14px; line-height: 1; }
.chip .chip-count {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.chip.is-on {
  background: var(--text);
  border-color: transparent;
  color: var(--surface);
}
.chip.is-on .chip-count { color: rgba(255,255,255,.55); }

/* ----------------------------------------------------------- CONTROLS ---- */
.controls {
  position: fixed;
  right: 16px;
  bottom: calc(20px + var(--safe-b));
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  transition: transform .5s var(--ease);
}
/* Slide the controls clear of the detail panel. */
@media (min-width: 761px) {
  body.panel-open .controls { transform: translateX(calc(-1 * (var(--panel-w) + 8px))); }
}
.ctl {
  width: 40px; height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  color: var(--text);
  transition: background .14s var(--ease);
}
.ctl:hover { background: var(--surface-2); }
.ctl:active { transform: scale(.94); }
.ctl svg { width: 19px; height: 19px; }

.legend {
  position: fixed;
  left: 16px;
  bottom: calc(20px + var(--safe-b));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-1);
}
.legend b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- PANEL ---- */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(10,12,16,.28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fade .28s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.panel {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 40;
  width: var(--panel-w);
  max-width: calc(100vw - 24px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--sh-2);
  overflow: hidden;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  pointer-events: none;
  transition: transform .48s var(--ease), opacity .3s var(--ease);
}
.panel.is-open { transform: none; opacity: 1; pointer-events: auto; }
.panel-grip { display: none; }

.panel-close {
  position: absolute;
  top: 14px; right: 14px;
  z-index: 3;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(10,12,16,.42);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.panel-close svg { width: 15px; height: 15px; }
.panel-close:hover { background: rgba(10,12,16,.62); }

.panel-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.panel-scroll::-webkit-scrollbar { width: 8px; }
.panel-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; border: 2px solid var(--surface); }

/* hero */
.hero {
  position: relative;
  aspect-ratio: 16 / 10;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.hero::-webkit-scrollbar { display: none; }
.hero-slide {
  flex: none;
  width: 100%;
  scroll-snap-align: center;
  background-size: cover;
  background-position: center;
}
.hero-dots {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 5px;
  pointer-events: none;
}
.hero-dots i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,.5);
  transition: width .24s var(--ease), background .24s var(--ease);
}
.hero-dots i.is-on { width: 16px; background: #fff; }

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 0;
  margin-top: -34px;
  position: relative;
}
.panel-logo {
  flex: none;
  width: 64px; height: 64px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  border: 3px solid var(--surface);
  box-shadow: var(--sh-1);
}
.panel-title { padding-top: 38px; min-width: 0; }
.panel-title h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.024em;
  line-height: 1.2;
}
.panel-title p { margin: 3px 0 0; font-size: 13.5px; color: var(--text-2); }

.panel-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 20px 0;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border-radius: var(--r-pill);
}
.tag.is-open  { color: var(--ok);   background: rgba(18,161,80,.10); }
.tag.is-shut  { color: var(--warn); background: rgba(232,69,44,.10); }
.tag .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* actions */
.actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 18px 20px 4px;
}
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 13px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: transform .16s var(--ease), background .16s var(--ease);
}
.action:hover { background: var(--accent-soft); color: var(--accent); }
.action:active { transform: scale(.97); }
.action svg { width: 19px; height: 19px; }
.action.is-primary { background: var(--accent); color: #fff; }
.action.is-primary:hover { background: var(--accent); filter: brightness(1.06); color: #fff; }

/* sections */
.section { padding: 22px 20px 0; }
.section:last-child { padding-bottom: 26px; }
.section h2 {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.section p { margin: 0; font-size: 14.5px; color: var(--text-2); line-height: 1.55; }

.rows { border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row.is-today { background: var(--surface-2); }
.row span { color: var(--text-2); }
.row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.row.is-today span, .row.is-today b { color: var(--text); }

.pill-list { display: flex; flex-wrap: wrap; gap: 7px; }

.link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  font-size: 14px;
  font-weight: 550;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: background .14s var(--ease);
}
.link-row:last-child { border-bottom: 0; }
.link-row:hover { background: var(--surface-2); }
.link-row svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }

.nearby { display: flex; flex-direction: column; gap: 2px; }
.nearby .result { padding: 8px 8px; }

/* ------------------------------------------------------------ EDIT HUD --- */
.edit-hud {
  position: fixed;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  font-size: 12.5px;
  color: var(--text-2);
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-2);
}
.edit-hud strong { color: var(--text); }
.edit-hud code {
  padding: 4px 9px;
  font-size: 12px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  color: var(--text);
}
kbd {
  padding: 1px 5px;
  font: inherit;
  font-size: 11px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
}

/* ------------------------------------------------------------- MOBILE ---- */
@media (max-width: 760px) {
  .topbar { left: 12px; right: 12px; width: auto; top: calc(12px + var(--safe-t)); }
  .legend { display: none; }
  .controls { bottom: calc(16px + var(--safe-b)); right: 12px; }
  .panel.is-open ~ .controls,
  body.panel-open .controls { transform: translateY(200%); }

  .panel {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-width: none;
    height: min(86vh, 780px);
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-bottom: 0;
    transform: translateY(100%);
    padding-bottom: var(--safe-b);
  }
  .panel-grip {
    display: block;
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 38px; height: 4px;
    border-radius: 99px;
    background: rgba(255,255,255,.7);
  }
  .panel-title h1 { font-size: 20px; }
  .pin-label { max-width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
