/* Abacus — sitio promocional.
   El mundo: un ábaco trabajando. Marco marino profundo, varillas hairline y cuentas
   elipse que se deslizan. Display: Archivo expandida. Cuerpo: Hanken Grotesk (la de
   la app). Cifras: Azeret Mono. El latón aparece solo cuando se habla de plata. */

:root {
  --fondo: #070e24;
  --fondo-2: #0c1531;
  --fondo-3: #0f1a3d;
  --linea: rgba(173, 190, 235, 0.16);
  --papel: #eff3fc;
  --papel-dim: #a9b6dc;
  --azul: #1668dc;
  --azul-claro: #69a4ff;
  --gris: #8a96a8;
  --laton: #dcab52;
  --display: "Archivo", "Hanken Grotesk", system-ui, sans-serif;
  --cuerpo: "Hanken Grotesk", system-ui, sans-serif;
  --mono: "Azeret Mono", ui-monospace, monospace;
  --resorte: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--fondo);
  color: var(--papel);
  font-family: var(--cuerpo);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--azul); color: var(--papel); }

img, svg, video { display: block; max-width: 100%; }

a { color: var(--azul-claro); }

:focus-visible {
  outline: 2px solid var(--azul-claro);
  outline-offset: 3px;
  border-radius: 4px;
}

.visualmente-oculto {
  position: absolute;
  width: 1px; height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.salto {
  position: absolute;
  left: 1rem; top: -3rem;
  z-index: 10;
  background: var(--azul);
  color: var(--papel);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  transition: top 0.2s var(--resorte);
}
.salto:focus-visible { top: 1rem; }

/* ---------- Las piezas del mundo: cuentas y varillas ---------- */

.cuenta {
  --tinte: var(--gris);
  display: inline-block;
  width: 22px; height: 17px;
  border-radius: 50%;
  background:
    radial-gradient(120% 140% at 32% 24%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 46%),
    var(--tinte);
  box-shadow: 0 5px 12px rgba(2, 6, 20, 0.55);
}
.cuenta--azul { --tinte: var(--azul); }
.cuenta--papel { --tinte: var(--papel); }

/* ---------- Cabecera ---------- */

.cabecera {
  display: flex;
  align-items: center;
  gap: 2rem;
  max-width: 1120px;
  margin-inline: auto;
  padding: 1.4rem clamp(1.25rem, 4vw, 2.5rem);
}

.marca {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--papel);
}
.marca__palabra {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 108%;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}
.marca__palabra b { color: var(--azul-claro); }

.cabecera__nav {
  display: flex;
  gap: 1.75rem;
  margin-left: auto;
}
.cabecera__nav a {
  color: var(--papel-dim);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
}
.cabecera__nav a:hover { color: var(--papel); border-color: var(--azul); }

@media (max-width: 720px) {
  .cabecera__nav { display: none; }
  .cabecera { justify-content: space-between; }
}

/* ---------- Botones: pastillas con una cuenta adentro ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 105%;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 999px;
  padding: 0.85rem 1.6rem;
  transition: transform 0.3s var(--resorte), box-shadow 0.3s, background-color 0.25s, border-color 0.25s;
}

.btn--primario {
  background: var(--azul);
  color: var(--papel);
  box-shadow: 0 10px 26px rgba(22, 104, 220, 0.35);
}
.btn--primario:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(22, 104, 220, 0.45);
}

.btn__cuenta {
  width: 13px; height: 10px;
  border-radius: 50%;
  background:
    radial-gradient(120% 140% at 32% 24%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 50%),
    var(--papel);
  opacity: 0.9;
  transition: transform 0.35s var(--resorte);
}
.btn--primario:hover .btn__cuenta { transform: translateX(5px); }

.btn--fantasma {
  color: var(--papel);
  border: 1px solid var(--linea);
}
.btn--fantasma:hover { border-color: var(--papel-dim); transform: translateY(-2px); }

.btn--chico { padding: 0.55rem 1.15rem; font-size: 0.9rem; border: 1px solid var(--linea); color: var(--papel); }
.btn--chico:hover { border-color: var(--azul-claro); }

/* ---------- Hero ---------- */

.hero {
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(1.8rem, 4.5vw, 3.1rem) clamp(1.25rem, 4vw, 2.5rem) clamp(3rem, 7vw, 5.5rem);
  text-align: center;
}

