/* ==========================================================================
   Pro Auction — Sale, catalogue and lot pages (build order step 6)
   Mobile-first: the 375px view is the base, wider views are the override.
   ========================================================================== */

/* --- Sale sub-nav §5.3 ---------------------------------------------------
   Sticks below the header once scrolled. On mobile the sale name is dropped
   rather than truncated — the countdown and the register CTA are what matter
   at 375px, and a clipped sale name helps nobody. */
.sale-subnav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: var(--ink);
  color: var(--paper);
  padding-block: var(--s-2);
}
.sale-subnav__inner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  justify-content: space-between;
}
.sale-subnav__title {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  display: none;
}
.sale-subnav .countdown { color: var(--paper); font-size: var(--fs-sm); }
.sale-subnav .btn { flex-shrink: 0; }

@media (min-width: 768px) {
  .sale-subnav__title { display: block; }
}

/* --- Sale head ----------------------------------------------------------- */
.sale-head { display: flex; flex-direction: column; gap: var(--s-3); }
.sale-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.sale-head__when,
.sale-head__where { margin: 0; color: var(--muted); font-size: var(--fs-base); }
.sale-head__actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); }
/* Full-width buttons at 375px — side-by-side buttons wrap into slivers. */
.sale-head__actions .btn { flex: 1 1 100%; }

@media (min-width: 560px) {
  .sale-head__actions .btn { flex: 0 1 auto; }
}

/* --- Key facts ----------------------------------------------------------- */
.key-facts { max-width: 42rem; }
.key-facts__gap { margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--muted); }

/* --- Catalogue controls §5.3 --------------------------------------------- */
.catalogue-controls {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s-4);
  margin-bottom: var(--s-8);
}
.catalogue-controls__row { display: flex; flex-direction: column; gap: var(--s-4); }
.catalogue-controls .field { margin-bottom: 0; }
.catalogue-controls__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  align-items: center;
  justify-content: space-between;
}

.view-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.view-toggle__btn {
  background: transparent;
  border: 0;
  padding: var(--s-2) var(--s-4);
  min-height: 44px;
  font-family: var(--font-ui);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--muted);
  cursor: pointer;
}
.view-toggle__btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

@media (min-width: 768px) {
  .catalogue-controls__row { flex-direction: row; align-items: flex-end; }
  .catalogue-controls__search { flex: 2; }
  .catalogue-controls__sort { flex: 1; }
}

/* List view — what trade buyers actually use. */
[data-catalogue-view="list"] { grid-template-columns: 1fr; }
[data-catalogue-view="list"] .lot-card { flex-direction: row; align-items: stretch; }
[data-catalogue-view="list"] .lot-card__media { width: 33%; max-width: 200px; aspect-ratio: 1; border-bottom: 0; border-right: 1px solid var(--line); }
[data-catalogue-view="list"] .lot-card__body { flex: 1; }

/* --- Lot page §5.4 -------------------------------------------------------
   Single column at 375px; gallery above the rail so the object is seen
   before the numbers. */
.lot__layout { display: grid; gap: var(--s-8); }
.lot__rail { display: flex; flex-direction: column; gap: var(--s-4); }
.lot__number { margin: 0; font-size: var(--fs-sm); color: var(--steel);
               letter-spacing: .04em; text-transform: uppercase; }
.lot__title { margin: 0; font-size: var(--fs-2xl); }
.lot__sale { margin: 0; font-size: var(--fs-sm); }
.lot__figures { margin-top: var(--s-2); }
.lot__actions { display: flex; flex-direction: column; gap: var(--s-3); }

@media (min-width: 900px) {
  .lot__layout { grid-template-columns: 1.4fr 1fr; gap: var(--s-16); align-items: start; }
  /* The rail follows the gallery on long lot descriptions. */
  .lot__rail { position: sticky; top: var(--s-16); }
}

/* --- Premium calculation §5.4 -------------------------------------------- */
.premium-calc {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s-4);
}
.premium-calc__title { font-size: var(--fs-lg); margin: 0 0 var(--s-2); }
.premium-calc .data-row:first-of-type { border-top: 0; }
.data-row--total {
  border-top: 2px solid var(--ink);
  font-weight: var(--fw-semibold);
}
.data-row--total .data-row__value { color: var(--ink); font-size: var(--fs-lg); }
.premium-calc__note { font-size: var(--fs-xs); color: var(--muted); margin: var(--s-3) 0 0; }

/* --- Gallery §5.4 -------------------------------------------------------- */
.gallery { display: flex; flex-direction: column; gap: var(--s-3); }
.gallery__stage { margin: 0; }
.gallery__zoom {
  display: block; width: 100%; padding: 0; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--paper); cursor: zoom-in;
  overflow: hidden;
}
.gallery__zoom img { width: 100%; height: auto; display: block; aspect-ratio: 4/3; object-fit: contain; }

/* Thumbnails scroll horizontally on mobile rather than wrapping into a wall. */
.gallery__thumbs {
  list-style: none; margin: 0; padding: 0;
  display: flex; gap: var(--s-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.gallery__thumbs li { scroll-snap-align: start; flex: 0 0 auto; }
.gallery__thumb {
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--paper); cursor: pointer; overflow: hidden;
  width: 72px; height: 56px;
}
.gallery__thumb[aria-current="true"] { border-color: var(--ink); border-width: 2px; }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery__dialog { border: 0; padding: 0; max-width: 100vw; max-height: 100vh;
                   width: 100%; height: 100%; background: var(--ink); }
.gallery__dialog::backdrop { background: rgba(var(--ink-rgb), .92); }
.gallery__dialog img { width: 100%; height: 100%; object-fit: contain; }
.gallery__close {
  position: absolute; top: var(--s-4); right: var(--s-4); z-index: 1;
  min-height: 44px; padding: var(--s-2) var(--s-4);
  background: var(--paper); color: var(--ink); border: 0;
  border-radius: var(--r-sm); font-family: var(--font-ui);
  font-weight: var(--fw-semibold); cursor: pointer;
}

@media (min-width: 768px) {
  .gallery__thumb { width: 96px; height: 72px; }
}

/* --- Lot detail ---------------------------------------------------------- */
.lot__detail { display: flex; flex-direction: column; gap: var(--s-12); }
.lot__spec { max-width: 42rem; }
.lot__enquiry { max-width: 42rem; }

/* --- Lot navigation ------------------------------------------------------ */
.lot-nav { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
           background: var(--paper); }
.lot-nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); padding-block: var(--s-4);
  font-size: var(--fs-sm); font-weight: var(--fw-medium);
}
.lot-nav a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.lot-nav a:hover { text-decoration: underline; }
/* "Back to catalogue" is the least useful of the three on a small screen. */
.lot-nav__index { display: none; }

@media (min-width: 560px) {
  .lot-nav__index { display: inline-flex; }
}
