/* Detail gallery only. The original deck, bid panel and live-state controller
   remain authoritative. DOM order puts the decision before secondary photos. */
html.calm main.lot-detail .detail-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  grid-template-areas: "media decision" "photos decision";
  /* A decision panel taller than both left-hand rows gives its extra height to
     the photo row only, never a blank band under the main photo. */
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 1rem 1.5rem;
}
.lot-detail .detail-media { grid-area: media; }
.lot-detail .detail-decision { grid-area: decision; }
.lot-detail .detail-photo-library { grid-area: photos; min-width: 0; }
.lot-detail .detail-photo-library[hidden],
.lot-detail .detail-photo-library [hidden],
.lot-detail .gallery-library-link[hidden] { display: none !important; }
.lot-detail .detail-photo-library {
  scroll-margin-top: calc(var(--bhnav-height, 60px) + 5rem);
}
.lot-detail .detail-photo-library h2 {
  margin: 0 0 .35rem;
  color: var(--ink);
  font-size: 1.1rem;
}
.lot-detail .gallery-library-help {
  margin: 0 0 .6rem;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.5;
}
.lot-detail .gallery-library-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .4rem 0;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.lot-detail .gallery-library-link > span { margin-left: .5rem; }
.lot-detail .gallery-library-link:focus,
.lot-detail .detail-photo-library:focus,
.lot-detail .detail-photo-library button:focus {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.lot-detail .detail-photo-library .gallery-trust {
  flex-wrap: wrap;
  margin: 0 0 .75rem;
}
.lot-detail .detail-photo-library .gallery-trust button {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.lot-detail .detail-photo-library .thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 0;
  padding: 4px;
  overflow: visible;
}
.lot-detail .detail-photo-library .thumbs button {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .4rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  cursor: zoom-in;
}
.lot-detail .detail-photo-library .thumbs img {
  display: block;
  width: 100%;
  height: 240px;
  object-fit: contain;
  border: 0;
  border-radius: 6px;
  background: #fff;
}
.lot-detail [data-gallery-caption] {
  display: block;
  padding: .6rem .15rem .25rem;
  color: var(--ink);
  font-size: .8rem;
  line-height: 1.4;
  text-align: left;
  overflow-wrap: anywhere;
}
.lot-detail .detail-photo-library .thumbs button[aria-current="true"] {
  border-color: var(--ink);
}
.lot-detail .thumbs button[aria-current="true"] [data-gallery-caption] {
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: .2em;
}
/* Browsers without native <dialog> (the Safari 13 floor): the viewer exists
   only while open, as the shared modal overlay (BidHarborBidTransport.modalFallback). */
.lot-gallery:not([open]) { display: none; }
.lot-gallery [hidden] { display: none !important; }
.lot-gallery-shade {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, .88);
}
.lot-gallery-fallback[open] {
  display: block;
  top: 3%;
  right: 0;
  left: 0;
  z-index: 9999;
  margin: 0 auto;
}
@media (min-width: 961px) {
  /* Compact arrows beside the tall desktop photo only; phones and tablets keep
     the large edge arrows the page already gives them. */
  .lot-detail .hero-frame > .photo-edge {
    width: 44px;
    height: 52px;
    border-radius: 8px;
  }
  html.calm main.lot-detail .detail-media .hero {
    height: 480px;
    object-fit: contain;
  }
}
@media (max-width: 960px) {
  html.calm main.lot-detail .detail-overview {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "media" "decision" "photos";
    grid-template-rows: none;
    gap: .75rem;
  }
  .lot-detail .detail-photo-library .thumbs img {
    height: clamp(140px, 40vw, 300px);
  }
}
