/* ============================================================
   SUN ICE — Locator (slim)
   ============================================================ */

body { background: var(--paper); }

/* ---------- SEARCH BAR ---------- */
.search-bar {
  background: var(--sun-yellow);
  border-bottom: 1.5px solid var(--ink);
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.search-bar__title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 0.95;
  font-size: clamp(28px, 3.4vw, 44px);
  margin: 0;
  color: var(--ink);
  text-align: center;
  text-wrap: balance;
}

.search-bar__form {
  display: flex;
  align-items: center;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  width: 100%;
  max-width: 560px;
  padding: 4px 4px 4px 18px;
  transition: border-color 120ms ease;
  box-shadow: 0 2px 0 0 var(--ink);
}
.search-bar__form:focus-within { border-color: var(--ink); }

.search-bar__icon {
  width: 18px; height: 18px;
  color: var(--fg-muted);
  flex-shrink: 0;
  margin-right: 10px;
}

.search-bar__form input {
  flex: 1; min-width: 0;
  border: none; outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  padding: 10px 4px;
}
.search-bar__form input::placeholder { color: var(--fg-muted); }

.search-bar__geo {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 120ms ease, color 120ms ease;
}
.search-bar__geo:hover { background: var(--paper-warm); }
.search-bar__geo svg { width: 18px; height: 18px; }
.search-bar__geo.is-locating { animation: ro-spin 800ms linear infinite; }
@keyframes ro-spin { to { transform: rotate(360deg); } }

.search-bar__submit {
  border: none;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 14px;
  padding: 0 22px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 120ms ease;
}
.search-bar__submit:hover { background: var(--ink-soft); }

.search-bar__status {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 0.01em;
  opacity: 0.75;
}
.search-bar__status #resultCount,
.search-bar__status #nearLabel {
  font-weight: 700;
  color: var(--ink);
  opacity: 1;
}
.search-bar__sep { margin: 0 6px; opacity: 0.5; }

/* ---------- MAIN LAYOUT ---------- */
.locator {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px - 56px - 22px - 60px);
  min-height: 560px;
  max-height: 820px;
  max-width: 1320px;
  margin: 16px auto;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  overflow: hidden;
  background: var(--paper);
}

/* Map on top, list below */
.locator .map-wrap { order: 1; height: 38%; min-height: 0; border-bottom: 1px solid var(--hairline); border-right: none; }
.locator .rail     { order: 2; border-left: none; height: 62%; min-height: 0; }

/* ---------- LIST RAIL ---------- */
.rail {
  order: 2;
  border-left: 1px solid var(--hairline);
  background: var(--paper);
  display: flex; flex-direction: column;
  min-height: 0;
}
.rail__list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  background: var(--paper);
}
.rail__list::-webkit-scrollbar { width: 8px; }
.rail__list::-webkit-scrollbar-thumb { background: var(--hairline-strong); border-radius: 999px; }

.store {
  position: relative;
  padding: 16px 22px;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  background: var(--paper);
  transition: background 100ms;
}
.store:hover { background: var(--paper-warm); }
.store.is-active { background: var(--paper-warm); }
.store.is-active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sun-blue);
}

.store__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.store__name {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 1.15;
  font-size: 15px;
  margin: 0;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}
.store__dist {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}
.store__addr {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.4;
  margin: 0;
}
.store__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  text-decoration: none;
  padding: 6px 12px;
  border: 1.25px solid var(--hairline-strong);
  border-radius: 999px;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.store__cta:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.store__cta svg { width: 11px; height: 11px; }

/* hide legacy bits not used in slim layout */
.store__rank, .store__meta, .store__links, .store__type, .store__flavors,
.geo-btn, .helper-tags, .helper-tag, .helper-label, .search-bar__copy,
.search-bar__controls, .search-bar__row, .rail__count { display: none !important; }

/* Rail header — context above the list */
.rail__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 2;
}
.rail__header-eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}
.rail__header-count {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
}

/* State divider — between groups when list is sorted by state */
.state-divider {
  padding: 14px 22px 6px;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border-top: 1px solid var(--hairline);
}
.state-divider:first-child { border-top: none; }

/* National view — state summary + hint */
.rail__hint {
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--hairline);
}
.rail__hint-title {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  font-size: 15px;
  margin: 0 0 6px;
  color: var(--ink);
}
.rail__hint p {
  font-size: 13px;
  color: var(--fg-muted);
  line-height: 1.45;
  margin: 0;
}
.state-list { display: flex; flex-direction: column; }
.state-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border: none;
  border-bottom: 1px solid var(--hairline);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--font-body);
  text-align: left;
  transition: background 100ms;
}
.state-row:hover { background: var(--paper-warm); }
.state-row__name {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  font-size: 14px;
  color: var(--ink);
}
.state-row__count {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  background: var(--sun-yellow);
  border: 1.25px solid var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  min-width: 32px;
  text-align: center;
}

.empty-state {
  padding: 56px 28px;
  text-align: center;
  color: var(--fg-muted);
}
.empty-state h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--ink);
}
.empty-state p { margin: 0 0 16px; font-size: 14px; line-height: 1.4; }

/* ---------- MAP (Leaflet) ---------- */
.map-wrap {
  order: 1;
  position: relative;
  background: #F1ECDE;
  overflow: hidden;
}
.map-stage {
  width: 100%;
  height: 100%;
  background: #F1ECDE;
}

