/* The maps (T13 place pages, T12 profiles; A2: MapLibre on OpenStreetMap). Wide windows: list left, sticky map
   right, sized from the first paint (no layout shift). Narrow windows: list or map, switched by the
   "Karte anzeigen" / "Liste anzeigen" button in a bar docked to the bottom edge. Before the visitor's intent
   a map area is our own placeholder; MapLibre's stylesheet comes with the map. */

.place-results--map {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}
.place-results__list {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}
.place-map {
  position: relative;
  min-width: 0;
}
.place-map__skip {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 3;
  padding: 10px 16px;
  border-radius: var(--r-control);
  background: var(--pl-teal-deep);
  color: #fff;
  font-weight: 700;
  transform: translateY(-200%);
  opacity: 0;
}
.place-map__skip:focus {
  transform: none;
  opacity: 1;
  color: #fff;
}
.place-map__frame {
  position: relative;
  height: min(620px, calc(100vh - 32px));
  border: 1.5px solid var(--pl-line);
  border-radius: var(--r-card);
  overflow: hidden;
  background-color: #dcebee;
  background-image: linear-gradient(#ffffff 2px, transparent 2px), linear-gradient(90deg, #ffffff 2px, transparent 2px);
  background-size: 96px 96px;
}
.place-map__canvas {
  position: absolute;
  inset: 0;
}
/* MapLibre's stylesheet makes its container `position: relative`; the canvas keeps filling the frame. */
.place-map__canvas.maplibregl-map,
.profile-location__canvas.maplibregl-map {
  position: absolute;
}
/* Before the map: our own picture (the frame's grid) with one button; nothing is requested from anyone. */
.map-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  padding: var(--sp-6);
  text-align: center;
}
.map-placeholder__icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-round);
  background: var(--pl-surface-card);
  color: var(--pl-teal-deep);
  box-shadow: var(--sh-1);
}
.map-placeholder__button {
  background: var(--pl-surface-card);
}
.map-placeholder__button[hidden] {
  display: none;
}
.map-placeholder__note {
  max-width: 340px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-8);
  background: var(--pl-surface-card);
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--pl-ink-muted);
}
/* The attribution: always visible, above the placeholder and the map. */
.map-attribution {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  max-width: 100%;
  margin: 0;
  padding: 2px 8px;
  border-top-left-radius: var(--r-8);
  background: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  line-height: 1.5;
  color: var(--pl-ink);
}
.map-attribution a {
  color: inherit;
  text-decoration: none;
}
.map-attribution a:hover,
.map-attribution a:focus-visible {
  text-decoration: underline;
}
.place-map__status {
  position: absolute;
  left: 12px;
  bottom: 30px;
  z-index: 2;
  display: none;
  align-items: center;
  gap: var(--sp-2);
  max-width: calc(100% - 24px);
  padding: 6px 10px;
  border-radius: var(--r-8);
  background: var(--pl-surface-card);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--pl-ink-muted);
}
.place-map__status.is-visible {
  display: inline-flex;
}
.place-map__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-4);
  margin: var(--sp-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-label);
  font-weight: 600;
  color: var(--pl-ink-muted);
}
.place-map__legend li {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.place-map__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 2px solid #fff;
  border-radius: var(--r-round);
  box-shadow: 0 0 0 1px var(--pl-line);
}
.place-map__key--pin {
  min-width: 22px;
  height: 22px;
  border-radius: var(--r-pill-inf);
  background: var(--pl-teal-deep);
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}
.place-map__key--dot {
  width: 14px;
  height: 14px;
  border-width: 3px;
  background: var(--pl-teal-deep);
}
.place-map__key--other {
  width: 10px;
  height: 10px;
  background: #8aa6ac;
}

/* The card of the chosen pin (board "City": `.card.on`). */
.listing-card.is-map-active {
  outline: 2px solid var(--pl-teal-deep);
  outline-offset: -2px;
  box-shadow: var(--sh-2);
}

