/* Marvin · landing — la base: tokens, tipografía, nav y héroe.
   El lenguaje visual sigue la anatomía de la referencia aprobada por Wilson
   (héroe pegajoso, nav de píldora, tarjetas flotantes, revelados al scroll)
   con la marca de la casa: donde la referencia pone negro va verde pino,
   donde pone su acento va el verde claro y el sobre-verde nuestros. */

:root {
  --verde: #1f5c46;
  --verde-hondo: #174534; /* el "negro" de esta página */
  --verde-claro: #6fb496;
  --sobre-verde: #d2deda;
  --papel: #f2f4f1;
  --papel-alto: #ffffff;
  --tinta: #1c211e;
  --tinta-suave: #4c564f;
  --tinta-tenue: #666e68; /* 4.7:1 sobre papel — el #6d7770 anterior no llegaba a 4.5 */
  --linea: #e2e6e2;
  --atencion: #d9a54a;
  --critico: #a33d2e;
  --radio: 20px;
  --radio-tarjeta: 28px;
  --salida: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--tinta);
  background: var(--papel);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: 'Newsreader', Georgia, serif; font-weight: 500; line-height: 1.08; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.6rem, 6vw, 4.25rem); }
h2 { font-size: clamp(2rem, 4.6vw, 3.4rem); }
h3 { font-size: clamp(1.15rem, 2vw, 1.35rem); font-family: 'IBM Plex Sans', sans-serif; font-weight: 600; }

p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

.centro { max-width: 1280px; margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 4rem); }

.rotulo { font-family: 'IBM Plex Mono', monospace; font-size: 0.8rem; color: var(--tinta-tenue); }

