/* PromoPrint · Vitrina: el catálogo entero vive en un solo estudio.
   Todas las fotos comparten el mismo set (fondo carbón, piso de concreto, contraluz ámbar arriba a la izquierda),
   así que al cambiar de producto el set se queda quieto y solo cambia el objeto: la luz del estudio "lo descubre"
   desde la esquina del contraluz. Usa los tokens de hero.css. Comportamiento en vitrina.js. */

@property --vit-r { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

.vit {
  --vit-line: rgb(var(--paper-rgb) / 0.12);
  --vit-48: rgb(var(--paper-rgb) / 0.56);
  --vit-dur: 4200ms; /* tiempo de cada producto en la vitrina automática */
  position: relative;
  background: var(--ink);
  padding: clamp(64px, 7vw, 112px) 0 clamp(72px, 8vw, 120px);
}
.vit__inner {
  width: var(--wrap);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) auto;
  column-gap: clamp(40px, 5vw, 96px);
  align-items: start;
}
/* La columna de la vitrina mide lo que mide el set: set + leyenda + tira caben en una pantalla. */
.vit__main {
  --stage: clamp(420px, calc(100svh - var(--nav-h) - 330px), 660px);
  width: min(var(--stage), 54vw);
}

/* ── Columna de entrada: título, buscador e índice ─────────────────── */

.vit__side { min-width: 0; }
.vit__eyebrow {
  display: flex; align-items: center; gap: 12px; margin: 0 0 18px;
  font: 600 12.5px/1.2 var(--font); letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-64);
}
.vit__eyebrow::before { content: ""; flex: none; width: 34px; height: 3px; border-radius: 2px; background: var(--brand); }
.vit__title {
  margin: 0; font-weight: 600; font-size: clamp(2.1rem, 1.2rem + 1.9vw, 3.25rem); line-height: 1.04;
  letter-spacing: -0.035em; color: var(--paper);
}
.vit__line { display: block; text-wrap: balance; }
.vit__title em { font-style: normal; color: var(--brand); }

.vit__search {
  position: relative; display: flex; align-items: center; margin-top: clamp(26px, 3vw, 36px);
  border: 1px solid var(--vit-line); border-radius: 999px; background: var(--carbon);
  transition: border-color var(--t-ui) var(--ease-ui), box-shadow var(--t-ui) var(--ease-ui);
}
.vit__search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(253, 87, 0, 0.16); }
.vit__search svg { position: absolute; left: 20px; width: 18px; height: 18px; fill: none; stroke: var(--paper-64); stroke-width: 1.8; stroke-linecap: round; pointer-events: none; }
.vit__q {
  flex: 1; min-width: 0; height: 54px; padding: 0 52px 0 50px; border: 0; background: none; outline: none;
  font: 500 16px/1 var(--font); color: var(--paper); -webkit-appearance: none; appearance: none;
}
.vit__q::placeholder { color: var(--vit-48); }
.vit__q::-webkit-search-cancel-button { display: none; }
.vit__kbd {
  position: absolute; right: 16px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid var(--vit-line);
  border-radius: 6px; font: 600 12px/1 var(--font); color: var(--vit-48); pointer-events: none;
}
.vit__clear {
  position: absolute; right: 5px; display: none; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: none; color: var(--paper-64); cursor: pointer;
}
.vit__clear svg { position: static; width: 16px; height: 16px; stroke: currentColor; }
.vit.has-q .vit__clear { display: grid; }
.vit.has-q .vit__kbd { display: none; }
.vit__clear:hover { color: var(--paper); }
.vit__clear:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.vit__status { min-height: 20px; margin: 12px 0 0 22px; font: 500 13.5px/1.4 var(--font); color: var(--vit-48); }
.vit__status a { color: var(--paper); text-underline-offset: 3px; }
.vit__status a:hover { color: var(--brand); }