/* The markers: HTML buttons on one layer above the map (map-view.js moves them; a group glides, fades and grows
   like the app's `map-cluster-controller.dart`). The button is the point; its face is drawn around it. */
.map-layer {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
}
.map-marker {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  will-change: transform, opacity;
}
.map-marker:focus {
  outline: none;
}
.map-marker > span {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transform: translate(-50%, -50%);
  transition: transform 0.2s var(--ez-soft), background-color 0.2s var(--ez-soft);
}
.map-marker:focus-visible > span {
  outline: 3px solid var(--pl-coral-deep);
  outline-offset: 2px;
}
/* A transparent ring around the small faces, so they are easy to hit. */
.map-pin--dot::before,
.map-pin--other::before {
  content: "";
  position: absolute;
  inset: -10px;
}
/* The numbered pin of a practice of the list: a bubble with a tip at the point. */
.map-pin--pin {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 2px solid #fff;
  border-radius: var(--r-pill-inf);
  background: var(--pl-teal-deep);
  box-shadow: 0 2px 10px rgba(0, 61, 74, 0.3);
  font: 800 14px var(--font-body);
  color: #fff;
}
.map-marker--pin > span {
  transform: translate(-50%, calc(-100% - 7px));
}
.map-pin--pin::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  border: 6px solid transparent;
  border-top: 7px solid var(--pl-teal-deep);
  border-bottom: 0;
  transform: translateX(-50%);
}
/* Another online bookable practice: a brand-coloured dot, no number. */
.map-pin--dot {
  width: 16px;
  height: 16px;
  border: 3px solid #fff;
  border-radius: var(--r-round);
  background: var(--pl-teal-deep);
  box-shadow: 0 1px 6px rgba(0, 61, 74, 0.35);
}
/* Another vet clinic, not bookable online: the smallest neutral circle. */
.map-pin--other {
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: var(--r-round);
  background: #8aa6ac;
  box-shadow: 0 1px 3px rgba(0, 61, 74, 0.3);
}
.map-marker:hover > .map-pin--pin,
.map-marker.is-hovered-card > .map-pin--pin,
.map-marker.is-active > .map-pin--pin {
  background: var(--pl-teal-deepest);
  transform: translate(-50%, calc(-100% - 7px)) scale(1.15);
}
.map-marker.is-active > .map-pin--pin::after,
.map-marker.is-hovered-card > .map-pin--pin::after {
  border-top-color: var(--pl-teal-deepest);
}
.map-marker:hover > .map-pin--dot,
.map-marker:hover > .map-pin--other,
.map-marker.is-active > .map-pin--dot,
.map-marker.is-active > .map-pin--other {
  transform: translate(-50%, -50%) scale(1.35);
}
.map-marker.is-active {
  z-index: 3;
}
.map-marker--pin {
  z-index: 2;
}
/* A group: grows and shrinks with its count. */
.map-cluster {
  border: 3px solid #fff;
  border-radius: var(--r-round);
  box-shadow: 0 0 0 4px rgba(59, 164, 179, 0.24);
  font: 800 14px var(--font-body);
  color: #fff;
  transition:
    width 0.36s var(--ez-soft),
    height 0.36s var(--ez-soft),
    transform 0.2s var(--ez-soft);
}
.map-marker--bookable > .map-cluster {
  background: var(--pl-teal-deep);
}
.map-marker--other > .map-cluster {
  background: var(--pl-ink-2);
  box-shadow: 0 0 0 4px rgba(74, 110, 119, 0.24);
}
.map-marker--cluster:hover > .map-cluster {
  transform: translate(-50%, -50%) scale(1.08);
}
.map-marker--cluster {
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  .map-marker > span,
  .map-cluster {
    transition: none;
  }
}

