/* ALEAU — composants : tiroir panier, lightbox, modale vidéo, recherche, toast, zoom, carrousel */

/* Voile commun */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(0 0 0 / 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t) var(--ease), visibility var(--t);
}
.overlay.is-open { opacity: 1; visibility: visible; }

/* Sélecteur de quantité */
.qty {
  display: inline-flex;
  align-items: center;
  height: 38px;
  border-radius: var(--pill);
  box-shadow: inset 0 0 0 1px var(--line);
}
.qty button {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  transition: background var(--t-fast);
}
.qty button:hover { background: var(--soft); }
.qty button:disabled { opacity: 0.35; cursor: default; background: none; }
.qty .icon { width: 15px; height: 15px; }
.qty output { min-width: 26px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.qty--lg { height: 54px; }
.qty--lg button { width: 50px; height: 54px; }

/* Tiroir panier */
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 420ms var(--ease), visibility 420ms;
}
.drawer.is-open { transform: none; visibility: visible; }
.drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px 24px;
  border-bottom: 1px solid var(--line);
}
.drawer__title { font-size: 1.25rem; font-weight: 650; letter-spacing: -0.025em; }
.drawer__title span { color: var(--muted); font-weight: 500; }
.drawer__body { flex: 1; overflow-y: auto; padding: 8px 24px; overscroll-behavior: contain; }
.drawer__foot { padding: 18px 24px 24px; border-top: 1px solid var(--line); background: #fff; }

.cart-line {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line:last-child { border-bottom: 0; }
.cart-line__img {
  width: 84px; height: 84px;
  border-radius: var(--radius-sm);
  background: var(--soft);
  object-fit: cover;
}
.cart-line__img.is-cutout { object-fit: contain; padding: 6px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.cart-line__top { display: flex; justify-content: space-between; gap: 10px; }
.cart-line__name { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; }
.cart-line__name a:hover { text-decoration: underline; text-underline-offset: 3px; }
.cart-line__unit { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.cart-line__total { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cart-line__bottom { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.cart-line__remove { font-size: 0.8rem; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.cart-line__remove:hover { color: var(--red); }

.cart-empty { display: grid; justify-items: center; gap: 14px; padding: 64px 12px; text-align: center; }
.cart-empty .icon { width: 44px; height: 44px; color: var(--muted-2); }
.cart-empty p { color: var(--muted); max-width: 30ch; }

.cart-upsell {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  font-size: 0.86rem;
}
.cart-upsell strong { display: block; font-weight: 650; }
.cart-upsell .btn { min-height: 36px; padding: 0 14px; font-size: 0.82rem; }

.cart-sum { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; font-weight: 650; }
.cart-sum output { font-size: 1.3rem; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.cart-note { margin: 4px 0 16px; font-size: 0.8rem; color: var(--muted); }
.cart-actions { display: grid; gap: 10px; }
.cart-trust { margin-top: 14px; font-size: 0.76rem; line-height: 1.45; text-align: center; color: var(--muted); text-wrap: balance; }
.cart-trust a { text-decoration: underline; text-underline-offset: 2px; color: var(--ink-2); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgb(10 10 10 / 0.96);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t) var(--ease), visibility var(--t);
}
.lightbox.is-open { opacity: 1; visibility: visible; }
.lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; }
.lightbox__count { font-size: 0.88rem; font-variant-numeric: tabular-nums; opacity: 0.8; }
.lightbox__tools { display: flex; gap: 6px; }
.lightbox .icon-btn { color: #fff; }
.lightbox .icon-btn:hover { background: rgb(255 255 255 / 0.12); }
.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  padding: 0 72px;
  touch-action: pan-y;
}
.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  max-height: calc(100dvh - 200px);
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 320ms var(--ease), opacity 200ms;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox__img.is-cutout { background: #fff; border-radius: 16px; }
.lightbox.is-zoomed .lightbox__img { transform: scale(2.2); cursor: zoom-out; transition: transform 320ms var(--ease); }
.lightbox__img.is-loading { opacity: 0.25; }
.lightbox__nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  display: grid; place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.1);
  color: #fff;
  transition: background var(--t-fast);
}
.lightbox__nav:hover { background: rgb(255 255 255 / 0.22); }
.lightbox__nav--prev { left: 14px; }
.lightbox__nav--next { right: 14px; }
.lightbox__nav .icon { width: 24px; height: 24px; }
.lightbox__caption { padding: 14px 20px 8px; text-align: center; font-size: 0.92rem; opacity: 0.85; min-height: 1.5em; }
.lightbox__thumbs {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 6px 16px 18px;
  overflow-x: auto;
}
.lightbox__thumbs button {
  flex: none;
  width: 58px; height: 42px;
  border-radius: 8px;
  overflow: hidden;
  opacity: 0.45;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: opacity var(--t-fast), outline-color var(--t-fast);
}
.lightbox__thumbs button[aria-current="true"] { opacity: 1; outline-color: #fff; }
.lightbox__thumbs button:hover { opacity: 0.85; }
.lightbox__thumbs img { width: 100%; height: 100%; object-fit: cover; background: #fff; }

/* Modale vidéo */
.video-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(0 0 0 / 0.86);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--t) var(--ease), visibility var(--t);
}
.video-modal.is-open { opacity: 1; visibility: visible; }
.video-modal__frame {
  position: relative;
  width: min(1100px, 100%);
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: #000;
  box-shadow: var(--shadow-lg);
  transform: scale(0.96);
  transition: transform var(--t) var(--ease);
}
.video-modal.is-open .video-modal__frame { transform: none; }
.video-modal video { width: 100%; height: 100%; object-fit: contain; }
.video-modal video::cue {
  font-family: var(--font);
  font-size: clamp(0.95rem, 2.2vw, 1.35rem);
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: rgb(0 0 0 / 0.62);
}
.video-modal__close { position: absolute; top: 14px; right: 14px; color: #fff; z-index: 2; }
.video-modal__close.icon-btn { background: rgb(0 0 0 / 0.4); }
.video-modal__close.icon-btn:hover { background: rgb(0 0 0 / 0.65); }

/* Recherche */
.search-panel {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 120;
  padding: 22px var(--gutter) 28px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(-100%);
  visibility: hidden;
  transition: transform 360ms var(--ease), visibility 360ms;
}
.search-panel.is-open { transform: none; visibility: visible; }
.search-panel__inner { max-width: 760px; margin-inline: auto; }
.search-field { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 1.5px solid var(--ink); }
.search-field .icon { width: 22px; height: 22px; color: var(--muted); }
.search-field input { flex: 1; border: 0; outline: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: -0.02em; background: none; }
.search-results { display: grid; gap: 4px; margin-top: 16px; }
.search-results .drop-link { grid-template-columns: 60px 1fr auto; }
.search-results .drop-link img { width: 60px; height: 60px; }
.search-results__empty { padding: 12px 4px; color: var(--muted); }
.search-results .price__int { font-size: 1.4rem; }
.search-results .price__cents { font-size: 0.8rem; }
.drop-link img.is-cutout { object-fit: contain; mix-blend-mode: multiply; padding: 4px; }

/* Toast */
.toast-zone {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 150;
  display: grid;
  gap: 8px;
  translate: -50% 0;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--pill);
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 320ms var(--ease);
}
.toast .icon { width: 18px; height: 18px; color: var(--green-wa); }
.toast.is-leaving { animation: toast-out 260ms var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* Zoom au survol */
.zoom {
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
}
.zoom img { transition: transform 420ms var(--ease); transform-origin: 50% 50%; }
.zoom.is-zooming img { transform: scale(var(--zoom-scale, 1.9)); transition: transform 140ms linear; }
.zoom__hint {
  position: absolute;
  right: 12px; bottom: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  border-radius: var(--pill);
  background: rgb(255 255 255 / 0.9);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--t-fast), transform var(--t-fast) var(--ease);
}
.zoom__hint .icon { width: 14px; height: 14px; }
.zoom:hover .zoom__hint, .zoom:focus-visible .zoom__hint { opacity: 1; transform: none; }

/* Carrousel */
.carousel { position: relative; }
.carousel__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.carousel__controls { display: flex; gap: 8px; }
.carousel__btn {
  display: grid; place-items: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--soft);
  transition: background var(--t-fast), opacity var(--t-fast);
}
.carousel__btn:hover { background: var(--soft-2); }
.carousel__btn:disabled { opacity: 0.35; cursor: default; }
.carousel__btn .icon { width: 20px; height: 20px; }
.carousel__track {
  /* Aligne la première carte sur le conteneur tout en laissant défiler jusqu'au bord de l'écran. */
  --edge: max(var(--gutter), calc((100vw - var(--container)) / 2 + var(--gutter)));
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(270px, 38vw, 500px);
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--edge);
  padding-inline: var(--edge);
  padding-bottom: 6px;
  scrollbar-width: none;
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__slide { scroll-snap-align: start; }
.carousel__progress { height: 3px; margin-top: 20px; border-radius: 3px; background: var(--soft-2); overflow: hidden; }
.carousel__progress span { display: block; height: 100%; width: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0.2); transition: transform 200ms var(--ease); }

.use-card { display: grid; gap: 12px; }
.use-card .zoom { border-radius: var(--radius); aspect-ratio: 16 / 10; background: var(--soft); }
.use-card img { width: 100%; height: 100%; object-fit: cover; }
.use-card h3 { font-size: 1.05rem; font-weight: 650; letter-spacing: -0.02em; }
.use-card p { font-size: 0.9rem; color: var(--muted); margin-top: 2px; }

@media (max-width: 760px) {
  .carousel__track { grid-auto-columns: 84%; gap: 12px; }
  .lightbox__stage { padding: 0 8px; }
  .lightbox__nav { width: 42px; height: 42px; background: rgb(0 0 0 / 0.45); }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .zoom__hint { opacity: 1; transform: none; }
}

@media (hover: none) {
  .zoom { cursor: pointer; }
}

.search-field input::-webkit-search-cancel-button { display: none; }
