/* ── QuickFresh Carousel (standalone, refined v3) ───────────────────────── */

.carousel {
  position: relative;
  background: #fff;
  border: 1px solid #CBD5E1;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
  overflow: hidden;
}

.carousel-viewport {
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  align-items: center;
  gap: 0;
  transition: transform .35s ease-in-out;
  will-change: transform;
}

.carousel-slide {
  min-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F3F6FB;
  margin: 0;
  overflow: hidden;
}

/* ── Media ───────────────────────────────────── */
.carousel-slide img,
.carousel-slide video {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(60vh, 520px);
  object-fit: contain;
  object-position: center center;
  border: 0;
  margin: auto;
  border-radius: 8px;
  background: #eaeff5;
}

/* ── Overlay gradient (melhora contraste da legenda) ───────────────────── */
.carousel::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 80px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.25), transparent);
  pointer-events: none;
  z-index: 1;
}

/* ── Controls ─────────────────────────────────── */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid #CBD5E1;
  background: #fff;
  color: #0D3550;
  display: grid;
  place-items: center;
  font-size: 26px;
  line-height: 1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
  cursor: pointer;
  transition: all .2s ease;
  z-index: 2;
}
.carousel-btn:hover {
  background: #2563EB;
  color: #fff;
  border-color: #2563EB;
}
.carousel-btn.prev { left: 12px; }
.carousel-btn.next { right: 12px; }

/* ── Dots (indicators) ────────────────────────── */
.carousel-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}
.carousel-dots button {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  border: 0;
  background: #c7d2fe;
  opacity: .7;
  cursor: pointer;
  transition: all .25s ease;
}
.carousel-dots button:hover {
  opacity: .9;
  background: #3b82f6;
}
.carousel-dots button[aria-current="true"] {
  background: #2563EB;
  opacity: 1;
  width: 22px;
  border-radius: 6px;
}

/* ── Caption (improved readability) ────────────── */
.carousel-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  padding: 8px 14px 12px;
  z-index: 2;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  pointer-events: none;
}

/* ── Compact mode ──────────────────────────────── */
.carousel--compact {
  max-width: 820px;
  margin-inline: auto;
  border-radius: 12px;
}
.carousel--compact .carousel-btn {
  width: 34px;
  height: 34px;
  font-size: 20px;
}
.carousel--compact .carousel-dots {
  bottom: 10px;
  gap: 6px;
}
.carousel--compact .carousel-dots button {
  width: 7px;
  height: 7px;
  opacity: .6;
  background: #cbd5e1;
}
.carousel--compact .carousel-dots button[aria-current="true"] {
  width: 18px;
  border-radius: 5px;
  opacity: 1;
  background: #2563EB;
}

/* ── Mobile ───────────────────────────────────── */
@media (max-width:640px) {
  .carousel-btn { width: 36px; height: 36px; font-size: 22px; }
  .carousel--compact .carousel-btn { width: 30px; height: 30px; font-size: 18px; }
  .carousel-caption { font-size: 12px; padding: 6px 10px; }
}

/* ── Gallery: height auto, safe for videos ─────── */
#gallery .carousel,
#gallery .carousel-viewport,
#gallery .carousel-track,
#gallery .carousel-slide {
  height: auto !important;
}

#gallery .carousel-slide img,
#gallery .carousel-slide video {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: min(60vh, 520px) !important;
  object-fit: contain !important;
  margin: auto !important;
}

@supports (-webkit-touch-callout: none) {
  #gallery .carousel-slide img,
  #gallery .carousel-slide video {
    max-height: 65svh !important;
  }
}
