/* ── Web viva ───────────────────────────────────────────────────────────────
   Escenas animadas de la portada, sobre el negro de styles.css. Cada elemento parte de su estado
   final y los keyframes solo lo apartan un momento: con «Reducir movimiento», styles.css apaga las
   animaciones y todo queda visible. */
:root {
  --papel: #1c1c1e;
  --papel-2: #2a2a2d;
  --lavanda: #c5b1ff;
  --curva: cubic-bezier(.2, .72, .2, 1);
}

/* Las escenas usan los colores de la app (SoberTheme, NativeTheme.swift). */
:root, [data-tema="oscuro"] {
  --app-lienzo: #191b1f;
  --app-tarjeta: #24262b;
  --app-sutil: #292a31;
  --app-texto: #f0f0f3;
  --app-gris: #b5b3bf;
  --app-tinta: #c7b3f7;
  --app-relleno: #b398f2;
  --app-sobre: #262032;
  --app-hoy: #302b3c;
}
[data-tema="claro"] {
  --app-lienzo: #faf9f6;
  --app-tarjeta: #fff;
  --app-sutil: #f4f2f7;
  --app-texto: #24232b;
  --app-gris: #696773;
  --app-tinta: #6750ad;
  --app-relleno: #b398f2;
  --app-sobre: #262032;
  --app-hoy: #f7f3fd;
}
.vg-hilo, .vg-espacio, .vg-tarjeta, .vg-compositor, .vh, .vh-etiqueta, .mv, .mv-lista span, .mv-mes i, .mv-pastilla {
  transition: background-color .5s ease, color .5s ease;
}

/* Selector Claro/Oscuro. Sin JavaScript no aparece porque no podría hacer nada. */
.tema { display: none; flex: 0 0 auto; gap: 2px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, .08); }
.con-tema .tema { display: inline-flex; }
.con-tema .tema[hidden] { display: none; }
.tema button { min-height: 36px; padding: 0 14px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.tema button[aria-pressed="true"] { background: var(--text); color: #000; font-weight: 500; }
.tema button:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }
.tema-centro { display: flex; justify-content: center; margin-bottom: 18px; }
.demo-controls { flex-wrap: wrap; justify-content: center; }

/* Orbe. El <img> es el respaldo sin JavaScript. */
.orbe { display: block; line-height: 0; }
.orbe img { width: 100%; height: auto; }
.orbe canvas { display: block; }
.orbe-logo { width: 28px; height: 28px; }
.orbe-hero { position: relative; width: 132px; height: 132px; margin-bottom: 22px; }
.orbe-hero::before, .orbe-final::before {
  content: "";
  position: absolute;
  inset: -55%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(197, 177, 255, .2), transparent);
  pointer-events: none;
}
.orbe-final { position: relative; width: 96px; height: 96px; margin: 0 auto 28px; }

/* Portada: entra en orden, de arriba abajo. */
.hero-copy { isolation: isolate; }
.palabra { display: inline-block; }
.vivo .hero-title .palabra {
  animation: subir .7s var(--curva) both;
  animation-delay: calc(.14s + var(--n, 0) * .06s);
}
.vivo .orbe-hero { animation: posarse 1s var(--curva) both; }
.vivo .hero .eyebrow { animation: subir .6s var(--curva) .08s both; }
.vivo .hero-lead { animation: subir .7s var(--curva) .52s both; }
.vivo .launch-bar { animation: subir .7s var(--curva) .66s both; }
.vivo .demo-hero { animation: subir .9s var(--curva) .8s both; }
@keyframes subir {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
@keyframes posarse {
  from { opacity: 0; transform: scale(.82); }
  to { opacity: 1; transform: none; }
}

/* Crece mientras sube al centro. Donde el navegador no lo admite, la imagen sale a tamaño final. */
@supports (animation-timeline: view()) {
  .demo-hero .demo-stage img {
    animation: acercarse linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 42%;
  }
}
@keyframes acercarse {
  from { transform: scale(.9); }
  to { transform: none; }
}

/* Avance de la vista activa mientras la portada se reproduce sola. */
.demo-views button { position: relative; overflow: hidden; }
[data-playing] .demo-views button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: auto 14px 5px;
  height: 2px;
  border-radius: 2px;
  background: var(--lavanda);
  transform-origin: left;
  animation: avance 5s linear both;
}
@keyframes avance {
  from { transform: scaleX(0); }
  to { transform: none; }
}