.hero__titulo {
  font-family: var(--display);
  font-stretch: 118%;
  font-weight: 860;
  font-size: clamp(2.9rem, 9vw, 5.75rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.hero__titulo em {
  font-style: normal;
  color: var(--azul-claro);
}

.hero__apoyo {
  max-width: 42rem;
  margin: 1.35rem auto 0;
  font-size: clamp(1.1rem, 2vw, 1.25rem);
  color: var(--papel-dim);
  text-wrap: pretty;
}

.hero__acciones,
.cierre__acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
  margin-top: 1.8rem;
}

/* El instrumento: el video dentro del marco del ábaco */

.instrumento {
  position: relative;
  max-width: 880px;
  margin: clamp(2.1rem, 4.5vw, 3.1rem) auto 0;
  scroll-margin-top: 2rem;
}

.instrumento__varilla {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 26px;
  height: 34px;
}
.instrumento__varilla::before {
  content: "";
  position: absolute;
  left: 12px; right: 12px;
  top: 50%;
  height: 2px;
  background: var(--linea);
  border-radius: 2px;
}
.instrumento__varilla .cuenta {
  position: relative;
  transition: transform 0.7s var(--resorte), background-color 0.4s;
}
.instrumento__varilla .cuenta.contada {
  --tinte: var(--azul);
  transform: translateX(var(--corrimiento, 0px));
}

.instrumento__pantalla {
  position: relative;
  border: 3px solid rgba(239, 243, 252, 0.92);
  border-bottom: none;
  border-radius: 26px 26px 18px 18px;
  padding: 14px 14px 0;
  background: linear-gradient(180deg, rgba(173, 190, 235, 0.07), rgba(173, 190, 235, 0.02));
}
/* los extremos redondos de las varillas laterales, como en el logo */
.instrumento__pantalla::before,
.instrumento__pantalla::after {
  content: "";
  position: absolute;
  bottom: -5px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgba(239, 243, 252, 0.92);
}
.instrumento__pantalla::before { left: -6px; }
.instrumento__pantalla::after { right: -6px; }

.instrumento__pantalla video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px 14px 8px 8px;
  background: #04081a;
}

.portada {
  position: absolute;
  inset: 14px 14px 0;
  border: none;
  border-radius: 14px 14px 8px 8px;
  cursor: pointer;
  color: var(--papel);
  background:
    radial-gradient(90% 130% at 50% 0%, rgba(22, 104, 220, 0.32), rgba(22, 104, 220, 0) 55%),
    radial-gradient(70% 90% at 82% 92%, rgba(22, 104, 220, 0.18), rgba(22, 104, 220, 0) 60%),
    #0a1230;
  display: grid;
  place-items: center;
  transition: opacity 0.5s;
}
.portada__escena {
  display: grid;
  justify-items: center;
  gap: 1.1rem;
}
.portada__reproducir {
  display: grid;
  place-items: center;
  width: 74px; height: 58px;
  border-radius: 50%;
  color: var(--papel);
  background:
    radial-gradient(120% 140% at 32% 24%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 46%),
    var(--azul);
  box-shadow: 0 12px 30px rgba(22, 104, 220, 0.5);
  transition: transform 0.35s var(--resorte);
}
.portada:hover .portada__reproducir { transform: scale(1.07); }
.portada__texto {
  font-family: var(--display);
  font-stretch: 108%;
  font-weight: 700;
  font-size: 1.05rem;
}
.portada__falta {
  position: absolute;
  bottom: 1rem; left: 0; right: 0;
  font-size: 0.85rem;
  color: var(--papel-dim);
}
.portada__falta code { font-family: var(--mono); color: var(--azul-claro); }
.portada.oculta { opacity: 0; pointer-events: none; }

.instrumento__swoosh {
  width: 96%;
  height: clamp(30px, 6vw, 58px);
  margin: 10px auto 0;
  opacity: 0.95;
}

/* Pantallas anchas pero bajas (portátiles): el titular cabe en una línea y el
   instrumento se acerca, para que el marco y el arranque del swoosh entren al pliegue. */
@media (min-width: 1000px) and (max-height: 960px) {
  .hero { padding-top: 1.5rem; }
  .hero__titulo { font-size: clamp(3.2rem, 4.6vw, 4.3rem); }
  .hero__titulo br { display: none; }
  .instrumento { max-width: 760px; margin-top: 1.9rem; }
  .instrumento__varilla { height: 30px; }
}

@media (max-width: 720px) {
  .hero { padding-top: 1.8rem; }
  .hero__titulo { font-size: clamp(2.7rem, 13vw, 3.4rem); }
  .instrumento__pantalla { padding: 8px 8px 0; border-width: 2.5px; border-radius: 20px 20px 12px 12px; }
  .portada { inset: 8px 8px 0; }
  .portada__reproducir { width: 58px; height: 46px; }
  .portada__logo { width: 52px; height: 52px; }
  .instrumento__varilla { height: 28px; padding: 0 14px; }
}

