/* Shared by the media-grid map card and the legacy standalone map section. */
.store-map-section {
  width: 100%;
}

.store-map-shell {
  --store-map-desktop-ratio: 5 / 2;
  --store-map-mobile-ratio: 1 / 1;
  --store-map-marker-background: rgb(var(--color-button-background));
  --store-map-marker-color: rgb(var(--color-button-text));
  --store-map-radius: 0px;

  display: block;
  width: 100%;
}

.store-map-container {
  position: relative;
  width: 100%;
  aspect-ratio: var(--store-map-desktop-ratio);
  overflow: hidden;
  border-radius: var(--store-map-radius);
  background: rgb(var(--color-background));
  isolation: isolate;
}

.store-map-canvas {
  position: absolute;
  inset: 0;
}

.store-map-status {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(var(--color-background));
  color: rgb(var(--color-text));
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.store-map-shell[data-map-ready="true"] .store-map-status {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.store-map-shell[data-map-state="empty"] .store-map-status,
.store-map-shell[data-map-state="error"] .store-map-status {
  background: color-mix(in srgb, currentColor 4%, transparent);
}

.store-map-shell .maplibregl-map,
.store-map-shell .maplibregl-canvas-container,
.store-map-shell .maplibregl-canvas {
  width: 100%;
  height: 100%;
}

.store-map-shell .maplibregl-canvas {
  display: block;
  outline: none;
}

.store-map-shell .maplibregl-canvas:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.store-map-count-marker,
.store-map-pin {
  appearance: none;
  margin: 0;
  border: 0;
  font: inherit;
  cursor: pointer;
}

/* MapLibre writes the marker position to an inline transform on every frame.
   Never animate that transform or the marker will trail behind the map while
   panning, especially during touch momentum. */
.store-map-shell .maplibregl-marker {
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  transition: none !important;
  animation: none !important;
  will-change: transform;
}

.store-map-count-marker {
  width: 48px;
  height: 48px;
  padding: 7px 5px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 50%;
  background: var(--store-map-marker-background);
  color: var(--store-map-marker-color);
  white-space: nowrap;
  user-select: none;
  line-height: 1;
  text-align: center;
}

.store-map-count-marker:focus-visible,
.store-map-pin:focus-visible {
  outline: 2px solid rgb(var(--color-text));
  outline-offset: 3px;
}

.store-map-count-marker__label {
  max-width: 74px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  text-overflow: ellipsis;
}

.store-map-count-marker__count {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.store-map-pin {
  width: 20px;
  height: 20px;
  border: 3px solid rgb(var(--color-button-text));
  border-radius: 50%;
  background: rgb(var(--color-button-background));
  box-shadow: 0 2px 8px rgb(0 0 0 / 25%);
}

.store-map-shell .maplibregl-popup {
  max-width: min(300px, calc(100vw - 48px)) !important;
}

.store-map-shell .maplibregl-popup-content {
  padding: 16px 18px;
  border-radius: 10px;
  color: rgb(var(--color-text));
  background: rgb(var(--color-background));
  font: inherit;
  line-height: 1.45;
  box-shadow: 0 8px 28px rgb(0 0 0 / 16%);
}

.store-map-shell .maplibregl-popup-anchor-top .maplibregl-popup-tip,
.store-map-shell .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.store-map-shell .maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: rgb(var(--color-background));
}

.store-map-shell .maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.store-map-shell .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.store-map-shell .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: rgb(var(--color-background));
}

.store-map-shell .maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: rgb(var(--color-background));
}

.store-map-shell .maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: rgb(var(--color-background));
}

.store-map-popup {
  display: grid;
  gap: 8px;
  min-width: 180px;
  font-size: 13px;
}

.store-map-popup__name {
  padding-inline-end: 18px;
  font-size: 15px;
  font-weight: 700;
}

.store-map-popup__hours {
  white-space: pre-line;
}

.store-map-popup__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding-top: 2px;
}

.store-map-popup__links a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.store-map-shell .maplibregl-popup-close-button {
  width: 32px;
  height: 32px;
  padding: 0;
  color: rgb(var(--color-text));
  font-size: 22px;
  line-height: 32px;
  cursor: pointer;
}

.store-map-shell .maplibregl-ctrl-top-right {
  top: 12px;
  right: 12px;
}

.store-map-shell .maplibregl-ctrl-group {
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgb(0 0 0 / 12%);
}

.store-map-shell .maplibregl-ctrl-group button {
  cursor: pointer;
}

.store-map-shell .maplibregl-ctrl-attrib {
  display: none;
}

@media (max-width: 768px) {
  .store-map-container {
    aspect-ratio: var(--store-map-mobile-ratio);
  }

  .store-map-count-marker {
    width: 52px;
    height: 52px;
  }

  .store-map-count-marker__label {
    font-size: 11px;
  }

  .store-map-count-marker__count {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .store-map-count-marker,
  .store-map-pin,
  .store-map-status {
    transition: none;
  }
}
