/* ===== Kodex — capa de animaciones ===== */
:root { --ease: cubic-bezier(.2, .8, .2, 1); }

/* Grano sutil de película sobre toda la página */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ===== Intro / preloader ===== */
.loader {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  clip-path: inset(0 0 0 0);
  animation: loaderOut .8s 2.6s cubic-bezier(.7, 0, .2, 1) forwards; /* respaldo por si falla el JS */
}
.loader.is-done { animation: loaderOut .8s cubic-bezier(.7, 0, .2, 1) forwards; }
.loader__mark { width: 64px; height: 64px; color: var(--accent); filter: drop-shadow(0 0 18px rgba(139,123,255,.6)); }
.loader__mark path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 1s .1s var(--ease) forwards; }
.loader__word { display: flex; gap: .12em; font: 700 28px var(--display); letter-spacing: .3em; overflow: hidden; }
.loader__word span { display: inline-block; animation: charIn .7s var(--ease) backwards; animation-delay: calc(.35s + var(--i) * 60ms); }
.loader__bar { width: 140px; height: 2px; background: var(--line); border-radius: 2px; overflow: hidden; }
.loader__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ff4d8d); transform-origin: left; animation: bar 1s .2s var(--ease) both; }
@keyframes loaderOut { to { clip-path: inset(0 0 100% 0); visibility: hidden; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes bar { from { transform: scaleX(0); } }

/* Mientras está la intro, el hero espera */
.fx body:not(.is-ready) .hero * { animation-play-state: paused !important; }

/* ===== Barra de progreso de scroll ===== */
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 30; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), #ff4d8d, #3ddc97);
  transform-origin: 0 50%; transform: scaleX(var(--p, 0));
}

/* ===== Barra superior ===== */
.topbar { transition: background .3s, box-shadow .3s; }
.topbar__inner { transition: height .35s var(--ease); }
.topbar.is-scrolled { background: rgba(13, 15, 20, .92); box-shadow: 0 10px 30px -10px rgba(0,0,0,.5); }
.topbar.is-scrolled .topbar__inner { height: 56px; }
.brand__mark path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: draw 1.2s .3s var(--ease) forwards; }
.brand:hover .brand__mark { animation: wiggle .6s var(--ease); }
@keyframes wiggle { 30% { transform: rotate(-10deg) scale(1.08); } 60% { transform: rotate(6deg); } }
.topbar__nav a { position: relative; transition: color .2s; }
.topbar__nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -5px; height: 2px; border-radius: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease);
}
.topbar__nav a:hover::after { transform: scaleX(1); transform-origin: left; }
.search { transition: width .4s var(--ease), border-color .2s, box-shadow .3s; }
.search:focus-within { width: 320px; box-shadow: 0 0 0 4px rgba(139,123,255,.15); }

/* ===== Hero ===== */
.hero__bg { transform: translate3d(0, var(--sy, 0px), 0) scale(1.08); will-change: transform; }
.hero .cover::before { animation-play-state: running; }
.hero__aurora { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hero__aurora span {
  position: absolute; width: 46vw; height: 46vw; border-radius: 50%;
  filter: blur(90px); opacity: .32; mix-blend-mode: screen;
  animation: aurora 20s ease-in-out infinite;
}
.hero__aurora span:nth-child(1) { background: var(--accent); top: -25%; left: -10%; }
.hero__aurora span:nth-child(2) { background: var(--hero-c1, #ff4d8d); bottom: -35%; right: 5%; animation-duration: 24s; animation-delay: -8s; }
.hero__aurora span:nth-child(3) { background: #2ec4b6; top: 15%; left: 38%; width: 28vw; height: 28vw; opacity: .18; animation-duration: 28s; animation-delay: -14s; }
@keyframes aurora {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(10%, 12%) scale(1.15); }
  66% { transform: translate(-8%, 5%) scale(.9); }
}
.hero__spot {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(650px circle at var(--hx, 70%) var(--hy, 40%), rgba(139,123,255,.13), transparent 60%);
}
.hero__eyebrow::before { animation: pulse 2.2s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(139,123,255,.7), 0 0 12px var(--accent); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(139,123,255,0), 0 0 12px var(--accent); }
}

/* Título que se arma letra por letra */
.split .word { display: inline-block; overflow: hidden; padding-bottom: .1em; margin-bottom: -.1em; vertical-align: top; }
.split .char { display: inline-block; animation: charIn .9s var(--ease) backwards; animation-delay: calc(.25s + var(--i) * 40ms); }
@keyframes charIn { from { transform: translateY(110%) rotate(10deg); opacity: 0; } }

[data-in] { animation: fadeUp .9s var(--ease) backwards; animation-delay: var(--d, 0s); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); filter: blur(4px); } }

