/* ════════════════════════════════════════════════════════
   MISS EXTENSIONS — gallery-carousel.css  v1.0
   Galería en carrusel automático con movimiento ondulado.
   Se carga solo en la portada (functions.php).

   Dos modos:
   · Base (sin JS / prefers-reduced-motion): fila estática
     con scroll horizontal manual y scroll-snap.
   · .is-animated (lo añade gallery-carousel.js): bucle
     infinito, sin scroll, con fundido en los bordes.
════════════════════════════════════════════════════════ */

.me-gallery-section {
  /* Tamaños por breakpoint — el JS lee --g-amp y --g-speed */
  --g-card-w: min(68vw, 260px);
  --g-gap:    32px;
  --g-amp:    14px;   /* amplitud de la ola */
  --g-speed:  25;     /* px/s */
  --g-gold:   #C9A84C;
  --g-text:   #F5F5F5;

  position: relative;
  background: #0a0a0a;
  padding-top: 4.5rem;
  padding-bottom: 2rem;
  overflow: hidden;
}

@media (min-width: 768px) {
  .me-gallery-section {
    --g-card-w: 280px;
    --g-gap:    48px;
    --g-amp:    24px;
    --g-speed:  30;
    padding-top: 6rem;
    padding-bottom: 3rem;
  }
}

@media (min-width: 1024px) {
  .me-gallery-section {
    --g-card-w: 340px;
    --g-gap:    64px;
    --g-amp:    36px;
    --g-speed:  35;
    padding-top: 7rem;
    padding-bottom: 4rem;
  }
}

/* ── Cabecera ── */
.me-gallery-head {
  text-align: left;
}

.me-gallery-head__eyebrow {
  display: block;
  font-family: var(--ff-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--g-gold);
  margin-bottom: 1rem;
}

.me-gallery-head__title {
  font-family: var(--ff-display, Georgia, 'Times New Roman', serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1.05;
  color: var(--g-text);
  margin: 0;
}

/* ── Contenedor del carrusel ──
   El padding vertical deja sitio a la ola: amplitud + 40px. */
.me-gallery {
  position: relative;
  padding-block: calc(var(--g-amp) + 40px);
  /* Modo estático: la primera foto alineada con el contenedor */
  padding-inline: calc((100% - min(var(--container, 1240px), 100% - 3rem)) / 2);
  scroll-padding-inline: calc((100% - min(var(--container, 1240px), 100% - 3rem)) / 2);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 76, 0.35) transparent;
}

.me-gallery__track {
  position: relative;          /* offsetParent de las tarjetas */
  display: flex;
  gap: var(--g-gap);
  width: max-content;
}

/* ── Tarjeta ── */
.me-gallery__card {
  --zoom: 1;
  position: relative;
  flex: 0 0 var(--g-card-w);
  width: var(--g-card-w);
  aspect-ratio: 9 / 16;
  margin: 0;
  border-radius: 16px;
  overflow: hidden;
  isolation: isolate;          /* recorte del radio con transform en Safari */
  background: #141414;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
  scroll-snap-align: start;
}

.me-gallery__card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(var(--zoom));
  transition: transform 0.6s cubic-bezier(.22, 1, .36, 1);
}

/* Montajes cuadrados antes/después: se encuadra la mitad "después"
   (derecha) y se amplía lo justo para que no asomen el título,
   el marco beige ni la línea de unión. Valores calculados para
   la plantilla de los montajes (panel "después" ≈ x 540-1040,
   y 140-965 sobre 1080×1080); son % y valen en cualquier tamaño. */
.me-gallery__card--montage {
  --zoom: 1.36;
}
.me-gallery__card--montage img {
  object-position: 100% 50%;
  transform-origin: 58.6% 54.2%;
}

/* Degradado inferior para legibilidad del texto */
.me-gallery__card::after {
  content: '';
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to bottom, rgba(10, 10, 10, 0) 0%, rgba(10, 10, 10, 0.75) 100%);
  pointer-events: none;
  z-index: 1;
}

.me-gallery__caption {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 22px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.me-gallery__label {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--g-gold);
}

.me-gallery__title {
  font-family: var(--ff-display, Georgia, 'Times New Roman', serif);
  font-style: italic;
  font-weight: 400;
  font-size: 22px;
  line-height: 1.15;
  color: #fff;
}

/* Hover solo en dispositivos con ratón */
@media (hover: hover) and (pointer: fine) {
  .me-gallery__card:hover img {
    transform: scale(calc(var(--zoom) * 1.04));
  }
}

/* ══ Modo animado (clase añadida por gallery-carousel.js) ══ */
.me-gallery.is-animated {
  padding-inline: 0;
  overflow-x: hidden;
  scroll-snap-type: none;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
          mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
}

.me-gallery.is-animated .me-gallery__track,
.me-gallery.is-animated .me-gallery__card {
  will-change: transform;
}

/* Arrastre: el gesto horizontal lo gestiona el JS; el vertical
   sigue siendo scroll normal de la página en móvil. */
.me-gallery.is-animated,
.me-gallery.is-animated .me-gallery__track {
  touch-action: pan-y;
}

/* Sin arrastre fantasma de imágenes ni selección de texto */
.me-gallery.is-animated .me-gallery__card,
.me-gallery.is-animated .me-gallery__card img {
  -webkit-user-select: none;
          user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

@media (hover: hover) and (pointer: fine) {
  .me-gallery.is-animated { cursor: grab; }
  .me-gallery.is-animated.is-dragging { cursor: grabbing; }
  /* Durante el arrastre, sin zoom de hover para no distraer */
  .me-gallery.is-dragging .me-gallery__card:hover img {
    transform: scale(var(--zoom));
  }
}

.me-gallery.is-animated:focus { outline: none; }
.me-gallery.is-animated:focus-visible {
  outline: 2px solid var(--g-gold);
  outline-offset: -4px;
}

/* ══ Accesibilidad: sin animaciones ══ */
@media (prefers-reduced-motion: reduce) {
  .me-gallery__card img { transition: none; }
}
