/* =====================================================
   MAIN.CSS — se carga en TODAS las páginas
   Contiene: variables, reset, utilidades, botones,
   encabezados de sección, NAV, menú móvil, FOOTER,
   theme toggle + modo invertido, command palette,
   toast y reveal.
   ⚠️ Cargar ANTES del CSS propio de cada página.
   ===================================================== */

/* ================= BASE ================= */
:root {
  --bg: #0E0C1C;
  --bg2: #131024;
  --panel: #181430;
  --panel2: #1E1940;
  --panel3: #241E4A;
  --line: #282250;
  --line2: #342C66;
  --ink: #F1EFFC;
  --sub: #A6A1C9;
  --mut: #6F6A96;
  --acc: #8B7CF7;
  --acc2: #6C5CE7;
  --deep: #5646C8;
  --lav: #E9E6FC;
  --ok: #3ECF8E;
  --grad: linear-gradient(135deg, #8B7CF7 0%, #6C5CE7 55%, #5646C8 100%);
  --f-head: 'Space Grotesk', sans-serif;
  --f-body: 'Inter', sans-serif;
  --f-mono: 'JetBrains Mono', monospace;
  --shadow: 0 30px 70px -30px rgba(0, 0, 0, .7);
}

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

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

body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased
}

::selection {
  background: var(--acc2);
  color: #fff
}

::-webkit-scrollbar {
  width: 10px
}

::-webkit-scrollbar-track {
  background: var(--bg2)
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(#8B7CF7, #5646C8);
  border-radius: 8px;
  border: 2px solid var(--bg2)
}

a {
  text-decoration: none;
  color: inherit
}

img,
svg {
  display: block
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px
}

.icon {
  width: 1.2em;
  height: 1.2em;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none
}

kbd {
  font-family: var(--f-mono);
  font-size: 11px;
  background: var(--panel3);
  border: 1px solid var(--line2);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 7px;
  color: var(--sub)
}

[id] {
  scroll-margin-top: 96px
}

/* grano sutil sobre todo el sitio */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3000;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E")
}

.skip {
  position: fixed;
  top: -60px;
  left: 20px;
  z-index: 4000;
  background: var(--acc2);
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  transition: .3s
}

.skip:focus {
  top: 14px
}

/* ================= UTILIDADES COMPARTIDAS ================= */
.grad-txt {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent
}

.wdot {
  width: 11px;
  height: 11px;
  border-radius: 50%
}

.wdot.r {
  background: #FF5F57
}

.wdot.y {
  background: #FEBC2E
}

.wdot.g {
  background: #28C840
}

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--f-head);
  font-weight: 600;
  font-size: 15px;
  padding: 14px 28px;
  border-radius: 999px;
  cursor: pointer;
  border: 0;
  transition: .3s
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(108, 92, 231, .7)
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 42px -12px rgba(108, 92, 231, .8)
}

.btn-ghost {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line2)
}

.btn-ghost:hover {
  border-color: var(--acc);
  transform: translateY(-3px)
}

/* ---- Secciones y encabezados ---- */
section {
  padding: 110px 0;
  position: relative
}

.sec-head {
  max-width: 640px;
  margin-bottom: 56px
}

.sec-head.center {
  margin-inline: auto;
  text-align: center
}

.sec-tag {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--acc);
  margin-bottom: 16px
}

.sec-tag::before {
  content: '';
  width: 24px;
  height: 1.5px;
  background: var(--acc)
}

.sec-head.center .sec-tag::after {
  content: '';
  width: 24px;
  height: 1.5px;
  background: var(--acc)
}

h2 {
  font-family: var(--f-head);
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.12
}

.sec-sub {
  font-size: 16.5px;
  line-height: 1.75;
  color: var(--sub);
  margin-top: 16px
}

/* ---- Keyframes compartidos ---- */
@keyframes ping {
  70% {
    box-shadow: 0 0 0 9px rgba(139, 124, 247, 0)
  }

  100% {
    box-shadow: 0 0 0 0 rgba(139, 124, 247, 0)
  }
}

@keyframes floaty {
  50% {
    transform: translateY(-10px)
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* ================= NAV ================= */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: .35s;
  border-bottom: 1px solid transparent
}

nav.scrolled {
  background: rgba(14, 12, 28, .8);
  backdrop-filter: blur(16px);
  border-bottom-color: var(--line)
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  height: 72px;
  display: flex;
  align-items: center;
  gap: 30px
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--f-head);
  font-weight: 700;
  font-size: 23px;
  letter-spacing: -.02em;
  color: var(--ink)
}

