/* =========================================================
   ByF · animaciones, 3D y detalles
   Todo lo que se mueve vive aquí. Si alguien tiene activado
   "reducir movimiento" en su teléfono, se apaga (ver final).
   ========================================================= */
:root {
  /* Curvas: arrancan rápido y frenan suave ("de más a menos") */
  --ease-out: cubic-bezier(.16, 1, .3, 1);      /* expo out */
  --ease-soft: cubic-bezier(.22, 1, .36, 1);    /* quint out */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1); /* rebote pequeño */
  interpolate-size: allow-keywords;              /* permite animar a height:auto */
}

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

/* ---------- Encabezado que se esconde al bajar ---------- */
.header { transition: transform .6s var(--ease-out), background-color .4s; }
.header.is-hidden { transform: translateY(-100%); }
.header.is-scrolled { background: rgba(13,13,13,.97); }

/* ---------- Aparecer al hacer scroll ---------- */
.js [data-reveal] {
  opacity: 0;
  transition: opacity 1s var(--ease-out), transform 1.2s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
  will-change: opacity, transform;
}
.js [data-reveal="up"]    { transform: translate3d(0, 46px, 0); }
.js [data-reveal="left"]  { transform: translate3d(-60px, 0, 0); }
.js [data-reveal="right"] { transform: translate3d(60px, 0, 0); }
.js [data-reveal="zoom"]  { transform: scale(.88); }
.js [data-reveal="flip"]  { transform: perspective(1100px) rotateX(32deg) translate3d(0, 70px, 0); transform-origin: 50% 100%; }
.js [data-reveal].is-in   { opacity: 1; transform: none; will-change: auto; }

/* ---------- Título que entra palabra por palabra ---------- */
.js [data-split] .word { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.js [data-split] .word__in {
  display: inline-block;
  transform: translate3d(0, 115%, 0) rotate(7deg);
  transform-origin: 0 100%;
  opacity: 0;
  animation: word-in 1.2s var(--ease-out) forwards;
  animation-delay: calc(150ms + var(--i) * 75ms);
}
@keyframes word-in { to { transform: none; opacity: 1; } }

/* ---------- Hero: fondo vivo ---------- */
.hero { position: relative; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; z-index: -1; width: 760px; height: 760px; right: -220px; top: -220px;
  background: radial-gradient(circle, rgba(59,116,255,.20), transparent 62%);
  animation: glow-drift 16s ease-in-out infinite alternate; pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; z-index: -1; width: 520px; height: 520px; left: -260px; bottom: -200px;
  background: radial-gradient(circle, rgba(242,67,78,.13), transparent 65%);
  animation: glow-drift 20s ease-in-out infinite alternate-reverse; pointer-events: none;
}
@keyframes glow-drift { from { transform: translate3d(0,0,0) scale(1); } to { transform: translate3d(-90px, 70px, 0) scale(1.15); } }
.hero__dots {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.09) 1px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
}

/* Etiquetas flotantes en 3D */
.chip { position: absolute; transform-style: preserve-3d; pointer-events: none; }
.chip span {
  display: inline-block; white-space: nowrap; font-size: .8rem; font-weight: 700;
  background: rgba(22,22,22,.92); color: var(--white); border: 1px solid rgba(59,116,255,.55);
  padding: 7px 13px; border-radius: 999px; box-shadow: 0 14px 30px rgba(0,0,0,.5);
  animation: bob 5s ease-in-out infinite;
}
.chip--1 { left: -4%;  top: 2%;  transform: translateZ(calc(50px + var(--pop) * 90px)); }
.chip--2 { right: 2%;  top: -4%; transform: translateZ(calc(30px + var(--pop) * 60px)); }
.chip--2 span { animation-delay: -1.6s; }
.chip--3 { left: 6%;   bottom: 2%; transform: translateZ(calc(70px + var(--pop) * 110px)); }
.chip--3 span { animation-delay: -3.2s; }
@media (max-width: 640px) {
  .chip span { font-size: .68rem; padding: 5px 10px; }
  .chip--1 { left: 0; }
  .views button { padding: 7px 11px; font-size: .8rem; }
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }

