/* LIVIN · Detalle de producto (producto.html?vino=<slug>).
   Page-only layout. Tabs, stepper, specs, cards, trust strip, pending photo and the live can are
   shared components from css/livin.css; this file places them and draws the stage and the rail. */

/* ?vino=<another product>: hidden until js/pages/producto.js paints it (see the inline script) */
/* opacity too: the stage's live layer sets visibility: visible on itself, which showed the poster alone on white */
html.detalle-espera [data-detalle] { visibility: hidden; opacity: 0; }
/* ...and, once its images are decoded, it comes in with a short fade instead of popping (2026-11-09) */
@media (prefers-reduced-motion: no-preference) {
  html.detalle-llega .detalle-hero, html.detalle-llega .detalle-miga [data-detalle] { animation: detalle-llega 460ms var(--ease-out) backwards; }
}
@keyframes detalle-llega { from { opacity: 0; } }

/* ------------------------------------------------------------------ breadcrumb */
.detalle-miga { padding-top: var(--e-5); padding-bottom: var(--e-5); }

/* ------------------------------------------------------------------ hero: gallery + buy column */
.detalle-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 29vw, 420px);
  column-gap: clamp(var(--e-6), 4vw, var(--e-8));
  align-items: start;
}

.galeria {
  --miniatura: clamp(72px, 6.8vw, 96px);
  display: grid;
  grid-template-columns: var(--miniatura) minmax(0, 1fr);
  column-gap: var(--e-3);
  align-items: start;
}

/* the stage: the product's colour field, lit like a studio sweep (light behind the can, the strong
   tint toward the floor), two out-of-focus copies of the can for depth, then the live can or a still */
.escenario {
  --esc-luz: var(--campo-claro);
  --esc-fondo: var(--campo);
  grid-column: 2;
  grid-row: 1;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  height: clamp(480px, calc(100svh - var(--alto-cabecera) - 150px), 660px);
  background-color: var(--esc-fondo);
  background-image:
    radial-gradient(42% 46% at 50% 42%, var(--esc-luz) 0%, transparent 100%),
    linear-gradient(176deg, var(--esc-luz) 0%, var(--esc-fondo) 60%);
}
/* frisante rosado needs no override: its shared field is lila light (#EAD3E6, 1.29:1 lighter than the
   #DFB4D5 can) with #F5E9F3 as its light, so the can stays the darker shape like on every other page.
   The plum can (#561B42) sits on plum: its light is a deeper mix, never the pale lilac */
.escenario.campo-frisante-tinto { --esc-luz: color-mix(in oklab, var(--ciruela) 64%, var(--lila) 36%); }

.escenario__fondo { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.escenario__desenfoque { position: absolute; width: auto; max-width: none; transform-origin: 50% 50%; }
.escenario__desenfoque--lejos { left: 7%; top: 8%; height: 40%; transform: rotate(-26deg); filter: blur(6px); opacity: 0.72; }
.escenario__desenfoque--cerca { right: -7%; bottom: -12%; height: 62%; transform: rotate(21deg); filter: blur(14px); opacity: 0.78; }

.escenario { --fundido: 420ms; }
.escenario__capa {
  position: absolute; inset: 0; z-index: 1;
  opacity: 0; visibility: hidden;
  transition: opacity var(--fundido) var(--ease-out-suave), visibility 0s linear var(--fundido);
}
.escenario__capa.is-activa { opacity: 1; visibility: visible; transition: opacity var(--fundido) var(--ease-out-suave), visibility 0s; }

/* live can: the poster takes the float pose (size and tilt of the first 3D frame), so the canvas
   fades in without a jump. 94.5% (was 90%): measured against the first live frame on 2026-11-09, the
   live can stood 5% taller than its poster and grew as it faded in. */
.escenario .lata3d__poster { height: calc(var(--lata-altura) * 94.5%); transform: translate(-50%, -50%) rotate(12deg); }

/* stills */
.escenario__vista {
  position: absolute; left: 50%; top: 50%;
  height: 74%; width: auto; max-width: none;
  transform: translate(-50%, -50%) scale(0.985);
  opacity: 0; visibility: hidden;
  transition: opacity var(--fundido) var(--ease-out-suave), transform var(--dur-lenta) var(--ease-out), visibility 0s linear var(--fundido);
}
.escenario__vista.is-visible {
  opacity: 1; visibility: visible; transform: translate(-50%, -50%);
  transition: opacity var(--fundido) var(--ease-out-suave), transform var(--dur-lenta) var(--ease-out), visibility 0s;
}
/* the lid view is a square crop whose body runs off its bottom edge: stand it on the stage floor */
.escenario__vista.is-tapa { top: auto; bottom: 0; height: 76%; transform: translateX(-50%) scale(0.985); transform-origin: 50% 100%; }
.escenario__vista.is-tapa.is-visible { transform: translateX(-50%); }
.escenario__vista.sin-transicion { transition: none; }

/* thumbnail rail. A whole can fitted into a 6:5 tile is a sliver a third of the tile wide, and at
   96px front, side and back look alike; so each upright still is drawn at 150% of the tile height,
   lid and foot past the edges, and the label face fills the tile: the wordmark (front), the sticker
   (three-quarter and side), the back copy (reverso). The live tile is the front view, same scale,
   tilted like the float pose. */
.galeria__miniaturas { grid-column: 1; grid-row: 1; display: grid; gap: var(--e-2); }
.miniatura { position: relative; display: block; width: 100%; aspect-ratio: 6 / 5; }
.miniatura__campo { position: absolute; inset: 0; overflow: hidden; display: block; }
.miniatura__campo img {
  position: absolute; left: 50%; top: 56%;
  height: 150%; width: auto; max-width: none;
  transform: translate(-50%, -50%);
  transition: transform var(--dur-lenta) var(--ease-out);
}
.miniatura--video .miniatura__campo img { transform: translate(-50%, -50%) rotate(12deg); }
/* the lid tile frames the rim alone, centred. The tapa raster (square) puts the rim ellipse at
   x 34→665 and y 26→566 of 700, with label art from y≈595: showing x 14→686 and y 16→576 holds the
   whole ellipse and leaves the art below the tile edge (6:5 tile: image 125% tall, top -2.86%) */
.miniatura--tapa .miniatura__campo img { top: -2.86%; height: 125%; transform: translateX(-50%); }
.miniatura::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  border: 2px solid transparent;
  transition: border-color var(--dur) var(--ease-out);
}
.miniatura:hover::after { border-color: rgb(17 17 17 / 0.28); }
.miniatura[aria-pressed="true"]::after { border-color: var(--tinta); }
.miniatura:focus-visible { outline-offset: 3px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .miniatura:hover .miniatura__campo img { transform: translate(-50%, -50%) scale(1.05); }
  .miniatura--video:hover .miniatura__campo img { transform: translate(-50%, -50%) rotate(12deg) scale(1.05); }
  .miniatura--tapa:hover .miniatura__campo img { transform: translateX(-50%) scale(1.05); }
}
/* the "video" badge */
.miniatura__play {
  position: absolute; left: 50%; top: 50%;
  width: 30px; height: 30px; margin-left: -15px; margin-top: -15px;
  display: grid; place-items: center;
  border-radius: var(--r-pill);
  background: var(--tinta); color: var(--blanco);
}
.miniatura__play .icon { --icon: 12px; fill: currentColor; stroke-width: 1.2; margin-left: 2px; }