.brand svg {
  width: 33px;
  height: 33px
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto
}

.nav-links a {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--sub);
  transition: .25s
}

.nav-links a:hover {
  color: #fff
}

.nav-links .btn-lib {
  background: var(--grad);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 24px -10px rgba(108, 92, 231, .7)
}

.nav-links .btn-lib:hover {
  transform: translateY(-2px)
}

.cmdk-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--mut);
  border-radius: 11px;
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
  transition: .25s
}

.cmdk-btn:hover {
  border-color: var(--acc);
  color: var(--sub)
}

.cmdk-btn kbd {
  margin-left: 4px
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
  margin-left: auto
}

.burger span {
  width: 24px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--ink);
  transition: .3s
}

.mobile-menu {
  display: none
}

/* ================= FOOTER ================= */
footer {
  border-top: 1px solid var(--line);
  background: var(--bg2);
  padding: 70px 0 0
}

/* ── Variante clara (main.js agrega .ftr-light en páginas
   con fondo claro nativo, para que el footer coincida) ── */
footer.ftr-light {
  --bg2: #F6F6FE;
  --panel: #FFFFFF;
  --line: #E6E4F5;
  --line2: #DAD7F8;
  --ink: #16143A;
  --mut: #726F94;
  --acc: #6C5CE7;
  --acc2: #6C5CE7;
}

.foot-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 56px
}

.foot-brand p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--mut);
  max-width: 300px;
  margin-top: 18px
}

.socials {
  display: flex;
  gap: 11px;
  margin-top: 22px
}

.socials a {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line2);
  display: grid;
  place-items: center;
  color: var(--mut);
  transition: .3s
}

.socials a:hover {
  background: var(--acc2);
  border-color: var(--acc2);
  color: #fff;
  transform: translateY(-4px)
}

.socials svg {
  width: 17px;
  height: 17px;
  fill: currentColor
}

.nl {
  display: flex;
  gap: 8px;
  margin-top: 22px;
  max-width: 320px
}

.nl input {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 11px;
  padding: 11px 14px;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 13.5px;
  outline: none;
  transition: .25s;
  min-width: 0
}

.nl input:focus {
  border-color: var(--acc)
}

.nl input::placeholder {
  color: var(--mut)
}

.nl button {
  border: 0;
  cursor: pointer;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 0 18px;
  border-radius: 11px;
  transition: .25s
}

.nl button:hover {
  filter: brightness(1.1)
}

.foot-col h4 {
  font-family: var(--f-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 20px
}

.foot-col a {
  display: block;
  font-size: 14px;
  color: var(--mut);
  padding: 5.5px 0;
  transition: .25s
}

.foot-col a:hover {
  color: var(--acc);
  transform: translateX(4px)
}

.foot-bottom {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--mut)
}

.foot-bottom .mono {
  font-family: var(--f-mono);
  font-size: 12px
}

.foot-bottom .mono b {
  color: var(--acc)
}

/* ---- Botón invertir paleta ---- */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid var(--line2);
  background: var(--panel);
  color: var(--mut);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: .3s
}

.theme-toggle:hover {
  color: #fff;
  border-color: var(--acc);
  background: var(--acc2);
  transform: translateY(-2px)
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round
}

.theme-toggle .ico-moon {
  display: none
}

.theme-toggle[aria-pressed="true"] .ico-sun {
  display: none
}

.theme-toggle[aria-pressed="true"] .ico-moon {
  display: block
}

/* ================= MODO INVERTIDO (tema claro) =================
   main.js agrega la clase .inverted al <html>: el filtro voltea
   claro↔oscuro toda la página conservando los matices. */
html.inverted {
  filter: invert(1) hue-rotate(180deg)
}

/* Los medios vuelven a sus colores naturales (logos, capturas
   y los iframes del Visor muestran el sitio real) */
html.inverted img,
html.inverted video,
html.inverted iframe,
html.inverted object,
html.inverted embed {
  filter: invert(1) hue-rotate(180deg)
}

/* Transición suave del volteo */
html {
  transition: filter .35s ease
}

/* ================= COMMAND PALETTE ================= */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(8, 6, 18, .7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 14vh 20px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s
}

.cmdk.open {
  opacity: 1;
  pointer-events: auto
}

.cmdk-box {
  width: 100%;
  max-width: 580px;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: 20px;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .8), 0 0 80px -30px rgba(108, 92, 231, .5);
  overflow: hidden;
  transform: scale(.96) translateY(-8px);
  transition: transform .25s cubic-bezier(.2, 1, .3, 1)
}