/* En el teléfono el video es el vertical (9:16) y el instrumento se vuelve un
   marco retrato, dimensionado para que quepa entero con sus cuentas y su base. */
.instrumento--retrato {
  max-width: min(100%, calc((100vh - 230px) * 9 / 16));
  max-width: min(100%, calc((100dvh - 230px) * 9 / 16));
}
.instrumento--retrato .instrumento__pantalla video { aspect-ratio: 9 / 16; }

/* ---------- Secciones ---------- */

.seccion {
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 4vw, 2.5rem) 0;
  scroll-margin-top: 1.5rem;
}

.seccion__titulo {
  font-family: var(--display);
  font-stretch: 114%;
  font-weight: 820;
  font-size: clamp(2rem, 4.6vw, 3.1rem);
  letter-spacing: -0.02em;
  line-height: 1.05;
  text-wrap: balance;
}

.seccion__apoyo {
  margin-top: 0.9rem;
  color: var(--papel-dim);
  max-width: 46rem;
  font-size: 1.1rem;
}

.seccion--panel {
  max-width: none;
  background: var(--fondo-2);
  border-top: 1px solid var(--linea);
  border-bottom: 1px solid var(--linea);
  margin-top: clamp(4rem, 9vw, 7rem);
  padding: clamp(4rem, 8vw, 6rem) clamp(1.25rem, 4vw, 2.5rem);
}
.seccion--panel > * { max-width: 1120px; margin-inline: auto; }
.seccion--panel .seccion__apoyo { margin-top: 0.9rem; }

/* ---------- El día: cuatro pasos sobre una varilla ---------- */

.pasos {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  margin-top: clamp(2.5rem, 5vw, 4rem);
  position: relative;
}
/* la varilla continua que une los tanteos */
.pasos::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: 16px;
  height: 2px;
  background: var(--linea);
  border-radius: 2px;
}

.paso { position: relative; }

.paso__tanteo {
  position: relative;
  display: flex;
  gap: 7px;
  align-items: center;
  height: 34px;
}
.paso__tanteo .cuenta { width: 24px; height: 19px; }

.paso h3 {
  font-family: var(--display);
  font-stretch: 108%;
  font-weight: 750;
  font-size: 1.3rem;
  letter-spacing: -0.01em;
  margin-top: 0.9rem;
}
.paso p {
  margin-top: 0.55rem;
  color: var(--papel-dim);
  font-size: 0.99rem;
}

@media (max-width: 860px) {
  .pasos {
    grid-template-columns: 1fr;
    gap: 2.2rem;
    padding-left: 3.1rem;
  }
  /* en el teléfono la varilla es vertical y los tanteos se cuelgan de ella */
  .pasos::before {
    left: 12px; right: auto;
    top: 8px; bottom: 8px;
    width: 2px; height: auto;
  }
  .paso__tanteo {
    position: absolute;
    left: -3.1rem;
    top: 2px;
    flex-direction: column;
    gap: 5px;
    height: auto;
    width: 26px;
    align-items: center;
  }
  .paso__tanteo .cuenta { width: 22px; height: 17px; }
  .paso h3 { margin-top: 0; }
}

/* ---------- Las pruebas ---------- */

.prueba {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  padding: clamp(2.2rem, 4.5vw, 3.2rem) 0;
  border-bottom: 1px solid var(--linea);
}
.seccion--panel .prueba:first-of-type { margin-top: clamp(2rem, 4vw, 3rem); border-top: 1px solid var(--linea); }
.prueba:last-of-type { border-bottom: none; padding-bottom: 0; }

.prueba__texto h3 {
  font-family: var(--display);
  font-stretch: 110%;
  font-weight: 780;
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}
.prueba__texto p {
  margin-top: 0.8rem;
  color: var(--papel-dim);
}

.prueba__pieza { justify-self: center; width: 100%; max-width: 380px; }
.prueba__pieza figcaption {
  margin-top: 0.8rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--gris);
}

/* Las pantallas reales de la app, enmarcadas en el mundo del instrumento:
   marco con varilla de tres cuentas miniatura y la captura como pantalla. */
.pantalla {
  display: block;
  border: 2px solid rgba(239, 243, 252, 0.85);
  border-radius: 22px;
  background: var(--fondo-3);
  padding: 0 10px 10px;
  box-shadow: 0 16px 36px rgba(2, 6, 20, 0.5);
}
.pantalla__varilla {
  position: relative;
  display: flex;
  gap: 6px;
  align-items: center;
  height: 30px;
  padding: 0 6px;
}
.pantalla__varilla::before {
  content: "";
  position: absolute;
  left: 2px; right: 2px;
  top: 50%;
  height: 2px;
  background: var(--linea);
  border-radius: 2px;
}
.pantalla__varilla .cuenta {
  position: relative;
  width: 15px; height: 11px;
}
.pantalla img {
  width: 100%;
  height: auto;
  border-radius: 12px;
}

