/* =========================================================
   YMU Place Detail v2.5.2 hotfix
   Stable mobile scrolling with an opt-in interactive map.
   ========================================================= */

.place-map-mobile-controls {
  display: none;
}

@media (max-width: 760px) {
  .place-detail-map-panel {
    position: relative;
  }

  .place-v2-map {
    height: min(46svh, 360px);
    min-height: 300px !important;
  }

  /*
   * Leaflet normally claims touch gestures. While locked, permit native
   * vertical momentum scrolling across the visible map.
   */
  .place-v2-map.ymu-mobile-map-locked {
    touch-action: pan-y !important;
    overscroll-behavior: auto;
  }

  .place-v2-map.ymu-mobile-map-locked .leaflet-map-pane,
  .place-v2-map.ymu-mobile-map-locked .leaflet-control-container {
    touch-action: pan-y !important;
  }

  .place-v2-map.ymu-mobile-map-active {
    touch-action: none !important;
    outline: 3px solid color-mix(
      in srgb,
      var(--accent) 58%,
      transparent
    );
    outline-offset: 2px;
  }

  .place-map-mobile-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 700;
    display: flex;
    gap: 6px;
  }

  .place-map-mobile-controls[hidden] {
    display: none !important;
  }

  .place-map-mobile-controls button {
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    color: var(--accent);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 4px 12px rgba(23, 33, 24, 0.18);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 850;
    cursor: pointer;
    backdrop-filter: blur(8px);
  }

  .place-map-mobile-controls button:hover,
  .place-map-mobile-controls button:focus-visible {
    color: #ffffff;
    background: var(--accent);
  }

  .place-map-mobile-controls button[hidden] {
    display: none !important;
  }

  /*
   * Cards remain fully visible and synchronized beneath the map.
   * No focus mode or fixed-position wrapper is used.
   */
  .place-map-destination-track {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: inline mandatory;
  }

  .place-map-layer-card {
    scroll-snap-align: start;
  }
}

/* ---------------------------------------------------------
   v2.5.2 map-control and thumbnail refinements.
   --------------------------------------------------------- */

.place-map-mobile-controls,
.place-map-mobile-controls button {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

/*
 * Keep mobile thumbnails dimensionally stable when selected.
 * The active state uses an inset ring instead of a layout-affecting outline.
 */
@media (max-width: 760px) {
  .place-photo-thumbnail-track {
    align-items: flex-start;
    padding-block: 10px 6px;
  }

  .place-photo-thumbnail {
    box-sizing: border-box;
    flex-basis: 92px;
    overflow: visible;
    gap: 3px;
    padding: 4px 4px 6px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: inset 0 0 0 2px transparent;
  }

  .place-photo-thumbnail img {
    display: block;
    width: 100%;
    height: 58px;
    border-radius: 7px;
    object-fit: cover;
  }

  .place-photo-thumbnail span {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 1.25em;
    padding: 2px 2px 0;
    overflow: hidden;
    color: var(--muted);
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .place-photo-thumbnail:hover,
  .place-photo-thumbnail:focus-visible {
    border-color: transparent;
    box-shadow:
      inset 0 0 0 2px color-mix(
        in srgb,
        var(--accent) 42%,
        transparent
      );
  }

  .place-photo-thumbnail-active,
  .place-photo-thumbnail-active:hover,
  .place-photo-thumbnail-active:focus-visible {
    border-color: transparent;
    color: var(--accent);
    background: var(--surface);
    box-shadow:
      inset 0 0 0 2px var(--accent),
      0 2px 8px rgba(23, 33, 24, 0.08);
  }

  .place-photo-thumbnail-active span {
    color: var(--accent);
    font-weight: 800;
  }
}