.vit__cats ul { margin: 18px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--vit-line); }
.vit__cats li { border-bottom: 1px solid var(--vit-line); }
.vit__cat {
  position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; min-height: 40px;
  padding: 9px 0; font: 500 15.5px/1.3 var(--font); color: var(--paper-64); text-decoration: none;
  transition: color var(--t-ui) var(--ease-ui), padding var(--t-ui) var(--ease-out);
}
.vit__cat::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 10px; height: 2px; border-radius: 2px; background: var(--brand);
  transform: translateY(-50%) scaleX(0); transform-origin: left; transition: transform 260ms var(--ease-out);
}
.vit__cat-n { font: 600 12.5px/1 var(--font); letter-spacing: 0.04em; color: var(--vit-48); font-variant-numeric: tabular-nums; }
.vit__cat[aria-current="true"] { padding-left: 22px; color: var(--paper); }
.vit__cat[aria-current="true"]::before { transform: translateY(-50%) scaleX(1); }
.vit__cat[aria-current="true"] .vit__cat-n { color: var(--brand); }
.vit__cat:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
@media (hover: hover) and (pointer: fine) { .vit__cat:hover { color: var(--paper); } }
.vit.is-searching .vit__cat[aria-current="true"] { padding-left: 0; color: var(--paper-64); }
.vit.is-searching .vit__cat[aria-current="true"]::before { transform: translateY(-50%) scaleX(0); }

/* ── La vitrina: el set y el producto ─────────────────────────────── */

.vit__frame {
  position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 24px; background: #0e0d0d; isolation: isolate; touch-action: pan-y;
  box-shadow: 0 50px 110px -60px rgba(0, 0, 0, 0.95), inset 0 0 0 1px rgb(var(--paper-rgb) / 0.05);
}
.vit__frame:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.vit__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
/* La luz del estudio descubre el producto nuevo desde el contraluz (arriba a la izquierda). */
.vit__img.is-enter {
  -webkit-mask-image: radial-gradient(circle at 22% 18%, #000 var(--vit-r), transparent calc(var(--vit-r) + 24%));
          mask-image: radial-gradient(circle at 22% 18%, #000 var(--vit-r), transparent calc(var(--vit-r) + 24%));
  animation: vit-sweep 900ms var(--ease-out) forwards;
}
.vit__img.is-leave { animation: vit-leave 900ms var(--ease-out) forwards; }
@keyframes vit-sweep { from { --vit-r: -24%; } to { --vit-r: 142%; } }
@keyframes vit-leave { to { transform: scale(0.985); filter: brightness(0.7); } }
/* El destello ámbar del contraluz acompaña cada cambio. */
.vit__frame::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0;
  background: radial-gradient(60% 50% at 22% 18%, rgba(255, 150, 70, 0.32), transparent 70%);
  mix-blend-mode: screen;
}
.vit__frame.is-flash::after { animation: vit-flash 900ms var(--ease-out); }
@keyframes vit-flash { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
.vit__frame:not(.is-ready)::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(70% 55% at 30% 32%, rgba(255, 140, 60, 0.18), transparent 70%), linear-gradient(#141212, #0b0b0c 70%);
}
.vit__empty {
  position: absolute; inset: 0; z-index: 3; display: none; place-content: center; gap: 14px; padding: 32px; text-align: center;
  font: 500 16px/1.5 var(--font); color: var(--paper-64);
}
.vit.is-empty .vit__empty { display: grid; }
.vit.is-empty .vit__img { opacity: 0; transition: opacity 300ms; }

/* ── Leyenda y acciones ──────────────────────────────────────────── */

.vit__cap { margin-top: 22px; min-height: 64px; }
.vit__meta { margin: 0; font: 600 12px/1.3 var(--font); letter-spacing: 0.14em; text-transform: uppercase; color: var(--vit-48); }
.vit__meta b { color: var(--brand); font-weight: 600; }
.vit__name {
  margin: 6px 0 0; font: 600 clamp(1.4rem, 1.05rem + 0.9vw, 2rem)/1.15 var(--font); letter-spacing: -0.02em; color: var(--paper);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Controles sobre el piso oscuro del set, abajo a la derecha: no compiten con el producto ni con la leyenda. */
.vit__set { position: relative; }
.vit__ctrl {
  position: absolute; right: 14px; bottom: 14px; z-index: 4; display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 14px;
  border-radius: 999px; background: rgba(11, 11, 12, 0.55); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: inset 0 0 0 1px rgb(var(--paper-rgb) / 0.1);
}
.vit__ctrl .vit__btn { border-color: transparent; }
.vit__name a { color: inherit; text-decoration: none; }
.vit__name a:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
@media (hover: hover) and (pointer: fine) { .vit__name a:hover { color: var(--brand); } }
.vit__count { min-width: 58px; margin-right: 4px; font: 600 12.5px/1 var(--font); letter-spacing: 0.08em; color: var(--vit-48); text-align: right; font-variant-numeric: tabular-nums; }
.vit__count b { color: var(--paper); font-weight: 600; }
.vit__btn {
  display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--vit-line); border-radius: 50%;
  background: none; color: var(--paper); cursor: pointer;
  transition: border-color var(--t-ui) var(--ease-ui), color var(--t-ui) var(--ease-ui), transform 120ms var(--ease-ui);
}
.vit__btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.vit__btn:active { transform: scale(0.94); }
.vit__btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .vit__btn:hover { border-color: var(--brand); color: var(--brand); } }
.vit__btn .i-play { display: none; }
.vit.is-stopped .vit__btn .i-play { display: block; }
.vit.is-stopped .vit__btn .i-pause { display: none; }

.vit__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.vit__a {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px; border-radius: 999px;
  font: 600 15px/1 var(--font); text-decoration: none; transition: background-color var(--t-ui) var(--ease-ui), color var(--t-ui) var(--ease-ui), border-color var(--t-ui) var(--ease-ui);
}
.vit__a svg { width: 17px; height: 17px; flex: none; }
.vit__a--wa { background: var(--brand); color: var(--ink); }
.vit__a--wa svg { fill: currentColor; }
.vit__a--go { border: 1px solid var(--vit-line); color: var(--paper); }
.vit__a--go svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vit__a--all { display: flex; width: fit-content; min-height: 44px; margin: 4px 0 0 auto; padding: 0 4px; font-size: 14px; color: var(--paper-64); }
.vit__a--all svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.vit__a:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .vit__a--wa:hover { background: var(--paper); }
  .vit__a--go:hover { border-color: var(--paper); }
  .vit__a--all:hover { color: var(--brand); }
}
.vit.is-searching .vit__a--all { visibility: hidden; }

