/* ════════════════════════════════════════════════════════
   COMPONENTS — Elementos reutilizables
   Navegación, botones, temas de sección, formulario,
   WhatsApp flotante, hamburguesa, accesibilidad
════════════════════════════════════════════════════════ */

/* ── SKIP LINK (accesibilidad) ──────────────────────── */

.skip-link {
  position: fixed; top: -100%; left: 50%; transform: translateX(-50%);
  background: var(--blue-600); color: #fff;
  padding: .6rem 1.4rem; border-radius: var(--radius-xs);
  font-family: var(--font-h); font-weight: 700; font-size: .85rem;
  z-index: 9999; transition: top .2s;
}
.skip-link:focus { top: .5rem; }

/* ── SR-ONLY (oculto visual, accesible por lectores) ── */

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── FOCUS VISIBLE (global) ─────────────────────────── */

:focus-visible {
  outline: 2px solid var(--blue-400);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* ── ICON INLINE ────────────────────────────────────── */

.icon-inline {
  display: inline-block; vertical-align: middle;
  width: auto; height: 1em; margin-right: .25em;
}

/* ── NAVEGACIÓN ─────────────────────────────────────── */

nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 5vw;
  background: rgba(5,8,16,.93);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--dark-border);
  transition: border-color .3s;
}

.nav-brand {
  display: flex; align-items: center; gap: .75rem;
  cursor: pointer; text-decoration: none; color: inherit;
  transition: opacity .2s;
}
.nav-brand:hover { opacity: .85; }

.nav-logo {
  width: 44px; height: 44px;
  filter: drop-shadow(0 0 12px rgba(30,136,229,.7));
}

.nav-name {
  font-family: var(--font-h); font-size: 1.1rem;
  font-weight: 800; color: var(--dark-text); letter-spacing: -.3px;
}
.nav-name em { color: var(--blue-400); font-style: normal; }

/* Brand accent color para el nombre de marca */
.brand-m { color: var(--blue-400); }
.s-light .brand-m { color: var(--blue-600); }

.nav-sub {
  font-size: .65rem; color: var(--blue-300);
  text-transform: uppercase; letter-spacing: .32em; line-height: 1;
  margin-top: 1px;
}
.nav-sub strong {
  color: var(--blue-200); font-weight: 700;
}

.nav-links {
  display: flex; gap: 2rem;
  font-size: .85rem; color: var(--dark-muted); font-weight: 500;
}
.nav-links a { transition: color .2s; position: relative; }
.nav-links a:hover { color: var(--blue-400); }
.nav-links a.active {
  color: var(--blue-400);
}
.nav-links a.active::after {
  content: ''; position: absolute; bottom: -6px; left: 0; right: 0;
  height: 2px; background: var(--blue-400); border-radius: 1px;
}

.nav-right { display: flex; gap: .75rem; align-items: center; }

.btn-ghost-nav {
  font-family: var(--font-h); font-size: .8rem; font-weight: 600;
  color: var(--dark-muted); padding: .45rem 1rem;
  border: 1px solid var(--dark-border); border-radius: var(--radius-xs);
  transition: all .2s;
}
.btn-ghost-nav:hover { color: var(--dark-text); border-color: var(--blue-500); }

.btn-cta-nav {
  display: flex; align-items: center; gap: .4rem;
  font-family: var(--font-h); font-size: .8rem; font-weight: 700;
  background: var(--blue-600); color: #fff;
  padding: .45rem 1.1rem; border-radius: var(--radius-xs);
  transition: all .2s; white-space: nowrap;
}
.btn-cta-nav:hover { background: var(--blue-700); transform: translateY(-1px); }

/* ── HAMBURGER BUTTON ───────────────────────────────── */

