/* Keep shared dialogs above the preserved header. Native gallery is top-layer. */
#drawer-backdrop[data-tsh-trip-backdrop] {z-index:100010;}
#drawer-saved.drawer,#drawer-planner.drawer {z-index:100020;}
[data-retained-mature-gallery] [data-detail-photo] {cursor:pointer;}
[data-retained-mature-gallery] [data-detail-photo]:focus-visible {outline:3px solid #17618c;outline-offset:3px;}
[data-retained-mature-gallery] #tsh-detail-gallery {width:94vw;max-width:1000px;height:90vh;max-height:90vh;padding:20px;border:0;border-radius:14px;box-sizing:border-box;}
[data-retained-mature-gallery] #tsh-detail-gallery::backdrop {background:rgb(0 0 0 / .8);}
[data-retained-mature-gallery] .tsh-gallery-top {display:flex;align-items:center;justify-content:space-between;gap:20px;position:sticky;top:-20px;z-index:1;background:#fff;padding-block:8px;}
[data-retained-mature-gallery] #tsh-detail-gallery figure {margin:16px 0;}
[data-retained-mature-gallery] #tsh-detail-gallery img {width:100%;height:auto;display:block;}
[data-retained-mature-gallery] #tsh-detail-gallery button {padding:10px 16px;cursor:pointer;}
[data-retained-mature-gallery] .tsh-gallery-unavailable {padding:24px;background:#f2f2f2;color:#333;}
@media(max-width:600px){
  body[data-tsh-place-system] .place-hero .v9-masthead h1 {font-size:clamp(2rem,9vw,3.25rem);overflow-wrap:anywhere;}
}

/* Recovered place pages keep the original photo tiles as divs. Size the tiles by
   their gallery role, so the same mosaic works with either divs or buttons. */
body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(2, minmax(0, 1fr)) !important;
  aspect-ratio: 2.5 / 1;
}
body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > :is(.v9-main, .v9-thumb) {
  display: block !important;
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  aspect-ratio: auto !important;
}
body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > :is(.v9-main, .v9-thumb) > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
@media (min-width: 681px) {
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > .v9-main {
    grid-area: 1 / 1 / 3 / 3;
  }
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > .v9-thumb:nth-child(2) { grid-area: 1 / 3; }
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > .v9-thumb:nth-child(3) { grid-area: 2 / 3; }
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > .v9-thumb:nth-child(4) { grid-area: 1 / 4; }
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > .v9-thumb:nth-child(5) { grid-area: 2 / 4; }
}
body .v71-gallery-mosaic[data-tsh-gallery-model] > .v71-view-all > img {
  filter: none;
  transform: none !important;
}
body .v71-gallery-mosaic[data-tsh-gallery-model] > .v71-view-all::after {
  background: linear-gradient(transparent 35%, rgb(0 0 0 / .76));
  pointer-events: none;
}
body .v71-gallery-mosaic[data-tsh-gallery-model] .v71-view-all-copy {
  inset: auto 0 0;
  padding: 8px 6px;
}
body .v71-gallery-mosaic[data-tsh-gallery-model] .v71-view-all-copy .v71-camera {
  display: none;
}
@media (max-width: 680px) {
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    grid-template-rows: auto !important;
    aspect-ratio: auto;
  }
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > :is(.v9-main, .v9-thumb) {
    grid-area: auto;
    height: auto;
    aspect-ratio: 4 / 3 !important;
  }
  body .v71-gallery-mosaic[data-tsh-gallery-model]:has(> .v9-thumb:nth-child(5)) > .v9-main {
    grid-column: 1 / -1;
  }
}
