/* ==========================================================================
   Wonder · Ficha de producto (juguete y libro)
   ========================================================================== */

.wd-ficha {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: var(--wd-e8);
  align-items: start;
  padding-bottom: var(--wd-e10);
}

/* --- Galería -------------------------------------------------------------- */

/* La galería queda fija mientras se recorre la columna de compra, y se
   suelta sola al terminar la fila. Lo hace `sticky` dentro de la rejilla:
   no hace falta JavaScript ni medir alturas.

   `max-height` con la altura de la ventana para que una galería más alta
   que la pantalla no quede cortada por abajo al anclarse. */
.wd-galeria {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: var(--wd-e4);
  position: sticky;
  top: var(--wd-e4);
}

.wd-galeria__miniaturas { display: grid; gap: var(--wd-e2); align-content: start; }
.wd-galeria__mini {
  width: 64px;
  height: 64px;
  padding: var(--wd-e1);
  background: var(--wd-superficie);
  border: 2px solid var(--wd-borde);
  border-radius: var(--wd-r);
  overflow: hidden;
}
.wd-galeria__mini img { width: 100%; height: 100%; object-fit: contain; }
.wd-galeria__mini[aria-current="true"] { border-color: var(--wd-navy); }
.wd-galeria__mini:hover { border-color: var(--wd-borde-fuerte); }

/* El marco es cuadrado salvo en pantallas bajas: ahí se limita a la altura
   de la ventana para que, anclado, no quede cortado por abajo. Al recortar
   la altura deja de ser cuadrado, pero la foto no se pierde porque va con
   `object-fit: contain`. */
.wd-galeria__marco {
  position: relative;
  background: var(--wd-superficie);
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r-md);
  aspect-ratio: 1;
  max-height: calc(100vh - 5rem);
  overflow: hidden;
}
.wd-galeria__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: var(--wd-e8);
  transition: transform 0.2s ease;
}
.wd-galeria__marco:hover .wd-galeria__img { transform: scale(1.6); }

.wd-galeria__distintivo {
  position: absolute;
  top: var(--wd-e4);
  left: var(--wd-e4);
  z-index: 1;
  mix-blend-mode: normal;
}
.wd-galeria__pista {
  position: absolute;
  right: var(--wd-e4);
  bottom: var(--wd-e4);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r-full);
  padding: 2px var(--wd-e3);
  font-size: var(--wd-t-xs);
  color: var(--wd-texto-medio);
}

/* --- Columna de compra ------------------------------------------------------ */

/* Sin anclar: es la columna que se recorre. */
.wd-compra { display: grid; gap: var(--wd-e4); container-type: inline-size; }

.wd-compra__marca {
  font-size: var(--wd-t-xs);
  font-weight: var(--wd-peso-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--wd-texto-tenue);
}
.wd-compra__titulo {
  font-size: var(--wd-t-xl);
  font-weight: var(--wd-peso-bold);
  line-height: 1.18;
  letter-spacing: -0.015em;
}
.wd-compra__autor { font-size: var(--wd-t-sm); color: var(--wd-texto-medio); }
.wd-compra__autor a { font-weight: var(--wd-peso-bold); color: var(--wd-navy); text-decoration: underline; }
.wd-compra__sku { font-size: var(--wd-t-sm); color: var(--wd-texto-tenue); }

.wd-compra__valoracion {
  display: flex;
  align-items: center;
  gap: var(--wd-e2);
  font-size: var(--wd-t-sm);
}
.wd-compra__valoracion a { text-decoration: underline; font-weight: var(--wd-peso-bold); }

/* --- Caja de precio ---------------------------------------------------------- */

