/* =========================================================
   MOR SHOP · Catálogo: ficha de producto y detalles
   Se carga después de los estilos del catálogo y los completa.
   ========================================================= */

/* ---------- Tarjetas de producto: entran al hacer scroll ---------- */
html.cat-motion .model { opacity: 0; transform: translate3d(0, 18px, 0); transition: opacity 600ms cubic-bezier(.22, 1, .36, 1), transform 700ms cubic-bezier(.22, 1, .36, 1); transition-delay: calc(var(--i, 0) * 45ms); }
html.cat-motion .model.is-in { opacity: 1; transform: none; }
/* Fotos verticales (3:4) en tarjeta cuadrada: se recorta la percha de arriba, no el pantalón */
.model .pic img[src*="/img/oct26-"], .model .pic img[src*="/img/nov09-"] { object-position: 50% 62%; }
html.cat-motion .view { animation: view-in 480ms cubic-bezier(.22, 1, .36, 1) both; }
@keyframes view-in { from { opacity: 0; transform: translate3d(0, 10px, 0); } }

/* ---------- Ficha de producto ---------- */
body.lb-open { overflow: hidden; }
.lb {
  /* grid-auto-rows: max-content — si no, al desbordar la ventana las filas se quedan con su mínimo y la foto pisa el texto */
  grid-template-rows: none; grid-auto-rows: max-content; grid-template-columns: minmax(0, 1fr); align-content: start; align-items: start;
  overflow-y: auto; overscroll-behavior: contain; gap: 0;
  padding: 0 0 calc(env(safe-area-inset-bottom, 0px) + 24px);
  opacity: 0; transition: opacity 240ms ease;
}
.lb.is-open { opacity: 1; }
.lb-cap { transform: translate3d(0, 14px, 0); opacity: 0; transition: transform 520ms cubic-bezier(.22, 1, .36, 1) 60ms, opacity 400ms ease 60ms; }
.lb.is-open .lb-cap { transform: none; opacity: 1; }
.lb-top {
  position: sticky; top: 0; z-index: 6; justify-content: flex-end; align-items: start;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 0; pointer-events: none;
}
.lb-top > * { pointer-events: auto; }
#lb-count { position: absolute; left: 16px; top: calc(env(safe-area-inset-top, 0px) + 22px); font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.lb-btn { backdrop-filter: blur(6px); }
.lb-stage { position: relative; padding: 0 12px 6px; display: grid; gap: 10px; justify-items: center; min-height: auto; }
.lb-stage img { max-height: 54vh; width: auto; border-radius: 14px; background: #fff; transition: opacity 220ms ease; }
.lb-stage img.is-loading { opacity: 0; }
.lb-stage video { max-height: 54vh; border-radius: 14px; }
.lb-nav { position: absolute; top: 45%; }
.lb-prev { left: 18px; }
.lb-next { right: 18px; }

/* Miniaturas */
.lb-thumbs { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; padding: 4px 2px; scrollbar-width: none; }
.lb-thumbs::-webkit-scrollbar { display: none; }
.lb-thumbs button {
  position: relative; flex: none; width: 56px; height: 56px; padding: 0; border-radius: 9px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--line); background: #fff; opacity: .55; transition: opacity 200ms, box-shadow 200ms, transform 200ms;
}
.lb-thumbs button:hover { opacity: .9; transform: translateY(-1px); }
.lb-thumbs button[aria-current="true"] { opacity: 1; border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.lb-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-thumbs .v::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 14px; background: rgba(0, 0, 0, .35); }

/* Panel de información */
.lb-cap { text-align: left; display: grid; gap: 14px; align-content: start; padding: 12px 18px 0; font-family: var(--body); font-size: 15px; }
.lb-cap > * { order: 10; }
.lb-sub { order: 0; margin: 0; font-size: 11px; letter-spacing: .22em; }
.lb-badges { order: 1; display: flex; flex-wrap: wrap; gap: 8px; }
.lb-badges:empty { display: none; }
.lb-badges span { font: 700 10px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; padding: 6px 9px; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold); }
.lb-badges .new { background: var(--goldgrad); color: var(--ink); border-color: transparent; }
#lb-cap { order: 2; display: block; font-family: var(--display); font-weight: 500; font-size: clamp(26px, 5vw, 38px); line-height: 1.05; letter-spacing: -.01em; color: var(--text); }
.lb-pitch { order: 3; margin: 0; font: italic 500 clamp(18px, 2.2vw, 23px)/1.3 var(--display); color: var(--gold-pale); }
.lb-pitch small { display: block; margin-top: 6px; font: 400 14px/1.5 var(--body); color: var(--muted); }
.lb-pitch:empty { display: none; }
.lb-stock { order: 4; margin: 0; justify-self: start; }
.lb-col { order: 5; margin: 0; font-size: 14px; color: var(--text); }
.lb-col:not(:empty)::before { content: "Color · "; color: var(--muted); }
.lb .sw { order: 6; justify-content: flex-start; margin: 0; }
.lb .sw:empty { display: none; }
.lb-price { order: 7; margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding-top: 4px; }
.lb-price b { font: 500 30px/1 var(--display); color: var(--text); }
.lb-price small { font-size: 12.5px; color: var(--muted); }
.lb-price:empty { display: none; }
.lb-actions { order: 8; justify-content: flex-start; margin: 2px 0 0; gap: 8px; }
.lb-actions #lb-wa { flex: 1 1 100%; justify-content: center; height: 50px; font-size: 12.5px; letter-spacing: .14em; }
.lb-trust { order: 9; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 0; padding: 0; list-style: none; }
.lb-trust li { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 12.5px; line-height: 1.3; color: var(--text); background: rgba(255, 255, 255, .02); }
.lb-trust li b { color: var(--gold-pale); font-weight: 600; }
.lb-trust svg { width: 18px; height: 18px; flex: none; color: var(--gold); }
.lb-revs { order: 11; margin: 10px 0 0; max-width: none; text-align: left; }
.lb-revs > small { text-align: left; }
.lb-revs > .lb-top-tag { display: none; } /* el distintivo va ahora junto al título */
.lb-rel { order: 12; margin: 10px 0 0; justify-items: start; }
.lb-rel .row { justify-content: flex-start; }

