/* ============================================================
   carassiu, Página de producto (PDP)
   Depende de styles.css (tipografías, tokens y estilos de .nav)
   ============================================================ */

:root {
  --pdp-orange: #f49a13;
  --pdp-blue: #90cef1;

  /* medidas compartidas por la tarjeta y por los reels, que se alinean con ella */
  --pdp-pad: clamp(24px, 3.2vw, 46px);
  --pdp-gap: clamp(28px, 5vw, 86px);
  --pdp-col-1: 0.86fr;
  --pdp-col-2: 1fr;

  /* rejilla de la galería: la reusan los botones para centrarse bajo la foto */
  --g-thumb: clamp(74px, 8vw, 96px);
  --g-gap: clamp(8px, 1vw, 14px);
}

/* ============================================================
   SECCIÓN · Ficha de producto
   ============================================================ */
.pdp {
  position: relative;
  padding: 22px clamp(16px, 4vw, 56px) clamp(60px, 8vw, 120px);
  background: var(--pdp-blue);
  overflow: hidden;
}
.pdp__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  pointer-events: none;
}

/* ---------- Nav en naranja con letra blanca ---------- */
.nav--orange {
  background: var(--pdp-orange);
  max-width: 1180px;
  margin: 0 auto;
}
.nav--orange .nav__menu a { color: #fff; }
.nav--orange .nav__menu a:hover { color: var(--cream); opacity: 0.8; }
.nav--orange .nav__cart {
  background: #fff;
  color: var(--pdp-orange);
}
.nav--orange .nav__cart:hover { background: var(--cream); }
.nav--orange .nav__toggle span { background: #fff; }
.nav--orange .nav__logo img { height: 24px; filter: brightness(0) invert(1); }

/* el número queda centrado dentro del círculo */
.nav--orange .nav__cart-count {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-width: 0;
  padding: 0;
  line-height: 0;          /* line-height heredado descentraba el dígito */
  font-size: 0.68rem;
  text-align: center;
}
.nav--orange .nav__cart-count[hidden] { display: none; }

/* ============================================================
   Tarjeta blanca con la ficha
   ============================================================ */
.pdp__card {
  position: relative;
  z-index: 10;
  max-width: 1050px;
  margin: clamp(22px, 3vw, 46px) auto 0;
  padding: var(--pdp-pad);
  background: #fff;
  box-shadow: 0 30px 70px -34px rgba(31, 56, 92, 0.45);

  display: grid;
  grid-template-columns: minmax(0, var(--pdp-col-1)) minmax(0, var(--pdp-col-2));
  gap: var(--pdp-gap);
  align-items: start;
}

/* ============================================================
   Galería
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: var(--g-thumb) minmax(0, 1fr);
  gap: var(--g-gap);
  align-items: stretch;
}
.gallery__thumbs {
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 0;   /* las tres miniaturas se tocan, sin espacio entre ellas */
  min-height: 0;
}
.gthumb {
  position: relative;      /* la imagen va absoluta: no aporta altura propia */
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.2s ease, opacity 0.2s ease;
}
.gthumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* el bote sin fondo también sube aquí: si no, se corta por la base */
.gthumb img[src$="producto-beforsun.webp"] { object-position: center 78%; }
.gthumb:hover { opacity: 0.86; }
.gthumb:focus-visible { outline-color: var(--pdp-orange); }

/* la principal manda en la altura de la fila: cuadrada sobre su propio ancho */
.gallery__main {
  align-self: start;
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0;
  overflow: hidden;
  background: #fff;
}
.gallery__main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.25s ease;
}
/* el bote sin fondo sube dentro de su marco para que se vea más su base */
.gallery__main img[src$="producto-beforsun.webp"] { object-position: center 72%; }
.gallery__main.is-swapping img { opacity: 0; }

/* ---------- Contador + botón (centrados bajo la foto principal) ---------- */
/* el padding salta la columna de miniaturas: así el par queda centrado
   respecto a la imagen grande, no respecto a toda la galería */