/* Custom numbered pin (cream + ink ring, matches brand) */
.leaflet-pin {
  width: 30px; height: 30px;
  border-radius: 999px;
  background: var(--paper);
  border: 2px solid var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  line-height: 1;
  box-shadow: 0 2px 6px -1px rgba(10,10,10,0.18);
  transition: transform 140ms ease, background 140ms ease;
  cursor: pointer;
}
.leaflet-pin:hover { background: var(--paper-warm); }
.leaflet-pin.is-active {
  background: var(--ink);
  color: var(--paper);
  transform: scale(1.18);
  z-index: 1000;
}

/* ---------- MARKER CLUSTERS ---------- */
/* Yellow circle totaling stores when zoomed out; breaks apart into
   individual black pins as you zoom in. */
.leaflet-marker-icon.marker-cluster {
  background: transparent !important;
  background-clip: padding-box !important;
}
.marker-cluster div {
  width: 40px !important;
  height: 40px !important;
  margin-left: 0 !important;
  margin-top: 0 !important;
  background: var(--sun-yellow) !important;
  background-color: var(--sun-yellow) !important;
  border: 2px solid var(--ink) !important;
  border-radius: 999px !important;
  font-family: var(--font-body) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  color: var(--ink) !important;
  line-height: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 2px 8px -2px rgba(10,10,10,0.25);
  transition: transform 140ms ease;
  opacity: 1 !important;
}
.marker-cluster:hover div { transform: scale(1.08); }
.marker-cluster span {
  font-family: var(--font-body) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  color: var(--ink) !important;
  line-height: 1 !important;
}
/* Larger clusters get slightly bigger circles to convey density */
.marker-cluster-small  div { width: 36px !important; height: 36px !important; font-size: 12px !important; }
.marker-cluster-medium div { width: 44px !important; height: 44px !important; font-size: 14px !important; }
.marker-cluster-large  div { width: 52px !important; height: 52px !important; font-size: 16px !important; }
.marker-cluster-small  span { font-size: 12px !important; }
.marker-cluster-medium span { font-size: 14px !important; }
.marker-cluster-large  span { font-size: 16px !important; }

/* Black pin (single retailer) — replaces the cream pin when zoomed in */
.leaflet-pin--dot {
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--ink);
  border: 2px solid var(--paper);
  box-shadow: 0 1px 3px rgba(10,10,10,0.35);
  transition: transform 120ms ease;
  cursor: pointer;
}
.leaflet-pin--dot:hover { transform: scale(1.4); }
.leaflet-pin--dot.is-active {
  background: var(--sun-blue);
  border-color: var(--ink);
  transform: scale(1.5);
  z-index: 1000;
}

/* Leaflet UI overrides — brand-light */
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-zoom a {
  background: var(--paper) !important;
  color: var(--ink) !important;
  border: 1px solid var(--hairline-strong) !important;
  font-weight: 700;
  width: 32px !important;
  height: 32px !important;
  line-height: 30px !important;
}
.leaflet-control-zoom a:hover {
  background: var(--ink) !important;
  color: var(--paper) !important;
  border-color: var(--ink) !important;
}
.leaflet-control-zoom-in { border-radius: 999px 999px 0 0 !important; }
.leaflet-control-zoom-out { border-radius: 0 0 999px 999px !important; }
.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(247,244,236,0.85) !important;
  color: var(--fg-muted) !important;
}
.leaflet-control-attribution a { color: var(--ink) !important; }

/* Leaflet popup — brand-styled */
.leaflet-popup-content-wrapper {
  background: var(--paper) !important;
  border: 1px solid var(--hairline-strong) !important;
  border-radius: 12px !important;
  box-shadow: 0 12px 32px -8px rgba(10,10,10,0.18) !important;
  padding: 4px !important;
}
.leaflet-popup-content { margin: 14px 16px !important; min-width: 200px; }
.leaflet-popup-tip { background: var(--paper) !important; }
.leaflet-popup-close-button {
  color: var(--fg-muted) !important;
  font-size: 22px !important;
  padding: 6px 8px 0 0 !important;
}
.lpop { display: flex; flex-direction: column; gap: 6px; }
.lpop__name {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  line-height: 1.1;
  font-size: 16px;
  color: var(--ink);
}
.lpop__addr { font-size: 12.5px; color: var(--fg-muted); line-height: 1.4; }
.lpop__row { font-size: 12.5px; color: var(--fg-muted); }
.lpop__btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 4px;
  background: var(--ink);
  color: var(--paper) !important;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none !important;
  transition: background 120ms ease;
}
.lpop__btn:hover { background: var(--ink-soft); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1000px) {
  .search-bar { padding: 24px 20px 20px; gap: 14px; }
  .search-bar__form { max-width: 100%; }
  .search-bar__submit { padding: 0 16px; }

  /* Bounded locator section on mobile — like Google Maps' map-card behavior.
     The whole locator is its own card; you can scroll past it to reach the
     rest of the page. Map sits on top, list scrolls INSIDE the card. */
  .locator {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    height: 80vh;
    min-height: 520px;
    max-height: 720px;
    border: 1px solid var(--hairline);
    border-radius: 14px;
    margin: 16px;
    overflow: hidden;
    background: var(--paper);
  }
  .map-wrap {
    order: 1;
    position: relative;
    top: auto;
    z-index: auto;
    height: 34%;
    min-height: 0;
    flex: 0 0 auto;
    border-bottom: 1px solid var(--hairline);
  }
  .rail {
    order: 2;
    border-left: none;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    background: var(--paper);
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
  }
  .rail__list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    max-height: none;
  }
}
