/* kfx: piezas de movimiento compartidas (titular letra por letra, tarjetas apiladas, giro 3D, magnético, parallax, rieles).
   Colores por variables para que cada página (plataforma o negocio) ponga los suyos. */

/* Titular letra por letra */
.kfx-word { display: inline-block; white-space: nowrap; }
.kfx-ch { display: inline-block; opacity: 0; transform: translateY(.45em) rotate(4deg); transition: opacity .5s ease, transform .7s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 22ms); }
[data-kfx-letters].is-in .kfx-ch { opacity: 1; transform: none; }

/* Tarjetas apiladas */
.kfx-stack { position: relative; height: calc(var(--n, 4) * 85vh); }
.kfx-stack-stage { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow: hidden; padding: clamp(20px, 5vh, 56px) 16px; box-sizing: border-box; }
.kfx-stack-head { width: 100%; max-width: 1040px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.kfx-stack-rail { width: 90px; height: 3px; border-radius: 2px; background: var(--kfx-line, rgba(0, 0, 0, .12)); overflow: hidden; }
.kfx-stack-rail i { display: block; height: 100%; background: var(--kfx-ink, #10162f); transform-origin: 0 50%; transform: scaleX(0); }
.kfx-stack-deck { position: relative; flex: 1; width: 100%; max-width: 1040px; margin: clamp(18px, 4vh, 40px) auto 0; min-height: 0; }
.kfx-stack-card { position: absolute; inset: 0; border-radius: 28px; overflow: hidden; transform-origin: 50% 0; will-change: transform; backface-visibility: hidden; }
.kfx-stack-card::after { content: ""; position: absolute; inset: 0; background: #05060a; opacity: var(--shade, 0); pointer-events: none; }

/* Giro 3D (frente y reverso) */
.kfx-flip { perspective: 1100px; cursor: pointer; outline: none; border-radius: 18px; }
.kfx-flip:focus-visible { box-shadow: 0 0 0 3px var(--kfx-focus, #4f5bff); }
.kfx-flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.2, .8, .2, 1); }
.kfx-flip-inner.is-flipped { transform: rotateY(180deg); }
.kfx-flip-front, .kfx-flip-back { position: absolute; inset: 0; border-radius: 18px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform .25s ease-out; }
.kfx-flip-back { transform: rotateY(180deg); }

/* Magnético */
[data-magnetic] { transition: transform .25s cubic-bezier(.2, .8, .2, 1); will-change: transform; }

/* Parallax: la foto se sale un poco del marco para poder moverse sin dejar bordes */
.kfx-para { position: relative; overflow: hidden; }
.kfx-para > [data-parallax] { position: absolute; inset: -8% 0; width: 100%; height: 116%; object-fit: cover; will-change: transform; }

/* Rieles con flechas */
.kfx-rail { position: relative; }
.kfx-rail-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 30%); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; scrollbar-width: thin; }
.kfx-rail-track > * { scroll-snap-align: start; }
@media (max-width: 700px) { .kfx-rail-track { grid-auto-columns: 82%; } }

@media (prefers-reduced-motion: reduce) {
  .kfx-ch { opacity: 1; transform: none; transition: none; }
  .kfx-flip-inner { transition: none; }
  .kfx-stack { height: auto; }
  .kfx-stack-stage { position: static; height: auto; }
  .kfx-stack-deck { display: grid; gap: 16px; }
  .kfx-stack-card { position: relative; inset: auto; min-height: 320px; transform: none !important; opacity: 1 !important; }
}