/* buy column */
.detalle-info {
  --ritmo: var(--e-6);
  container-type: inline-size;
  align-self: center;
  display: flex; flex-direction: column; align-items: flex-start;
}
@media (min-width: 900px) and (max-height: 820px) { .detalle-info { --ritmo: var(--e-5); } }
/* the buy column's focal point, sized to the column (55.5px at 1440, 60px cap). The product name never
   breaks (nowrap span): a name too long for the line drops whole under "LIVIN". The widest single
   lines are "LIVIN Vino Tinto" (7.40em) and "Frisante Rosado" alone (7.37em), so 13.3cqi is the
   largest size that keeps both inside the column, with ~1.5% to spare. On desktop and phones Tinto
   holds one line and the other four names stack under "LIVIN"; at 600–899px the 60px cap in a 560px
   column fits more names on one line. The 2.25rem floor only binds below a ~303px viewport. */
.detalle-info__nombre { font-size: clamp(2.25rem, 13.3cqi, 3.75rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.035em; }
.detalle-info__nombre span { white-space: nowrap; }
.detalle-info__linea { margin-top: var(--e-4); max-width: 30ch; color: var(--tinta-2); }
.detalle-info__precio { margin-top: var(--ritmo); font-size: clamp(1.75rem, 1.35rem + 0.9vw, 2.25rem); line-height: 1; letter-spacing: -0.02em; }
.detalle-info__precio .precio__moneda { margin-left: 0.1em; font-size: 1.125rem; font-weight: 700; letter-spacing: 0.02em; }
@media (min-width: 900px) { .detalle-info__precio .precio__moneda { font-size: 1.25rem; } }
.detalle-info__compra { width: 100%; margin-top: var(--ritmo); display: grid; gap: var(--e-3); }
.detalle-info__compra .cantidad { justify-self: start; margin-bottom: var(--e-2); }
.detalle-info__confianza { width: 100%; margin-top: var(--ritmo); }
/* four labels in a ~400px column: a little less side padding keeps each to two or three lines */
.detalle-info .confianza__item { padding-left: var(--e-1); padding-right: var(--e-1); }
html.js-revelar .detalle-info > .revelar:nth-child(6) { --retraso: 450ms; }

/* ------------------------------------------------------------------ tabs */
.detalle-pestanas { padding-top: clamp(var(--e-8), 6.5vw, var(--e-9)); }
.detalle-pestanas .pestanas__lista { gap: clamp(4px, 2vw, 32px); }
.detalle-pestanas .pestanas__tab { min-width: clamp(6rem, 14vw, 13rem); }
/* with JS on wide screens the three panels share one cell, so switching never moves the page */
@media (min-width: 900px) {
  .pestanas.is-lista .detalle-paneles { display: grid; }
  .pestanas.is-lista .detalle-paneles > .pestanas__panel { grid-area: 1 / 1; }
  .pestanas.is-lista .detalle-paneles > .pestanas__panel[hidden] { display: block !important; visibility: hidden; }
}

.detalle-panel { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(var(--e-6), 5vw, 72px); align-items: start; }
.detalle-panel--descripcion { align-items: center; }
.detalle-panel .overline { margin-bottom: var(--e-4); }
.detalle-panel__titulo { font-size: clamp(2rem, 1rem + 2.8vw, 3.25rem); font-weight: 800; line-height: 1.04; letter-spacing: -0.032em; }
.detalle-panel__descripcion { margin-top: var(--e-4); max-width: 44ch; color: var(--tinta-2); }
.detalle-foto { --ratio: 12 / 5; --lata-alto: 74%; --lata-x: 60%; --lata-base: 12%; --nota-ancho: 28ch; }
/* with its photo the block opens to 2:1 beside the description: at the comp's 12:5 the glass rim and the can's
   base touched the edges (revision/detalle/probar-detalle.mjs wants >=85% of the photo's height in view) */
@media (min-width: 900px) { .detalle-foto.foto-pendiente--lista { --ratio: 2 / 1; } }
.specs--cata { grid-template-columns: minmax(6rem, max-content) 1fr; }
.detalle-maridaje__texto { max-width: 30ch; font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.875rem); font-weight: 700; line-height: 1.3; letter-spacing: -0.015em; text-wrap: balance; }

