/* =========================================================================
 *  lot-carousel.css — Carousel premium pour les fiches lot
 *  encheres-chu-lille · Fonds de dotation du CHU de Lille
 *  -----------------------------------------------------------------------
 *  Hérite des tokens définis dans chaque page (--accent, --radius-lg, etc.)
 *  Mode dégradé "image unique" via attribut [data-single] sur le wrapper.
 * ========================================================================= */

.lot-media[data-carousel] {
  position: relative;
  display: block; /* override inline `display: grid` historique */
  aspect-ratio: auto; /* override inline aspect-ratio (déplacée sur .lot-media-viewport) */
  margin: 0;
  border-radius: var(--radius-lg, 24px);
  background: linear-gradient(160deg, #0E2040 0%, #1A3A6A 60%, #07152A 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

/* ─── Viewport (aspect-ratio fixe, contient slides + contrôles) ─── */
.lot-media-viewport {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.lot-media-track {
  position: absolute;
  inset: 0;
  list-style: none;
  margin: 0;
  padding: 0;
}

.lot-media-slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 700ms cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 700ms;
}

.lot-media-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
  transition: opacity 700ms cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0s linear 0s;
}

.lot-media-slide picture {
  display: block;
  width: 100%;
  height: 100%;
}

.lot-media-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  /* Ken-Burns subtil : zoom lent sur la slide active */
  transform: scale(1.0);
  transition: transform 6500ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.lot-media-slide.is-active img {
  transform: scale(1.045);
}

/* Respect prefers-reduced-motion : pas de Ken-Burns, fondu instantané */
@media (prefers-reduced-motion: reduce) {
  .lot-media-slide { transition: opacity 1ms; }
  .lot-media-slide.is-active { transition: opacity 1ms; }
  .lot-media-slide img,
  .lot-media-slide.is-active img { transform: none; transition: none; }
}

/* ─── Badge "Lot unique" (au-dessus des slides) ─── */
.lot-media[data-carousel] .lot-badge {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 4;
  background: var(--accent, #C9A844);
  color: var(--accent-fg, #07152A);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ─── Flèches prev / next ─── */
.lot-media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: rgba(7, 21, 42, 0.78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  transition: background-color .18s ease, transform .18s ease, opacity .18s ease;
}

.lot-media-nav:hover {
  background: rgba(7, 21, 42, 0.94);
  transform: translateY(-50%) scale(1.06);
}

.lot-media-nav-prev { left: 12px; }
.lot-media-nav-next { right: 12px; }
.lot-media-nav svg { width: 22px; height: 22px; }

/* ─── Bouton pause / play ─── */
.lot-media-pause {
  position: absolute;
  bottom: 12px;
  right: 12px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: rgba(7, 21, 42, 0.78);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.20);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
  transition: background-color .18s ease, opacity .18s ease;
}

.lot-media-pause:hover { background: rgba(7, 21, 42, 0.94); }
.lot-media-pause svg { width: 16px; height: 16px; }
.lot-media-pause .ico-pause { display: block; }
.lot-media-pause .ico-play  { display: none; }
.lot-media-pause[aria-pressed="true"] .ico-pause { display: none; }
.lot-media-pause[aria-pressed="true"] .ico-play  { display: block; }

/* Focus visible accessible */
.lot-media-nav:focus-visible,
.lot-media-pause:focus-visible {
  outline: 3px solid var(--accent, #C9A844);
  outline-offset: 2px;
}

/* ─── Vignettes ─── */
.lot-media-thumbs {
  list-style: none;
  margin: 0;
  padding: 12px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.34);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.20) transparent;
}

.lot-media-thumbs::-webkit-scrollbar { height: 6px; }
.lot-media-thumbs::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.20);
  border-radius: 3px;
}

.lot-media-thumbs li { flex: 0 0 auto; }

.lot-media-thumb {
  position: relative;
  display: block;
  width: 84px;
  aspect-ratio: 4 / 3;
  padding: 0;
  background: rgba(255, 255, 255, 0.04);
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity .18s ease, border-color .18s ease, transform .18s ease;
}

.lot-media-thumb picture,
.lot-media-thumb img {
  display: block;
  width: 100%;
  height: 100%;
}

.lot-media-thumb img {
  object-fit: cover;
  object-position: center;
}

.lot-media-thumb:hover { opacity: 1; }

.lot-media-thumb.is-active {
  opacity: 1;
  border-color: var(--accent, #C9A844);
  box-shadow: 0 0 0 3px rgba(201, 168, 68, 0.20);
}

.lot-media-thumb:focus-visible {
  outline: 3px solid var(--accent, #C9A844);
  outline-offset: 2px;
}

/* ─── Mode image unique : contrôles & thumbs masqués ─── */
.lot-media[data-single] .lot-media-nav,
.lot-media[data-single] .lot-media-pause,
.lot-media[data-single] .lot-media-thumbs { display: none !important; }

/* ─── Adaptations small-screen ─── */
@media (max-width: 540px) {
  .lot-media-nav { width: 40px; height: 40px; }
  .lot-media-nav-prev { left: 8px; }
  .lot-media-nav-next { right: 8px; }
  .lot-media-pause { width: 34px; height: 34px; bottom: 8px; right: 8px; }
  .lot-media-thumb { width: 64px; }
}

/* ─── prefers-contrast: more (a11y) ─── */
@media (prefers-contrast: more) {
  .lot-media-nav,
  .lot-media-pause {
    background: #07152A;
    border-color: #fff;
  }
  .lot-media-thumb.is-active { border-width: 3px; }
}