/* Away from the place: back to its practices. */
.place-map__back {
  position: absolute;
  top: 12px;
  left: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 16px;
  border: 1.5px solid var(--pl-teal-deep);
  border-radius: var(--r-pill-inf);
  background: var(--pl-surface-card);
  box-shadow: var(--sh-2);
  font: 700 var(--fs-body) var(--font-body);
  color: var(--pl-teal-deep);
  cursor: pointer;
  transform: translateX(-50%);
  white-space: nowrap;
}
.place-map__back .icon {
  transform: rotate(180deg);
}

/* The info card of a pin, in MapLibre's popup (above the markers; MapLibre's stylesheet loads later, hence the
   longer selectors). */
.place-map .maplibregl-popup,
.profile-location .maplibregl-popup {
  z-index: 3;
}
.place-map .maplibregl-popup-content {
  padding: 14px 16px 12px;
  border-radius: var(--r-card);
  box-shadow: var(--sh-2);
}
.place-map .maplibregl-popup-close-button {
  width: 32px;
  height: 32px;
  font-size: 20px;
  color: var(--pl-ink-muted);
}

.map-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 260px;
  font-family: var(--font-body);
  color: var(--pl-ink);
}
.map-info__name {
  font-family: var(--font-display);
  font-size: var(--fs-lead);
  font-weight: 600;
  line-height: 1.2;
  color: var(--pl-teal-deep);
  overflow-wrap: anywhere;
}
.map-info__line {
  font-size: var(--fs-body);
  font-weight: 600;
  color: var(--pl-ink-muted);
  overflow-wrap: anywhere;
}
.map-info__hours {
  color: var(--pl-ink);
}
.map-info__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-1);
}
.map-info__actions .btn {
  min-height: 40px;
  padding: 0 14px;
  font-size: var(--fs-body);
}

/* The switch between list and map on narrow windows: a bar docked to the bottom edge (Patrick Palacin's review,
   24 November 2026: a floating button sat on a card's "Termin buchen"). The page keeps the bar's height free
   below its content (`has-map-toggle`), so every card can be scrolled fully above the bar, and the bar never
   lies over a card in the middle of the screen. */
.map-toggle {
  --map-toggle-height: 72px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  display: flex;
  justify-content: center;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1.5px solid var(--pl-line);
  background: var(--pl-surface-card);
  box-shadow: 0 -4px 16px rgba(0, 61, 74, 0.08);
}
.map-toggle__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  max-width: 420px;
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--r-pill-inf);
  background: var(--pl-teal-deep);
  font: 700 var(--fs-md) var(--font-body);
  color: #fff;
  cursor: pointer;
}
.map-toggle[hidden],
.map-toggle [hidden] {
  display: none;
}
.map-toggle span {
  display: inline-flex;
}
/* An open filter menu (place-list.js) is never covered by the bar: the bar steps aside until the menu closes. */
.has-filter-menu-open .map-toggle {
  display: none;
}
@media (max-width: 959px) {
  .has-map-toggle {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  /* The bar already keeps the footer clear of the browser's bottom bar (base.css). */
  .has-map-toggle .site-footer__inner {
    padding-bottom: 28px;
  }
}

/* List and map side by side from 960 px (Patrick review: landscape tablets such as 1006 × 523). */
@media (min-width: 960px) {
  .place-results--map {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 42%);
  }
  .place-map {
    position: sticky;
    top: 16px;
  }
  .map-toggle {
    display: none !important;
  }
}

@media (max-width: 959px) {
  .place-map {
    display: none;
  }
  .place-page.is-map-view .place-map {
    display: block;
  }
  .place-page.is-map-view .place-results__list {
    display: none;
  }
  .place-map__frame {
    height: calc(100vh - 160px);
    height: calc(100dvh - 160px);
    min-height: 360px;
  }
}

/* The practice's own pin on the profile's map: a drop with its tip at the point. */
.map-pin--place {
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  background: var(--pl-teal-deep);
  box-shadow: 0 3px 10px rgba(0, 61, 74, 0.3);
}
.map-marker--place > span {
  transform: translate(-50%, -125%) rotate(-45deg);
}
.map-marker--place:hover > span {
  background: var(--pl-teal-deepest);
}
