.card-media,
.gallery {
  min-width: 0;
}

.listing-preview {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  height: 100%;
  min-height: 220px;
  padding: 22px;
  overflow: hidden;
  background: #121310;
  color: #fff;
  text-align: left;
}
.listing-preview::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(0deg, #121310 3%, #121310cc 25%, transparent 65%);
}
.listing-preview-tag {
  position: absolute;
  top: 20px;
  left: 22px;
  max-width: calc(100% - 84px);
  color: #e3d7be;
  font-size: 12px;
  line-height: 1.4;
}
.listing-preview .listing-preview-art {
  position: absolute;
  z-index: -2;
  width: 168px;
  height: 168px;
  top: 12%;
  right: 14px;
  object-fit: contain;
  opacity: .45;
  border-radius: 50%;
}
.listing-preview-caption { position: relative; display: grid; gap: 4px; }
.listing-preview-caption strong { color: #fff; font-size: clamp(18px, 1.8vw, 23px); font-weight: 600; line-height: 1.25; letter-spacing: -.025em; }
.listing-preview-caption > span { color: #d4d2ca; font-size: 12px; }
.listing-preview--video .listing-preview-caption { padding-right: 40px; }
.listing-preview-play { position: absolute; right: 22px; bottom: 27px; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #fea20188; border-radius: 50%; color: var(--gold); background: #151613; }
.preview-detail { margin: 0 44px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.preview-detail .listing-preview { min-height: 300px; padding: 26px; }
.preview-detail .listing-preview-art { right: 6%; width: 220px; height: 220px; }
.preview-detail .listing-preview-caption > span { display: none; }
.preview-detail-action { padding: 16px 20px; background: var(--paper); }
.preview-detail-action p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.6; }
.preview-detail-action .button { width: 100%; gap: 10px; }
.photo-track .listing-preview { padding-bottom: 56px; }
.card-media .photo-track .listing-preview-tag { top: 52px; }
@media (max-width: 680px) {
  .preview-detail { margin-inline: 12px; }
  .preview-detail .listing-preview { min-height: 260px; padding: 22px; }
  .preview-detail .listing-preview-art { width: 170px; height: 170px; right: 12px; }
  .preview-detail-action { padding: 16px; }
}

.photo-track {
  display: flex;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  user-select: none;
}

.photo-track::-webkit-scrollbar,
.photo-dots::-webkit-scrollbar {
  display: none;
}

.photo-track > button {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.photo-track > button:focus-visible {
  z-index: 1;
  outline-offset: -4px;
}

.card-media .card-image {
  aspect-ratio: 4 / 3;
}

.card-media .card-image img {
  object-position: center;
  transition: none;
}

.card-media .card-image:hover img {
  transform: none;
}

.card-media .photo-count {
  top: 14px;
  bottom: auto;
  background: #171815e6;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.photo-dots {
  position: absolute;
  z-index: 2;
  bottom: 7px;
  left: 50%;
  display: flex;
  justify-content: safe center;
  max-width: calc(100% - 20px);
  padding-inline: 5px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  transform: translateX(-50%);
}

.photo-dots::before {
  position: absolute;
  z-index: -1;
  inset: 8px 0;
  border-radius: 999px;
  background: #171815e6;
  content: "";
  pointer-events: none;
}

.photo-dot {
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  width: 24px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.photo-dot::before {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: .64;
  content: "";
}

.photo-dot.selected::before {
  width: 14px;
  opacity: 1;
}

.photo-dot:focus-visible {
  border-radius: 999px;
  outline-offset: -4px;
}

.gallery-stage {
  height: clamp(340px, 56dvh, 540px);
  background: var(--dark);
}

.gallery-stage .photo-track {
  height: 100%;
}

.gallery-expand {
  position: relative;
  overflow: hidden;
}

.gallery-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
}

#gallery-count,
.gallery-open {
  position: static;
  font-size: 13px;
}

#gallery-count {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.gallery-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.gallery-open:hover,
.gallery-open:active {
  background: var(--brand-wash);
  border-color: var(--brand-border);
}

.thumbs {
  max-width: 100%;
  padding: 6px 4px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.thumbs::-webkit-scrollbar { display: none; }

.viewing-bar { background: #fff; }

.thumb {
  min-width: 44px;
  min-height: 44px;
}

.thumb.selected {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 1px var(--gold-dark);
}

.thumb:focus-visible {
  outline-offset: -4px;
}

.play {
  padding-left: 0;
}

.play::before {
  content: none;
}

#detail.has-photo-viewer {
  overflow: hidden;
}

.pswp__button--arrow--prev,
.pswp__button--arrow--next {
  display: none;
}

.pswp__gallery-footer {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(7px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  color: #fff;
}

.pswp__gallery-caption {
  overflow: hidden;
  color: #fff;
  font-size: 13px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pswp__gallery-footer .thumbs {
  justify-content: safe center;
  scrollbar-width: none;
}

.pswp__gallery-footer .thumb {
  flex-basis: 52px;
  height: 44px;
  background: var(--dark);
}

.pswp__gallery-footer .thumb.selected {
  border-color: #fff;
  box-shadow: none;
}

@media (max-width: 680px) {
  .gallery-stage {
    height: clamp(240px, calc((100vw - 24px) * .75), 440px);
  }
}

@media (max-height: 490px) and (orientation: landscape) {
  .gallery-stage {
    height: 65dvh;
  }
}
