/* =============================================================================
   NexKey365 — Tarjeta de licencia digital (formato LARGO 3D)
   Representa una LICENCIA como estuche en vitrina: el arte del producto flota
   grande sobre un pedestal claro y la tarjeta ENTERA gira en perspectiva
   siguiendo el cursor (JS pone --rxn/--ryn en grados y --gx/--gy para el
   brillo especular). El arte, el badge y la cinta viven en capas translateZ.
   En táctil / reduced-motion no se cablea el giro y queda la tarjeta plana.
   Tokens del sistema, negro + verde.
   ============================================================================= */

.product-card.lic-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 0;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  /* overflow visible + sin isolation: ambos aplanarían el preserve-3d y las
     capas no podrían sobresalir de la tarjeta al girar */
  overflow: visible;
  transform-style: preserve-3d;
  transition: transform .55s var(--ease-out), translate .6s var(--ease-out),
    opacity .6s var(--ease-out), box-shadow .4s var(--ease-out), border-color .4s var(--ease-out);
}

.lic-card:hover {
  transform: none;              /* neutraliza el translateY de .product-card:hover */
  translate: 0 -6px;            /* la elevación va por translate para no pisar el giro 3D */
  border-color: oklch(0.6 0.11 178 / 0.45);
  box-shadow:
    0 24px 54px oklch(0.3 0.04 178 / 0.14),
    0 0 0 1px oklch(0.6 0.11 178 / 0.14),
    0 10px 26px oklch(0.45 0.082 178 / 0.1);
}

/* Giro en perspectiva: solo mientras el mouse está encima (clase is-tilt).
   La transición corta suaviza cada salto de --rxn/--ryn entre eventos. */
.product-card.lic-card.is-tilt {
  transform: perspective(1050px)
    rotateX(calc(var(--rxn, 0) * 1deg))
    rotateY(calc(var(--ryn, 0) * 1deg));
  transition: transform .14s linear, translate .6s var(--ease-out),
    opacity .6s var(--ease-out), box-shadow .4s var(--ease-out), border-color .4s var(--ease-out);
  will-change: transform;
}

/* --- Media: vitrina alta con el arte del producto flotando al centro --- */
.lic-card__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  text-decoration: none;
  background: linear-gradient(170deg, #fff, oklch(0.966 0.004 240));
  border-bottom: 1px solid var(--border);
  border-radius: calc(var(--r-lg) - 1px) calc(var(--r-lg) - 1px) 0 0;
  transform-style: preserve-3d;
}