.wd-caja-precio {
  background: var(--wd-crema);
  border: 1px solid var(--wd-crema-borde);
  border-radius: var(--wd-r-md);
  padding: var(--wd-e5);
  display: grid;
  gap: var(--wd-e2);
}
.wd-caja-precio__fila { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--wd-e3); }
.wd-caja-precio__actual {
  font-size: var(--wd-t-2xl);
  font-weight: var(--wd-peso-bold);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.wd-caja-precio__antes {
  font-size: var(--wd-t-md);
  color: var(--wd-texto-tenue);
  text-decoration: line-through;
  font-variant-numeric: tabular-nums;
}
.wd-caja-precio__ahorro {
  background: var(--wd-rojo);
  color: #fff;
  font-size: var(--wd-t-xs);
  font-weight: var(--wd-peso-bold);
  border-radius: var(--wd-r-full);
  padding: var(--wd-e1) var(--wd-e3);
}

/* --- Chips y variantes -------------------------------------------------------- */

.wd-compra__chips { display: flex; flex-wrap: wrap; gap: var(--wd-e2); }

.wd-variantes { display: grid; gap: var(--wd-e2); }
.wd-variantes__titulo { font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); }
.wd-variantes__opciones { display: flex; flex-wrap: wrap; gap: var(--wd-e2); }
.wd-variante {
  border: 1px solid var(--wd-borde-fuerte);
  background: var(--wd-superficie);
  border-radius: var(--wd-r);
  padding: var(--wd-e2) var(--wd-e4);
  font-size: var(--wd-t-sm);
  font-weight: var(--wd-peso-bold);
}
.wd-variante[aria-pressed="true"] {
  background: var(--wd-navy);
  border-color: var(--wd-navy);
  color: #fff;
}

/* --- Selector de formato del libro (lista de radios) --------------------------- */

.wd-formatos { display: grid; gap: var(--wd-e2); border: 0; padding: 0; margin: 0; }
.wd-formatos legend {
  font-size: var(--wd-t-sm);
  font-weight: var(--wd-peso-bold);
  padding: 0;
  margin-bottom: var(--wd-e1);
}
.wd-formato {
  display: flex;
  align-items: center;
  gap: var(--wd-e3);
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r);
  padding: var(--wd-e3) var(--wd-e4);
  background: var(--wd-superficie);
  cursor: pointer;
}
.wd-formato:hover { border-color: var(--wd-borde-fuerte); }
.wd-formato:has(input:checked) {
  border-color: var(--wd-navy);
  box-shadow: inset 0 0 0 1px var(--wd-navy);
}
.wd-formato:has(input:focus-visible) { outline: 3px solid var(--wd-amarillo-ui); outline-offset: 2px; }
.wd-formato__texto { flex: 1; min-width: 0; }
.wd-formato__nombre { display: block; font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); }
.wd-formato__nota { display: block; font-size: var(--wd-t-xs); color: var(--wd-texto-medio); }
.wd-formato__precio {
  font-size: var(--wd-t-sm);
  font-weight: var(--wd-peso-bold);
  font-variant-numeric: tabular-nums;
}
.wd-formato--simulado { border-style: dashed; }

/* --- Cantidad y CTA ------------------------------------------------------------ */

.wd-cantidad-fila { display: flex; align-items: center; gap: var(--wd-e4); flex-wrap: wrap; }

.wd-disponible { font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); color: var(--wd-exito); }
.wd-agotado { font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); color: var(--wd-rojo); }

.wd-compra__acciones { display: grid; gap: var(--wd-e2); }
.wd-compra__fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--wd-e2); }
/* Deseos: solo el corazón en columnas estrechas (móvil), «Deseos» en la
   columna de escritorio (400 px) y el texto completo cuando sobra sitio.
   «Agregar al carrito · RD$…» mide unos 260 px y no debe partirse. */
.wd-compra__deseo { padding-inline: var(--wd-e4); }
.wd-compra__deseo-largo, .wd-compra__deseo-corto { display: none; }
@container (min-width: 370px) { .wd-compra__deseo-corto { display: inline; } }
@container (min-width: 480px) { .wd-compra__deseo-corto { display: none; } .wd-compra__deseo-largo { display: inline; } }