/* Cabeceras de sección, línea a línea. */
.reveal-active .section-heading > *,
.reveal-active .capture-copy > *,
.reveal-active .privacy-copy > * {
  animation: subir .7s var(--curva) both;
}
.reveal-active .section-heading > :nth-child(2),
.reveal-active .capture-copy > :nth-child(2),
.reveal-active .privacy-copy > :nth-child(2) { animation-delay: .08s; }
.reveal-active .section-heading > :nth-child(3),
.reveal-active .capture-copy > :nth-child(3),
.reveal-active .privacy-copy > :nth-child(3) { animation-delay: .16s; }
.reveal-active .everyday-grid article,
.reveal-active .plan { animation: subir .6s var(--curva) both; }
.reveal-active .everyday-grid article:nth-child(2), .reveal-active .plan:nth-child(2) { animation-delay: .08s; }
.reveal-active .everyday-grid article:nth-child(3) { animation-delay: .16s; }
.reveal-active .everyday-grid article:nth-child(4) { animation-delay: .24s; }
.reveal-active .everyday-grid article:nth-child(5) { animation-delay: .32s; }

/* «Lo habitual» se tacha delante de ti. */
.reveal-active .compare-usual { animation: tachar 1s ease .55s both; }
@keyframes tachar {
  from { text-decoration-color: transparent; opacity: 1; }
  to { text-decoration-color: rgba(255, 255, 255, .34); opacity: .78; }
}