.lic-card__media::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background-image:
    linear-gradient(oklch(0 0 0 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0 0 0 / 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(74% 74% at 50% 44%, #000, transparent 78%);
  mask-image: radial-gradient(74% 74% at 50% 44%, #000, transparent 78%);
  opacity: 0.5;
}

/* Halo de marca que se enciende bajo el arte al pasar el cursor */
.lic-card__media::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 84%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(closest-side, oklch(0.72 0.132 178 / 0.2), transparent 72%);
  opacity: 0;
  transition: opacity .5s var(--ease-out);
  transform: translateZ(6px);
}

.lic-card:hover .lic-card__media::after {
  opacity: 1;
}

/* El arte: estuche cuadrado grande (la imagen del dueño se ve casi completa,
   como caja de producto en exhibición) */
.lic-card__art {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: min(74%, 240px);
  aspect-ratio: 1 / 1;
  border-radius: clamp(16px, 8%, 22px);
  background: #fff;
  box-shadow:
    0 16px 34px oklch(0 0 0 / 0.13),
    0 0 0 1px oklch(0 0 0 / 0.05);
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out);
}

.lic-card:hover .lic-card__art {
  transform: translateY(-6px) rotate(-1.5deg) scale(1.03);
  box-shadow:
    0 26px 50px oklch(0 0 0 / 0.17),
    0 0 0 1px oklch(0 0 0 / 0.05);
}

/* Con el giro activo el arte se despega de la tarjeta (capa más cercana) */
.lic-card.is-tilt .lic-card__art {
  transform: rotate(-1.5deg) scale(1.03) translateZ(46px);
}

.lic-card__glyph {
  line-height: 0;
}

.lic-card__glyph .brand-glyph {
  box-shadow: 0 18px 34px oklch(0 0 0 / 0.16), 0 0 0 1px oklch(0 0 0 / 0.05);
}

.lic-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.lic-card__img.is-on~.lic-card__glyph {
  visibility: hidden;
}

/* Barrido holográfico: hoy solo lo usa el escaparate del detalle
   (.pd-stage--lic); en la tarjeta lo reemplazó el brillo especular. */
.lic-card__shine {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(115deg, transparent 32%, oklch(1 0 0 / 0.65) 46%, oklch(0.7 0.128 178 / 0.07) 54%, transparent 70%);
  transform: translateX(-130%);
  transition: transform .8s var(--ease-out);
}

/* Brillo especular que sigue al cursor sobre la vitrina (JS pone --gx/--gy) */
.lic-card__glare {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(520px circle at var(--gx, 50%) var(--gy, 42%),
      oklch(1 0 0 / 0.45), oklch(1 0 0 / 0.12) 42%, transparent 64%);
  opacity: 0;
  transition: opacity .35s var(--ease-out);
  transform: translateZ(60px);
}

.lic-card.is-tilt .lic-card__glare {
  opacity: 1;
}

/* Estado disponible / agotado (arriba a la derecha del media) */
.lic-card__flag {
  position: absolute;
  top: .7rem;
  right: .7rem;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .68rem;
  font-weight: 700;
  padding: .28rem .55rem;
  border-radius: var(--r-pill);
  background: oklch(1 0 0 / 0.85);
  color: oklch(0.45 0.082 178);
  border: 1px solid oklch(0.55 0.101 178 / 0.28);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.lic-card__flag--out {
  color: var(--ink-muted);
  border-color: var(--border-strong);
}

/* Con el giro activo el badge flota por encima del arte */
.lic-card.is-tilt .lic-card__flag {
  transform: translateZ(54px);
}

.lic-card__live {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: #1ed47e;
  box-shadow: 0 0 0 0 oklch(0.78 0.143 178 / 0.6);
  animation: lic-pulse 2.2s var(--ease-out) infinite;
}

/* Cinta de entrega: aparece con fundido + leve subida (sin overflow hidden ya
   no puede "entrar" desde fuera de la tarjeta) */
.lic-card__hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .85rem .8rem .6rem;
  font-size: .74rem;
  font-weight: 600;
  color: var(--ink);
  pointer-events: none;
  background: linear-gradient(0deg, oklch(1 0 0 / 0.95) 45%, transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .3s var(--ease-out), transform .38s var(--ease-out);
}

.lic-card:hover .lic-card__hint {
  opacity: 1;
  transform: translateY(0);
}

.lic-card.is-tilt .lic-card__hint {
  opacity: 1;
  transform: translateY(0) translateZ(42px);
}

.lic-card__hint svg {
  width: .95rem;
  height: .95rem;
  color: oklch(0.5 0.092 178);
  flex: none;
}

/* --- Cuerpo --- */
.lic-card__body {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.05rem 1.1rem 1.2rem;
}

.lic-card__cat {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--brand-ink);
}

.lic-card__name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  letter-spacing: -.015em;
  line-height: 1.18;
  color: var(--ink);
}

.lic-card__name a {
  transition: color var(--t);
}

.lic-card__name a:hover {
  color: var(--brand-ink);
}

.lic-card .rating {
  font-size: .82rem;
}

/* Rasgos de la licencia: fila de píldoras (Nuevo · Digital · Activación inmediata) */
.lic-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .1rem;
}

.lic-tag {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
  padding: .32rem .62rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-muted);
}

.lic-tag svg {
  width: .88rem;
  height: .88rem;
  color: var(--brand-ink);
  flex: none;
}

.lic-tag--accent {
  color: var(--brand-ink);
  border-color: oklch(0.7 0.128 178 / 0.35);
  background: oklch(0.7 0.128 178 / 0.1);
}

/* Ícono de copiar dentro de la clave (decorativo, como en la referencia) */
.lic-card__copy {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: var(--r-xs);
  color: var(--ink-faint);
  flex: none;
}

.lic-card__copy svg {
  width: .95rem;
  height: .95rem;
}

/* Botón "agregar al carrito" estilo contorno + badge "+" que indica que suma al carrito */
.lic-card__add {
  position: relative;
  overflow: visible;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-body);
}

.lic-card__add:hover {
  background: var(--surface-2);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.add-btn__plus {
  position: absolute;
  top: -.32rem;
  right: -.32rem;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-strong);
  color: #fff;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1;
  border: 2px solid var(--surface);
}

/* Clave de licencia (el toque "digital / llaves") */
.lic-card__key {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .15rem;
  padding: .5rem .6rem;
  border-radius: var(--r-sm);
  background: oklch(0.972 0.004 240);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color var(--t);
}

.lic-card:hover .lic-card__key {
  border-color: oklch(0.6 0.11 178 / 0.4);
}

.lic-card__key svg {
  width: 1rem;
  height: 1rem;
  color: oklch(0.5 0.092 178);
  flex: none;
}

.lic-card__key code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .05em;
  color: var(--ink-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--t);
}

.lic-card:hover .lic-card__key code {
  color: var(--ink-strong);
}

