/* ============================================================
   PHOTO MOSAIC
   ============================================================ */

.fe-product__mosaic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.fe-product__mosaic-img {
  aspect-ratio: 2 / 3;
  object-fit: cover;
  width: 100%;
  height: 100%;
  display: block;
}


/* ============================================================
   RESPONSIVE — TABLET (<=1024px)
   ============================================================ */

@media (max-width: 1024px) {

  .fe-product__hero-inner {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 0; /* en layout de 1 columna el gap crea espacio blanco vertical innecesario */
  }

  .fe-product__gallery {
    position: static;
  }

  .fe-product__panel {
    border-left: none;
    border-top: 1px solid var(--fe-border);
    padding-top: 0; /* panel is below image in stacked layout — no header offset needed */
  }

  .fe-product__panel-inner {
    position: static;
    padding: var(--fe-space-8);
  }

  .fe-product__wishlist {
    top: var(--fe-space-8);
    right: var(--fe-space-8);
  }

  .fe-product__details-inner {
    grid-template-columns: 1fr;
    gap: var(--fe-space-12);
  }

  .fe-product__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .fe-product__story-cinematic {
    grid-template-columns: 1fr;
    grid-template-rows: auto; /* reset: cada row se dimensiona por su contenido explícito */
  }

  .fe-product__story-cinematic-media {
    height: 50vh;
    order: 1;
  }

  .fe-product__story-cinematic-text {
    order: 2;
    padding: 60px var(--fe-space-8);
  }

  .fe-product__mosaic {
    grid-template-columns: repeat(3, 1fr);
  }

}


/* ============================================================
   RESPONSIVE — MOBILE (<=768px)
   ============================================================ */

