/* Keep the selected picture and its previews visible together. */
body .detail-page-v07 .gallery {
  --gallery-height: clamp(300px, 60vh, 480px);
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  column-gap: 20px;
  row-gap: 12px;
  align-items: start;
}
body .detail-page-v07 .gallery-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  height: var(--gallery-height);
  aspect-ratio: auto;
  background: #fff;
}
body .detail-page-v07 .gallery-main > .gallery-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}
body .detail-page-v07 .gallery-main > img.gallery-slide { height: 100%; max-height: none; object-fit: contain; cursor: zoom-in; }
body .detail-page-v07 .gallery-main > .gallery-video { height: 100%; aspect-ratio: auto; }
body .detail-page-v07 .gallery-main > .gallery-video > img { width: 100%; height: 100%; object-fit: contain; }
body .detail-page-v07 .gallery-thumbs {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  height: var(--gallery-height);
  max-height: var(--gallery-height);
  margin: 0;
  padding: 2px 6px 2px 2px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
body .detail-page-v07 .gallery-thumbs button { flex: 0 0 66px; width: 100%; height: 66px; min-height: 66px; }
body .detail-page-v07 .gallery-touch-controls { grid-column: 2; grid-row: 2; margin-top: 0; }
body .detail-page-v07 .gallery-zoom {
  position: absolute;
  z-index: 2;
  bottom: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #c5d6e4;
  border-radius: 8px;
  background: #fff;
  color: #103b6d;
  font: inherit;
  font-size: .8rem;
  font-weight: 700;
  cursor: zoom-in;
}
body .detail-page-v07 .gallery-zoom[hidden] { display: none; }
body .detail-page-v07 .gallery-zoom:hover { background: #e9f3f9; }
.gallery-zoom svg { width: 18px; height: 18px; }
body.gallery-lightbox-open { overflow: hidden; }
dialog.gallery-lightbox {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: min(1400px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 16px;
  border: 0;
  border-radius: 12px;
  background: #fff;
  color: #103b6d;
  overflow: auto;
}
dialog.gallery-lightbox::backdrop { background: rgba(3, 20, 40, .86); }
.gallery-lightbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 12px; }
.gallery-lightbox-toolbar p { margin: 0; font-size: .9rem; line-height: 1.5; }
.gallery-lightbox-close { min-height: 44px; padding: 10px 16px; border: 1px solid #b6cada; border-radius: 8px; background: #fff; color: #103b6d; font: inherit; font-weight: 700; cursor: pointer; }
.gallery-lightbox-close:hover { background: #e9f3f9; }
.gallery-lightbox img { display: block; width: 100%; max-width: 100%; height: auto; max-height: calc(100dvh - 150px); margin: auto; object-fit: contain; }
@media (max-width: 820px) {
  body .detail-page-v07 .gallery { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  body .detail-page-v07 .gallery-main { grid-column: 1; height: auto; max-height: 340px; aspect-ratio: 16 / 10; }
  body .detail-page-v07 .gallery-touch-controls { grid-column: 1; grid-row: 2; }
  body .detail-page-v07 .gallery-thumbs { grid-column: 1; grid-row: 3; flex-direction: row; height: auto; max-height: none; gap: 8px; padding: 8px 2px 6px; overflow-x: auto; overflow-y: hidden; scrollbar-gutter: auto; }
  body .detail-page-v07 .gallery-thumbs button { flex: 0 0 88px; width: 88px; height: 62px; min-height: 62px; }
  body .detail-page-v07 .gallery-zoom { bottom: 8px; left: 8px; }
}