/* ── Tira de productos: navegar, ver qué sigue y el avance automático ─ */

.vit__strip {
  display: grid; grid-auto-flow: column; grid-auto-columns: 84px; gap: 10px; margin: 26px 0 0; padding: 6px 2px 10px;
  list-style: none; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent);
          mask-image: linear-gradient(90deg, #000 calc(100% - 64px), transparent);
}
.vit__strip::-webkit-scrollbar { display: none; }
.vit__strip li { scroll-snap-align: start; }
.vit__th {
  position: relative; display: block; width: 84px; height: 84px; padding: 0; overflow: hidden; border: 0; border-radius: 14px;
  background: var(--carbon); cursor: pointer; opacity: 0.55; transition: opacity 240ms var(--ease-ui), transform 240ms var(--ease-out);
}
.vit__th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vit__th::before { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; box-shadow: inset 0 0 0 1px rgb(var(--paper-rgb) / 0.08); }
.vit__th[aria-current="true"] { opacity: 1; transform: translateY(-3px); }
.vit__th[aria-current="true"]::before { box-shadow: inset 0 0 0 2px var(--brand); }
/* Avance: una línea que se llena en la miniatura activa mientras la vitrina corre sola. */
.vit__th::after {
  content: ""; position: absolute; left: 8px; right: 8px; bottom: 7px; z-index: 2; height: 3px; border-radius: 3px;
  background: var(--brand); transform: scaleX(0); transform-origin: left; opacity: 0;
}
.vit.is-auto .vit__th[aria-current="true"]::after { opacity: 1; animation: vit-progress var(--vit-dur) linear forwards; }
.vit.is-auto.is-held .vit__th[aria-current="true"]::after { animation-play-state: paused; }
@keyframes vit-progress { to { transform: scaleX(1); } }
.vit__th:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .vit__th:hover { opacity: 1; } }

/* ── Fallback sin JS: el índice ya lleva a cada categoría ─────────── */
.vit:not(.is-live) .vit__main { display: none; }
.vit:not(.is-live) .vit__search, .vit:not(.is-live) .vit__status { display: none; }

/* ── Pantallas anchas: la columna de entrada no pasa de 520 px y el ancho que sobra agranda el set;
      la tira pasa a ser una columna vertical junto al set (como un rollo de película). ─ */