.pdp__actions {
  display: flex;
  gap: var(--g-gap);
  align-items: center;
  justify-content: center;
  padding-left: calc(var(--g-thumb) + var(--g-gap));
  margin-top: clamp(14px, 1.8vw, 22px);
}
.qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: clamp(27px, 2.5vw, 32px);
  padding: 0 5px;
  border: 1.6px solid var(--red);
  border-radius: 999px;
  background: #fff;
}
.qty__btn {
  width: 17px;
  border: 0;
  background: none;
  color: var(--red);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.qty__btn:hover { opacity: 0.6; }
.qty__value {
  width: 22px;
  border: 0;
  background: none;
  color: var(--red);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: center;
  padding: 0;
}
.qty__value:focus { outline: none; }

.btn-add {
  justify-self: start;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-inline: clamp(14px, 1.8vw, 24px);   /* se ajusta al texto */
  padding-block: 1px 0;    /* el texto queda ligerísimamente alto: se baja un punto */
  height: clamp(27px, 2.5vw, 32px);
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(0.7rem, 0.88vw, 0.82rem);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.15s ease;
}
.btn-add:hover { background: #c93a12; }
.btn-add:active { transform: scale(0.98); }
.btn-add.is-added { background: var(--green); }
/* móviles estrechos (375 px o menos): el texto no se parte en dos líneas */
@media (max-width: 389px) {
  .pdp__actions .btn-add { white-space: nowrap; padding-inline: 12px; }
}

/* ============================================================
   Información del producto
   ============================================================ */
.pdp__info { padding-top: clamp(4px, 1vw, 14px); }

.pdp__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: 'wght' 700, 'hght' 1000;
  font-size: clamp(1.36rem, 2.4vw, 2.08rem);
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  color: #1f3f7a;
}
.pdp__title em {
  font-style: italic;
  font-weight: 700;
}
.pdp__subtitle {
  margin: 1px 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(0.736rem, 1.08vw, 0.944rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #1f3f7a;
}
.pdp__price {
  margin: clamp(6.4px, 0.88vw, 10.4px) 0 0;
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(0.92rem, 1.44vw, 1.24rem);
  line-height: 1;
  color: #1f3f7a;
}

.pdp__desc {
  margin-top: clamp(6.4px, 0.88vw, 10.4px);
  font-family: var(--font-body);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(0.608rem, 0.76vw, 0.704rem);
  line-height: 1.28;
  color: #1f3f7a;
  max-width: none;
}
.pdp__desc p { margin: 0 0 0.6em; }
.pdp__desc p:last-child { margin-bottom: 0; }
.pdp__claim { font-weight: 600; }

/* ---------- Cómo usarlo ---------- */
.howto { margin-top: clamp(17.6px, 2.48vw, 32px); }
.howto__title {
  margin: 0 0 clamp(6.4px, 0.88vw, 9.6px);
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: 'wght' 700, 'hght' 1000;
  font-size: clamp(0.64rem, 0.84vw, 0.784rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1f3f7a;
}
.howto__steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(8px, 1.4vw, 20px);
  max-width: none;
}
.howto__step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
}
.howto__num {
  display: grid;
  place-items: center;
  width: clamp(24px, 2.4vw, 30px);
  height: clamp(24px, 2.4vw, 30px);
  border: 1.4px solid #1f3f7a;
  border-radius: 50%;
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: #1f3f7a;
}
.howto__step p {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(0.6rem, 0.75vw, 0.7rem);
  line-height: 1.12;               /* pasos más compactos */
  color: #1f3f7a;
}

/* ============================================================
   Reels, sobresalen del borde inferior de la tarjeta
   ============================================================ */
/* van anclados abajo a la derecha: asoman por debajo de la tarjeta
   y solo su parte superior se mete dentro */
.pdp__reels {
  position: absolute;
  left: var(--pdp-pad);
  right: var(--pdp-pad);
  top: 100%;
  transform: translateY(-24%);
  /* mismas columnas que la tarjeta: así el grupo se centra justo sobre el texto */
  display: grid;
  grid-template-columns: minmax(0, var(--pdp-col-1)) minmax(0, var(--pdp-col-2));
  gap: var(--pdp-gap);
  /* el contenedor cubre todo el ancho de la tarjeta: sin esto taparía
     los clics del botón de ingredientes, que queda justo debajo */
  pointer-events: none;
}
.pdp__reels-inner {
  grid-column: 2;
  display: flex;
  justify-content: center;
  gap: clamp(8px, 1vw, 14px);
}
.preel {
  width: clamp(90px, 10.3vw, 142px);
  aspect-ratio: 9 / 16;
  border-radius: 0;               /* sin esquinas redondeadas */
  overflow: hidden;
  background: #123;
  box-shadow: 0 16px 32px -18px rgba(31, 56, 92, 0.6);
}
.preel video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================================================
   Ingredientes + iconos (fuera de la tarjeta)
   ============================================================ */
.pdp__extra {
  position: relative;
  z-index: 5;
  max-width: 1100px;
  margin: clamp(26px, 3vw, 44px) auto 0;
}

/* anclaje del desplegable: sin esto la lista se posiciona respecto a
   .pdp__extra y aparece al final del bloque, bajo los iconos */
.ingredients {
  position: relative;
  max-width: none;
  margin-left: clamp(10px, 2.4vw, 42px);
}
.ingredients__toggle {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: 'wght' 700, 'hght' 1000;
  font-size: clamp(0.8rem, 1.1vw, 1rem);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.ingredients__toggle:hover { opacity: 0.78; }
/* misma caja que ocupa la lista desplegada: "Todos los ingredientes" y el boton de la ficha, juntos al borde derecho
   y el boton de la ficha juntos y pegados al borde derecho. Mismo cuerpo de letra que la lista para que
   los 66ch midan igual en ambas */
.ingredients__bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px clamp(14px, 2vw, 24px);
  width: min(66ch, 100%);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.74rem, 1vw, 0.92rem);
}
/* boton circular con icono de documento; el texto sale al pasar el raton */
.ingredients__sheet {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}
.ingredients__sheet:hover,
.ingredients__sheet:focus-visible { background: #fff; color: #1f385c; }
.ingredients__sheet::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 4px 10px;
  border-radius: 6px;
  background: #fff;
  color: #1f385c;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.ingredients__sheet:hover::after,
.ingredients__sheet:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.ingredients__list {
  position: absolute;
  top: 100%;
  left: 0;
  margin: 0;
  padding-top: clamp(8px, 1.2vw, 14px);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(0.74rem, 1vw, 0.92rem);
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  color: #fff;
  width: min(66ch, 100%);
  animation: ingredients-in 0.28s ease both;
  pointer-events: none;
}
@keyframes ingredients-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Tres iconos ---------- */
.pdp__features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 4vw, 60px);
  max-width: 760px;
  /* deja pasar los reels, que asoman por debajo de la tarjeta */
  margin: clamp(110px, 16vw, 200px) auto 0;
}
.pdp__features li { display: grid; place-items: center; }
/* los tres comparten alto de lienzo: escalando por altura, sus textos
   quedan en la misma línea y ninguno se deforma */