/* --- Panel de entrega ----------------------------------------------------------- */

.wd-entrega {
  display: grid;
  gap: var(--wd-e3);
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r);
  background: var(--wd-superficie);
  padding: var(--wd-e4);
}
.wd-entrega__item { display: flex; gap: var(--wd-e3); font-size: var(--wd-t-sm); }
.wd-entrega .wd-icono { flex: none; color: var(--wd-navy); }
.wd-entrega__item strong { font-weight: var(--wd-peso-bold); }

/* --- Incluye --------------------------------------------------------------------- */

.wd-incluye__titulo { font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); margin-bottom: var(--wd-e2); }
.wd-incluye ul { display: grid; gap: var(--wd-e1); font-size: var(--wd-t-sm); color: var(--wd-texto-medio); }
.wd-incluye li { padding-left: var(--wd-e4); position: relative; }
.wd-incluye li::before { content: "•"; position: absolute; left: var(--wd-e1); color: var(--wd-amarillo-ui); font-weight: 700; }

/* ==========================================================================
   Contenido inferior
   ========================================================================== */

.wd-tablist {
  display: flex;
  gap: var(--wd-e6);
  border-bottom: 1px solid var(--wd-borde);
  overflow-x: auto;
  scrollbar-width: none;
}
.wd-tablist::-webkit-scrollbar { display: none; }
.wd-tab {
  padding: var(--wd-e3) 0;
  font-size: var(--wd-t-sm);
  font-weight: var(--wd-peso-bold);
  color: var(--wd-texto-medio);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.wd-tab[aria-selected="true"] { color: var(--wd-navy); border-bottom-color: var(--wd-navy); }

.wd-panel { padding-block: var(--wd-e6); max-width: var(--wd-ancho-texto); }
.wd-panel h3 { font-size: var(--wd-t-md); font-weight: var(--wd-peso-bold); margin-bottom: var(--wd-e3); }
.wd-panel p { margin-bottom: var(--wd-e4); line-height: 1.65; color: var(--wd-texto-medio); }

/* La sinopsis ocupa el ancho de la sección en dos columnas: a una sola, las
   líneas de 1.200 px no se pueden leer. Las demás pestañas siguen a ancho de
   texto. */
#panel-desc { max-width: none; }
.wd-sinopsis { columns: 2 22rem; column-gap: var(--wd-e10); }
.wd-sinopsis p { break-inside: avoid; }
.wd-sinopsis p:first-child { color: var(--wd-texto); }

/* --- Tabla de detalles ------------------------------------------------------------ */

.wd-detalles { border: 1px solid var(--wd-borde); border-radius: var(--wd-r); overflow: hidden; background: var(--wd-superficie); }
.wd-detalles th, .wd-detalles td {
  text-align: left;
  padding: var(--wd-e3) var(--wd-e4);
  font-size: var(--wd-t-sm);
  border-bottom: 1px solid var(--wd-borde);
}
.wd-detalles tr:last-child th, .wd-detalles tr:last-child td { border-bottom: 0; }
.wd-detalles th { width: 40%; font-weight: var(--wd-peso-bold); background: var(--wd-pozo); }
.wd-detalles td { color: var(--wd-texto-medio); }
.wd-detalles--envio { margin-bottom: var(--wd-e4); }
.wd-detalles--envio th { width: 60%; }
.wd-detalles .wd-pendiente { color: var(--wd-aviso); font-style: italic; }

/* --- Preguntas ---------------------------------------------------------------------- */

.wd-pregunta {
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r);
  background: var(--wd-superficie);
  padding: var(--wd-e4);
  margin-bottom: var(--wd-e2);
}
.wd-pregunta__p { display: flex; gap: var(--wd-e3); font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); }
.wd-pregunta__r { display: flex; gap: var(--wd-e3); font-size: var(--wd-t-sm); color: var(--wd-texto-medio); margin-top: var(--wd-e2); }
.wd-pregunta__marca {
  flex: none;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: var(--wd-r-sm);
  background: var(--wd-navy); color: #fff;
  font-size: 10px; font-weight: var(--wd-peso-bold);
}
.wd-pregunta__r .wd-pregunta__marca { background: var(--wd-amarillo-ui); color: var(--wd-navy); }