@media (max-width: 768px) {

  /* ── FIX #7: Evita overflow horizontal en toda la página ── */
  .fe-product__hero,
  .fe-product__panel,
  .fe-product__details,
  .fe-product__reviews,
  .fe-product__story,
  .fe-product__partners {
    overflow-x: hidden;
  }

  /* ── FIX #10 + #12: Layout móvil — flexbox en lugar de grid para evitar
     comportamientos inconsistentes de Safari iOS con align-items:start y
     min-height en CSS Grid. Flexbox apila galería y panel sin espacio extra. ── */
  .fe-product__hero-inner {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-top: var(--fe-nav-height); /* empuja la imagen debajo del nav fijo de 80px */
    align-items: stretch;
    min-height: unset;
  }

  /* ── FIX #2: Foto del producto, proporción 4:5 en móvil ── */
  .fe-product__gallery {
    position: static;
    flex: 0 0 auto; /* no crece ni encoge; se ajusta a su contenido */
    width: 100%;
    overflow: hidden; /* clip por si algo excede las dimensiones */
  }

  .fe-product__images {
    /* height: 125vw = 100vw × 5/4 = proporción 4:5 con altura EXPLÍCITA.
       Usar "height: auto + aspect-ratio" no crea una altura "definite" en CSS,
       lo que rompe height:100% en los hijos (gallery-set → track → img) y
       deja espacio blanco dentro del contenedor. Con 125vw la cadena
       height:100% se resuelve correctamente y la imagen llena el contenedor. */
    height: 125vw;
    aspect-ratio: unset;
    position: relative; /* ancla el chevron con top:50% exacto */
  }

  /* ── FIX #2: Ocultar thumbnails en móvil ── */
  .fe-product__thumbs {
    display: none;
  }

  /* ── Swipe hint — chevron centrado exactamente en la imagen ── */
  .fe-product__gallery-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 16px; /* área táctil generosa sin apariencia visual */
    cursor: pointer;
    z-index: 20;
    pointer-events: auto;
    opacity: 0.72;
    transition: opacity 0.4s ease;
  }

  .fe-product__gallery-hint svg {
    display: block;
    color: var(--fe-white);
    filter: drop-shadow(0 1px 6px rgba(0, 0, 0, 0.6));
  }

  /* Se oculta con fade después del primer swipe (añadida via JS) */
  .fe-product__gallery-hint--hidden {
    opacity: 0;
    pointer-events: none;
  }

  /* ── Panel de compra ── */
  .fe-product__panel-inner {
    padding: var(--fe-space-6) var(--fe-space-4) var(--fe-space-8);
    gap: var(--fe-space-2); /* FIX #3: menos espacio entre elementos */
    max-width: 100%;
    box-sizing: border-box;
  }

  .fe-product__wishlist {
    top: var(--fe-space-6);
    right: var(--fe-space-4);
  }

  /* ── FIX #3: Reducir espacio entre título, estrellas y precio ── */
  .fe-product__title {
    font-size: var(--fe-size-xl);
    margin-bottom: 2px;
  }

  .fe-product__stars {
    margin-top: 2px;
    margin-bottom: 2px;
  }

  .fe-product__price {
    font-size: 1.5rem;
    margin-top: 2px;
    margin-bottom: 0;
  }

  /* ── FIX #4: Mini descripción no desborda horizontalmente ── */
  .fe-product__short-desc {
    overflow-wrap: break-word;
    word-break: break-word;
    overflow: hidden;
    max-width: 100%;
  }

  /* ── FIX #5: Swatches de color no se salen ── */
  .fe-product__swatches {
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
  }

  /* ── FIX #5: Botones de talla no se salen ── */
  .fe-product__sizes {
    flex-wrap: wrap;
    max-width: 100%;
    overflow: hidden;
  }

  /* ── FIX #6 + #11: Botones de acción no desbordan y son más altos ── */
  .fe-product__add-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    height: 60px; /* FIX #11: más alto para mejor UX táctil */
  }

  .fe-product__secondary-actions {
    flex-direction: column;
    gap: 4px;
  }

  .fe-product__wishlist-btn {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    justify-content: center;
    padding: 12px var(--fe-space-4);
    height: auto;
  }

  /* ── Barra sticky ── */
  .fe-product__sticky-bar {
    height: 56px;
    padding: 0 var(--fe-space-4);
    gap: var(--fe-space-3);
  }

  .fe-product__sticky-name {
    font-size: var(--fe-size-sm);
    max-width: 35%;
  }

  .fe-product__sticky-price {
    font-size: var(--fe-size-sm);
  }

  .fe-product__sticky-cta {
    padding: 0 var(--fe-space-4);
    font-size: 0.65rem;
    height: 36px;
  }

  /* ── FIX #9: Story Behind — foto pegada al bloque de texto, sin espacio ── */
  .fe-product__story-cinematic {
    display: flex;
    flex-direction: column;
    height: auto;
    max-height: none;
    overflow: hidden;
    gap: 0;
    width: 100%;
    padding: 0;
    margin: 0;
  }

  .fe-product__story-cinematic-media {
    order: 1;
    height: auto;   /* la imagen dicta su propia altura — foto completa, sin recorte */
    margin: 0;
    padding: 0;
    flex-shrink: 0;
    line-height: 0;
    font-size: 0;
  }

  /* Foto completa en móvil: altura natural, sin object-fit crop ni posición absoluta */
  .fe-product__story-cinematic-media img {
    position: static; /* cancela position:absolute del desktop */
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
    object-fit: unset;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: top;
  }

  .fe-product__story-cinematic-media video {
    position: static;
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: top;
  }

  .fe-product__story-cinematic-text {
    order: 2;
    padding: var(--fe-space-12) var(--fe-space-4);
    margin: 0;
    flex-shrink: 0;
  }

  .fe-product__story-cinematic-title {
    font-size: 1.5rem;
  }

  /* ── Grid de exploración ── */
  .fe-product__grid-title {
    font-size: var(--fe-size-lg);
  }

  .fe-product__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--fe-space-3);
  }

  .fe-product__upsells,
  .fe-product__related {
    padding: var(--fe-space-12) var(--fe-space-4);
  }

  .fe-product__details {
    padding: var(--fe-space-12) var(--fe-space-4);
  }

  /* ── Reviews ── */
  .fe-product__reviews {
    padding: var(--fe-space-12) var(--fe-space-4);
  }

  .fe-product__reviews-title {
    font-size: var(--fe-size-xl);
  }

  .fe-product__reviews-grid {
    columns: 1;
    column-gap: 0;
  }

  /* ── FIX #8: Mostrar solo 3 reviews en móvil; el resto se revela con "See more" ── */
  .fe-product__reviews-grid .fe-product__review-card:nth-child(n+4) {
    display: none;
  }

  .fe-product__reviews-grid.reviews-expanded .fe-product__review-card:nth-child(n+4) {
    /* inline-block, matching the card's base display (reviews.css) — block
       here would undo the Safari column fix the moment "See more" expands. */
    display: inline-block;
  }

  /* Botón mobile "See more reviews" — visible solo en móvil */
  .fe-product__reviews-see-more-wrap {
    display: block;
  }

  /* Ocultar en móvil el botón AJAX "Load More" (que es para desktop):
     el botón mobile-see-more lo reemplaza */
  .fe-product__reviews-more {
    display: none;
  }

  .fe-product__review-card {
    margin-bottom: 32px;
  }

  .fe-product__review-form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .fe-product__review-custom-form input[type="text"] {
    margin-bottom: 24px;
  }

  .fe-product__review-card {
    padding: 24px 16px;
  }

  .fe-product__mosaic {
    grid-template-columns: repeat(2, 1fr);
  }

}

