/* =========================================================
   SM Carousel & Lightbox — Frontend CSS
   ========================================================= */

/* ── Wrapper ─────────────────────────────────────────────── */
.smcar-wrap {
  --smcar-h: 480px;
  position: relative;
  width: 100%;
  overflow: hidden;
}

/* ── Swiper override ─────────────────────────────────────── */
.smcar-swiper {
  width: 100%;
  height: var(--smcar-h);
  /* Overflow hidden essenziale per non vedere le slide fuori campo */
  overflow: hidden;
}

/* Fix critico: con effect=fade Swiper mette le slide in position:absolute,
   le slide inattive devono essere invisible ma non sovrapporse visivamente */
.smcar-swiper.swiper-fade .swiper-slide {
  pointer-events: none;
  opacity: 0 !important;
  transition: opacity 600ms ease !important;
}

.smcar-swiper.swiper-fade .swiper-slide-active {
  pointer-events: auto;
  opacity: 1 !important;
}

/* Con slide/cube: tutte le slide sono visibili ma fuori viewport */
.smcar-swiper:not(.swiper-fade) .swiper-wrapper {
  display: flex;
}

.smcar-swiper:not(.swiper-fade) .swiper-slide {
  flex-shrink: 0;
  height: 100%;
}

.smcar-slide {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  display: flex;
  align-items: flex-end;
}

/* ── Overlay ─────────────────────────────────────────────── */
.smcar-slide::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  transition: opacity .4s;
}

.smcar-overlay-dark::before {
  background: linear-gradient(to top,
    rgba(0,0,0,.72) 0%,
    rgba(0,0,0,.35) 50%,
    rgba(0,0,0,.08) 100%);
}

.smcar-overlay-light::before {
  background: linear-gradient(to top,
    rgba(255,255,255,.85) 0%,
    rgba(255,255,255,.4) 50%,
    transparent 100%);
}

.smcar-overlay-none::before { display: none; }

/* ── Content area ────────────────────────────────────────── */
.smcar-content {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 2.5rem clamp(1.5rem, 5vw, 4rem);
}

.smcar-inner {
  max-width: 720px;
}

/* Badge offerta */
.smcar-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .3rem .85rem;
  border-radius: 999px;
  background: #e53935;
  color: #fff;
  margin-bottom: .85rem;
  animation: smcar-pulse 2s ease-in-out infinite;
}

@keyframes smcar-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,57,53,.45); }
  50%       { box-shadow: 0 0 0 8px rgba(229,57,53,0); }
}

/* Titolo */
.smcar-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 300;
  line-height: 1.15;
  margin: 0 0 .6rem;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.smcar-overlay-light .smcar-title {
  color: #1a3f2c;
  text-shadow: none;
}

/* Sottotitolo */
.smcar-subtitle {
  font-size: clamp(.85rem, 1.5vw, 1.05rem);
  color: rgba(255,255,255,.88);
  font-weight: 300;
  line-height: 1.7;
  margin: 0 0 1.5rem;
  max-width: 60ch;
}

.smcar-overlay-light .smcar-subtitle { color: #555550; }

/* CTA buttons */
.smcar-cta {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: center;
}

.smcar-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .75rem 1.6rem;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  border-radius: 3px;
  text-decoration: none;
  cursor: pointer;
  transition: all .25s cubic-bezier(.25,.46,.45,.94);
  white-space: nowrap;
  border: none;
  font-family: 'DM Sans', sans-serif;
}