/* --- Comprados juntos ----------------------------------------------------------------- */

.wd-juntos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--wd-e5);
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r);
  background: var(--wd-superficie);
  padding: var(--wd-e5);
}
.wd-juntos__lista { display: flex; align-items: flex-start; gap: var(--wd-e3); flex-wrap: wrap; }
.wd-juntos__item { width: 118px; display: grid; gap: var(--wd-e2); justify-items: center; text-align: center; }
.wd-juntos__caja {
  width: 92px; height: 92px;
  background: var(--wd-pozo);
  border-radius: var(--wd-r);
  padding: var(--wd-e2);
}
.wd-juntos__caja img { width: 100%; height: 100%; object-fit: contain; }
.wd-juntos__nombre {
  font-size: var(--wd-t-xs);
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
a.wd-juntos__caja { display: block; }
a.wd-juntos__nombre { color: inherit; text-decoration: none; }
a.wd-juntos__nombre:hover { text-decoration: underline; }
.wd-juntos__item--fuera .wd-juntos__caja,
.wd-juntos__item--fuera .wd-juntos__nombre,
.wd-juntos__item--fuera .wd-juntos__precio { opacity: .45; }
.wd-juntos__precio { font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); }
.wd-juntos__mas { font-size: 18px; color: var(--wd-texto-tenue); align-self: center; }
.wd-juntos__total { margin-left: auto; text-align: right; display: grid; gap: var(--wd-e2); }
.wd-juntos__etiqueta { font-size: var(--wd-t-xs); color: var(--wd-texto-medio); }
.wd-juntos__cifra { font-size: var(--wd-t-lg); font-weight: var(--wd-peso-bold); }

/* --- Saga -------------------------------------------------------------------------------- */

