/* ─────────────────────────────────────────────────────────────────────────────
   TUBIS DEV — styles.css
   Paleta: fondo #0f0f1a | primary #6c63ff | secondary #00d4ff
   Mobile-first. Breakpoints: sm 640px | md 768px | lg 1024px
───────────────────────────────────────────────────────────────────────────── */

/* ══════════════════════════════════════════════ 1. CUSTOM PROPERTIES (TOKENS) */
:root {
  --bg:           #0f0f1a;
  --bg-alt:       #13132a;
  --surface:      rgba(255, 255, 255, 0.04);
  --border:       rgba(255, 255, 255, 0.08);

  --primary:      #6c63ff;
  --primary-dark: #574fd6;
  --secondary:    #00d4ff;

  --text:         #e2e8f0;
  --text-muted:   #94a3b8;
  --text-faint:   #64748b;

  --error:        #fc8181;
  --success:      #68d391;

  --radius:       12px;
  --radius-sm:    8px;
  --radius-lg:    16px;

  --transition:   0.25s ease;

  --max-w:        1160px;
  --max-w-narrow: 720px;

  --section-py:   80px;
}

/* ══════════════════════════════════════════════════════════════════ 2. RESET */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px; /* compensa el navbar fijo */
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; }

ul { list-style: none; }

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

textarea { resize: vertical; }

/* ══════════════════════════════════════════════════════════════ 3. TIPOGRAFÍA */
h1, h2, h3, h4 {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════════ 4. UTILIDADES */

/* Container */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: 20px;
}
.container--narrow {
  max-width: var(--max-w-narrow);
}

/* Texto con gradiente purple → cyan */
.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* fallback */
  color: var(--primary);
}

/* Acento púrpura para el logo */
.accent { color: var(--primary); }

/* Glassmorphism */
.glass {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

/* Sección base */
.section {
  padding-block: var(--section-py);
}
.section-alt {
  background: rgba(108, 99, 255, 0.03);
}

/* Encabezado de sección */
.section-header {
  text-align: center;
  margin-bottom: 52px;
}
.section-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 12px;
}
.section-title {
  font-size: clamp(28px, 5vw, 42px);
  color: var(--text);
}
.section-desc {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 16px;
  max-width: 480px;
  margin-inline: auto;
}

/* Botón base */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  transition: filter var(--transition), transform var(--transition), opacity var(--transition);
  white-space: nowrap;
  cursor: pointer;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: #fff;
}
.btn-primary:hover {
  filter: brightness(1.12);
  transform: translateY(-2px);
}
.btn-primary:active {
  transform: translateY(0);
  filter: brightness(0.95);
}
.btn-lg {
  padding: 15px 32px;
  font-size: 16px;
}

/* Fade-in (clase usada por IntersectionObserver en JS) */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}
.fade-in.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Retraso escalonado para hijos de grids */
.services-grid .fade-in:nth-child(2) { transition-delay: 0.1s; }
.services-grid .fade-in:nth-child(3) { transition-delay: 0.2s; }
.why-grid .why-item:nth-child(2)     { transition-delay: 0.1s; }
.why-grid .why-item:nth-child(3)     { transition-delay: 0.2s; }
.why-grid .why-item:nth-child(4)     { transition-delay: 0.3s; }

/* ═══════════════════════════════════════════════════════════════════ 5. NAVBAR */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: background var(--transition), backdrop-filter var(--transition), box-shadow var(--transition);
}
.navbar.scrolled {
  background: rgba(15, 15, 26, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--border);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-links a {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
  transition: width var(--transition);
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
}
.nav-links a.active::after,
.nav-links a:hover::after {
  width: 100%;
}
.nav-links a.nav-cta {
  background: rgba(108, 99, 255, 0.15);
  border: 1px solid rgba(108, 99, 255, 0.4);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
}
.nav-links a.nav-cta::after { display: none; }
.nav-links a.nav-cta:hover {
  background: rgba(108, 99, 255, 0.25);
  color: var(--primary);
}

/* Hamburguesa (solo visible en mobile) */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  width: 36px;
  height: 36px;
  z-index: 1001;
}
.hamburger .bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  margin: 3px 0;
}
.hamburger.is-open .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.is-open .bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ══════════════════════════════════════════════════════════════════ 6. HERO */
.section-hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-block: 100px 60px;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
  opacity: 0.25;
}
.hero-glow--primary {
  width: 600px; height: 600px;
  background: var(--primary);
  top: -150px; left: -200px;
}
.hero-glow--secondary {
  width: 500px; height: 500px;
  background: var(--secondary);
  bottom: -150px; right: -150px;
  opacity: 0.12;
}

/* Layout dos columnas en desktop */
.hero-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 48px;
  align-items: center;
  width: 100%;
}

@media (min-width: 900px) {
  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 64px;
  }
}

/* Columna texto */
.hero-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
  background: rgba(104, 211, 145, 0.1);
  border: 1px solid rgba(104, 211, 145, 0.25);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}

.hero-name {
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 20px;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 40px;
  line-height: 1.7;
  max-width: 460px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* Botón outline para el segundo CTA */
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover {
  border-color: rgba(108, 99, 255, 0.5);
  background: rgba(108, 99, 255, 0.07);
  transform: translateY(-2px);
}

/* ── Ventana de código ── */
.hero-code-window {
  border-radius: var(--radius-lg);
  background: #0d0d1f;
  border: 1px solid rgba(108, 99, 255, 0.25);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.04),
    0 32px 64px rgba(0,0,0,0.5),
    0 0 80px rgba(108, 99, 255, 0.08);
  overflow: hidden;
  font-size: 13px;
  line-height: 1.7;
}

