/* ============================================================================
   TRAZA — Ficha de producto: imagen principal interactiva (pdp-story)
   Se carga solo en las fichas que tienen [data-pdp-story]. No toca estilos
   globales: todo cuelga de .ph (la imagen) o de .ph-panel-fixed (la columna
   derecha mientras dura el recorrido).
   Paleta y tipografías: las de la web (variables de styles.css).
   ========================================================================== */
.ph { --st-ease: cubic-bezier(.16, 1, .3, 1); position: relative; min-width: 0; }
.ph .u-sr {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- recorrido fijo (escritorio) ----------------------------------------- */
.ph.is-pinned .ph__stage { position: sticky; display: flex; flex-direction: column; align-items: center; }
.ph-panel-fixed { position: sticky; top: var(--ph-panel-top, calc(var(--nav-h) + 1rem)); }

/* --- tarjeta de la foto -------------------------------------------------- */
.ph__stage { position: relative; }
.ph__card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--r-block);
  background: #fff;
  isolation: isolate;
}
.ph.is-static .ph__card { width: 100%; }
.ph__bgs, .ph__bg { position: absolute; inset: 0; }
.ph__bg { opacity: 0; transition: opacity .8s var(--st-ease); }
.ph__bg--base { background: #fff; opacity: 1; }
.ph.is-fin .ph__bg.is-on { opacity: 1; }

.ph__word {
  position: absolute; left: 0; right: 0; top: 50%;
  margin: 0;
  transform: translateY(-62%);
  text-align: center; white-space: nowrap;
  font-family: var(--display); font-weight: 400;
  font-size: 7rem; line-height: .9; letter-spacing: -.02em;
  overflow: hidden; padding: .06em 0;
  opacity: 0;
  transition: opacity .6s var(--st-ease);
  pointer-events: none;
}
.ph.is-fin .ph__word { opacity: .85; }
.ph__l { display: inline-block; transform: translateY(105%); }
.ph.is-fin .ph__l { animation: phRoll .9s var(--st-ease) both; animation-delay: calc(var(--i) * 35ms); }
@keyframes phRoll { from { transform: translateY(105%); } to { transform: translateY(0); } }

/* la foto ocupa toda la tarjeta (misma proporción 4:5): los puntos van en % */
.ph__frame, .ph__spots { position: absolute; inset: 0; transform-origin: 50% 55%; }
.ph__frame { mix-blend-mode: multiply; }
.ph__spots { z-index: 2; }
/* "multiply": sobre blanco la foto se ve tal cual; sobre el color de fondo,
   el fondo de la foto toma ese color y la palabra queda detrás del producto */
.ph__photos { position: absolute; inset: 0; }
.ph__layer {
  position: absolute; inset: 0;
  opacity: 0; transform: scale(1.035);
  transition: opacity .7s var(--st-ease), transform .9s var(--st-ease);
}
.ph__layer.is-in { opacity: 1; transform: none; }
.ph__layer img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- puntos de detalle --------------------------------------------------- */
.story-spot {
  position: absolute; width: 0; height: 0; z-index: 2;
  transition: opacity .5s var(--st-ease);
}
.ph.is-pinned.is-fin .story-spot { opacity: 0; pointer-events: none; }
.ph.is-pinned.is-fin .story-spot * { pointer-events: none; }
.story-spot__dot {
  position: absolute; left: -22px; top: -22px;
  width: 44px; height: 44px;           /* área táctil */
  padding: 0; border: 0; background: none; cursor: pointer;
  display: grid; place-items: center;
}
.story-spot__dot::before {            /* halo */
  content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%;
  background: rgba(242, 239, 232, .45);
  transform: scale(1); opacity: 0;
  transition: transform .6s var(--st-ease), opacity .6s var(--st-ease);
}
.story-spot__dot::after {             /* punto */
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  background: var(--crema);
  box-shadow: 0 2px 10px rgba(23, 23, 21, .35);
  transform: scale(.55);
  transition: transform .6s var(--st-ease);
}
.story-spot.is-on .story-spot__dot::before { transform: scale(2.6); opacity: 1; }
.story-spot.is-on .story-spot__dot::after,
.story-spot__dot:hover::after { transform: scale(1); }
.story-spot__dot:focus-visible { outline: none; }
.story-spot__dot:focus-visible::after { box-shadow: 0 0 0 3px var(--carbon), 0 0 0 5px var(--crema); }
.story-spot__line {
  position: absolute; top: 0; left: 12px;
  width: 56px; height: 1px;
  background: var(--crema);
  transform: scaleX(0); transform-origin: left;
  transition: transform .55s var(--st-ease);
  pointer-events: none;
}
.story-spot__card {
  position: absolute; top: -20px; left: 72px;
  width: 230px;
  padding: .75rem .9rem;
  border-radius: var(--r-xs);
  background: rgba(23, 23, 21, .62);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  color: var(--crema);
  opacity: 0; transform: translateY(8px);
  transition: opacity .5s var(--st-ease), transform .6s var(--st-ease);
  pointer-events: none;
}
.story-spot--r .story-spot__line { left: auto; right: 12px; transform-origin: right; }
.story-spot--r .story-spot__card { left: auto; right: 72px; text-align: right; }
.story-spot.is-on .story-spot__line { transform: scaleX(1); transition-delay: .05s; }
.story-spot.is-on .story-spot__card { opacity: 1; transform: none; transition-delay: .15s; }
.story-spot__num {
  display: block; font-family: var(--sans); font-size: .66rem; font-weight: 500;
  letter-spacing: .16em; text-transform: uppercase; opacity: .8;
}
.story-spot__txt { display: block; margin-top: .3rem; font-family: var(--sans); font-size: .86rem; line-height: 1.4; }

/* --- textos sobre la foto ------------------------------------------------ */
.ph__label, .ph__count { position: absolute; z-index: 3; top: 1.4rem; margin: 0; transition: opacity .5s var(--st-ease), transform .6s var(--st-ease); }
.ph__label { left: 1.5rem; }
.ph__count {
  right: 1.5rem;
  font-family: var(--sans); font-size: var(--fs-label); letter-spacing: .18em; color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.ph__kicker {
  margin: 0; font-family: var(--sans); font-size: var(--fs-label); font-weight: 500;
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-mute);
}
.ph__sub { margin: .4rem 0 0; font-size: var(--fs-caption); color: var(--text-soft); font-variant-numeric: tabular-nums; }
.ph__label--fin, .ph__count { opacity: 0; transform: translateY(-6px); }
.ph.is-fin .ph__label--fin, .ph.is-fin .ph__count { opacity: 1; transform: none; }
.ph.is-fin .ph__label--detail { opacity: 0; transform: translateY(-6px); }
.ph.is-static .ph__label--detail { display: none; }

.ph__progress {
  position: absolute; z-index: 3; left: 0; right: 0; top: 0;
  height: 2px; background: rgba(23, 23, 21, .08);
  transition: opacity .5s var(--st-ease);
}
.ph__progress i { position: absolute; inset: 0; background: var(--carbon); transform: scaleX(0); transform-origin: left; }
.ph.is-fin .ph__progress, .ph.is-static .ph__progress { opacity: 0; }

/* --- muestras de color --------------------------------------------------- */
.ph__bar {
  display: flex; align-items: center; gap: 1rem;
  transition: opacity .5s var(--st-ease), transform .6s var(--st-ease);
}
.ph.is-pinned .ph__bar {
  position: absolute; z-index: 4; bottom: calc(1.4rem + var(--ph-row-h, 0px));
  left: calc(50% - var(--ph-card-w, 0px) / 2 + 1.5rem);
}
.ph__swatches { display: flex; gap: .7rem; }
.ph__sw {
  width: 34px; height: 34px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer;
  background: var(--sw);
  box-shadow: 0 6px 14px -8px rgba(23, 23, 21, .7);
  transition: transform .45s var(--st-ease);
}
.ph__sw:hover { transform: translateY(-3px) scale(1.06); }
.ph__sw.is-on { box-shadow: 0 0 0 3px var(--crema), 0 0 0 4px var(--carbon); }
.ph__sw:focus-visible { outline: 2px solid var(--carbon); outline-offset: 5px; }
.ph__next { margin: 0; font-size: var(--fs-label); letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); }
.ph__next span { color: var(--text-mute); }