.pdp__features img {
  width: auto;
  height: clamp(80px, 10vw, 140px);
  max-width: 100%;
  transition: transform 0.25s ease;
}
.pdp__features li:hover img { transform: scale(0.95); }

/* ============================================================
   SECCIÓN 2 · PREGUNTAS FRECUENTES
   ============================================================ */
.faq {
  position: relative;
  /* el hueco inferior acoge el solape del carrusel y deja algo de aire antes del footer */
  padding: clamp(60px, 9vw, 130px) clamp(16px, 4vw, 56px) clamp(95px, 11vw, 165px);
  overflow: hidden;
  background: #cfe6ea;
}
/* La imagen se ancla arriba con una altura propia (mayor que la sección), no
   al 100% del contenedor: así al desplegar una pregunta la sección crece y solo
   se descubre un poco más de la parte baja de la foto, sin reencuadrarla. */
.faq__bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: auto;
  width: 100%;
  height: clamp(620px, 105vw, 1150px);
  object-fit: cover;
  object-position: center top;
  z-index: 0;
  pointer-events: none;
}

.faq__card {
  position: relative;
  z-index: 1;
  max-width: 1030px;
  margin: clamp(20px, 2.5vw, 40px) auto 0;
  padding: clamp(30px, 4.4vw, 66px) clamp(24px, 4vw, 60px) clamp(34px, 5vw, 70px);
  background: #fff;
}

/* el título va superpuesto y no debe interceptar clics del acordeón */
.faq__title {
  position: absolute;
  top: clamp(4px, 0.8vw, 12px);
  left: clamp(6px, 1vw, 20px);
  width: var(--faq-title-w);
  height: auto;
  z-index: 2;
  pointer-events: none;   /* no debe interceptar clics del acordeón */
}

/* la lista arranca con margen izquierdo y amplio arriba */
.faq__list {
  margin-left: clamp(34px, 5.4vw, 92px);
  margin-top: clamp(40px, 6vw, 80px);
  border-top: 1.5px solid var(--faq-blue, #164a97);
}
.faq {
  --faq-blue: #164a97;
  --faq-warm: #e44215;
  --faq-title-w: clamp(120px, 15vw, 205px);
}

.faq__item { border-bottom: 1.5px solid var(--faq-blue); }

.faq__q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(8.8px, 1.2vw, 14.4px) 4px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-variation-settings: 'wght' 700, 'hght' 1000;
  font-size: clamp(0.68rem, 1.08vw, 0.976rem);
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--faq-blue);
  transition: opacity 0.2s ease;
}
/* el botón ocupa toda la fila (el "+" queda pegado a la derecha);
   quien se estrecha es el texto de la pregunta */
.faq__q > span:first-child { max-width: 74%; }
.faq__item--warm .faq__q { color: var(--faq-warm); }
.faq__q:hover { opacity: 0.68; }

.faq__sign {
  flex: 0 0 auto;
  font-size: 1.35em;
  line-height: 0.8;
  transition: transform 0.25s ease;
}
.faq__q[aria-expanded="true"] .faq__sign { transform: rotate(45deg); }

