/*!
 * AWCarousel v1.0.0 — styles
 */

/* -- Custom elements: force block (default is inline) ------------------------ */
aw-carousel {
  display: block;
}
aw-slide {
  display: block;
}

/* -- Container --------------------------------------------------------------- */
.awcarousel {
  display: block;
  position: relative;
  overflow-x: clip;   /* clip without scroll context — prevents browser from forcing overflow-y:auto */
  width: 100%;
  -webkit-user-select: none;
  user-select: none;
}

/* -- Wrapper ----------------------------------------------------------------- */
.awc-wrapper {
  display: flex;
  align-items: flex-start;  /* let slides define their own height */
  will-change: transform;
}

/* -- Slides ------------------------------------------------------------------ */
.awc-slide,
aw-slide.awc-slide {
  display: block;
  flex-shrink: 0;
  position: relative;
  width: 100%;
  /* height intentionally NOT set here — defined by the user */
  box-sizing: border-box;
}

/* -- Cadre à ratio imposé : chaîne de hauteurs -------------------------------
   Quand un ratio est demandé (data-aw-ratio), l'hôte reçoit un `aspect-ratio`
   et les images un `height: 100%` accompagné d'`object-fit: cover`. Mais ce
   pourcentage se résout contre le SLIDE, dont la hauteur est laissée libre
   ci-dessus — il retombait donc sur `auto` : l'image gardait son ratio
   naturel et laissait une bande vide sous elle, à l'intérieur du cadre. Avec
   un placeholder 1200×500 dans un cadre 16/9, cela faisait 159 px de blanc.

   On rétablit donc la chaîne hôte → wrapper → slide, et `object-fit: cover`
   a enfin une boîte à remplir. Uniquement quand un ratio EST imposé : le
   mode « hauteur automatique » (`none`) doit garder des slides libres. */
aw-carousel[data-aw-ratio]:not([data-aw-ratio='none']) > .awc-wrapper,
aw-carousel[data-aw-ratio]:not([data-aw-ratio='none']) > .awc-wrapper > .awc-slide {
  height: 100%;
}

/* -- Fade effect ------------------------------------------------------------- */
.awcarousel--fade .awc-wrapper {
  transform: none !important;
}
.awcarousel--fade .awc-slide {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.awcarousel--fade .awc-slide.awc-slide-active {
  opacity: 1;
  pointer-events: auto;
  position: relative;
}

/* -- Pagination bullets ------------------------------------------------------ */
.awc-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 12px 0 0;
  width: 100%;
}

.awc-bullet {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: background 0.25s, transform 0.25s, opacity 0.25s;
  flex-shrink: 0;
}

.awc-bullet-active {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.3);
}

/* -- Dynamic bullets --------------------------------------------------------- */
.awc-pagination--dynamic {
  /* Viewport: show exactly 5 bullets (8px + 6px gap each) */
  overflow: hidden;
  width: calc(8px * 5 + 6px * 4); /* 64px */
}

.awc-pagination-track {
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.35s ease;
  /* width = all bullets; overflow clips the rest */
  white-space: nowrap;
}

/* Active */
.awc-pagination--dynamic .awc-bullet-active {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1);
  width: 8px; height: 8px;
}

/* ±1 from active */
.awc-pagination--dynamic .awc-bullet-prev,
.awc-pagination--dynamic .awc-bullet-next {
  background: rgba(0, 0, 0, 0.45);
  transform: scale(0.85);
}

/* ±2 from active */
.awc-pagination--dynamic .awc-bullet-prev2,
.awc-pagination--dynamic .awc-bullet-next2 {
  background: rgba(0, 0, 0, 0.2);
  transform: scale(0.65);
}

/* Beyond ±2 — hidden but keep space (clip by parent overflow) */
.awc-pagination--dynamic .awc-bullet-hidden {
  transform: scale(0.4);
  opacity: 0;
  pointer-events: none;
}

/* -- Navigation arrows ------------------------------------------------------- */
.awc-prev,
.awc-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: background 0.2s, box-shadow 0.2s;
  -webkit-user-select: none;
  user-select: none;
  font-size: 16px;
  line-height: 1;
  color: #333;
}

.awc-prev { left: 12px; }
.awc-next { right: 12px; }

.awc-prev:hover,
.awc-next:hover {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.awc-prev.awc-disabled,
.awc-next.awc-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* -- Vertical direction ------------------------------------------------------ */
.awcarousel[data-direction="vertical"],
aw-carousel[direction="vertical"] {
  overflow-x: visible;
  overflow-y: clip;
}

/* -- Thumbs carousel --------------------------------------------------------- */
.awc-thumbs {
  margin-top: 10px;
  cursor: default !important;
}

.awc-thumbs .awc-slide {
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.2s, outline 0.2s;
  border-radius: 4px;
  overflow: hidden;
  outline: 2px solid transparent;
}

.awc-thumbs .awc-slide:hover {
  opacity: 0.75;
}

.awc-thumbs .awc-slide.awc-thumb-active {
  opacity: 1;
  outline-color: currentColor;
}

.awc-thumbs .awc-slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

/* -- Drag: disable text selection -------------------------------------------- */
.awcarousel.awc-dragging {
  -webkit-user-select: none;
  user-select: none;
}
.awcarousel.awc-dragging .awc-slide * {
  pointer-events: none;
}