.cmdk.open .cmdk-box {
  transform: none
}

.cmdk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line)
}

.cmdk-head svg {
  width: 18px;
  height: 18px;
  color: var(--mut)
}

.cmdk-head input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15.5px
}

.cmdk-head input::placeholder {
  color: var(--mut)
}

.cmdk-list {
  max-height: 320px;
  overflow-y: auto;
  padding: 8px
}

.cmdk-group {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--mut);
  padding: 12px 12px 6px
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  cursor: pointer;
  color: var(--sub);
  font-size: 14px;
  font-weight: 500
}

.cmdk-item .ci {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--panel3);
  display: grid;
  place-items: center;
  color: var(--mut);
  flex: none
}

.cmdk-item .ci svg {
  width: 15px;
  height: 15px
}

.cmdk-item.sel {
  background: rgba(139, 124, 247, .12);
  color: #fff
}

.cmdk-item.sel .ci {
  background: var(--grad);
  color: #fff
}

.cmdk-item .enter {
  margin-left: auto;
  opacity: 0;
  font-size: 11px;
  color: var(--acc)
}

.cmdk-item.sel .enter {
  opacity: 1
}

.cmdk-empty {
  padding: 36px;
  text-align: center;
  color: var(--mut);
  font-size: 14px
}

.cmdk-foot {
  display: flex;
  gap: 18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--mut)
}

.cmdk-foot span {
  display: flex;
  align-items: center;
  gap: 6px
}

/* ================= TOAST / REVEAL ================= */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 90px);
  background: var(--panel2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  padding: 14px 24px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .7);
  border: 1px solid var(--line2);
  transition: .45s cubic-bezier(.2, 1.2, .4, 1);
  z-index: 2600
}

#toast.show {
  transform: translate(-50%, 0)
}

#toast.err {
  border-color: rgba(255, 95, 87, .5)
}

#toast svg {
  width: 18px;
  height: 18px;
  stroke: var(--ok);
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  flex: none
}

#toast.err svg {
  stroke: #FF5F57
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .3, 1)
}

.reveal.visible {
  opacity: 1;
  transform: none
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px) {
  .foot-grid {
    grid-template-columns: 1fr 1fr
  }
}

@media (max-width: 860px) {
  .nav-links {
    display: none
  }

  .burger {
    display: flex
  }

  .mobile-menu {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 86px 28px 26px;
    background: var(--bg2);
    border-bottom: 1px solid var(--line);
    transform: translateY(-105%);
    transition: .4s;
    z-index: 990
  }

  .mobile-menu.open {
    transform: none
  }

  .mobile-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 4px;
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    color: var(--sub)
  }

  .mobile-menu .btn-lib {
    margin-top: 18px;
    justify-content: center;
    width: 100%;
    background: var(--grad);
    color: #fff;
    border-bottom: 0;
    border-radius: 999px;
    padding: 14px 22px;
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase
  }

  section {
    padding: 80px 0
  }

  .cmdk {
    padding-top: 10vh
  }

  /* ---- Footer móvil ---- */
  footer {
    padding-top: 56px
  }

  .foot-grid {
    grid-template-columns: 1fr 1fr;
    /* las 3 columnas de links en 2 col */
    gap: 36px 24px;
  }

  .foot-brand {
    grid-column: 1 / -1
  }

  /* la marca ocupa todo el ancho */
  .nl {
    max-width: 100%
  }

  .foot-bottom {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 12px
  }
}

@media (max-width: 520px) {
  .foot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 30px 18px
  }
  .foot-brand{
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
  }
  .foot-brand a{
    width: 100%;
    text-align: center;
  }
  .foot-brand p{
    width: 100%;
    max-width: 100%;
    display: flex;
    text-align: center;
  }
  .brand{
    justify-content: center;
  }
  .foot-col{
    width: 100%;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
  }
  .foot-col h4{
    width: 100%;
    text-align: center;
  }
  .foot-col a {
    width: auto;
    text-align: center;
    padding: 5px 0;
  }

  .socials {
    gap: 9px;
    width: 100%;
  }
  #nlForm{
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important
  }

  html {
    scroll-behavior: auto;
    transition: none
  }
}

/* ================= ELEMENTOS CON TEXTO BLANCO FIJO =================
   Fondos de marca + texto blanco: contra-filtro para que se vean
   IDÉNTICOS en ambos temas (el filtro global los cancela). */
html.inverted .btn-primary,
html.inverted .nav-links .btn-lib,
html.inverted .mobile-menu .btn-lib,
html.inverted .nl button {
  filter: invert(1) hue-rotate(180deg);
}