.wd-saga-tira { border: 1px solid var(--wd-borde); border-radius: var(--wd-r); background: var(--wd-superficie); padding: var(--wd-e5); }
.wd-saga-tira__cab { display: flex; justify-content: space-between; align-items: baseline; gap: var(--wd-e4); margin-bottom: var(--wd-e4); }
.wd-saga-tira__etiqueta { font-size: var(--wd-t-xs); font-weight: var(--wd-peso-bold); letter-spacing: 0.1em; text-transform: uppercase; color: var(--wd-rojo); }
.wd-saga-tira__lista { display: grid; grid-auto-flow: column; grid-auto-columns: 122px; gap: var(--wd-e3); overflow-x: auto; padding-bottom: var(--wd-e2); }
.wd-saga-tira__item { display: grid; gap: var(--wd-e2); }
.wd-saga-tira__caja { position: relative; aspect-ratio: 3/4; background: var(--wd-pozo); border-radius: var(--wd-r-sm); overflow: hidden; }
.wd-saga-tira__caja img { width: 100%; height: 100%; object-fit: contain; }
.wd-saga-tira__num {
  position: absolute; top: 4px; left: 4px;
  width: 20px; height: 20px; display: grid; place-items: center;
  background: var(--wd-navy); color: #fff;
  border-radius: var(--wd-r-sm); font-size: 11px; font-weight: var(--wd-peso-bold);
}
.wd-saga-tira__nombre { font-size: var(--wd-t-xs); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wd-saga-tira__precio { font-size: var(--wd-t-xs); font-weight: var(--wd-peso-bold); }
.wd-saga-tira__actual { border: 2px solid var(--wd-navy); border-radius: var(--wd-r-sm); }

/* --- Reseñas ------------------------------------------------------------------------------- */

.wd-editorial {
  background: var(--wd-navy);
  color: #fff;
  border-radius: var(--wd-r);
  padding: var(--wd-e5);
  margin-bottom: var(--wd-e6);
}
.wd-editorial__etiqueta { font-size: var(--wd-t-xs); font-weight: var(--wd-peso-bold); letter-spacing: 0.1em; text-transform: uppercase; color: var(--wd-amarillo); }
.wd-editorial__cita { font-size: var(--wd-t-md); line-height: 1.55; font-style: italic; margin-block: var(--wd-e3); }
.wd-editorial__firma { font-size: var(--wd-t-sm); color: #a8b8c2; }

.wd-resumen-resenas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--wd-e8);
  align-items: center;
  background: var(--wd-superficie);
  border: 1px solid var(--wd-borde);
  border-radius: var(--wd-r);
  padding: var(--wd-e5);
  margin-bottom: var(--wd-e5);
}
.wd-resumen-resenas__nota { text-align: center; }
.wd-resumen-resenas__cifra { font-size: 2.5rem; font-weight: var(--wd-peso-bold); line-height: 1; }
.wd-resumen-resenas__estrellas { color: var(--wd-amarillo-ui); font-size: var(--wd-t-md); }
.wd-resumen-resenas__conteo { font-size: var(--wd-t-xs); color: var(--wd-texto-medio); }
.wd-histograma { flex: 1; min-width: 240px; display: grid; gap: var(--wd-e1); }
.wd-histograma__fila { display: flex; align-items: center; gap: var(--wd-e3); font-size: var(--wd-t-xs); }
.wd-histograma__barra { flex: 1; height: 8px; background: var(--wd-borde); border-radius: var(--wd-r-full); overflow: hidden; }
.wd-histograma__relleno { height: 100%; background: var(--wd-amarillo-ui); }

.wd-resena { border-bottom: 1px solid var(--wd-borde); padding-block: var(--wd-e4); }
.wd-resena__cab { display: flex; align-items: center; gap: var(--wd-e2); font-size: var(--wd-t-sm); margin-bottom: var(--wd-e1); }
.wd-resena__autor { font-weight: var(--wd-peso-bold); }
.wd-resena__verificada { color: var(--wd-exito); font-size: var(--wd-t-xs); font-weight: var(--wd-peso-bold); }
.wd-resena__fecha { color: var(--wd-texto-tenue); font-size: var(--wd-t-xs); margin-left: auto; }
.wd-resena__titulo { font-size: var(--wd-t-sm); font-weight: var(--wd-peso-bold); }
.wd-resena__texto { font-size: var(--wd-t-sm); color: var(--wd-texto-medio); margin-block: var(--wd-e1) var(--wd-e2); }
.wd-resena__util { font-size: var(--wd-t-xs); color: var(--wd-texto-tenue); display: flex; gap: var(--wd-e3); }
.wd-resena__util button { text-decoration: underline; }

/* ==========================================================================
   Adaptación
   ========================================================================== */

@media (max-width: 1080px) {
  .wd-ficha { grid-template-columns: 1fr; }
  /* Apiladas no hay nada por lo que anclar. */
  .wd-galeria { position: static; }
  .wd-galeria__marco { max-height: none; }
}

@media (max-width: 720px) {
  .wd-galeria { grid-template-columns: 1fr; }
  .wd-galeria__miniaturas {
    grid-auto-flow: column;
    grid-auto-columns: 56px;
    overflow-x: auto;
    order: 2;
  }
  .wd-galeria__mini { width: 56px; height: 56px; }
  .wd-galeria__img { padding: var(--wd-e4); }
  .wd-compra__titulo { font-size: var(--wd-t-lg); }
  .wd-caja-precio__actual { font-size: var(--wd-t-xl); }
  .wd-juntos__total { margin-left: 0; text-align: left; }
}