@media (max-width: 860px) {
  .prueba { grid-template-columns: 1fr; gap: 1.6rem; }
  .prueba__pieza { justify-self: start; max-width: 340px; }
  .prueba__pieza figcaption { text-align: left; }
}

/* ---------- Del cuaderno ---------- */

.cuaderno {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.cuaderno__texto p { margin-top: 1rem; color: var(--papel-dim); max-width: 34rem; }

.lista-cuentas {
  list-style: none;
  margin-top: 1.4rem;
  display: grid;
  gap: 0.8rem;
}
.lista-cuentas li {
  position: relative;
  padding-left: 2.1rem;
}
.lista-cuentas li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.42em;
  width: 20px; height: 15px;
  border-radius: 50%;
  background:
    radial-gradient(120% 140% at 32% 24%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 46%),
    var(--azul);
  box-shadow: 0 4px 10px rgba(2, 6, 20, 0.5);
}
.lista-cuentas li:nth-child(2)::before { background-color: var(--gris); }
.lista-cuentas li:nth-child(3)::before { background-color: var(--papel); }

@media (max-width: 860px) {
  .cuaderno { grid-template-columns: 1fr; }
  .cuaderno__arte { max-width: 440px; }
}

/* ---------- Roles ---------- */

.roles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  position: relative;
}
.roles::before {
  content: "";
  position: absolute;
  left: 50%; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--linea);
  border-radius: 2px;
}
.rol h3 {
  font-family: var(--display);
  font-stretch: 112%;
  font-weight: 800;
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  letter-spacing: -0.015em;
}
.rol .lista-cuentas { margin-top: 1.2rem; }
.rol .lista-cuentas li { color: var(--papel-dim); }

@media (max-width: 860px) {
  .roles { grid-template-columns: 1fr; gap: 2.5rem; }
  .roles::before { display: none; }
  .rol + .rol { border-top: 1px solid var(--linea); padding-top: 2.2rem; }
}

/* ---------- Cierre y pie ---------- */

.cierre {
  max-width: 1120px;
  margin-inline: auto;
  padding: clamp(5rem, 10vw, 8rem) clamp(1.25rem, 4vw, 2.5rem) clamp(4rem, 8vw, 6rem);
  text-align: center;
  scroll-margin-top: 1.5rem;
}
.cierre__marca { margin-inline: auto; }
.cierre__titulo {
  font-family: var(--display);
  font-stretch: 116%;
  font-weight: 850;
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  letter-spacing: -0.02em;
  line-height: 1.02;
  margin-top: 1.8rem;
  text-wrap: balance;
}

.pie {
  border-top: 1px solid var(--linea);
  padding: 2rem clamp(1.25rem, 4vw, 2.5rem) 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  max-width: 1120px;
  margin-inline: auto;
  color: var(--papel-dim);
  font-size: 0.92rem;
}

/* ---------- Movimiento al entrar: solo los gestos del mundo ----------
   El texto y las secciones son visibles siempre. Lo que se mueve al aparecer es lo
   que en un ábaco se mueve: las cuentas se deslizan a su lugar y las cifras cuentan. */

.js .paso .cuenta {
  opacity: 0;
  transform: translateX(-16px);
}
.js .paso.vista .cuenta {
  opacity: 1;
  transform: none;
  transition: opacity 0.45s ease-out, transform 0.7s var(--resorte);
}
.js .paso.vista .cuenta:nth-child(2) { transition-delay: 0.08s; }
.js .paso.vista .cuenta:nth-child(3) { transition-delay: 0.16s; }
.js .paso.vista .cuenta:nth-child(4) { transition-delay: 0.24s; }

/* Mientras el video no arranca, el instrumento tantea despacio: una cuenta se corre
   y vuelve, como quien espera con el ábaco en la mano. */
@keyframes tanteo {
  0%, 90%, 100% { transform: none; }
  94% { transform: translateX(7px); }
}
.js .instrumento:not(.sonando) .instrumento__varilla .cuenta:nth-child(3) { animation: tanteo 7s infinite; }
.js .instrumento:not(.sonando) .instrumento__varilla .cuenta:nth-child(7) { animation: tanteo 7s 3.5s infinite; }

/* Sin JS no hay portada: el video queda a la vista con sus controles nativos. */
html:not(.js) .portada { display: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .paso .cuenta { opacity: 1; transform: none; }
  .js .instrumento .instrumento__varilla .cuenta { animation: none; }
  .instrumento__varilla .cuenta,
  .btn, .btn__cuenta, .portada__reproducir { transition: none !important; }
}