.lic-card__keydot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  flex: none;
  background: #1ed47e;
  box-shadow: 0 0 0 0 oklch(0.78 0.143 178 / 0.6);
  animation: lic-pulse 2.2s var(--ease-out) infinite;
}

.lic-card__foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .7rem;
  margin-top: .5rem;
}

.lic-card__foot .price {
  flex-direction: row;
  align-items: baseline;
  gap: .45rem;
}

.lic-card__foot .price__now {
  display: inline-block;
  transform-origin: left center;
  transition: transform .3s var(--ease-out), color .3s var(--ease-out);
}

.lic-card__foot:has(.lic-card__actions :hover) .price__now {
  transform: scale(1.16);
  color: var(--brand-ink);
}

.lic-card__actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  width: 100%;
}

.lic-card__buy {
  flex: 1;
  justify-content: center;
  gap: .35rem;
}

.lic-card__actions .add-btn {
  flex: none;
}

.lic-card__buy svg {
  width: 1em;
  height: 1em;
  transition: transform var(--t);
}

.lic-card__buy:hover svg {
  transform: translateX(3px);
}

.lic-card.is-out {
  opacity: .72;
}

.lic-card.is-out .lic-card__art {
  filter: grayscale(.7);
}

.lic-card.is-out .lic-card__live {
  animation: none;
  background: var(--ink-faint);
}

/* Entrada rápida de tarjetas, sin fade ni perspectiva costosa. */
.has-reveal .product-card.lic-card:not(.is-in) {
  translate: 0 18px;
  transform-origin: 50% 100%;
}