/* Guardar y preguntar. */
.vg {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 14px;
  min-height: 390px;
  margin-bottom: 14px;
  padding: clamp(14px, 2vw, 20px);
  border-radius: 28px;
  background: var(--panel);
}
.vg-hilo, .vg-espacio {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 18px;
  border-radius: 18px;
  background: var(--app-lienzo);
}
.vg-marca { margin: 0 0 18px; color: var(--app-texto); font-family: ui-serif, "New York", Georgia, serif; font-size: 19px; font-weight: 600; }
.vg-dia { margin: 0 0 10px; color: var(--app-gris); font-size: 12px; font-weight: 600; }
.vg-tarjeta {
  display: block;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--app-tarjeta);
  color: var(--app-texto);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
}
.vg-tarjeta small { display: block; margin-bottom: 2px; color: var(--app-gris); font-size: 11px; font-weight: 400; }
.vg-nueva { box-shadow: inset 0 0 0 1.5px var(--app-tinta); }
.vg:not(.con-nota) .vg-nueva { visibility: hidden; }
.vg.con-nota .vg-nueva { animation: aparecer .55s var(--curva) both; }
.vg .vg-relacion { margin: 6px 2px 0; color: var(--app-tinta); font-size: 11px; opacity: 0; transition: opacity .4s ease .35s; }
.vg.con-nota .vg-relacion { opacity: 1; }
@keyframes aparecer {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}
.vg-respuesta { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 150px; padding-block: 8px 14px; text-align: center; }
.vg-pensando { display: grid; place-items: center; }
.vg-pensando .orbe { transition: transform .4s var(--curva); }
.vg.pensando .vg-pensando .orbe { transform: scale(1.35); }
.vg-lema { margin: 0; color: var(--app-gris); font-family: ui-serif, "New York", Georgia, serif; font-size: 14px; line-height: 1.35; }
.vg.con-respuesta .vg-lema, .vg.pensando .vg-lema { display: none; }
.vg-contesta { display: none; max-width: 300px; margin: 0; color: var(--app-texto); font-size: 15px; font-weight: 500; line-height: 1.4; }
.vg-fuente { display: none; padding: 4px 10px; border-radius: 999px; background: var(--app-sutil); color: var(--app-gris); font-size: 11px; }
.vg.con-respuesta .vg-contesta { display: block; animation: aparecer .55s var(--curva) both; }
.vg.con-respuesta .vg-fuente { display: inline-block; animation: aparecer .55s var(--curva) .2s both; }
.vg-compositor { padding: 10px; border-radius: 16px; background: var(--app-tarjeta); }
.vg-modos { display: flex; gap: 6px; margin-bottom: 8px; }
.vg-modos span { flex: 1; padding: 7px 10px; border-radius: 10px; color: var(--app-gris); font-size: 12px; font-weight: 600; text-align: center; transition: background .3s ease, color .3s ease; }
.vg:not(.preguntando) .vg-modo-guardar, .vg.preguntando .vg-modo-preguntar { background: var(--app-relleno); color: var(--app-sobre); }
.vg-campo { display: flex; align-items: flex-end; gap: 8px; min-height: 76px; }
.vg-campo p { flex: 1; min-width: 0; margin: 0; color: var(--app-texto); font-size: 13px; line-height: 1.4; }
.vg-cursor { display: none; width: 1.5px; height: 1em; margin-left: 1px; vertical-align: -2px; background: var(--app-tinta); animation: parpadeo 1s steps(2, start) infinite; }
.vg.escribiendo .vg-cursor { display: inline-block; }
@keyframes parpadeo { to { visibility: hidden; } }
.vg-enviar { flex: 0 0 30px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--app-relleno); color: var(--app-sobre); font-size: 14px; font-weight: 700; transition: transform .2s ease; }
.vg.enviando .vg-enviar { transform: scale(.78); }
.steps article { transition: background .35s ease; }
.steps article h3, .steps article p { transition: color .35s ease; }
.steps article.paso-activo { background: var(--panel-2); }
.steps article.paso-activo .step-number { color: var(--lavanda); }
@media (max-width: 720px) {
  .vg { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .vg-hilo { min-height: 186px; }
}

/* El hilo: se desplaza solo y el orbe se queda en el centro, como en la pantalla de Inicio. */
.vh {
  position: relative;
  height: 360px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 28px;
  background: var(--app-lienzo);
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
}
.vh-cinta {
  position: absolute;
  inset: 0 0 auto;
  width: min(100%, 620px);
  height: 880px;
  margin-inline: auto;
  right: 0;
  animation: hilo 16s ease-in-out infinite alternate;
}
.vh-cinta svg { position: absolute; inset: 0 auto 0 50%; width: 80px; height: 100%; margin-left: -40px; overflow: visible; }
.vh-cinta path { fill: none; stroke: var(--app-tinta); stroke-width: 2.5; stroke-linecap: round; opacity: .45; }
.vh-fila { position: absolute; left: 50%; display: flex; }
.vh-fila.izquierda { right: 50%; left: auto; justify-content: flex-end; padding-right: 46px; }
.vh-fila.derecha { padding-left: 46px; }
.vh-fila .vg-tarjeta { width: 170px; margin: 0; background: var(--app-sutil); }
.vh-fila.hoy .vg-tarjeta { background: var(--app-hoy); box-shadow: inset 0 0 0 1.5px var(--app-tinta); }
.vh-fila.hecha .vg-tarjeta b { color: var(--app-gris); font-weight: 500; text-decoration: line-through; }
.vh-etiqueta { position: absolute; left: 50%; padding: 3px 10px; border-radius: 999px; background: var(--app-lienzo); color: var(--app-gris); font-size: 12px; font-weight: 600; white-space: nowrap; transform: translateX(-50%); }
.vh-etiqueta.hoy { background: var(--app-relleno); color: var(--app-sobre); }
.vh-orbe { position: absolute; top: 50%; left: 50%; margin: -30px 0 0 -30px; }
@keyframes hilo {
  0%, 12% { transform: translateY(-40px); }
  48%, 62% { transform: translateY(-260px); }
  100% { transform: translateY(-480px); }
}
@media (max-width: 560px) {
  .vh-fila .vg-tarjeta { width: min(140px, 38vw); }
  .vh-fila.izquierda { padding-right: 38px; }
  .vh-fila.derecha { padding-left: 38px; }
}

/* Viñetas de las tarjetas de «Tu día». */
.mv { position: relative; height: 104px; margin-bottom: 18px; overflow: hidden; border-radius: 16px; background: var(--app-lienzo); }
.mv-voz { display: flex; align-items: center; justify-content: center; gap: 4px; }
.mv-voz i { width: 4px; height: 44px; border-radius: 4px; background: var(--app-tinta); transform-origin: center; animation: voz 1.1s ease-in-out infinite alternate; }
.mv-voz i:nth-child(odd) { animation-duration: .8s; }
.mv-voz i:nth-child(3n) { animation-duration: 1.4s; animation-delay: .2s; }
.mv-voz i:nth-child(4n) { animation-delay: .35s; }
@keyframes voz {
  from { transform: scaleY(.18); opacity: .55; }
  to { transform: none; opacity: 1; }
}
.mv-lista { display: grid; align-content: center; gap: 6px; padding-inline: 16px; }
.mv-lista span { display: flex; gap: 10px; padding: 5px 10px; border-radius: 8px; background: var(--app-tarjeta); color: var(--app-texto); font-size: 12px; animation: lista 6s ease infinite; }
.mv-lista span b { color: var(--app-gris); font-weight: 400; font-variant-numeric: tabular-nums; }
.mv-lista span:nth-child(2) { animation-delay: .25s; box-shadow: inset 0 0 0 1px var(--app-tinta); }
.mv-lista span:nth-child(3) { animation-delay: .5s; }
@keyframes lista {
  0% { opacity: 0; transform: translateY(8px); }
  10%, 90% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
.mv-mes { display: grid; grid-template-columns: repeat(7, 1fr); align-content: center; gap: 4px; padding-inline: 22px; }
.mv-mes i { height: 12px; border-radius: 3px; background: var(--app-tarjeta); }
.mv-mes i.lunes { animation: lunes 6s ease infinite; }
.mv-mes i.lunes:nth-child(8) { animation-delay: .4s; }
.mv-mes i.lunes:nth-child(15) { animation-delay: .8s; }
.mv-mes i.lunes:nth-child(22) { animation-delay: 1.2s; }
@keyframes lunes {
  0%, 5% { background: var(--app-tarjeta); }
  12%, 82% { background: var(--app-tinta); }
  92%, 100% { background: var(--app-tarjeta); }
}
.mv-aviso { display: grid; align-content: center; gap: 14px; padding-inline: 18px; }
.mv-aviso div { position: relative; height: 22px; font-size: 12px; color: var(--app-gris); }
.mv-aviso div::before { content: ""; position: absolute; left: 58px; right: 0; top: 10px; height: 2px; background: var(--app-sutil); }
.mv-aviso div::after { content: ""; position: absolute; right: 0; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--app-texto); }
.mv-aviso i { position: absolute; top: 5px; right: 2%; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); animation: aviso-cafe 6s var(--curva) infinite; }
.mv-aviso div:first-child i { animation-name: aviso-vuelo; }
@keyframes aviso-vuelo {
  0%, 8% { right: 2%; }
  42%, 100% { right: 66%; }
}
@keyframes aviso-cafe {
  0%, 8% { right: 2%; }
  42%, 100% { right: 12%; }
}
.mv-lugar { display: grid; align-content: center; justify-items: center; gap: 12px; }
.mv-pastilla { position: relative; display: flex; padding: 3px; border-radius: 999px; background: var(--app-tarjeta); font-size: 12px; font-weight: 600; }
.mv-pastilla span { position: relative; z-index: 1; width: 74px; padding: 5px 0; color: var(--app-texto); text-align: center; }
.mv-pastilla::before { content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: 74px; border-radius: 999px; background: var(--app-sutil); box-shadow: inset 0 0 0 1px var(--gold); animation: lugar 6s var(--curva) infinite; }
.mv-ruta { position: relative; width: 148px; height: 2px; background: var(--app-sutil); }
.mv-ruta i { position: absolute; top: -4px; left: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: ruta 6s ease-in-out infinite; }
@keyframes lugar {
  0%, 44% { transform: none; }
  54%, 92% { transform: translateX(74px); }
  100% { transform: none; }
}
@keyframes ruta {
  0%, 6% { left: 0; }
  46%, 92% { left: calc(100% - 10px); }
  100% { left: 0; }
}