@media (min-width: 1400px) {
  /* El índice se adapta; el set tiene medida propia (por alto de pantalla y, como tope, por ancho). */
  .vit__inner { grid-template-columns: minmax(300px, 600px) auto; justify-content: space-between; }
  .vit__main {
    --stage: min(clamp(480px, calc(100svh - var(--nav-h) - 290px), 900px), 42vw);
    justify-self: end;
    width: auto;
    display: grid;
    grid-template-columns: var(--stage) 92px;
    grid-template-areas: "set strip" "cap cap" "act act";
    column-gap: 18px;
  }
  .vit__set { grid-area: set; }
  .vit__cap { grid-area: cap; }
  .vit__actions { grid-area: act; }
  .vit__a--all { grid-area: act; align-self: center; justify-self: end; margin: 16px 0 0; } /* en la fila de botones, a la derecha */
  .vit__strip {
    grid-area: strip; grid-auto-flow: row; grid-auto-rows: 84px; grid-auto-columns: auto; align-content: start;
    height: 0; min-height: 100%; /* mide lo que el set: la tira no estira la fila */
    margin: 0; padding: 2px 4px; overflow-x: hidden; overflow-y: auto; scroll-snap-type: y proximity;
    -webkit-mask-image: linear-gradient(180deg, #000 calc(100% - 72px), transparent);
            mask-image: linear-gradient(180deg, #000 calc(100% - 72px), transparent);
  }
  .vit__th[aria-current="true"] { transform: translateX(-3px); }
}

/* ── Tablet y teléfono: una columna; categorías como fila deslizable ─ */

@media (max-width: 1099px) {
  .vit__inner { grid-template-columns: minmax(0, 1fr); }
  .vit__side, .vit__main { min-width: 0; } /* sin esto la tira (153 miniaturas) ensancha la columna y la página */
  .vit__side { position: static; }
  .vit__cats { margin-inline: calc(-1 * var(--edge-x)); }
  .vit__cats ul {
    display: flex; gap: 8px; margin-top: 18px; padding: 2px var(--edge-x) 6px; border: 0; overflow-x: auto;
    scroll-padding-inline: var(--edge-x); scrollbar-width: none;
  }
  .vit__cats ul::-webkit-scrollbar { display: none; }
  .vit__cats li { flex: none; border: 0; }
  .vit__cat {
    gap: 8px; min-height: 44px; padding: 0 16px; align-items: center; border: 1px solid var(--vit-line); border-radius: 999px;
    font-size: 14.5px; white-space: nowrap;
  }
  .vit__cat::before { display: none; }
  .vit__cat[aria-current="true"] { padding-left: 16px; border-color: var(--paper); background: var(--paper); color: var(--ink); }
  .vit__cat[aria-current="true"] .vit__cat-n { color: var(--brand); }
  .vit.is-searching .vit__cat[aria-current="true"] { padding-left: 16px; border-color: var(--vit-line); background: none; color: var(--paper-64); }
  .vit__main { width: auto; margin-top: 28px; }
}
@media (max-width: 600px) {
  .vit__status { margin-left: 4px; }
  .vit__kbd { display: none; }
  .vit__frame { border-radius: 18px; }
  .vit__name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  /* En el teléfono el set y el nombre ya abren la ficha: WhatsApp se queda con la fila entera. */
  .vit__actions { display: grid; grid-template-columns: 1fr; }
  .vit__a { justify-content: center; padding: 0 14px; }
  .vit__a--go { display: none; }
  .vit__ctrl { right: 10px; bottom: 10px; padding-left: 12px; }
  .vit__a--all { margin-inline: auto; }
  .vit__strip { grid-auto-columns: 72px; margin-inline: calc(-1 * var(--edge-x)); padding-inline: var(--edge-x); scroll-padding-inline: var(--edge-x); -webkit-mask-image: none; mask-image: none; }
  .vit__th { width: 72px; height: 72px; border-radius: 12px; }
}

/* ── Movimiento reducido: sin barrido ni avance automático ─────────── */
@media (prefers-reduced-motion: reduce) {
  .vit__img.is-enter { -webkit-mask-image: none; mask-image: none; animation: vit-fade 180ms linear both; }
  .vit__img.is-leave, .vit__frame.is-flash::after { animation: none; }
  .vit__cat, .vit__cat::before, .vit__th { transition: none; }
}
@keyframes vit-fade { from { opacity: 0; } }

/* De la vitrina a la ficha: la foto viaja de un lugar al otro (View Transitions entre páginas). */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  .vit__img.is-current { view-transition-name: pp-foto; }
}