/* Botones de perspectiva */
.views { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; padding: 5px; background: var(--black-2); border: 1px solid var(--black-3); border-radius: 999px; width: fit-content; margin-inline: auto; }
.views button {
  font: inherit; font-size: .85rem; font-weight: 700; color: var(--gray); background: transparent; border: 0; cursor: pointer;
  padding: 8px 14px; border-radius: 999px; min-height: 36px; transition: color .3s, background-color .4s var(--ease-out);
}
.views button:hover { color: var(--white); }
.views button[aria-pressed="true"] { background: var(--accent-fill); color: var(--white); }
.drag-hint { text-align: center; color: var(--gray); font-size: .82rem; margin-top: 10px; transition: opacity .6s; }
.drag-hint.is-gone { opacity: 0; }
.drag-hint__icon { display: inline-block; color: var(--accent); animation: nudge 2.4s var(--ease-soft) infinite; }
.drag-hint--dark { color: var(--gray-dark); }
.drag-hint--dark .drag-hint__icon { color: var(--accent-dark); }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-5px); } 60% { transform: translateX(5px); } }

/* ---------- Cubo 3D ---------- */
.why__head { display: grid; gap: 48px; align-items: center; }
@media (min-width: 900px) { .why__head { grid-template-columns: 1.3fr .7fr; } }
.cube-wrap { display: flex; flex-direction: column; align-items: center; --size: 170px; }
@media (min-width: 640px) { .cube-wrap { --size: 200px; } }
.cube-scene { width: var(--size); height: var(--size); perspective: 900px; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; margin-top: 10px; }
.cube-scene.is-dragging { cursor: grabbing; }
.cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(-20deg) rotateY(35deg); }
.cube__face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--black); border: 2px solid var(--accent); border-radius: 16px;
  font-family: var(--font-head); font-weight: 800; font-size: 1.05rem; color: var(--white); letter-spacing: .02em;
  box-shadow: inset 0 0 40px rgba(59,116,255,.12);
}
.cube__face svg:not([width]) { width: 52px; height: 52px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cube__face img { width: 62%; height: auto; }
/* caras rojas para alternar con las azules */
.cube__face--right, .cube__face--bottom, .cube__face--back { border-color: var(--red); box-shadow: inset 0 0 40px rgba(242,67,78,.12); }
.cube__face--right svg:not([width]), .cube__face--bottom svg:not([width]) { stroke: var(--red); }
.cube__word { font-family: var(--font-code); font-weight: 800; font-size: calc(var(--size) * .26); letter-spacing: -0.03em; }
.cube__face--front  { transform: translateZ(calc(var(--size) / 2)); }
.cube__face--back   { transform: rotateY(180deg) translateZ(calc(var(--size) / 2)); }
.cube__face--right  { transform: rotateY(90deg)  translateZ(calc(var(--size) / 2)); }
.cube__face--left   { transform: rotateY(-90deg) translateZ(calc(var(--size) / 2)); }
.cube__face--top    { transform: rotateX(90deg)  translateZ(calc(var(--size) / 2)); }
.cube__face--bottom { transform: rotateX(-90deg) translateZ(calc(var(--size) / 2)); }
.cube-shadow { width: calc(var(--size) * .9); height: 22px; margin-top: 34px; border-radius: 50%; background: radial-gradient(ellipse, rgba(0,0,0,.28), transparent 70%); }

/* ---------- Tarjetas que se inclinan con el mouse ---------- */
.features, .plans { perspective: 1400px; }
.feature { transition: transform .7s var(--ease-out), box-shadow .7s var(--ease-out), opacity 1s var(--ease-out); }
@media (hover: hover) {
  .feature:hover { transform: translateY(-8px); box-shadow: 0 24px 50px rgba(13,13,13,.12); }
  .feature:hover .feature__icon { transform: rotateY(180deg); }
}
.feature__icon { transition: transform .9s var(--ease-spring); transform-style: preserve-3d; }

.plan { transform-style: preserve-3d; }
.plan::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 0%), rgba(59,116,255,.20), transparent 45%);
  opacity: 0; transition: opacity .5s var(--ease-out);
}
.plan.is-tilting::after { opacity: 1; }
.plan__price b { font-weight: 800; font-variant-numeric: tabular-nums; }
.plan__badge { animation: badge-glow 3s ease-in-out infinite; }
@keyframes badge-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(242,67,78,.45); } 50% { box-shadow: 0 0 0 8px rgba(242,67,78,0); } }