/* un solo selector de color: el de la foto (en la columna derecha queda el nombre) */
.ph-owns-color [data-opt-color] { display: none; }

/* --- cursor -------------------------------------------------------------- */
.ph__cursor {
  position: absolute; left: 0; top: 0; z-index: 5;
  width: 92px; height: 92px; border-radius: 50%;
  background: var(--c, var(--carbon));
  display: grid; place-items: center;
  pointer-events: none; opacity: 0;
  transition: opacity .25s;
}
.ph__cursor span {
  font-family: var(--sans); font-size: .6rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--crema);
}
.ph__cursor.is-on { opacity: .92; }
.ph__card.is-cursor { cursor: none; }
.ph.is-fin .ph__card { cursor: pointer; }

/* --- celular / tablet / movimiento reducido ------------------------------ */
.ph__caption { display: none; }
.ph.is-static .ph__caption {
  display: block; min-height: 2.8em; margin: .9rem 0 0;
  font-size: var(--fs-caption); line-height: 1.45; color: var(--text-soft);
}
.ph.is-static .ph__caption b {
  font-weight: 500; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--carbon);
  margin-right: .3rem;
}
.ph.is-static .ph__bar { margin-top: 1rem; flex-wrap: wrap; }
.ph.is-static .ph__count { top: 1rem; right: 1rem; }
.ph.is-static .ph__label { top: 1rem; left: 1rem; }
@media (max-width: 1023px) {
  .ph.is-static .story-spot__card, .ph.is-static .story-spot__line { display: none; }
  .ph.is-static .ph__card { max-width: 560px; margin: 0 auto; }
  .ph.is-static .ph__bar, .ph.is-static .ph__caption { max-width: 560px; margin-left: auto; margin-right: auto; }
}
@media (max-width: 1023px) and (min-width: 600px) {
  .ph.is-static .ph__bar { justify-content: flex-start; }
}
@media (max-width: 599px) {
  .ph__sw { width: 40px; height: 40px; }
  .ph__swatches { gap: .8rem; }
  .ph.is-static .ph__bar { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  .ph__l, .ph.is-fin .ph__l { animation: none; transform: none; }
  .ph__bg, .ph__layer, .story-spot, .story-spot__line, .story-spot__card,
  .story-spot__dot::before, .story-spot__dot::after, .ph__sw, .ph__word,
  .ph__label, .ph__count, .ph__bar { transition: none; }
  .ph__layer { transform: none; }
}

/* Puntos ocultos cuando la foto del color elegido no es la toma de referencia */
.ph.spots-off .ph__spots { opacity: 0; pointer-events: none; }
.ph.spots-off .ph__spots * { pointer-events: none; }
.ph.spots-off .ph__caption { visibility: hidden; }
.ph.spots-off .ph__label--detail .ph__sub { visibility: hidden; }


/* --- tomas en negro: Estudio / Ambiente / Detalle ------------------------ */
.ph__view {
  position: absolute; inset: 0; z-index: 6;
  opacity: 0; pointer-events: none;
  transition: opacity .6s var(--st-ease);
  background: var(--bg-alt);
}
.ph__view img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph.is-view .ph__view { opacity: 1; }
.ph.is-view .story-spot, .ph.is-view .ph__bar, .ph.is-view .ph__label,
.ph.is-view .ph__count, .ph.is-view .ph__progress, .ph.is-view .ph__caption,
.ph.is-view .ph__cursor { opacity: 0 !important; pointer-events: none !important; }
.ph.is-view .ph__card { cursor: default; }
.ph__shots {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: .6rem; margin-top: 12px;
}
.ph__shot {
  position: relative; height: 104px; padding: 0; border: 1px solid transparent;
  border-radius: calc(var(--r-block) * .55); overflow: hidden; cursor: pointer;
  background: var(--bg-alt);
  transition: transform .45s var(--st-ease), border-color .3s;
}
.ph__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph__shot span {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: .45em .5em; background: rgba(23, 23, 21, .68); color: var(--crema);
  font-size: var(--fs-label); letter-spacing: .16em; text-transform: uppercase; text-align: center;
}
.ph__shot:hover { transform: translateY(-3px); }
.ph__shot.is-on { border-color: var(--acento); }
.ph__shot:focus-visible { outline: 2px solid var(--carbon); outline-offset: 3px; }
.ph.is-static .ph__shots { max-width: 560px; margin-left: auto; margin-right: auto; }
@media (max-width: 719px) { .ph__shot { height: 84px; } }
.ph.is-static.is-view .ph__bar, .ph.is-static.is-view .ph__caption { display: none; }

/* sin palabra gigante del color ni "siguiente" (5/10) */
.ph__word { display: none !important; }
.ph__next { color: var(--carbon); }
.ph.is-fin .ph__card { cursor: default; }

/* tomas en columna a la derecha de la foto, como Siatra (5/10) */
.ph.is-pinned .ph__stage { flex-direction: row; justify-content: center; align-items: flex-start; gap: 12px; }
.ph.is-pinned .ph__bar { left: calc(var(--ph-card-left, 0px) + 1.5rem); bottom: 1.4rem; }
.ph.is-pinned .ph__shots { margin-top: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ph.is-pinned .ph__shot { height: 100%; }