/* Móvil: la foto arriba y «Pedir este» siempre a mano, pegado abajo */
@media (max-width: 899px) {
  .lb-actions {
    position: sticky; bottom: 0; order: 99; margin: 10px -18px 0; padding: 12px 18px calc(env(safe-area-inset-bottom, 0px) + 12px);
    background: linear-gradient(180deg, rgba(5, 4, 3, 0), rgba(5, 4, 3, .97) 28%);
  }
  .lb-actions #lb-wa { height: 48px; }
}

/* Escritorio: foto fija a la izquierda, ficha a la derecha */
@media (min-width: 900px) {
  .lb {
    grid-template-columns: minmax(0, 1.15fr) minmax(380px, 520px); column-gap: clamp(28px, 4vw, 64px);
    padding: 0 clamp(24px, 4vw, 64px) 56px;
  }
  .lb-top { grid-column: 1 / -1; padding-inline: 0; }
  #lb-count { left: 0; }
  .lb-stage { position: sticky; top: 72px; grid-column: 1; padding: 0; }
  .lb-stage img, .lb-stage video { max-height: calc(100vh - 190px); }
  .lb-stage video { max-width: 100%; }
  .lb-cap { grid-column: 2; padding: 4px 0 0; }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
  .lb-thumbs button { width: 64px; height: 64px; }
}

/* =========================================================
   Movimiento del catálogo · segunda capa
   Con «reducir movimiento» no existe html.cat-motion y nada de esto se aplica.
   ========================================================= */

/* La transición entre páginas (@view-transition) va en línea en el <head>: ver <style id="mor-vt"> en index.html */

/* ---------- Fotos: aparecen con un fundido; mientras cargan, el marco tiene un brillo suave ---------- */
html.cat-motion img.img-wait { opacity: 0 !important; }
html.cat-motion img.img-in { animation: img-in 520ms ease backwards; }
@keyframes img-in { from { opacity: 0; } }
html.cat-motion :is(.pic, .bt-ph, .ph):has(> img.img-wait)::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(8, 7, 6, .07) 50%, transparent 70%);
  transform: translate3d(-100%, 0, 0); animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translate3d(100%, 0, 0); } }

/* ---------- Guardar en «Mi lista»: el corazón late y suelta un anillo ---------- */
html.cat-motion .fav.is-pop, html.cat-motion #lb-fav.is-pop svg { animation: fav-pop 520ms cubic-bezier(.2, 1.4, .4, 1); }
@keyframes fav-pop { 35% { transform: scale(1.3); } }
html.cat-motion .fav.is-pop::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--gold); pointer-events: none;
  animation: fav-ring 640ms ease-out both;
}
@keyframes fav-ring { from { transform: scale(.8); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
/* Aviso («Añadido a tu lista»…): entra desde abajo y se retira hacia arriba */
html.cat-motion .toast { animation: toast 2200ms cubic-bezier(.22, 1, .36, 1) both; }
@keyframes toast {
  0% { opacity: 0; transform: translate(-50%, 14px); }
  10%, 88% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}

/* ---------- Ficha de producto: el contenido entra en cascada y la foto cambia con un fundido ---------- */
.lb-sub { --d: 0; } .lb-badges { --d: 1; } #lb-cap { --d: 2; } .lb-pitch { --d: 3; } .lb-stock, .lb-col { --d: 4; }
.lb .sw { --d: 5; } .lb-actions { --d: 6; } .lb-trust { --d: 7; } .lb-revs { --d: 8; } .lb-rel { --d: 9; }
html.cat-motion .lb.is-open .lb-cap > * { animation: lb-rise 560ms cubic-bezier(.22, 1, .36, 1) backwards; animation-delay: calc(90ms + var(--d, 0) * 45ms); }
@keyframes lb-rise { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
html.cat-motion .lb-stage img.is-swap { animation: lb-img 480ms cubic-bezier(.22, 1, .36, 1); }
@keyframes lb-img { from { opacity: 0; transform: scale(.975); } }
html.cat-motion .lb.is-open .lb-thumbs button { animation: lb-rise 420ms cubic-bezier(.22, 1, .36, 1) backwards; animation-delay: calc(180ms + var(--k, 0) * 28ms); }

/* ---------- Respuesta al tacto ---------- */
.btile, .ctile, .model .pic, .cta, .fchip, .cchip, .gtab, .qlink, .fav, .dot, .lb-btn, .newcard, .sitem { -webkit-tap-highlight-color: transparent; }
@media (hover: none) {
  html.cat-motion .btile:active, html.cat-motion .ctile:active { transform: scale(.975); transition-duration: 140ms; }
  html.cat-motion .model .pic:active { transform: scale(.98); transition-duration: 140ms; }
  html.cat-motion :is(.fchip, .cchip, .gtab, .qlink):active { transform: scale(.95); }
  html.cat-motion .cta:active { transform: scale(.97); }
}