/* ============================================================
   MOBILE CONTAINMENT — Nuclear override
   Previene que CUALQUIER elemento dentro de .fe-product
   cause scroll horizontal. Se aplica solo en móvil.
   ============================================================ */

@media (max-width: 768px) {
  .fe-product {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Todos los descendientes de .fe-product se limitan al ancho del viewport */
  .fe-product *:not(.fe-product__images):not(.fe-product__track):not(.fe-product__gallery-set) {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* La galería de imágenes necesita su propio manejo (carousel horizontal interno) */
  .fe-product__images,
  .fe-product__track,
  .fe-product__gallery-set {
    box-sizing: border-box;
  }

  /* Previene que texto largo sin espacios desborde */
  .fe-product p,
  .fe-product h1,
  .fe-product h2,
  .fe-product h3,
  .fe-product span:not(.fe-product__thumb):not(.fe-product__swatch) {
    overflow-wrap: break-word;
    word-break: break-word;
  }
}

/* ============================================================
   GALLERY HINT BUTTON (mobile swipe indicator)
   ============================================================ */

/* Solo se oculta en desktop. En móvil la regla del bloque
   @media (max-width: 768px) lo muestra con display: flex.
   NO poner esta regla sin media query — aplasta el display: flex móvil. */
@media (min-width: 769px) {
  .fe-product__gallery-hint {
    display: none;
  }
}

/* ============================================================
   STICKY BAR — solo en móvil
   ============================================================ */

/* En desktop (>768px) nunca mostrar la barra sticky */
@media (min-width: 769px) {
  .fe-product__sticky-bar {
    display: none;
  }
}

/* ─────────────────────────────────────────────────────────────
   Cart toast notification
   ───────────────────────────────────────────────────────────── */

@keyframes fe-toast-in {
  from { transform: translateX(calc(100% + 1.5rem)); opacity: 0; }
  to   { transform: translateX(0);                   opacity: 1; }
}

@keyframes fe-toast-out {
  from { transform: translateX(0);                   opacity: 1; }
  to   { transform: translateX(calc(100% + 1.5rem)); opacity: 0; }
}

.fe-cart-toast {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: 9999;
  display: none;
  align-items: center;
  gap: 14px;
  background: var(--fe-white);
  border: 1px solid var(--fe-border);
  border-left: 3px solid var(--fe-gold);
  padding: 1rem 1.25rem;
  max-width: 320px;
  pointer-events: none;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.fe-cart-toast--visible {
  display: flex;
  animation: fe-toast-in 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.fe-cart-toast--out {
  display: flex;
  animation: fe-toast-out 0.3s ease-in both;
}

.fe-cart-toast__img {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  object-fit: cover;
}

.fe-cart-toast__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.fe-cart-toast__name {
  font-family: var(--fe-font-display), serif;
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--fe-black);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fe-cart-toast__msg {
  font-family: var(--fe-font-body), sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--fe-warm-gray);
  text-transform: uppercase;
}

@media (max-width: 480px) {
  .fe-cart-toast {
    right: 1rem;
    left: 1rem;
    max-width: none;
    top: 72px;
  }
}