/* ------------------------------------------------------------------ También te puede gustar */
.detalle-reco { padding-top: var(--seccion); padding-bottom: var(--seccion); }
.detalle-reco__titulo { margin-bottom: clamp(var(--e-6), 3vw, var(--e-7)); } /* size: .titulo-3, as in the cart's suggestions */
.detalle-reco .tarjeta--mini .campo-lata { --ratio: 4 / 3; --lata-alto: 84%; }

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  .escenario .lata3d__poster { transform: translate(-50%, -50%); }
  .escenario__capa, .escenario__capa.is-activa, .escenario__vista, .escenario__vista.is-visible { transition: none; }
  .escenario__vista, .escenario__vista.is-visible { transform: translate(-50%, -50%); }
  .escenario__vista.is-tapa, .escenario__vista.is-tapa.is-visible { transform: translateX(-50%); }
}

/* ------------------------------------------------------------------ narrow: stage on top, rail under it */
@media (max-width: 899px) {
  .detalle-miga { padding-top: var(--e-4); padding-bottom: var(--e-4); }
  .detalle-hero { grid-template-columns: minmax(0, 1fr); row-gap: var(--e-6); }
  .galeria { grid-template-columns: minmax(0, 1fr); row-gap: var(--e-3); }
  .escenario {
    grid-column: 1; grid-row: 1;
    height: auto; aspect-ratio: 4 / 3;
    margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter));
  }
  .galeria__miniaturas { grid-column: 1; grid-row: 2; grid-template-columns: repeat(6, minmax(0, 88px)); }
  .miniatura { aspect-ratio: 1 / 1; }
  /* square tile: a square window can't hold the full rim width without reaching the label art, so
     it shows y 8→590 of the raster and lets the rim's far left and right run past the edges */
  .miniatura--tapa .miniatura__campo img { top: -1.4%; height: 120.3%; }
  /* one right edge for the line, stepper, buttons and trust row */
  .detalle-info { max-width: 560px; align-self: start; }
  .detalle-panel { grid-template-columns: minmax(0, 1fr); row-gap: var(--e-6); }
  .detalle-foto { --ratio: 4 / 3; }
}
@media (min-width: 600px) and (max-width: 899px) {
  .detalle-info__linea { max-width: 40ch; }
}
@media (max-width: 599px) {
  .escenario { aspect-ratio: 1 / 1; }
  .escenario__desenfoque--lejos { left: 2%; top: 5%; }
  /* the buy column's trust items in one quiet row: icon over a short label, no rules (the full
     strip still closes the page before the footer). Icons share one top line; at 360–430px the two
     longest claims take three lines ("cualquier momento" alone is wider than a quarter column) */
  .detalle-info .confianza--compacta .confianza__lista { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--e-1); }
  .detalle-info .confianza--compacta .confianza__item:nth-child(n) {
    border-top: 0; border-left: 0; gap: 6px; justify-content: flex-start;
    padding-top: var(--e-2); padding-bottom: var(--e-2); padding-left: 0; padding-right: 0;
    font-size: 0.75rem; line-height: 1.25; text-wrap: balance;
  }
  .detalle-info .confianza--compacta .confianza__item .icon { --icon: 22px; }
  .detalle-foto { --lata-x: 74%; --lata-alto: 66%; --nota-ancho: 22ch; }
  .specs--cata { grid-template-columns: minmax(0, 1fr); }
  .specs--cata dt { padding-bottom: 2px; border-bottom: 0; }
  .specs--cata dd { padding-top: 0; }
}
