/* ══════════════════════════════════════════════════════════════════════════
   Inversa — rediseño "Terminal" sobre el design system Nocturne.
   Un solo archivo: tokens (oscuro por defecto + rampa clara), reset,
   utilidades de movimiento y las clases que usa index.html.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  --color-bg: #161826;
  --color-surface: #232532;
  --color-text: #e9e9ed;
  --color-accent: #9184d9;
  --color-accent-2: #a7a1db;
  --color-divider: color-mix(in srgb, #e9e9ed 16%, transparent);

  /* Fondo de la banda de contacto — indigo profundo saturado. */
  --color-section: #262a60;
  --color-section-glow: #353b80;
  --color-section-ghost: #4c5397;

  --font-heading: "Inter", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-heading-weight: 500;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --shadow-md: 0 0 0 1px #595d6c, 0 6px 18px rgba(0, 0, 0, 0.55);

  --glow-a: rgba(145, 132, 217, 0.26);
  --glow-b: rgba(38, 42, 96, 0.55);
  --grid-line: rgba(233, 233, 237, 0.045);
  --panel: rgba(35, 37, 50, 0.66);
  --hairline: color-mix(in srgb, #e9e9ed 12%, transparent);
  --net: 145, 132, 217; /* tinte de la red de partículas del canvas */
  --sy: 0px;            /* scroll actual, lo escribe el JS para el parallax */
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

html[data-theme="light"] {
  color-scheme: light;
  --color-bg: #f3f5fe;
  --color-surface: #e9ebf7;
  --color-text: #232532;
  --color-accent: #796cbf;
  --color-accent-2: #7972a9;
  --color-divider: color-mix(in srgb, #232532 16%, transparent);
  --color-section: #262a60;
  --color-section-glow: #3f4899;
  --color-section-ghost: #6a72bd;
  --shadow-md: 0 0 0 1px #cfd3e5, 0 6px 18px rgba(38, 42, 96, 0.1);
  --glow-a: rgba(121, 108, 191, 0.2);
  --glow-b: rgba(38, 42, 96, 0.12);
  --grid-line: rgba(38, 42, 96, 0.07);
  --panel: rgba(255, 255, 255, 0.72);
  --hairline: color-mix(in srgb, #232532 12%, transparent);
  --net: 121, 108, 191;
}

/* — reset — */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  overflow-x: hidden;
  transition: background 0.5s ease, color 0.5s ease;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0;
}
h6 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
p { margin: 0; }
img { display: block; max-width: 100%; }
a { color: var(--color-accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { color: var(--color-accent-2); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* — botones — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid transparent;
  padding: 5.6px 10px; border-radius: var(--radius-md);
}
.btn-primary { color: var(--color-accent); border-color: var(--color-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--color-accent) 12%, transparent); color: var(--color-accent); }
.btn-primary:active { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
.btn-secondary { border-color: var(--color-divider); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); color: var(--color-text); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-block { width: 100%; margin-top: 5.6px; }

/* — logo: marca y letras como piezas independientes, para que el texto
     tenga peso propio en lugar de encogerse junto al ícono — */
.brand { display: flex; align-items: center; gap: 11px; flex: none; }
.brand-mark { height: 38px; width: auto; }
.brand-word { height: 24px; width: auto; }
.footer-brand .brand-mark { height: 50px; }
.footer-brand .brand-word { height: 32px; }
.logo-on-dark { display: block; }
.logo-on-light { display: none; }
html[data-theme="light"] .logo-on-dark { display: none; }
html[data-theme="light"] .logo-on-light { display: block; }

/* — navegación — */
.nav-link { color: color-mix(in srgb, var(--color-text) 68%, transparent); transition: color 0.3s ease; }
.nav-link:hover { color: var(--color-text); }
.footer-link { color: color-mix(in srgb, var(--color-text) 68%, transparent); }
.footer-link:hover { color: var(--color-accent); }

.icon-btn {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  background: transparent; color: var(--color-text); font-size: 13px;
  cursor: pointer; transition: border-color 0.3s ease, color 0.3s ease;
}
.icon-btn:hover { border-color: var(--color-accent); color: var(--color-accent); }

/* Menú móvil: el panel se despliega dentro de la misma cápsula del nav. */
.nav-toggle { display: none; }
.mobile-menu {
  display: none; width: 100%; flex-direction: column; gap: 4px;
  margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--color-divider);
}
.mobile-menu.open { display: flex; }
.mobile-menu a { padding: 9px 4px; font-size: 15px; }

/* — tarjetas de características / pasos — */
.tile { padding: 30px; background: var(--color-bg); transition: background 0.4s ease; }
.tile:hover { background: color-mix(in srgb, var(--color-accent) 8%, var(--color-bg)); }
.tile-sm { padding: 28px; }
.tile-sm:hover { background: color-mix(in srgb, var(--color-accent) 7%, var(--color-bg)); }

/* — campos del formulario de contacto — */
.field-input {
  width: 100%; padding: 14px 16px;
  border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  background: transparent; color: var(--color-text);
  font-family: var(--font-body); font-size: 14.5px;
  outline: none; transition: border-color 0.3s ease;
}
.field-input::placeholder { color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.field-input:focus { border-color: var(--color-accent); }
textarea.field-input { resize: vertical; }

/* — FAQ — */
.faq-item { border: 1px solid var(--color-divider); border-radius: var(--radius-md); transition: border-color 0.35s ease; }
.faq-item summary { list-style: none; cursor: pointer; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item:hover { border-color: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.faq-item[open] { border-color: color-mix(in srgb, var(--color-accent) 45%, transparent); }
.faq-plus { transition: transform 0.4s cubic-bezier(0.16, 0.84, 0.28, 1); }
.faq-item[open] .faq-plus { transform: rotate(135deg); }
.faq-item[open] .faq-body { animation: riseIn 0.45s cubic-bezier(0.16, 0.84, 0.28, 1) both; }

/* — simulador — */
.plazo-btn {
  padding: 14px 8px; border: 1px solid var(--color-divider); border-radius: var(--radius-md);
  background: transparent; color: color-mix(in srgb, var(--color-text) 70%, transparent);
  font-family: var(--font-heading); font-weight: 500; font-size: 14px;
  cursor: pointer; transition: border-color 0.35s ease, background 0.35s ease, color 0.35s ease;
}
.plazo-btn[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--color-accent) 55%, transparent);
  background: color-mix(in srgb, var(--color-accent) 14%, transparent);
  color: var(--color-accent);
}
.monto-input {
  flex: 1; min-width: 0; padding: 0; border: none; outline: none; background: transparent;
  color: var(--color-text); font-family: var(--font-heading); font-weight: 500;
  font-size: clamp(28px, 3vw, 40px); letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.monto-range { width: 100%; margin-top: 20px; accent-color: var(--color-accent); }

/* — pestañas del modelo de inversión — */
.tab-btn {
  position: relative; width: 128px; padding: 11px 0; border: none; background: transparent;
  color: color-mix(in srgb, var(--color-text) 70%, transparent);
  font-family: var(--font-heading); font-weight: 500; font-size: 14px;
  cursor: pointer; transition: color 0.35s ease;
}
.tab-btn[aria-selected="true"] { color: var(--color-accent); }
.tab-panel { display: none; margin-top: 30px; }
.tab-panel.active { display: block; animation: riseIn 0.5s cubic-bezier(0.16, 0.84, 0.28, 1) both; }

/* — páginas legales (términos, aviso de privacidad) — */
.legal {
  margin-top: 40px;
  font-size: 15.5px;
  line-height: 1.8;
  color: color-mix(in srgb, var(--color-text) 72%, transparent);
}
.legal > div { margin-top: 22px; }
.legal h3 {
  margin: 44px 0 14px;
  padding-top: 22px;
  border-top: 1px solid var(--color-divider);
  font-size: 21px;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
/* El primer encabezado va pegado a la introducción, sin la línea de sección. */
.legal > h3:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.legal b, .legal strong { color: var(--color-text); font-weight: 600; }
.legal a { color: var(--color-accent); }
.legal a:hover { text-decoration: underline; text-underline-offset: 3px; }
.legal .legal-accent { color: var(--color-accent); }

/* — movimiento — */
@keyframes rise { from { opacity: 0; transform: translateY(34px); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }
@keyframes assemble {
  from { opacity: 0; transform: translateY(0.42em) rotate(2deg); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes floatySlow { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-20px) rotate(1deg); } }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulseRing { 0% { opacity: 0.5; transform: scale(0.8); } 70%, 100% { opacity: 0; transform: scale(1.7); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes glowShift { 0%, 100% { opacity: 0.55; transform: translate3d(0, 0, 0) scale(1); } 50% { opacity: 0.9; transform: translate3d(3%, -5%, 0) scale(1.12); } }
@keyframes dash { to { stroke-dashoffset: 0; } }
@keyframes sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Reveal al entrar en viewport. Donde hay animation-timeline lo resuelve el
   CSS; donde no (Safari/Firefox), el JS añade .in-view. */
[data-reveal] { opacity: 0; }
[data-reveal].in-view { animation: rise 0.9s cubic-bezier(0.16, 0.84, 0.28, 1) both; }
[data-grow] { transform: scaleX(0); transform-origin: left center; }
[data-grow].in-view { animation: sweep 1s cubic-bezier(0.16, 0.84, 0.28, 1) both; }

@supports (animation-timeline: view()) {
  [data-reveal] { opacity: 1; animation: rise 0.9s cubic-bezier(0.16, 0.84, 0.28, 1) both; animation-timeline: view(); animation-range: entry 4% cover 24%; }
  [data-grow] { animation: sweep 1s cubic-bezier(0.16, 0.84, 0.28, 1) both; animation-timeline: view(); animation-range: entry 10% cover 40%; }
}

[data-parallax] { transform: translate3d(0, calc(var(--sy) * -0.06), 0); }
[data-parallax-slow] { transform: translate3d(0, calc(var(--sy) * -0.02), 0); }

/* — responsive — */
@media (max-width: 980px) {
  .hide-sm { display: none !important; }
  .nav-toggle { display: grid; }
  .hero-floater { display: none; }
}

/* En pantallas estrechas la cápsula del nav debe caber sin empujar: la marca
   cede unos píxeles y el CTA se acorta antes que romper la fila. */
@media (max-width: 620px) {
  .brand { gap: 8px; }
  .brand-mark { height: 30px; }
  .brand-word { height: 19px; }
  .footer-brand .brand-mark { height: 42px; }
  .footer-brand .brand-word { height: 27px; }
  header > nav { gap: 12px; padding-left: 14px; }
  header .btn-primary { padding: 6px 10px; font-size: 13px; }
  .icon-btn { width: 32px; height: 32px; }
}

/* Muy angosto: el CTA se va al menú desplegable antes que encoger la marca. */
@media (max-width: 430px) {
  header .btn-primary { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  html { scroll-behavior: auto; }
  [data-reveal], [data-grow] { opacity: 1; transform: none; }
}