.smcar-btn-primary {
  background: var(--c-primary, #3a7d5c);
  color: #fff;
  box-shadow: 0 4px 18px rgba(0,0,0,.2);
}

.smcar-btn-primary:hover {
  background: var(--c-primary-dark, #275e42);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
}

.smcar-btn-outline {
  border: 1.5px solid rgba(255,255,255,.8);
  color: #fff;
  background: transparent;
}

.smcar-btn-outline:hover {
  background: rgba(255,255,255,.15);
  border-color: #fff;
  transform: translateY(-2px);
}

.smcar-overlay-light .smcar-btn-outline {
  border-color: var(--c-primary, #3a7d5c);
  color: var(--c-primary, #3a7d5c);
}

.smcar-btn-offerta {
  background: #fff;
  color: #e53935;
  box-shadow: 0 4px 18px rgba(0,0,0,.18);
}

.smcar-btn-offerta:hover {
  background: #ffe8e8;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(229,57,53,.25);
}

/* ── Navigation arrows ───────────────────────────────────── */
.smcar-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .25s;
  color: #fff;
  user-select: none;
}

.smcar-nav-btn svg { width: 22px; height: 22px; }

.smcar-nav-btn:hover {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.6);
  transform: translateY(-50%) scale(1.08);
}

.smcar-button-prev { left: 1.25rem; }
.smcar-button-next { right: 1.25rem; }

.smcar-nav-btn.swiper-button-disabled {
  opacity: .3;
  pointer-events: none;
}

/* ── Pagination dots ─────────────────────────────────────── */
.smcar-pagination {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  gap: 6px;
  align-items: center;
}

.smcar-pagination .swiper-pagination-bullet {
  width: 8px;
  height: 8px;
  background: rgba(255,255,255,.5);
  border-radius: 50%;
  cursor: pointer;
  transition: all .25s;
  opacity: 1;
  margin: 0;
}

.smcar-pagination .swiper-pagination-bullet-active {
  background: #fff;
  width: 24px;
  border-radius: 4px;
}

/* ── Lightbox ────────────────────────────────────────────── */
.smcar-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  visibility: hidden;
  opacity: 0;
  transition: opacity .3s, visibility .3s;
}

.smcar-lightbox.is-open {
  visibility: visible;
  opacity: 1;
}

.smcar-lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.smcar-lb-dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 12px;
  max-width: 520px;
  width: calc(100% - 2rem);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 32px 80px rgba(0,0,0,.35);
  transform: scale(.94) translateY(10px);
  transition: transform .3s cubic-bezier(.34,1.56,.64,1);
  overflow: hidden;
}

.smcar-lightbox.is-open .smcar-lb-dialog {
  transform: scale(1) translateY(0);
}

.smcar-lb-close {
  position: absolute;
  top: .75rem;
  right: .75rem;
  z-index: 2;
  width: 32px;
  height: 32px;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  color: #333;
}

.smcar-lb-close svg { width: 14px; height: 14px; }
.smcar-lb-close:hover { background: #f5f5f5; transform: scale(1.1); }

.smcar-lb-img {
  width: 100%;
  aspect-ratio: 16/7;
  overflow: hidden;
}

.smcar-lb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.smcar-lb-body {
  padding: 1.75rem 1.75rem 2rem;
}

.smcar-lb-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--c-primary-deeper, #1a3f2c);
  margin: 0 0 .75rem;
  line-height: 1.2;
}

.smcar-lb-content {
  font-size: .9rem;
  color: #555;
  line-height: 1.8;
  margin-bottom: 1.25rem;
}

.smcar-lb-content p { margin-bottom: .5rem; }

.smcar-lb-expiry {
  font-size: .78rem;
  color: #e53935;
  margin-bottom: 1.25rem;
  padding: .5rem .75rem;
  background: #fff8f8;
  border: 1px solid #fcc;
  border-radius: 4px;
}

.smcar-lb-cta {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .85rem 2rem;
  background: var(--c-primary, #3a7d5c);
  color: #fff;
  text-decoration: none;
  border-radius: 3px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: all .25s;
  font-family: 'DM Sans', sans-serif;
}

.smcar-lb-cta:hover {
  background: var(--c-primary-dark, #275e42);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .smcar-swiper { height: calc(var(--smcar-h) * .65); }
  .smcar-content { padding: 1.5rem 1rem; }
  .smcar-nav-btn { width: 36px; height: 36px; }
  .smcar-nav-btn svg { width: 16px; height: 16px; }
  .smcar-button-prev { left: .5rem; }
  .smcar-button-next { right: .5rem; }
  .smcar-btn { padding: .6rem 1.1rem; font-size: .72rem; }
}