.code-window-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
}
.dot--red    { background: #ff5f57; }
.dot--yellow { background: #febc2e; }
.dot--green  { background: #28c840; }

.code-window-title {
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-faint);
  font-family: 'Inter', monospace;
}

.code-window-body {
  padding: 24px 20px;
  overflow-x: auto;
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.75;
  white-space: pre;
}

/* Colores de sintaxis */
.ct-import   { color: #c792ea; }
.ct-brace    { color: #89ddff; }
.ct-class    { color: #ffcb6b; }
.ct-string   { color: #c3e88d; }
.ct-decorator{ color: #82aaff; }
.ct-key      { color: #f07178; }
.ct-kw       { color: #c792ea; }
.ct-fn       { color: #82aaff; }
.ct-var      { color: #eeffff; }
.ct-num      { color: #f78c6c; }
.ct-bool     { color: #ff5370; }
.ct-comment  { color: #546e7a; font-style: italic; }
.ct-punct    { color: #89ddff; }

/* ═══════════════════════════════════════════════════════════════ 7. SERVICIOS */
.services-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.service-card {
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.service-card:hover {
  transform: translateY(-6px);
  border-color: rgba(108, 99, 255, 0.3);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(108, 99, 255, 0.1);
}

.service-icon {
  width: 64px;
  height: 64px;
  background: rgba(108, 99, 255, 0.12);
  border: 1px solid rgba(108, 99, 255, 0.2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  color: var(--primary);
  transition: background var(--transition), border-color var(--transition);
}
.service-card:hover .service-icon {
  background: rgba(108, 99, 255, 0.2);
  border-color: rgba(108, 99, 255, 0.4);
}

.service-card h3 {
  font-size: 20px;
  color: var(--text);
  margin-bottom: 10px;
}
.service-card p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ═════════════════════════════════════════════════════════════ 8. ¿POR QUÉ? */
.why-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.why-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 28px 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}
.why-item:hover {
  border-color: rgba(108, 99, 255, 0.25);
}

.why-icon-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(108, 99, 255, 0.2), rgba(0, 212, 255, 0.1));
  border: 1px solid rgba(108, 99, 255, 0.3);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--secondary);
}

.why-content h3 {
  font-size: 17px;
  color: var(--text);
  margin-bottom: 6px;
}
.why-content p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════════════ 9. FORMULARIO */
.cotizacion-form {
  padding: 40px 32px;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Honeypot invisible para humanos, detectable por bots.
   El tabindex="-1" vive en el HTML (atributo), no aquí. */
.honeypot-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.required { color: var(--primary); margin-left: 1px; }
.optional  { color: var(--text-faint); font-weight: 400; }

.form-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  outline: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.form-input::placeholder { color: var(--text-faint); }
.form-input:focus {
  border-color: var(--primary);
  background: rgba(108, 99, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.12);
}
.form-input.is-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(252, 129, 129, 0.1);
}

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
.form-select option {
  background: #1e1e35;
  color: var(--text);
}

.form-textarea {
  min-height: 120px;
  line-height: 1.65;
}

.textarea-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  min-height: 18px;
}

.field-error {
  font-size: 12px;
  color: var(--error);
  font-weight: 500;
  display: none;
}
.field-error:not(:empty) { display: block; }

.char-count {
  font-size: 12px;
  color: var(--text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}
.char-count.limit-near { color: #f6ad55; }

/* Botón submit */
.btn-submit {
  width: 100%;
  justify-content: center;
  padding: 16px 32px;
  font-size: 16px;
  position: relative;
}
.btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

/* Spinner dentro del botón */
.btn-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.btn-submit.is-loading .btn-text   { display: none; }
.btn-submit.is-loading .btn-spinner { display: block; }

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

/* Nota de privacidad */
.form-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-faint);
  text-align: center;
  justify-content: center;
}

/* Mensaje de respuesta global del formulario */
.form-message {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  display: none;
}
.form-message.success {
  display: block;
  background: rgba(104, 211, 145, 0.1);
  border: 1px solid rgba(104, 211, 145, 0.25);
  color: var(--success);
}
.form-message.error {
  display: block;
  background: rgba(252, 129, 129, 0.08);
  border: 1px solid rgba(252, 129, 129, 0.2);
  color: var(--error);
}

/* ══════════════════════════════════════════════════════════════ 10. FOOTER */
.footer {
  padding-block: 40px 28px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 24px;
}

.footer-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 16px;
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.footer-social a:hover {
  color: var(--text);
  border-color: rgba(108, 99, 255, 0.4);
  background: rgba(108, 99, 255, 0.1);
}

.footer-copy {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════ 11. RESPONSIVE */

/* ── sm: 640px ── */
@media (min-width: 640px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
  .why-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── md: 768px ── */
@media (min-width: 768px) {
  :root { --section-py: 100px; }

  .cotizacion-form { padding: 52px 48px; }
}

/* ── lg: 1024px ── */
@media (min-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Mobile nav ── */
@media (max-width: 767px) {
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 40px;
    background: rgba(15, 15, 26, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 999;
    /* oculto por defecto */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }
  .nav-links.is-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
  }
  .nav-links a {
    font-size: 22px;
    font-weight: 600;
  }
  .nav-links a.nav-cta {
    font-size: 18px;
    padding: 10px 28px;
  }
}

/* ── Preferencia: sin animaciones ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .fade-in {
    opacity: 1;
    transform: none;
  }
}
