/* VillApps · sistema visual v2 «acero claro» — compartido por todas las páginas
   de villapps.com (portada, secundarias y legales vía legal.css).
   Tokens light/dark, reset, tipografía, header/footer, botones, tarjetas,
   chips, segmented, revelado, keyframes y responsive base.
   Cada página conserva su CSS específico inline. Guía: scratchpad/guia_v2_landing.md */

/* ---------- Tokens ---------- */
:root {
  --bg: #f5f7fb; --surface: #ffffff; --elev: #eef2f8; --line: #dfe5ee;
  --ink: #0b1626; --ink2: #4a586c; --ink3: #7b8797;
  --steel: #1e3a5f; --accent: #1b64f2; --accent2: #22c1ff;
  --tint: rgba(27,100,242,.08);
  --navy: #0b1626; --navy2: #111f33; --navyline: #213353;
  --ok: #22c55e; --warn: #f59e0b; --bad: #e5484d;
  --glass: rgba(245,247,251,.78);
  --sombra-tarjeta: 0 24px 44px -28px rgba(11,22,38,.4);
  --sombra-tarjeta-grande: 0 30px 50px -30px rgba(11,22,38,.45);
  --sombra-boton: 0 14px 30px -14px rgba(27,100,242,.7);
  --sombra-boton-hover: 0 20px 36px -14px rgba(27,100,242,.8);
  --sans: 'Manrope', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --acero: linear-gradient(135deg, #1e3a5f, #0b1626);
  --degradado: linear-gradient(90deg, var(--accent), var(--accent2));
  color-scheme: light;
}
/* Preferencia del sistema cuando no hay tema guardado (el snippet del head
   siempre fija data-theme, así que esto solo actúa sin JS). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #070b12; --surface: #0d1420; --elev: #121b2a; --line: #1c2738;
    --ink: #e9eef6; --ink2: #a2aec0; --ink3: #6f7c8f;
    --steel: #8db3e6; --accent: #4d8dff; --accent2: #39d0ff;
    --tint: rgba(77,141,255,.14);
    --navy: #0d1420; --navy2: #121b2a; --navyline: #223049;
    --glass: rgba(7,11,18,.72);
    --sombra-tarjeta: 0 24px 44px -28px rgba(0,0,0,.7);
    --sombra-tarjeta-grande: 0 30px 50px -30px rgba(0,0,0,.75);
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --bg: #070b12; --surface: #0d1420; --elev: #121b2a; --line: #1c2738;
  --ink: #e9eef6; --ink2: #a2aec0; --ink3: #6f7c8f;
  --steel: #8db3e6; --accent: #4d8dff; --accent2: #39d0ff;
  --tint: rgba(77,141,255,.14);
  --navy: #0d1420; --navy2: #121b2a; --navyline: #223049;
  --glass: rgba(7,11,18,.72);
  --sombra-tarjeta: 0 24px 44px -28px rgba(0,0,0,.7);
  --sombra-tarjeta-grande: 0 30px 50px -30px rgba(0,0,0,.75);
  color-scheme: dark;
}

/* ---------- Reset y base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.6;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  transition: background .35s, color .35s;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--steel); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
p { margin: 0; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink3); }
strong { font-weight: 700; }
section[id] { scroll-margin-top: 80px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--tint); }

/* ---------- Tipografía ---------- */
.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 500; }
.h1 { font-size: 64px; line-height: 1.02; letter-spacing: -.04em; font-weight: 800; text-wrap: pretty; }
.h2 { font-size: 42px; line-height: 1.08; letter-spacing: -.035em; font-weight: 700; text-wrap: pretty; }
.lead { font-size: 19px; line-height: 1.55; color: var(--ink2); text-wrap: pretty; }
.cabecera { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.etiqueta { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink3); }
.etiqueta.accent { color: var(--accent); }
.degradado-texto { background: var(--degradado); -webkit-background-clip: text; background-clip: text; color: transparent; }
.acero { background: var(--acero); color: #e9eef6; }
.acero .eyebrow, .acero .etiqueta.accent { color: #39d0ff; }
.acero p, .acero .lead { color: #b7c4d6; }

/* ---------- Layout ---------- */
.contenedor { max-width: 1200px; margin: 0 auto; padding: 0 32px; width: 100%; }
.seccion { padding: 100px 0; }

/* ---------- Botones ---------- */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; padding: 15px 26px; border-radius: 13px;
  font-size: 16px; font-weight: 700; line-height: 1.2; text-decoration: none; border: 0; cursor: pointer;
  box-shadow: var(--sombra-boton); white-space: nowrap;
  transition: transform .2s, box-shadow .2s, border-color .2s, background .2s, color .2s;
}
.boton:hover { transform: translateY(-2px); box-shadow: var(--sombra-boton-hover); color: #fff; }
.boton.secundario {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  padding: 15px 22px; font-size: 15px; font-weight: 600; box-shadow: none;
}
.boton.secundario:hover { border-color: var(--accent); color: var(--ink); box-shadow: none; }
.boton.nav, .boton.nav-cta {
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 11px;
  font-size: 14px; font-weight: 600; box-shadow: none;
}
.boton.nav:hover, .boton.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(11,22,38,.6); color: var(--bg); }
.boton.blanco { background: #fff; color: #0b1626; border-radius: 12px; box-shadow: none; }
.boton.blanco:hover { color: #0b1626; box-shadow: 0 14px 30px -14px rgba(0,0,0,.5); }
.liga { font-size: 15px; font-weight: 600; }

/* ---------- Tarjetas, chips, pills, segmented ---------- */
.tarjeta {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .25s, box-shadow .25s, border-color .25s, background .35s;
}
.tarjeta:hover { transform: translateY(-4px); box-shadow: var(--sombra-tarjeta); border-color: var(--accent); }
.tarjeta h3 { font-size: 21px; letter-spacing: -.02em; }
.tarjeta p { font-size: 14.5px; line-height: 1.55; color: var(--ink2); }
.tarjeta-grande {
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .25s, box-shadow .25s, border-color .25s, background .35s;
}
.tarjeta-grande:hover { transform: translateY(-4px); box-shadow: var(--sombra-tarjeta-grande); border-color: var(--accent); }
.tarjeta-grande h3 { font-size: 24px; letter-spacing: -.02em; }
.tarjeta-grande p { font-size: 14.5px; line-height: 1.55; color: var(--ink2); }
.tarjeta.vidrio { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.05); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.tarjeta.vidrio:hover { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.2); box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .chips span {
  display: inline-block; font-size: 12.5px; padding: 5px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--elev); color: var(--ink2); line-height: 1.4;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em; color: var(--ink2);
}
.pill .punto { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulseDot 2.2s ease-out infinite; flex-shrink: 0; }
.numero-paso { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.circulo-paso {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface);
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--accent);
}

.segmento { display: inline-flex; gap: 4px; background: var(--elev); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.segmento button {
  border: 0; cursor: pointer; padding: 9px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  background: transparent; color: var(--ink2); white-space: nowrap; transition: background .3s, color .3s;
}
.segmento button:hover { color: var(--ink); }
.segmento button.activo { background: var(--accent); color: #fff; }
.segmento.oscuro { background: var(--navy2); border-color: var(--navyline); }
.segmento.oscuro button { color: #9aa8bb; }
.segmento.oscuro button.activo { background: #fff; color: #0b1626; }

.punto-estado { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink3); flex-shrink: 0; }
.punto-estado.ok { background: var(--ok); } .punto-estado.warn { background: var(--warn); }
.punto-estado.bad { background: var(--bad); } .punto-estado.accent { background: var(--accent); }

/* ---------- Header ---------- */
.glass { background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
header.nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); transition: background .35s;
}
.nav-fila { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.logo:hover { color: var(--ink); }
.logo-v {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; line-height: 1;
  box-shadow: 0 6px 16px -6px rgba(27,100,242,.6);
}
.logo-nombre { font-weight: 800; font-size: 17px; letter-spacing: -.02em; }
.nav-links { display: flex; gap: clamp(10px, 2vw, 26px); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.nav-links a { color: var(--ink2); transition: color .2s; }
.nav-links a:hover, .nav-links a.activo { color: var(--ink); }
.nav-derecha { display: flex; align-items: center; gap: 14px; }
.idiomas { font-family: var(--mono); font-size: 12px; color: var(--ink3); display: flex; gap: 6px; align-items: center; }
.idiomas button { background: none; border: 0; cursor: pointer; color: var(--ink3); font: inherit; padding: 2px; transition: color .2s; }
.idiomas button:hover { color: var(--ink); }
.idiomas button.activo { color: var(--ink); font-weight: 500; }
#btn-tema {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s, border-color .2s, background .35s;
}
#btn-tema:hover { transform: rotate(20deg); border-color: var(--accent); }
#menu, .menu {
  display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  width: 38px; height: 36px; cursor: pointer; padding: 0; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  transition: border-color .2s;
}
#menu:hover, .menu:hover { border-color: var(--accent); }
#menu span, .menu span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .25s; }
header.nav.abierto #menu span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
header.nav.abierto #menu span:nth-child(2) { opacity: 0; }
header.nav.abierto #menu span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

#barra-progreso {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%; z-index: 50; pointer-events: none;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .1s linear;
}

/* ---------- Footer ---------- */
footer { border-top: 1px solid var(--line); }
footer .contenedor {
  padding-top: 28px; padding-bottom: 28px; display: flex; justify-content: space-between; align-items: center;
  gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--ink3);
}
footer nav { display: flex; gap: 18px; flex-wrap: wrap; }
footer a { color: var(--ink3); transition: color .2s; }
footer a:hover { color: var(--ink); }

/* ---------- Revelado al scroll ---------- */
/* Solo se oculta cuando el snippet del head marcó html.js: sin JS todo se ve. */
html.js [data-reveal] {
  opacity: 0; transform: translateY(24px);
  transition: opacity .8s cubic-bezier(.2,.7,.2,1) var(--d, 0ms), transform .8s cubic-bezier(.2,.7,.2,1) var(--d, 0ms);
}
html.js [data-reveal].visible { opacity: 1; transform: none; }

/* ---------- Decorativos ---------- */
.fondo-cuadricula {
  position: absolute; inset: 0; pointer-events: none; opacity: .8;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px; animation: gridDrift 7s linear infinite;
  -webkit-mask-image: radial-gradient(ellipse at 65% 35%, #000 20%, transparent 72%);
  mask-image: radial-gradient(ellipse at 65% 35%, #000 20%, transparent 72%);
}
.fondo-cuadricula.estatica { animation: none; }
.acero .fondo-cuadricula, .fondo-cuadricula.clara {
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  -webkit-mask-image: radial-gradient(ellipse at 20% 50%, #000 20%, transparent 72%);
  mask-image: radial-gradient(ellipse at 20% 50%, #000 20%, transparent 72%);
}
.brillo {
  position: absolute; pointer-events: none; border-radius: 50%; width: 620px; height: 620px; top: -180px; right: -120px;
  background: radial-gradient(circle, rgba(34,193,255,.28), rgba(27,100,242,.12) 40%, transparent 70%);
  filter: blur(30px); animation: glowPulse 7s ease-in-out infinite;
}
.brillo.azul { background: radial-gradient(circle, rgba(27,100,242,.35), transparent 65%); filter: blur(40px); width: 600px; height: 600px; }
.flota { animation: floaty 9s ease-in-out infinite; }
.marquee-pista { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee-mascara { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent); }

/* ---------- Keyframes ---------- */
@keyframes gridDrift { from { background-position: 0 0, 0 0; } to { background-position: 0 56px, 56px 0; } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes glowPulse { 0%, 100% { opacity: .5; transform: scale(1); } 50% { opacity: .9; transform: scale(1.06); } }
@keyframes pulseDot { 0%, 100% { box-shadow: 0 0 0 0 rgba(27,100,242,.45); } 70% { box-shadow: 0 0 0 8px rgba(27,100,242,0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; }
  html.js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .tarjeta, .tarjeta-grande, .boton, #btn-tema { transition: none; }
  .tarjeta:hover, .tarjeta-grande:hover, .boton:hover, #btn-tema:hover { transform: none; }
  #barra-progreso { transition: none; }
}

/* ---------- Responsive base ---------- */
@media (max-width: 1024px) {
  .contenedor { padding: 0 20px; }
  .seccion { padding: 56px 0; }
  .h1 { font-size: 40px; }
  .h2 { font-size: 30px; }
  .lead { font-size: 17px; }
  #menu, .menu { display: inline-flex; }
  .nav-cta, .boton.nav { display: none; }
  .nav-links {
    display: none; position: absolute; top: 66px; left: 0; right: 0; flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 20px 12px; white-space: normal;
    box-shadow: 0 24px 40px -30px rgba(11,22,38,.4);
  }
  .nav-links a { padding: 10px 0; font-size: 15px; }
  header.nav.abierto .nav-links { display: flex; }
  .tarjeta, .tarjeta-grande .cuerpo { padding: 22px; }
  footer .contenedor { flex-direction: column; align-items: flex-start; gap: 14px; }
}
@media (max-width: 640px) {
  .h1 { font-size: 36px; }
  .h2 { font-size: 28px; }
  .boton { padding: 13px 20px; font-size: 15px; }
  .segmento { display: flex; flex-wrap: wrap; }
  .segmento button { flex: 1 1 auto; padding: 8px 12px; font-size: 13px; }
  .nav-derecha { gap: 10px; }
  .brillo { width: 380px; height: 380px; }
}