.faq__a {
  padding: 0 4px clamp(9.6px, 1.28vw, 16px);
  font-family: var(--font-body);
  font-size: clamp(0.68rem, 0.88vw, 0.84rem);
  line-height: 1.45;
  color: var(--faq-blue);
  /* llega justo antes del "+" de la pregunta */
  max-width: calc(100% - 2.6em);
  animation: faq-in 0.26s ease both;
}
.faq__item--warm .faq__a { color: var(--faq-warm); }
.faq__a p { margin: 0; }

@keyframes faq-in {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   CARRUSEL DE PRODUCTO · transición entre FAQ y footer
   ============================================================ */
/* se monta a caballo entre las dos secciones: el margen negativo lo sube
   hasta el hueco que deja la FAQ y las tarjetas caen sobre el footer */
.pdp-carousel {
  position: relative;
  z-index: 30;
  display: flex;
  justify-content: center;
  margin: clamp(-195px, -17vw, -125px) 0 clamp(-350px, -35vw, -230px);
  pointer-events: none;   /* la franja no debe tapar el footer */
}
/* aquí el carrusel va más pequeño que en la home: se escala en bloque para
   no duplicar las medidas de tarjetas, flechas y offsets */
.pdp-carousel .carousel {
  pointer-events: auto;
  transform: scale(0.85);
  transform-origin: center center;
}

/* ============================================================
   RESPONSIVE · móvil
   ============================================================ */
@media (max-width: 860px) {
  .pdp { padding: 16px 16px clamp(48px, 12vw, 80px); }

  .nav--orange { max-width: none; }
  /* el desplegable móvil tiene fondo crema: los enlaces vuelven al rojo de marca */
  .nav--orange .nav__menu a { color: var(--red); }
  .nav--orange .nav__menu a:hover { color: var(--green); opacity: 1; }

  .pdp__card {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(18px, 5vw, 28px);
    margin-top: clamp(26px, 7vw, 44px);
    padding: clamp(18px, 5vw, 26px);
  }

  .gallery { grid-template-columns: clamp(58px, 16vw, 74px) minmax(0, 1fr); }
  /* en móvil va dentro de la columna de información (ver producto.js): centrado y con aire arriba y abajo */
  .pdp__actions { justify-content: center; padding-left: 0; margin: clamp(16px, 4.5vw, 24px) 0; }
  /* más ancho, sin tocar el tamaño ni la posición del texto que contiene */
  .btn-add { padding-inline: clamp(22px, 2.8vw, 34px); }

  .pdp__info { padding-top: 0; }
  .pdp__desc, .howto__steps { max-width: none; }

  /* en móvil la tarjeta es de una columna: los reels se centran a lo ancho */
  .pdp__reels {
    grid-template-columns: minmax(0, 1fr);
    transform: translateY(-10%);   /* un poco más bajados que antes (-22%) */
  }
  .pdp__reels-inner { grid-column: 1; }
  .preel { width: clamp(80px, 24vw, 108px); }

  /* en móvil los reels quedan centrados: hay que dejarles sitio antes de los
     ingredientes; al bajar los reels, este hueco crece con ellos */
  .pdp__extra { margin-top: clamp(178px, 47vw, 224px); }
  .ingredients { max-width: none; margin-left: 0; }
  /* en móvil la fila de ingredientes + ficha va centrada */
  .ingredients__bar { width: 100%; justify-content: center; gap: 16px; }
  /* al desplegar, el texto pasa a ocupar espacio real (deja de ser absoluto)
     para que la página se extienda y no se solape con los iconos de abajo */
  .ingredients__list { position: static; width: auto; padding-top: clamp(6px, 1.6vw, 12px); text-align: center; }

  .pdp__features {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    /* más aire respecto a ingredientes + ficha, con la lista cerrada o abierta */
    margin-top: clamp(38px, 11vw, 62px);
  }

  /* en móvil se quita el título "Preguntas frecuentes": solo queda el acordeón */
  .faq__title { display: none; }
  .faq__list { margin-left: 0; margin-top: clamp(4px, 1.2vw, 12px); }
  /* títulos de las preguntas un poco más grandes y legibles, sin partir línea */
  .faq__q { font-size: 0.78rem; gap: 8px; }
  .faq__q > span:first-child { max-width: 92%; }

  /* en móvil el footer es estrecho: el carrusel se apoya sobre la unión
     pero ya no invade los enlaces de abajo */
  .faq { padding-bottom: clamp(120px, 32vw, 190px); }
  .pdp-carousel { margin: clamp(-160px, -34vw, -105px) 0 0; }
}

/* Modo popup (iframe de vista rápida del carrito): solo la ficha
   (galería, añadir al carrito, descripción, vídeos, ingredientes) ,
   sin nav, sin lo que viene después, sin aviso de cookies. */
.is-popup-view .pdp .nav,
.is-popup-view main,
.is-popup-view #cookieConsent {
  display: none !important;
}