@keyframes artIn {
  from { opacity: 0; clip-path: inset(100% 0 0 0 round 18px); transform: perspective(1200px) translateY(60px) rotateX(25deg) rotateY(-10deg); }
  to { clip-path: inset(0 0 0 0 round 18px); }
}
.hero__glare {
  position: absolute; inset: 0; pointer-events: none; z-index: 2; mix-blend-mode: overlay;
  background: radial-gradient(500px circle at var(--gx, 30%) var(--gy, 20%), rgba(255,255,255,.35), transparent 45%);
}
.hero__art .cover__title { transform: translateZ(40px); }

.hero__cue {
  position: absolute; left: 50%; bottom: 46px; translate: -50% 0; z-index: 2;
  width: 24px; height: 38px; border: 2px solid rgba(255,255,255,.25); border-radius: 14px;
  animation: fadeUp 1s 1.4s var(--ease) backwards;
}
.hero__cue::after {
  content: ""; position: absolute; left: 50%; top: 7px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--accent); animation: scrollCue 1.8s ease-in-out infinite;
}
@keyframes scrollCue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 80%, 100% { opacity: 0; transform: translateY(12px); } }

/* ===== Portadas vivas ===== */
.cover::before { animation: drift 14s ease-in-out infinite alternate; animation-play-state: paused; }
.card:hover .cover::before, .modal .cover::before { animation-play-state: running; }
@keyframes drift { to { transform: translate(-7%, 5%) rotate(10deg) scale(1.12); } }

/* ===== Botones ===== */
.btn::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%);
  transform: translateX(-120%); transition: transform .8s var(--ease);
}
.btn:hover::after { transform: translateX(120%); }
.btn--primary:hover { box-shadow: 0 10px 30px -8px rgba(139,123,255,.75); }
.btn svg { transition: transform .3s var(--ease); }
.btn:hover svg { transform: scale(1.2); }