/* Foto: el visor recorre el papel y aparece la cita organizada. */
.capture-demo { overflow: hidden; }
.capture-demo::after {
  content: "";
  position: absolute;
  inset: 8% 8% auto;
  height: 2px;
  background: var(--text);
  box-shadow: 0 0 22px 4px rgba(245, 245, 247, .4);
  opacity: 0;
  animation: barrido 8s ease-in-out infinite;
}
.paper-card { animation: papel 8s var(--curva) infinite; }
.scan-frame { animation: visor 8s var(--curva) infinite; }
.paper-card i { transform-origin: left; animation: renglon 8s ease infinite; }
.capture-result { animation: resultado 8s var(--curva) infinite; }
@keyframes barrido {
  0%, 8% { top: 8%; opacity: 0; }
  12% { opacity: 1; }
  44% { top: 90%; opacity: 1; }
  48%, 100% { top: 90%; opacity: 0; }
}
@keyframes papel {
  0% { transform: rotate(-9deg) scale(1.04); }
  10%, 100% { transform: rotate(-4deg); }
}
@keyframes visor {
  0% { opacity: 0; transform: scale(1.06); }
  10%, 92% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@keyframes renglon {
  0%, 24% { background: rgba(68, 60, 73, .13); }
  34%, 92% { background: rgba(68, 60, 73, .5); }
  100% { background: rgba(68, 60, 73, .13); }
}
@keyframes resultado {
  0%, 46% { opacity: 0; transform: translateY(18px) scale(.96); }
  54%, 94% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* Privacidad: lo que sale del orbe vuelve al orbe. La nube no recibe nada. */
.proof-center { position: relative; z-index: 1; }
.proof-center .orbe { margin-bottom: 20px; }
.proof-anillo { position: absolute; top: 50%; left: 50%; width: 250px; height: 250px; margin: -125px 0 0 -125px; border: 1px solid var(--line); border-radius: 50%; animation: giro 18s linear infinite; }
.proof-anillo.segundo { width: 340px; height: 340px; margin: -170px 0 0 -170px; animation-duration: 28s; animation-direction: reverse; }
.proof-anillo i { position: absolute; top: -4px; left: calc(50% - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--lavanda); box-shadow: 0 0 12px rgba(197, 177, 255, .8); }
.proof-anillo.segundo i { background: var(--gold); box-shadow: 0 0 12px rgba(243, 200, 120, .7); }
@keyframes giro { to { transform: rotate(360deg); } }
.proof-verbos b { font-weight: 400; animation: verbo 6s ease infinite; }
.proof-verbos b:nth-child(2) { animation-delay: 2s; }
.proof-verbos b:nth-child(3) { animation-delay: 4s; }
@keyframes verbo {
  0%, 30% { color: var(--text); }
  40%, 100% { color: var(--muted); }
}
.blocked-cloud i { transform-origin: center; animation: cerrojo 6s ease-in-out infinite; }
@keyframes cerrojo {
  0%, 100% { opacity: .5; }
  50% { opacity: 1; }
}
.privacy-proof { overflow: hidden; }
@media (max-width: 560px) {
  .proof-anillo { width: 210px; height: 210px; margin: -105px 0 0 -105px; }
  .proof-anillo.segundo { width: 280px; height: 280px; margin: -140px 0 0 -140px; }
}

/* Cierre: la galaxia y su órbita, como estaban, sobre el negro. */
.final-cta { border: 0; }
.final-cta::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(#000, transparent 22%, transparent 84%, #000);
  pointer-events: none;
}
.final-cta::after { animation: deriva 40s ease-in-out infinite alternate; }
.final-orbit-svg { z-index: 1; }
.final-cta .eyebrow.warm { color: var(--gold); font-size: 15px; }
@keyframes deriva {
  from { transform: translate(-50%, -50%) scale(1) rotate(-2deg); }
  to { transform: translate(-50%, -50%) scale(1.08) rotate(2deg); }
}

@media (prefers-reduced-motion: reduce) {
  .demo-hero .demo-stage img { animation: none; }
  .vh-cinta { transform: translateY(-260px); }
}

.section-heading .no-counts { display: flex; justify-content: center; }
