@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter-Bold.ttf") format("truetype");
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --bg: #08090a;
  --bg-top: #0d0e11;
  --surface: #16171b;
  --surface-soft: #1e1f23;
  --border: #272829;
  --text: #f2f1ef;
  --muted: #8b8d93;
  --accent: #2e7dff;
  --accent-fill: #2670eb;
  --accent-text: #8fb8ff;
  --accent-surface: #12233f;
  --ok: #4cd964;
  --radius: 28px;
  --gutter: 20px;
  /* Avance de la escena del fichaje, 0 → 1 (lo pone app.js). */
  --p: 0;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--accent-fill); color: #fff; padding: 10px 14px; border-radius: 12px;
}
.skip:focus { left: 8px; z-index: 50; }

/* ---------- Cabecera fija ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) var(--gutter) 12px;
  background: linear-gradient(var(--bg) 40%, rgba(8, 9, 10, 0));
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 900; letter-spacing: .04em; text-decoration: none; font-size: 17px;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--accent-fill);
  display: grid; place-items: center;
}
.brand-mark svg { width: 20px; height: 20px; }
svg path { fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; }
.top-cta {
  font-size: 14px; font-weight: 700; text-decoration: none;
  color: var(--accent-text); background: var(--accent-surface);
  padding: 9px 14px; border-radius: 999px; border: 1px solid #1d3a66;
}

/* ---------- Portada ---------- */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 110px var(--gutter) 80px;
  background:
    radial-gradient(60% 45% at 50% 38%, rgba(46, 125, 255, .22), transparent 70%),
    linear-gradient(var(--bg-top), var(--bg));
  position: relative;
}
.hero-logo {
  width: 112px; height: 112px; border-radius: 32px; background: var(--accent-fill);
  display: grid; place-items: center;
  box-shadow: 0 20px 60px rgba(46, 125, 255, .45);
  animation: pop .9s cubic-bezier(.2, .9, .25, 1.2) both;
}
.hero-logo svg { width: 64px; height: 64px; }
.hero-logo path {
  stroke-dasharray: 1; stroke-dashoffset: 1;
  animation: draw 1.2s .35s ease-out forwards;
}
.hero-title {
  margin: 26px 0 6px; font-size: clamp(64px, 20vw, 140px); line-height: .95;
  font-weight: 900; letter-spacing: -.04em;
  animation: rise .8s .25s ease-out both;
}
.hero-lead {
  margin: 8px 0 0; font-size: clamp(22px, 6vw, 34px); font-weight: 700; line-height: 1.2;
  animation: rise .8s .4s ease-out both;
}
.hero-lead span { color: var(--accent); }
.hero-sub { margin: 14px auto 0; max-width: 32ch; color: var(--muted); animation: rise .8s .55s ease-out both; }
.scroll-hint {
  position: absolute; bottom: 28px; width: 26px; height: 42px; border-radius: 14px;
  border: 2px solid var(--border);
}
.scroll-hint span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  border-radius: 2px; background: var(--muted); animation: hint 1.6s infinite;
}

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes rise { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes hint { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Escena del fichaje ---------- */
.scene { height: 320vh; position: relative; }
.scene-sticky {
  position: sticky; top: 0; height: 100svh; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 28px; padding: 80px var(--gutter) 40px;
}
.scene-stage { position: relative; width: min(100%, 420px); height: min(62svh, 520px); }

/* Caja/etiqueta del gimnasio */
.tag {
  position: absolute; left: 50%; bottom: 0;
  width: 150px; height: 150px; margin-left: -75px;
}
.tag-face {
  position: relative; z-index: 2; width: 100%; height: 100%; border-radius: 30px;
  background: linear-gradient(145deg, #1e2128, #121419);
  border: 1px solid #2b303b;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .05);
}
.tag-face span { font-weight: 900; letter-spacing: .14em; font-size: 15px; }
.tag-arcs { width: 52px; height: 52px; }
.tag-arcs path {
  stroke: color-mix(in srgb, var(--accent) calc(var(--glow, 0) * 100%), #4a4f5a);
  transition: stroke .2s;
}
.tag-ring {
  position: absolute; inset: 0; border-radius: 34px; border: 2px solid var(--accent);
  opacity: 0; z-index: 1;
}
.scene.tapped .tag-ring { animation: ring 1.6s ease-out infinite; }
.scene.tapped .tag-ring.r2 { animation-delay: .5s; }
@keyframes ring { from { transform: scale(1); opacity: .8; } to { transform: scale(1.8); opacity: 0; } }

/* Móvil */
.phone {
  margin: 0; position: relative;
  width: 100%; max-width: 300px; aspect-ratio: 585 / 1266;
  border-radius: 44px; padding: 10px;
  background: linear-gradient(160deg, #2a2d34, #15161a);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.phone img { width: 100%; height: 100%; object-fit: cover; object-position: top; border-radius: 34px; }
.phone-notch {
  position: absolute; z-index: 3; top: 18px; left: 50%; width: 30%; height: 22px; margin-left: -15%;
  background: #000; border-radius: 14px;
}
.phone-scene {
  /* Su parte de abajo se apoya 30 px sobre la etiqueta; en pantallas bajas
     el móvil se encoge para que quepa entero. */
  --w: min(178px, calc((min(62svh, 520px) - 130px) * 0.462));
  position: absolute; left: 50%; top: auto; bottom: 120px;
  width: var(--w); margin-left: calc(var(--w) / -2);
  /* Llega desde arriba a la derecha, inclinado, y se apoya sobre la etiqueta. */
  z-index: 3;
  /* Al final queda delante, con la parte de abajo apoyada en la etiqueta. */
  transform:
    translate(calc((1 - var(--approach, 0)) * 150px), calc((1 - var(--approach, 0)) * -50px))
    rotate(calc((1 - var(--approach, 0)) * 18deg))
    scale(calc(1.06 - var(--approach, 0) * .06));
  will-change: transform;
}
.phone-screen {
  position: relative; height: 100%; border-radius: 34px; overflow: hidden;
  background: var(--bg);
  display: grid; place-items: center; text-align: center;
}
.ps-idle, .ps-done {
  grid-area: 1 / 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px;
  transition: opacity .35s, transform .35s;
}
.ps-idle b, .ps-done b { font-size: 13px; line-height: 1.25; }
.ps-idle small, .ps-done small { color: var(--muted); font-size: 10.5px; }
.ps-pulse {
  width: 74px; height: 74px; border-radius: 50%; background: var(--accent-fill);
  display: grid; place-items: center; margin-bottom: 8px;
  box-shadow: 0 0 0 10px rgba(46, 125, 255, .12), 0 0 0 22px rgba(46, 125, 255, .06);
}
.ps-pulse svg { width: 38px; height: 38px; }
.ps-check {
  width: 82px; height: 82px; border-radius: 50%; background: var(--ok);
  display: grid; place-items: center; margin-bottom: 8px;
  box-shadow: 0 10px 40px rgba(76, 217, 100, .45);
}
.ps-check svg { width: 46px; height: 46px; }
.ps-check path { stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: 1; }
.ps-done { opacity: 0; transform: scale(.9); }
.scene.tapped .ps-idle { opacity: 0; transform: scale(.9); }
.scene.tapped .ps-done { opacity: 1; transform: none; }
.scene.tapped .ps-check path { animation: draw .5s .15s ease-out forwards; }
.scene.tapped .phone-screen { background: radial-gradient(80% 60% at 50% 40%, rgba(76, 217, 100, .18), var(--bg)); }

.scene-captions { position: relative; height: 64px; width: 100%; max-width: 520px; text-align: center; }
.cap {
  position: absolute; inset: 0; margin: 0; font-size: clamp(22px, 5.6vw, 30px);
  font-weight: 700; line-height: 1.2; opacity: 0; transform: translateY(12px);
  transition: opacity .4s, transform .4s;
}
.cap strong { color: var(--ok); }
.scene[data-cap="1"] .c1, .scene[data-cap="2"] .c2, .scene[data-cap="3"] .c3 { opacity: 1; transform: none; }

/* ---------- Funciones ---------- */
.features { padding: 40px var(--gutter) 40px; max-width: 1080px; margin: 0 auto; }
.section-head { text-align: center; margin: 20px auto 60px; max-width: 640px; }
.section-head h2, .cta h2 {
  font-size: clamp(30px, 8vw, 52px); line-height: 1.08; letter-spacing: -.02em; margin: 8px 0 0; font-weight: 900;
}
.eyebrow {
  margin: 0; color: var(--accent-text); font-weight: 700; font-size: 13px;
  letter-spacing: .12em; text-transform: uppercase;
}
.feature {
  display: grid; gap: 30px; align-items: center; justify-items: center;
  padding: 36px 0 70px;
}
.feature-text { max-width: 460px; text-align: center; }
.feature h3 { font-size: clamp(26px, 6.6vw, 40px); line-height: 1.12; margin: 8px 0 12px; letter-spacing: -.015em; font-weight: 900; }
.feature-text > p:not(.eyebrow) { color: #c6c7cb; font-size: 17px; margin: 0; }
.feature .phone { max-width: 270px; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; list-style: none; padding: 0; margin: 18px 0 0; }
.chips li {
  font-size: 13px; font-weight: 700; padding: 7px 12px; border-radius: 999px;
  background: var(--accent-surface); color: var(--accent-text); border: 1px solid #1d3a66;
}

@media (min-width: 860px) {
  .feature { grid-template-columns: 1fr 1fr; gap: 60px; padding: 60px 0 90px; }
  .feature-text { text-align: left; justify-self: start; }
  .chips { justify-content: flex-start; }
  .feature.flip .feature-text { order: 2; justify-self: end; }
  .feature .phone { max-width: 300px; }
}

/* Aparición al llegar con el scroll */
.reveal .feature-text, .reveal .phone, .reveal.section-head, .cta.reveal > * {
  opacity: 0; transform: translateY(40px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.reveal .phone { transform: translateY(70px) scale(.96); transition-delay: .12s; }
.reveal.in .feature-text, .reveal.in .phone, .reveal.in.section-head, .cta.reveal.in > * {
  opacity: 1; transform: none;
}
/* Ligero desplazamiento del móvil al hacer scroll (lo pone app.js). */
.reveal.in .phone { transform: translateY(var(--drift, 0px)); transition: opacity .8s ease, transform .2s linear; }

/* ---------- Cierre ---------- */
.cta {
  text-align: center; padding: 90px var(--gutter) 110px;
  background: radial-gradient(55% 50% at 50% 30%, rgba(46, 125, 255, .2), transparent 70%);
}
.cta-logo {
  width: 84px; height: 84px; border-radius: 24px; background: var(--accent-fill);
  display: grid; place-items: center; margin: 0 auto 22px;
}
.cta-logo svg { width: 48px; height: 48px; }
.cta h2 span { color: var(--accent); }
.cta p { color: var(--muted); max-width: 34ch; margin: 16px auto 0; }
.stores { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 26px; }
.store {
  padding: 13px 18px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--border); font-weight: 700; font-size: 14px;
}

/* ---------- Pie ---------- */
.foot {
  border-top: 1px solid var(--border); padding: 28px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  text-align: center; color: var(--muted); font-size: 14px;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-bottom: 10px; }
.foot a { text-decoration: none; }
.foot a:hover, .foot a:focus-visible { color: var(--text); text-decoration: underline; }

a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* «Reducir movimiento»: todo en su sitio, sin animaciones. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .hero-logo path, .ps-check path { stroke-dashoffset: 0; }
  .reveal .feature-text, .reveal .phone, .reveal.section-head, .cta.reveal > * { opacity: 1; transform: none; }
  .scene { height: auto; }
  .scene-sticky { position: relative; height: auto; min-height: 100svh; }
}

/* Que la cabecera fija no tape el título al saltar a una sección. */
section, article { scroll-margin-top: 80px; }

/* ---------- Más vida: brillo de color, números y tarjetas flotantes ---------- */
.visual {
  position: relative; width: 100%; max-width: 420px;
  display: grid; place-items: center; padding: 30px 0;
}
.visual::before {
  content: ""; position: absolute; inset: 6% -10%; z-index: 0;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--tint) 55%, transparent), transparent 78%);
  filter: blur(14px);
}
.visual > .phone, .visual > .card-shot { position: relative; z-index: 1; }
.num {
  position: absolute; z-index: 0; top: -10px; left: -6px;
  font-size: 120px; font-weight: 900; line-height: 1; letter-spacing: -.06em;
  color: transparent; -webkit-text-stroke: 1.5px rgba(255, 255, 255, .13);
}
.card-shot {
  margin: 0; width: 100%; max-width: 360px; border-radius: 26px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .06);
  transform: rotate(-3deg);
}
.float {
  position: absolute; z-index: 2; white-space: nowrap;
  padding: 10px 14px; border-radius: 16px; font-size: 13.5px; font-weight: 700;
  background: rgba(22, 23, 27, .82); border: 1px solid rgba(255, 255, 255, .09);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
  display: inline-flex; align-items: center; gap: 8px;
}
.float.fa { top: 18%; left: -4%; }
.float.fb { bottom: 16%; right: -4%; color: var(--accent-text); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 0 4px rgba(76, 217, 100, .18); }

/* Entrada de las tarjetas flotantes, un poco después del móvil. */
.reveal .float { opacity: 0; transform: translateY(20px) scale(.94); transition: opacity .7s .35s, transform .7s .35s cubic-bezier(.2, .8, .2, 1); }
.reveal.in .float { opacity: 1; transform: translateY(calc(var(--drift, 0px) * -1.6)); }
.reveal.in .float.fb { transition-delay: .5s; }
.reveal.in .visual > .phone, .reveal.in .visual > .card-shot { transform: translateY(var(--drift, 0px)); }
.reveal.in .visual > .card-shot { transform: translateY(var(--drift, 0px)) rotate(-3deg); }

/* Franja de fondo sutil detrás de cada función. */
.feature { position: relative; }
.feature::after {
  content: ""; position: absolute; inset: 10% 0; z-index: -1;
  background:
    radial-gradient(40% 60% at 70% 50%, color-mix(in srgb, var(--tint, #2e7dff) 7%, transparent), transparent 70%);
  pointer-events: none;
}
.features { position: relative; isolation: isolate; }
.features::before {
  /* Cuadrícula muy tenue, como de pista de entreno. */
  content: ""; position: absolute; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(transparent, #000 10%, #000 90%, transparent);
}

@media (min-width: 860px) {
  .features { max-width: 1200px; }
  .feature { min-height: 88vh; }
  .feature h3 { font-size: clamp(40px, 4.2vw, 58px); }
  .feature-text > p:not(.eyebrow) { font-size: 19px; }
  .visual { max-width: 520px; }
  .feature .phone { max-width: 340px; }
  .card-shot { max-width: 460px; }
  .num { font-size: 200px; top: -40px; left: -40px; }
  .float { font-size: 15px; padding: 12px 16px; }
  .float.fa { left: -12%; }
  .float.fb { right: -10%; }
  .scene-stage { transform: scale(1.3); transform-origin: center 60%; }
  .scene-captions { margin-top: 40px; }
  .cap { font-size: 40px; }
  .hero-logo { width: 140px; height: 140px; border-radius: 40px; }
  .hero-logo svg { width: 80px; height: 80px; }
  .hero-lead { font-size: 42px; }
  .hero-sub { font-size: 19px; }
}
/* La fila de funciones usa su color también en el texto pequeño. */
.feature .eyebrow { color: color-mix(in srgb, var(--tint, #8fb8ff) 70%, white); }

@media (prefers-reduced-motion: reduce) {
  .reveal .float { opacity: 1; transform: none; }
}

/* En la tarjeta del último entreno, las etiquetas no tapan el título. */
.visual.card .float.fa { top: auto; bottom: 6%; left: -4%; }
.visual.card .float.fb { top: 4%; bottom: auto; right: -2%; }

/* Nada se sale por los lados: la franja de funciones ocupa todo el ancho
   (sin corte) y lo que sobresale se recorta en el borde de la pantalla. */
.features { max-width: none; padding-left: 0; padding-right: 0; overflow: hidden; }
.features > * { max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.features > .section-head { max-width: 640px; }
.cta, .hero { overflow: hidden; }
