/* MAP-MOBILE-UX-2026-10-06
   Keep desktop Leaflet popups unchanged. On mobile, surface the selected store
   as a compact bottom card inside the map so all primary actions stay visible. */
.map-mobile-store-card {
  display: none;
}

@media (max-width: 760px) {
  /* Mobile uses the custom bottom store card only.
     Hide Leaflet's native popup before popupopen JS runs to prevent a one-frame flash. */
  #clawMap.ppob-mobile-card-ready .leaflet-popup {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  #clawMap.ppob-mobile-card-ready .leaflet-popup.ppob-mobile-popup-hidden {
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  #clawMap .map-mobile-store-card {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 920;
    display: block;
    max-height: min(220px, calc(100% - 88px));
    overflow: auto;
    border: 1px solid rgba(226, 211, 218, .96);
    border-radius: 18px;
    background: rgba(255, 255, 255, .98);
    padding: 14px 14px 13px;
    box-shadow: 0 12px 32px rgba(59, 42, 50, .18);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity .16s ease, transform .18s ease;
  }

  #clawMap .map-mobile-store-card.is-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  #clawMap .map-mobile-store-card[hidden] {
    display: none !important;
  }

  #clawMap .map-mobile-store-card-close {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: #f7f2f4;
    color: #705e66;
    padding: 0;
    font-family: system-ui, sans-serif;
    font-size: 1.15rem;
    line-height: 1;
  }

  #clawMap .map-mobile-store-card-body {
    min-width: 0;
    padding-right: 24px;
  }

  #clawMap .map-mobile-store-card .store-popup {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding: 0;
  }

  #clawMap .map-mobile-store-card .store-popup strong,
  #clawMap .map-mobile-store-card .store-popup p,
  #clawMap .map-mobile-store-card .store-popup span {
    grid-column: 1 / -1;
  }

  #clawMap .map-mobile-store-card .store-popup strong {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 1px;
    padding-right: 5px;
    font-size: 1rem;
    line-height: 1.28;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #clawMap .map-mobile-store-card .store-popup p {
    display: -webkit-box;
    overflow: hidden;
    margin: 0 0 2px;
    color: #74636b;
    font-size: .76rem;
    line-height: 1.42;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  #clawMap .map-mobile-store-card .store-popup button,
  #clawMap .map-mobile-store-card .store-popup a {
    width: 100%;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    border-radius: 11px;
    padding: 0 9px;
    font-size: .72rem;
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
  }

  #clawMap .map-mobile-store-card .store-popup button {
    border: 0;
    background: var(--primary);
    color: #fff;
  }

  #clawMap .map-mobile-store-card .store-popup a {
    border: 1px solid #efd8e2;
    background: #fff7fa;
    color: #aa3d6a;
    text-decoration: none;
  }
}

@media (max-width: 760px) {
  /* Keep Leaflet controls within the map's stacking layer, behind site navigation. */
  #mapSection .map-canvas-wrap {
    isolation: isolate;
    overflow: hidden;
  }

  #mapSection .store-panel {
    max-height: min(360px, 52svh);
    scroll-margin-top: 72px;
  }

  #mapSection .store-panel-head {
    flex-shrink: 0;
  }

  #mapSection .store-list {
    min-height: 0;
  }
}