/* ── Botones: la píldora de la casa ── */
.pildora {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 3rem; padding: 0.65rem 1.6rem;
  border-radius: 999px; font-weight: 500; font-size: 1rem;
  transition: transform 220ms var(--salida), box-shadow 220ms var(--salida), background-color 150ms;
}
.pildora:hover { transform: translateY(-2px); }
.pildora:active { transform: translateY(0); }
.pildora-verde { background: var(--verde); color: #fff; box-shadow: 0 10px 24px -12px rgba(23, 69, 52, 0.55), inset 0 1px 0 rgba(255,255,255,0.18); }
.pildora-verde:hover { background: var(--verde-hondo); box-shadow: 0 16px 32px -12px rgba(23, 69, 52, 0.6); }
.pildora-clara { background: #fff; color: var(--verde-hondo); box-shadow: 0 10px 24px -14px rgba(0,0,0,0.35); }
.pildora-clara:hover { color: var(--verde); }
.pildora-borde { border: 1px solid rgba(255,255,255,0.35); color: #fff; }
.pildora-borde:hover { background: rgba(255,255,255,0.1); }
.pildora .flecha { transition: transform 220ms var(--salida); }
.pildora:hover .flecha { transform: translateX(4px); }

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

/* saltar al contenido: invisible hasta que el teclado lo enfoca */
.salto { position: absolute; left: -9999px; top: 1rem; z-index: 60; background: #fff; color: var(--verde-hondo); padding: 0.6rem 1.2rem; border-radius: 999px; font-weight: 500; }
.salto:focus { left: 1rem; }

/* ── La barra: logo, píldora de navegación, CTA ── */
.barra {
  position: fixed; inset-inline: 0; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1rem clamp(1.25rem, 3vw, 2.5rem);
  transition: background-color 220ms var(--salida);
}
/* al salir del héroe la barra gana su propio suelo, como en la referencia */
.barra.sobre-claro {
  background: color-mix(in srgb, var(--papel) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.barra-marca img { height: 30px; }
.barra-marca .logo-tinta { display: none; }
/* sobre el lienzo claro, el logo cambia a su versión de tinta */
.barra.sobre-claro .logo-tinta { display: block; }
.barra.sobre-claro .logo-clara { display: none; }
.barra-menu {
  display: flex; gap: 0.25rem; padding: 0.35rem;
  background: var(--verde-hondo); border-radius: 999px;
  box-shadow: 0 12px 32px -12px rgba(0,0,0,0.45);
}
.barra-menu a {
  padding: 0.5rem 1.1rem; border-radius: 999px;
  color: rgba(255,255,255,0.85); font-size: 0.95rem;
  transition: background-color 150ms, color 150ms;
}
.barra-menu a:hover { color: #fff; }
.barra-menu a.activo { background: #fff; color: var(--verde-hondo); }
.barra-entrar { background: #fff; color: var(--verde-hondo); border: 1px solid var(--linea); box-shadow: 0 8px 20px -10px rgba(0,0,0,0.3); }
.barra-acciones { display: flex; gap: 0.5rem; }
/* en móvil la nav no desaparece: se pliega detrás del botón Menú */
.barra-menu-boton { display: none; background: var(--verde-hondo); color: #fff; border: none; cursor: pointer; font: inherit; }
@media (max-width: 900px) {
  .barra-menu { display: none; }
  .barra-menu-boton { display: inline-flex; }
  .barra.menu-abierto .barra-menu {
    display: flex; flex-direction: column; align-items: stretch; gap: 0.2rem;
    position: absolute; top: calc(100% + 0.25rem); left: 1rem; right: 1rem;
    border-radius: var(--radio); padding: 0.6rem;
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.45);
  }
  .barra.menu-abierto .barra-menu a { text-align: center; padding-block: 0.75rem; border-radius: 12px; }
}

/* ── El héroe pegajoso: verde drench; lo que sigue se le monta encima ── */
.heroe {
  position: sticky; top: 0; z-index: 0;
  min-height: 100vh; min-height: 100svh;
  display: grid; align-content: center; justify-items: center;
  text-align: center; overflow: clip;
  background:
    radial-gradient(90rem 60rem at 50% -20%, #2e7258 0%, var(--verde) 45%, var(--verde-hondo) 100%);
  color: #fff; padding: 7.5rem 1.5rem 9rem;
}
.heroe-kicker { display: inline-flex; align-items: center; gap: 0.55rem; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; color: var(--sobre-verde); }
.heroe-kicker .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--verde-claro); animation: late 2.6s ease-in-out infinite; }
.heroe h1 { max-width: 17ch; margin-top: 1.2rem; }
.heroe-baja { max-width: 46ch; margin-top: 1.4rem; font-size: 1.1rem; color: rgba(255,255,255,0.82); }
.heroe-acciones { display: flex; flex-wrap: wrap; gap: 0.9rem; justify-content: center; margin-top: 2.2rem; }
.heroe-dato { margin-top: 1.6rem; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; color: var(--sobre-verde); }

@keyframes late { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: 0.65; } }

/* las tarjetas flotantes del héroe: producto real, no adorno */
.flotante {
  position: absolute; text-align: left;
  background: var(--papel-alto); color: var(--tinta);
  border-radius: var(--radio); padding: 1.1rem 1.25rem;
  box-shadow: 0 30px 60px -24px rgba(9, 26, 20, 0.5);
  width: min(20rem, 42vw);
  will-change: transform;
}
.flotante h3 { font-size: 0.95rem; }
.flotante-a { left: clamp(1rem, 6vw, 6rem); bottom: 9rem; }
.flotante-b { right: clamp(1rem, 6vw, 6rem); bottom: 13rem; }
@media (max-width: 1050px) { .flotante { display: none; } }
.flotante .fila { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.65rem 0.8rem; border-radius: 12px; background: var(--papel); margin-top: 0.6rem; font-size: 0.85rem; }
.flotante .fila strong { font-family: 'IBM Plex Mono', monospace; font-weight: 500; }
.chip { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font-family: 'IBM Plex Mono', monospace; font-size: 0.7rem; }
.chip-atencion { background: #f6ead3; color: #8a5c10; }
.chip-verde { background: var(--sobre-verde); color: var(--verde-hondo); }

/* las gráficas de las tarjetas: la barra se llena hasta --hasta y vuelve a empezar,
   como las de ahorro de la referencia; el asunto de la derecha se teclea (guion.js) */
.flotante .fila { flex-wrap: wrap; }
.flotante .carga { width: 100%; height: 6px; border-radius: 999px; background: var(--linea); overflow: hidden; margin-top: 0.55rem; }
.flotante .carga-lleno { display: block; height: 100%; border-radius: inherit; background: var(--verde); transform-origin: left; transform: scaleX(var(--hasta, 1)); }
.carga-lleno.atencion { background: var(--atencion); }
html.anim .carga-lleno { animation: llena 5.6s var(--salida) infinite; }
html.anim .carga-lleno.atencion { animation-delay: 0.7s; }
@keyframes llena { 0% { transform: scaleX(0); } 42%, 86% { transform: scaleX(var(--hasta, 1)); } 96%, 100% { transform: scaleX(0); } }
html.anim .tipeo::after { content: ''; display: inline-block; width: 1.5px; height: 1em; background: var(--tinta); margin-left: 2px; vertical-align: -0.15em; animation: parpadea 1.1s steps(1) infinite; }
@keyframes parpadea { 50% { opacity: 0; } }

/* el paisaje: San Salvador con sus volcanes, de arriba a abajo. Foto de
   stock teñida por el modo de fusión — la foto pone la luz, el degradado
   verde de atrás pone el color. El texto pinta por encima. */
.paisaje {
  position: absolute; inset: 0; pointer-events: none;
  background: url('/paisaje-capital.jpg') center / cover no-repeat;
  mix-blend-mode: luminosity; opacity: 0.5;
}
.heroe > .rev-uno, .heroe-acciones, .cierre > .rev { position: relative; }

/* el rumbo: los puntos flotan y, de la nada, uno recorre una W hacia
   arriba con la línea de la casa detrás — caer, levantarse, caer,
   levantarse más alto. Siempre vamos adelante. */
.rumbo { position: absolute; left: 50%; transform: translateX(-50%); bottom: 7vh; width: min(46vw, 620px); height: auto; pointer-events: none; }
.cierre .rumbo { bottom: 4vh; width: min(38vw, 480px); }
.rumbo path { stroke-dasharray: 1; stroke-dashoffset: 1; }
@media (max-width: 900px) { .rumbo { display: none; } }
/* los destellos: puntos de marvin regados por el cielo, flotando */
.destello { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--verde-claro); opacity: 0.7; animation: flota 5.5s ease-in-out infinite; }
@keyframes flota {
  0%, 100% { transform: translateY(0) scale(1); opacity: 0.7; }
  50% { transform: translateY(-12px) scale(1.3); opacity: 0.5; }
}

/* ── El lienzo que se monta sobre el héroe ── */
.lienzo { position: relative; z-index: 1; background: var(--papel); border-radius: var(--radio-tarjeta) var(--radio-tarjeta) 0 0; box-shadow: 0 -30px 60px -30px rgba(9,26,20,0.35); }

/* ── Revelados: solo cuando hay JS (html.anim), visibles siempre sin él ── */
html.anim .rev > * { opacity: 0; transform: translateY(26px); }
html.anim .rev.visto > * { opacity: 1; transform: none; transition: opacity 700ms var(--salida), transform 700ms var(--salida); }
html.anim .rev.visto > *:nth-child(2) { transition-delay: 90ms; }
html.anim .rev.visto > *:nth-child(3) { transition-delay: 180ms; }
html.anim .rev.visto > *:nth-child(4) { transition-delay: 270ms; }
html.anim .rev.visto > *:nth-child(5) { transition-delay: 360ms; }
html.anim .rev.visto > *:nth-child(6) { transition-delay: 450ms; }

@media (prefers-reduced-motion: reduce) {
  html.anim .rev > * { opacity: 1; transform: none; transition: none; }
  .heroe-kicker .punto, .destello, .carga-lleno { animation: none; }
  .destello { transform: none; }
  .rumbo { display: none; }
  html.anim .tipeo::after { display: none; }
  html { scroll-behavior: auto; }
  .pildora, .pildora .flecha { transition: none; }
}

/* entrada del héroe al cargar: elemento por elemento, escalonado por el guion */
html.anim .rev-uno { opacity: 0; transform: translateY(24px); }
html.anim .rev-uno.visto { opacity: 1; transform: none; transition: opacity 800ms var(--salida), transform 800ms var(--salida); }
@media (prefers-reduced-motion: reduce) { html.anim .rev-uno { opacity: 1; transform: none; transition: none; } }