/* ---------- Botones con brillo e imán ---------- */
.btn--primary { position: relative; overflow: hidden; isolation: isolate; }
.btn--primary::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.55) 50%, transparent 75%);
  transform: translateX(-130%); transition: transform .9s var(--ease-out);
}
.btn--primary:hover::after { transform: translateX(130%); }
.btn[data-magnetic] { transition: background .2s, color .2s, transform .6s var(--ease-out); }

/* ---------- Pasos: línea que se llena ---------- */
.steps-wrap { position: relative; }
.steps__track { height: 4px; border-radius: 4px; background: var(--cream-2); margin-top: 48px; overflow: hidden; }
.steps__track span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--red)); transform-origin: 0 50%; transform: scaleX(0); }
.steps-wrap .steps { margin-top: 24px; }
.step__n { transition: transform .8s var(--ease-spring), background-color .5s; }
.step.is-in .step__n { animation: pop 1s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 120ms + 300ms); }
@keyframes pop { 0% { transform: scale(.4) rotate(-90deg); } 100% { transform: none; } }

/* ---------- Preguntas: abrir y cerrar suave ---------- */
.faq details::details-content {
  block-size: 0; overflow: hidden;
  transition: block-size .55s var(--ease-out), content-visibility .55s allow-discrete;
}
.faq details[open]::details-content { block-size: auto; }
.faq summary::after { transition: transform .5s var(--ease-spring); }
.faq details { transition: border-color .4s, background-color .4s; }
.faq details:hover { background: #1b1b1b; }

/* ---------- Ícono gigante que gira en contacto ---------- */
.section--contact { position: relative; overflow: hidden; isolation: isolate; }
.bg-mark { position: absolute; z-index: -1; width: 640px; height: 448px; right: -200px; top: 50%; margin-top: -224px; opacity: .07; pointer-events: none; }

/* ---------- Pie y WhatsApp ---------- */
.footer__nav a { transition: color .3s; position: relative; }
.footer__nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: 100% 50%; transition: transform .5s var(--ease-out); }
.footer__nav a:hover::after { transform: scaleX(1); transform-origin: 0 50%; }
.wa-float { animation: wa-in 1s var(--ease-spring) 1.6s both; transition: transform .5s var(--ease-spring); }
.wa-float::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid #25D366; animation: ring 2.6s ease-out 3s infinite; }
.wa-float:hover { transform: scale(1.1) rotate(-8deg); }
@keyframes wa-in { from { transform: scale(0) rotate(-120deg); } to { transform: none; } }
@keyframes ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.7); opacity: 0; } }

/* Menú del celular: entra deslizando */
@media (max-width: 760px) {
  .nav.is-open { animation: menu-in .5s var(--ease-out); }
  .nav.is-open a { animation: menu-item .6s var(--ease-out) both; }
  .nav.is-open a:nth-child(2) { animation-delay: .05s; }
  .nav.is-open a:nth-child(3) { animation-delay: .1s; }
  .nav.is-open a:nth-child(4) { animation-delay: .15s; }
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes menu-item { from { opacity: 0; transform: translateX(-16px); } }

/* ---------- Respeto a "reducir movimiento" ---------- */
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal], .js [data-split] .word__in { opacity: 1 !important; transform: none !important; animation: none !important; }
  .hero::before, .hero::after, .chip span, .drag-hint__icon, .plan__badge, .wa-float, .wa-float::before { animation: none !important; }
}