@keyframes lic-pulse {
  0% {
    box-shadow: 0 0 0 0 oklch(0.78 0.143 178 / 0.55);
  }

  70% {
    box-shadow: 0 0 0 6px oklch(0.78 0.143 178 / 0);
  }

  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

/* --- Móvil: tarjeta HORIZONTAL compacta (logo a la izquierda, datos a la
   derecha). Una tarjeta pasa de ~460px a ~230px de alto: el catálogo entero
   se recorre en la mitad de scroll. La clave decorativa y la cinta de hover
   no aportan en pantalla táctil y se ocultan. --- */
@media (max-width: 560px) {
  .product-card.lic-card {
    display: grid;
    grid-template-columns: 106px minmax(0, 1fr);
    align-items: stretch;
  }

  .lic-card__media {
    aspect-ratio: auto;
    height: 100%;
    min-height: 150px;
    border-bottom: 0;
    border-right: 1px solid var(--border);
    border-radius: calc(var(--r-lg) - 1px) 0 0 calc(var(--r-lg) - 1px);
  }

  .lic-card__media::before {
    background-size: 16px 16px;
  }

  /* Sin giro en táctil: fuera brillo y halo */
  .lic-card__glare,
  .lic-card__media::after {
    display: none;
  }

  .lic-card__art {
    width: 74px;
    height: 74px;
    border-radius: 14px;
    box-shadow:
      0 8px 18px oklch(0 0 0 / 0.12),
      0 0 0 1px oklch(0 0 0 / 0.05);
  }

  .lic-card__art .brand-glyph {
    width: 60px !important;
    height: 60px !important;
    border-radius: 14px;
  }

  .lic-card__art .brand-glyph svg {
    width: 37px;
    height: 37px;
  }

  .lic-card__hint,
  .lic-card__key {
    display: none;
  }

  /* "Disponible" ya lo dicen los tags y el botón; solo "Agotado" merece sello */
  .lic-card__flag {
    display: none;
  }

  .lic-card__flag--out {
    display: inline-flex;
    top: auto;
    bottom: 0.6rem;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .lic-card__body {
    padding: 0.8rem 0.85rem 0.85rem;
    gap: 0.4rem;
  }

  .lic-card__name {
    font-size: 1.02rem;
  }

  .lic-card__tags {
    gap: 0.3rem;
  }

  .lic-tag {
    font-size: 0.68rem;
    padding: 0.26rem 0.5rem;
  }

  .lic-card__foot {
    margin-top: 0.3rem;
    gap: 0.55rem;
  }
}

@media (prefers-reduced-motion: reduce) {

  .product-card.lic-card,
  .lic-card__art,
  .lic-card__shine,
  .lic-card__glare,
  .lic-card__media::after,
  .lic-card__hint {
    transition: none;
  }

  .lic-card__live,
  .lic-card__keydot {
    animation: none;
  }

  .has-reveal .product-card.lic-card:not(.is-in) {
    opacity: 1;
    translate: none;
    transform: none;
  }
}

/* =============================================================================
   Showcase de licencia en la página de detalle (coherente con .lic-card)
   Logo grande del software sobre grid técnico + panel con clave y activación.
   ============================================================================= */
/* .pd-stage.pd-stage--lic: escaparate CLARO, coherente con el hero 3D blanco. */
.pd-stage.pd-stage--lic {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  min-height: clamp(360px, 44vw, 480px);
  overflow: hidden;
  background: linear-gradient(170deg, #fff, oklch(0.962 0.004 240));
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
}

.pd-stage.pd-stage--lic::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(oklch(0 0 0 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, oklch(0 0 0 / 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(78% 60% at 50% 28%, #000, transparent 78%);
  mask-image: radial-gradient(78% 60% at 50% 28%, #000, transparent 78%);
  opacity: 0.5;
}

.pd-stage--lic .lic-card__flag {
  top: 1rem;
  right: 1rem;
}

.pd-stage--lic:hover .lic-card__shine {
  transform: translateX(130%);
}

.pd-lic__art {
  position: relative;
  z-index: 2;
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: radial-gradient(82% 82% at 50% 32%, #fff, oklch(0.955 0.005 240));
  box-shadow: inset 0 0 0 1px oklch(0 0 0 / 0.06);
}

.pd-lic__art .lic-card__glyph .brand-glyph {
  box-shadow: 0 22px 50px oklch(0 0 0 / 0.18), 0 0 0 1px oklch(0 0 0 / 0.05);
}

/* En el detalle la imagen se muestra COMPLETA (contain): las fotos que sube
   el dueño suelen ser logos/artes cuadrados y con cover se cortaban arriba y
   abajo. El marco claro del arte hace de fondo. */
.pd-stage--lic .pd-lic__art .lic-card__img {
  object-fit: contain;
  padding: clamp(0.6rem, 3%, 1.2rem);
}

.pd-lic__panel {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 1.1rem;
  border-radius: var(--r-lg);
  background: #fff;
  border: 1px solid var(--border);
}

.pd-lic__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.pd-lic__app {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.pd-lic__app .brand-glyph {
  width: 2.6rem !important;
  height: 2.6rem !important;
  border-radius: 12px;
}

.pd-lic__app-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.pd-lic__id {
  flex: 1;
  min-width: 0;
}

/* Tinta FIJA (no var(--ink)): el panel es siempre blanco, también en modo
   oscuro; con la variable el nombre quedaba blanco sobre blanco. */
.pd-lic__id b {
  display: block;
  color: oklch(0.24 0.02 250);
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.pd-lic__id span {
  font-size: 0.78rem;
  color: oklch(0.47 0.012 250);
}

.pd-lic__status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  color: oklch(0.45 0.082 178);
  background: oklch(0.6 0.11 178 / 0.1);
  border: 1px solid oklch(0.55 0.101 178 / 0.28);
  padding: 0.3rem 0.55rem;
  border-radius: var(--r-pill);
}

.pd-lic__status svg {
  width: 0.85rem;
  height: 0.85rem;
}

.pd-lic__key {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--r-sm);
  background: oklch(0.972 0.004 240);
  border: 1px solid var(--border);
}

.pd-lic__key svg {
  width: 1.1rem;
  height: 1.1rem;
  color: oklch(0.5 0.092 178);
  flex: none;
}

.pd-lic__key code {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: oklch(0.38 0.012 250);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pd-lic__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.1rem;
  margin: 0;
}

.pd-lic__steps li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: oklch(0.38 0.012 250);
}

.pd-lic__steps svg {
  width: 1rem;
  height: 1rem;
  color: oklch(0.5 0.092 178);
  flex: none;
}

/* Móvil: la cabecera del panel pasa a rejilla (logo + nombre arriba, estado
   debajo a lo ancho) para que el nombre no se rompa letra a letra. */
@media (max-width: 560px) {
  .pd-stage.pd-stage--lic {
    padding: 0.85rem;
    gap: 0.8rem;
    min-height: 0;
  }

  .pd-lic__panel {
    padding: 0.95rem;
    gap: 0.7rem;
  }

  .pd-lic__head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.2rem 0.7rem;
    align-items: center;
  }

  .pd-lic__status {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

.pd-stage--lic.is-out {
  opacity: 0.82;
}

.pd-stage--lic.is-out .pd-lic__art {
  filter: grayscale(0.7);
}

/* Badge "Nuevo": productos sin reseñas todavía (en vez de estrellas vacías). */
.rating--new {
  display: inline-flex;
  align-items: center;
  min-height: 1.2rem;
}

.badge-new {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: oklch(0.45 0.082 178);
  background: oklch(0.6 0.11 178 / 0.1);
  border: 1px solid oklch(0.55 0.101 178 / 0.28);
  padding: 0.2rem 0.6rem;
  border-radius: var(--r-pill);
}