.hamburger {
  display: none; /* shown via responsive.css */
  flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer;
  padding: 6px; z-index: 310;
}
.hb-line {
  display: block; width: 22px; height: 2px;
  background: var(--dark-text); border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.hamburger.open .hb-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open .hb-line:nth-child(2) { opacity: 0; }
.hamburger.open .hb-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── MOBILE MENU ────────────────────────────────────── */

.mobile-overlay {
  position: fixed; inset: 0; z-index: 350;
  background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.mobile-overlay.active { opacity: 1; visibility: visible; }

.mobile-menu {
  position: fixed; top: 0; right: 0; z-index: 400;
  width: 320px; max-width: 85vw; height: 100vh;
  background: var(--dark-900); border-left: 1px solid var(--dark-border);
  transform: translateX(100%); transition: transform .3s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
.mobile-menu.active { transform: translateX(0); }

.mm-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--dark-border2);
}
.mm-close {
  background: none; border: none; color: var(--dark-muted);
  font-size: 2rem; cursor: pointer; line-height: 1;
  transition: color .2s;
}
.mm-close:hover { color: var(--dark-text); }

.mm-links {
  display: flex; flex-direction: column;
  padding: 1.5rem; gap: .4rem;
}
.mm-links a {
  font-family: var(--font-h); font-size: 1.05rem; font-weight: 600;
  color: var(--dark-muted); padding: .7rem .8rem;
  border-radius: var(--radius-xs); transition: all .2s;
}
.mm-links a:hover,
.mm-links a.active { color: var(--blue-400); background: rgba(30,136,229,.08); }

.mm-cta {
  padding: 0 1.5rem 1.5rem;
  display: flex; flex-direction: column; gap: .75rem;
}
.mm-cta .btn-ghost-nav { text-align: center; }
.mm-wa { justify-content: center; }

.mm-contact {
  padding: 1.2rem 1.5rem; margin-top: auto;
  border-top: 1px solid var(--dark-border2);
  display: flex; flex-direction: column; gap: .4rem;
  font-size: .8rem; color: var(--dark-muted2);
}

/* ── SECCIONES — base tipográfica ───────────────────── */

section     { padding: 6rem 5vw; }
.wrap       { max-width: 1200px; margin: 0 auto; }

.section-tag {
  display: block; font-family: var(--font-h);
  font-size: .72rem; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: .6rem;
}

h2 {
  font-family: var(--font-h);
  font-size: clamp(1.9rem, 3.8vw, 3rem);
  font-weight: 800; letter-spacing: -1.2px; line-height: 1.1;
  margin-bottom: .8rem;
}

.section-sub {
  font-size: 1rem; max-width: 560px;
  margin-bottom: 3rem; line-height: 1.7;
}

/* ── TEMA OSCURO ────────────────────────────────────── */

.s-dark             { background: var(--dark-900); color: var(--dark-text); position: relative; overflow: hidden; }
.s-dark .section-tag { color: var(--blue-400); }
.s-dark h2           { color: var(--dark-text); }
.s-dark .section-sub { color: var(--dark-muted); }

/* ── TEMA CLARO ─────────────────────────────────────────── */

.s-light             { background: var(--light-bg); color: var(--light-text); position: relative; overflow: hidden; }
.s-light .section-tag { color: var(--blue-600); }
.s-light h2           { color: var(--light-text); }
.s-light .section-sub { color: var(--light-muted); }

/* ── SEPARADORES ENTRE SECCIONES ─────────────────── */

.section-divider {
  height: 1px; border: none; margin: 0;
  position: relative; z-index: 2;
}
.section-divider.dark-to-light {
  background: linear-gradient(90deg,
    transparent 5%,
    rgba(37,99,235,.25) 30%,
    rgba(37,99,235,.5) 50%,
    rgba(37,99,235,.25) 70%,
    transparent 95%
  );
}
.section-divider.light-to-dark {
  background: linear-gradient(90deg,
    transparent 5%,
    rgba(30,136,229,.2) 30%,
    rgba(0,188,212,.35) 50%,
    rgba(30,136,229,.2) 70%,
    transparent 95%
  );
}

/* ── FONDOS ANIMADOS SUTILES ─────────────────────── */

.section-bg {
  position: absolute; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.section-bg + .wrap,
.section-bg + .demo-grid,
.section-bg + .pacay-inner,
.section-bg ~ .wrap,
.section-bg ~ .demo-grid,
.section-bg ~ .pacay-inner { position: relative; z-index: 1; }

/* Fondo: gradiente flotante para secciones oscuras */
.bg-drift {
  background:
    radial-gradient(ellipse 60% 50% at 20% 50%, rgba(30,136,229,.06) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 40%, rgba(0,188,212,.04) 0%, transparent 70%);
  background-size: 200% 200%;
  animation: driftGradient 20s ease infinite;
}

/* Fondo: partículas para secciones claras */
.bg-particles::before,
.bg-particles::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.bg-particles::before {
  width: 300px; height: 300px;
  top: 10%; left: 5%;
  background: radial-gradient(circle, rgba(37,99,235,.06) 0%, transparent 70%);
  animation: floatParticle 12s ease-in-out infinite;
}
.bg-particles::after {
  width: 200px; height: 200px;
  bottom: 15%; right: 8%;
  background: radial-gradient(circle, rgba(0,188,212,.05) 0%, transparent 70%);
  animation: floatParticle 15s ease-in-out infinite reverse;
}

/* Fondo: línea de scan para secciones tech */
.bg-scanline::before {
  content: '';
  position: absolute;
  width: 100%; height: 2px;
  left: 0;
  background: linear-gradient(90deg, transparent, rgba(37,99,235,.12), transparent);
  animation: scanLine 8s linear infinite;
  z-index: 0;
}

@media (max-width: 768px) {
  .bg-drift { animation-duration: 30s; }
  .bg-particles::before,
  .bg-particles::after { display: none; }
  .bg-scanline::before { display: none; }
}

/* ── PAGE TRANSITION OVERLAY ─────────────────────── */

.page-transition {
  position: fixed; inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  background: var(--dark-950);
  transition: opacity .3s ease;
}
.page-transition.fade-out {
  opacity: 1;
  pointer-events: all;
}
.page-transition.fade-in {
  opacity: 0;
}

/* ── BOTONES GLOBALES ───────────────────────────────── */

.btn-primary {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-h); font-weight: 700; font-size: .95rem;
  background: var(--blue-600); color: #fff;
  padding: .85rem 1.9rem; border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: all .25s; white-space: nowrap;
}
.btn-primary:hover { background: transparent; border-color: var(--blue-500); color: var(--blue-400); }
.btn-primary:active, .btn-outline-dark:active, .btn-outline-light:active,
.btn-wa:active, .btn-plan:active, .btn-submit:active, .btn-cta-nav:active,
.btn-ghost-nav:active { transform: scale(.97); }

.btn-outline-dark {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-h); font-weight: 600; font-size: .95rem;
  background: transparent; color: var(--dark-text);
  padding: .85rem 1.9rem; border-radius: var(--radius-sm);
  border: 1px solid var(--dark-border);
  transition: all .25s;
}
.btn-outline-dark:hover { border-color: var(--blue-400); color: var(--blue-400); }