/* ===== Cinta de géneros ===== */
.marquee {
  overflow: hidden; padding: 6px 0 34px; user-select: none;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.marquee__track { display: flex; width: max-content; animation: marquee 45s linear infinite; }
.marquee:hover .marquee__track { animation-play-state: paused; }
.marquee__item {
  display: flex; align-items: center; gap: 28px; padding-right: 28px;
  font: 700 clamp(22px, 3vw, 34px) var(--display); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap;
}
.marquee__item:nth-child(even) { color: transparent; -webkit-text-stroke: 1px #4a5163; }
.marquee__item::after { content: "✦"; font-size: .55em; color: var(--accent); -webkit-text-stroke: 0; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ===== Aparición al hacer scroll ===== */
.fx [data-reveal] { opacity: 0; transform: translateY(32px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.fx [data-reveal].is-in { opacity: 1; transform: none; }
.catalog__head h2 { position: relative; }
.catalog__head h2::after {
  content: ""; position: absolute; left: 0; bottom: -8px; width: 44px; height: 3px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #ff4d8d); transform: scaleX(0); transform-origin: left;
  transition: transform .9s .35s var(--ease);
}
.catalog__head.is-in h2::after, html:not(.fx) .catalog__head h2::after { transform: scaleX(1); }

/* ===== Tarjetas ===== */
.fx .card { animation-play-state: paused; }
.fx .card.is-in { animation-play-state: running; }
@keyframes cardIn { from { opacity: 0; transform: perspective(900px) translateY(40px) rotateX(12deg) scale(.95); filter: blur(6px); } }
/* Borde que brilla siguiendo el cursor */
.card::before {
  content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; padding: 1px; pointer-events: none;
  background: radial-gradient(280px circle at var(--mx, -100%) var(--my, -100%), var(--accent), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}
/* Reflejo de luz sobre la tarjeta */
.card::after {
  content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; pointer-events: none;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.09), transparent 40%);
  opacity: 0; transition: opacity .3s;
}
.card:hover::after { opacity: 1; }
.card__title { transition: color .25s; }
.card:hover .card__title { color: var(--accent-2); }
.badge--new { animation: shine 3s ease-in-out infinite; background-image: linear-gradient(110deg, var(--accent) 40%, #d9d2ff 50%, var(--accent) 60%); background-size: 250% 100%; }
@keyframes shine { 0%, 60% { background-position: 100% 0; } 100% { background-position: -50% 0; } }

/* ===== Filtros ===== */
.chip { transition: color .2s, border-color .2s, background .25s, transform .25s var(--ease); }
.chip:hover { transform: translateY(-2px); }
.chip.is-active { animation: chipPop .4s var(--ease); box-shadow: 0 6px 20px -6px rgba(139,123,255,.7); }
@keyframes chipPop { 40% { transform: scale(1.1); } }
.segmented { position: relative; }
.segmented button { position: relative; z-index: 1; transition: color .25s; }
.fx .segmented button.is-active { background: none; }
.segmented__pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 999px;
  background: var(--surface-2); box-shadow: 0 0 0 1px rgba(255,255,255,.06);
  transition: left .45s var(--ease), width .45s var(--ease);
}

/* ===== Estadísticas ===== */
.stats > div { position: relative; overflow: hidden; transition: background .3s; }
.stats > div:hover { background: var(--surface); }
.stats > div::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: linear-gradient(90deg, var(--accent), transparent); transform: scaleX(0); transform-origin: left;
  transition: transform .5s var(--ease);
}
.stats > div:hover::after { transform: scaleX(1); }
.stats strong { font-variant-numeric: tabular-nums; }

/* ===== Nosotros: borde giratorio ===== */
.about__cta { position: relative; overflow: hidden; isolation: isolate; border-color: transparent; }
.about__cta::before {
  content: ""; position: absolute; inset: -60%; z-index: -2;
  background: conic-gradient(from 0deg, transparent 0 65%, var(--accent) 80%, #ff4d8d 88%, transparent 95%);
  animation: spin 6s linear infinite;
}
.about__cta::after { content: ""; position: absolute; inset: 1px; z-index: -1; border-radius: calc(var(--radius) - 1px); background: var(--surface); }
@keyframes spin { to { transform: rotate(1turn); } }

/* ===== Ficha (modal) ===== */
.modal[open]::backdrop { animation: fadeIn .35s ease; }
.modal.is-closing { animation: modalOut .25s ease-in forwards; }
.modal.is-closing::backdrop { animation: fadeIn .25s reverse forwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(40px) scale(.94); filter: blur(10px); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(20px) scale(.96); filter: blur(6px); } }
@keyframes fadeIn { from { opacity: 0; } }
.modal__media .cover { animation: zoomOut 1.4s var(--ease) backwards; }
@keyframes zoomOut { from { transform: scale(1.18); } }
.modal__content > div > *, .modal__side > * { animation: fadeUp .7s var(--ease) backwards; }
.modal__content > div > :nth-child(1) { animation-delay: .12s; }
.modal__content > div > :nth-child(2) { animation-delay: .18s; }
.modal__content > div > :nth-child(3) { animation-delay: .24s; }
.modal__content > div > :nth-child(4) { animation-delay: .3s; }
.modal__content > div > :nth-child(5) { animation-delay: .36s; }
.modal__side > :nth-child(1) { animation-delay: .25s; }
.modal__side > :nth-child(2) { animation-delay: .35s; }
.modal__close { transition: transform .35s var(--ease), background .2s; }
.modal__close:hover { transform: rotate(90deg); background: rgba(13,15,20,.9); }

/* ===== Responsive / accesibilidad ===== */
@media (max-width: 900px) {
  .hero__cue { display: none; }
  .search:focus-within { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .loader { display: none; }
  .fx [data-reveal] { opacity: 1; transform: none; }
  .hero__bg { transform: none; }
}