.btn-outline-light {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--font-h); font-weight: 600; font-size: .95rem;
  background: transparent; color: var(--light-text);
  padding: .85rem 1.9rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--light-border);
  transition: all .25s;
}
.btn-outline-light:hover { border-color: var(--blue-600); color: var(--blue-600); }

.btn-wa {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--font-h); font-weight: 700; font-size: .95rem;
  background: rgba(102,187,106,.12); color: var(--green-400);
  padding: .85rem 1.9rem; border-radius: var(--radius-sm);
  border: 1px solid rgba(102,187,106,.3);
  transition: all .25s;
}
.btn-wa:hover { background: rgba(102,187,106,.22); }
.btn-wa svg  { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }

/* ── FORMULARIO ─────────────────────────────────────── */

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.fg       { margin-bottom: .9rem; position: relative; }

label {
  display: block; font-size: .75rem; font-weight: 700;
  color: var(--light-muted2); margin-bottom: .35rem;
  text-transform: uppercase; letter-spacing: .05em;
}

input, select, textarea {
  width: 100%; background: var(--light-bg);
  border: 1.5px solid var(--light-border);
  color: var(--light-text); padding: .72rem 1rem;
  border-radius: 8px; font-family: var(--font-b);
  font-size: .9rem; outline: none; transition: border-color .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500); background: #fff;
}
input.invalid, select.invalid { border-color: #ef4444; }
select option { background: #fff; }
textarea      { resize: vertical; }

.field-error {
  display: block; font-size: .72rem; color: #ef4444;
  min-height: 0; overflow: hidden;
  transition: all .2s; margin-top: .2rem;
}
.field-error:empty { min-height: 0; margin-top: 0; }

.btn-submit {
  width: 100%; padding: .9rem;
  background: var(--blue-600); color: #fff;
  font-family: var(--font-h); font-weight: 700; font-size: .95rem;
  border: none; border-radius: 10px; cursor: pointer;
  transition: all .25s; margin-top: .4rem;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn-submit:hover { background: var(--blue-700); transform: translateY(-1px); }
.btn-submit:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-submit .spinner {
  width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── REFERENCIA DE SOLICITUD ────────────────────────── */

.solicitud-ref {
  text-align: center; padding: .6rem .8rem; margin-top: .5rem;
  font-size: .82rem; color: var(--dark-700);
  background: rgba(22, 163, 106, .08);
  border: 1px dashed rgba(22, 163, 106, .3);
  border-radius: 8px; letter-spacing: .02em;
  min-height: 0; transition: all .3s ease;
}
.solicitud-ref:empty { display: none; }
.solicitud-ref strong {
  font-family: var(--font-h); font-weight: 700;
  color: #16a34a; letter-spacing: .05em;
}

/* ── BACK TO TOP ────────────────────────────────────── */

.back-to-top {
  position: fixed; bottom: 2rem; left: 2rem; z-index: 400;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--dark-800); border: 1px solid var(--dark-border);
  color: var(--dark-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: all .3s;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }

/* ── WHATSAPP FLOTANTE ──────────────────────────────── */

.wa-float {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 500;
  width: 56px; height: 56px; background: var(--green-500);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(102,187,106,.45); cursor: pointer;
  transition: transform .25s, box-shadow .25s;
  animation: waFloat 3s ease-in-out infinite;
}
.wa-float:hover { transform: scale(1.1); box-shadow: 0 12px 40px rgba(102,187,106,.6); }
.wa-float svg   { width: 28px; height: 28px; fill: #fff; }

/* ── SCROLL HINT (comparativa mobile) ───────────────── */

.scroll-hint {
  display: none; text-align: center;
  font-size: .75rem; color: var(--dark-muted2);
  margin-bottom: .5rem; animation: fadeUp .5s ease both;
}
