/* ===== Variables & Reset ===== */
:root {
  --bg: #0a0b1e;
  --bg-2: #0f1129;
  --card: #14162e;
  --card-2: #191b38;
  --border: #262a4d;
  --text: #eef0ff;
  --muted: #9aa0c7;
  --purple: #7c5cff;
  --blue: #3b82f6;
  --grad: linear-gradient(135deg, #7c5cff 0%, #3b82f6 100%);
  --radius: 18px;
  --maxw: 1160px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

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

.container { width: min(100% - 40px, var(--maxw)); margin-inline: auto; }

/* Background glows */
.glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  z-index: 0;
  pointer-events: none;
  opacity: 0.45;
}
.glow--1 { width: 480px; height: 480px; background: #4b2a9c; top: -120px; right: -80px; }
.glow--2 { width: 420px; height: 420px; background: #163e8c; bottom: 10%; left: -120px; }

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(10, 11, 30, 0.72);
  border-bottom: 1px solid var(--border);
}
.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 20px;
}
.logo { display: inline-flex; align-items: center; }
.logo__img { height: 50px; width: auto; display: block; }
.logo--footer .logo__img { height: 44px; }

.nav { display: flex; gap: 28px; }
.nav a { color: var(--muted); font-weight: 500; font-size: 0.95rem; transition: color .2s; }
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); }
.nav a.active::after { content: ''; display: block; height: 2px; width: 100%; margin-top: 4px; border-radius: 2px; background: var(--grad); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: 0; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: .3s; }
.nav-toggle.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .2s, box-shadow .2s, background .2s;
}
.btn--sm { padding: 10px 20px; font-size: 0.9rem; }
.btn--primary { background: var(--grad); color: #fff; box-shadow: 0 10px 30px -10px rgba(124, 92, 255, 0.7); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(124, 92, 255, 0.85); }
.btn--ghost { background: rgba(255,255,255,0.04); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { border-color: var(--purple); transform: translateY(-2px); }
.btn .play { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--grad); color: #fff; }

/* ===== Hero ===== */
.hero { position: relative; z-index: 1; padding: 70px 0 90px; overflow: hidden; }
/* Aurora animada de fondo */
.hero::before {
  content: ''; position: absolute; inset: -40% -10% auto -10%; height: 700px; z-index: -1;
  background:
    radial-gradient(closest-side, rgba(124,92,255,0.28), transparent 70%) 20% 30% / 55% 55% no-repeat,
    radial-gradient(closest-side, rgba(59,130,246,0.22), transparent 70%) 80% 20% / 50% 50% no-repeat;
  filter: blur(20px); animation: aurora 14s ease-in-out infinite alternate;
}
@keyframes aurora {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(30px,20px) scale(1.08); }
  100% { transform: translate(-20px,10px) scale(1.04); }
}
.hero__inner { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 50px; align-items: center; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; color: var(--text);
  font-weight: 600; letter-spacing: .5px; font-size: 0.82rem; margin-bottom: 18px;
  padding: 7px 15px; border: 1px solid var(--border); border-radius: 999px;
  background: rgba(124,92,255,0.08);
}
.eyebrow__dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74,222,128,0.18); animation: blink-dot 2s ease-in-out infinite; }
@keyframes blink-dot { 50% { opacity: .4; } }

.hero__title { font-size: clamp(2.5rem, 5.2vw, 3.8rem); font-weight: 800; line-height: 1.1; letter-spacing: -1px; min-height: 2.2em; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.type-cursor { display: inline-block; width: 3px; height: 1em; margin-left: 4px; vertical-align: -0.12em; background: var(--purple); border-radius: 2px; animation: caret 1s step-end infinite; }
@keyframes caret { 50% { opacity: 0; } }
.hero__lead { color: var(--muted); font-size: 1.08rem; max-width: 470px; margin: 20px 0 30px; }
.hero__lead strong { color: var(--text); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 16px; }

.tech-badges { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 34px; }
.tech-badges li {
  font-size: 0.82rem; font-weight: 600; color: var(--muted);
  padding: 7px 14px; border: 1px solid var(--border); border-radius: 10px;
  background: rgba(255,255,255,0.02); transition: .2s;
}
.tech-badges li:hover { color: var(--text); border-color: var(--purple); transform: translateY(-2px); }

/* Hero visual */
.hero__visual { position: relative; min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; }
.hero__logo { position: relative; z-index: 2; width: min(280px, 70%); height: auto; filter: drop-shadow(0 16px 40px rgba(124,92,255,0.35)); animation: float 6s ease-in-out infinite; }
.orb {
  position: absolute; top: 4%; width: 340px; height: 340px; border-radius: 50%; z-index: 0;
  background: radial-gradient(circle at 35% 30%, rgba(124,92,255,0.55), rgba(59,130,246,0.15) 60%, transparent 70%);
  filter: blur(6px);
}
.code-window {
  position: relative; z-index: 2; width: 100%; max-width: 420px;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; box-shadow: 0 30px 70px -30px rgba(0,0,0,0.8);
}
.code-window__bar { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.code-window__bar span { width: 12px; height: 12px; border-radius: 50%; background: #3a3f66; }
.code-window__bar span:nth-child(1) { background: #ff5f56; }
.code-window__bar span:nth-child(2) { background: #ffbd2e; }
.code-window__bar span:nth-child(3) { background: #27c93f; }
.code-window__bar em { margin-left: auto; color: var(--muted); font-style: normal; font-size: 0.85rem; }
.code-window__body { padding: 20px; font-family: 'Fira Code', ui-monospace, monospace; font-size: 0.86rem; line-height: 1.9; color: #cbd0f5; overflow-x: auto; }
.code-window__body .k { color: #7c5cff; }
.code-window__body .s { color: #4ade80; }
.code-window__body .p { color: #60a5fa; }
.code-window__body .fn { color: #f0abfc; }
.code-window__body .c { color: #6b719e; font-style: italic; }

.hero__card {
  position: absolute; bottom: 6px; right: 0; z-index: 3;
  background: rgba(20, 22, 46, 0.9); border: 1px solid var(--border);
  border-radius: 16px; padding: 18px 22px; display: flex; align-items: center; gap: 12px;
  backdrop-filter: blur(8px); box-shadow: 0 20px 50px -20px rgba(0,0,0,0.7);
}
.hero__card-num { font-size: 2rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero__card-label { color: var(--muted); font-size: 0.85rem; line-height: 1.3; }

/* ===== Sections ===== */
.section { position: relative; z-index: 1; padding: 60px 0; }
.section__title { display: flex; align-items: center; gap: 14px; font-size: 1.7rem; font-weight: 700; margin-bottom: 34px; letter-spacing: -0.5px; }
.section__title .bar { width: 34px; height: 3px; border-radius: 3px; background: var(--grad); }
.section__head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.section__head .section__title { margin-bottom: 0; }

/* About + stats */
.about { display: grid; grid-template-columns: 1fr 1.2fr; gap: 50px; align-items: center; }
.about__text p { color: var(--muted); margin-bottom: 14px; }
.about__text strong { color: var(--text); }
.signature { font-family: 'Brush Script MT', cursive; font-size: 1.6rem; color: var(--purple); opacity: 0.8; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 20px; text-align: center; transition: .25s; }
.stat:hover { transform: translateY(-4px); border-color: var(--purple); }
.stat__icon { font-size: 1.5rem; margin-bottom: 10px; }
.stat__num { display: block; font-size: 1.8rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat__label { color: var(--muted); font-size: 0.9rem; }

/* Services */
.services { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.service-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; transition: .25s; }
.service-card:hover { transform: translateY(-6px); border-color: var(--purple); background: var(--card-2); }
.service-card__icon { width: 52px; height: 52px; display: grid; place-items: center; font-size: 1.5rem; border-radius: 14px; background: rgba(124,92,255,0.12); margin-bottom: 18px; }
.service-card h3 { font-size: 1.12rem; margin-bottom: 8px; }
.service-card p { color: var(--muted); font-size: 0.92rem; }

/* Projects */
.projects { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.project-card { display: block; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: .25s; }
.project-card:hover { transform: translateY(-6px); border-color: var(--purple); }
.project-card__thumb { height: 180px; display: grid; place-items: center; text-align: center; padding: 0 16px; font-size: 1.35rem; font-weight: 800; color: rgba(255,255,255,0.92); letter-spacing: 0.5px; }
.thumb--1 { background: linear-gradient(135deg, #1e3a8a, #3b82f6); }
.thumb--2 { background: linear-gradient(135deg, #5b21b6, #7c5cff); }
.thumb--3 { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.project-card__body { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px; }
.project-card__body h3 { font-size: 1.05rem; }
.project-card__body p { color: var(--muted); font-size: 0.88rem; }
.project-card .arrow { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--border); color: var(--purple); font-size: 1.1rem; transition: .2s; }
.project-card:hover .arrow { background: var(--grad); color: #fff; border-color: transparent; }

/* Contacto */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: 40px; align-items: start; background: linear-gradient(135deg, rgba(124,92,255,0.12), rgba(59,130,246,0.06)); border: 1px solid var(--border); border-radius: 24px; padding: 44px; }
.contact__intro p { color: var(--muted); margin-bottom: 24px; max-width: 380px; }
.contact__list { list-style: none; display: grid; gap: 14px; }
.contact__list li { display: flex; align-items: center; gap: 12px; color: var(--text); font-weight: 500; }
.contact__list li span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: rgba(124,92,255,0.12); font-size: 1.05rem; }
.contact__list li a { transition: color .2s; }
.contact__list li a:hover { color: var(--purple); }
.cta__plane { opacity: 0.85; margin-top: 24px; }

.contact__form { display: grid; gap: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; padding: 30px; }
.field { display: grid; gap: 7px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-hint { font-size: 0.85rem; color: var(--muted); margin: -4px 0 -2px; }
.field-hint strong { color: var(--text); }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.field label { font-size: 0.88rem; font-weight: 600; color: var(--muted); }
.field input, .field textarea {
  width: 100%; padding: 13px 15px; border-radius: 12px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  font-family: inherit; font-size: 0.95rem; transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(124,92,255,0.18);
}
.field textarea { resize: vertical; }
.field input.input-error, .field textarea.input-error { border-color: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,0.15); }
.field-error { color: #fca5a5; font-size: 0.8rem; }
.contact__form .btn { justify-content: center; margin-top: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-msg { padding: 13px 16px; border-radius: 12px; font-size: 0.9rem; font-weight: 500; }
.form-msg--ok { background: rgba(74,222,128,0.12); border: 1px solid rgba(74,222,128,0.4); color: #86efac; }
.form-msg--err { background: rgba(248,113,113,0.12); border: 1px solid rgba(248,113,113,0.4); color: #fca5a5; }

/* Footer */
.site-footer { position: relative; z-index: 1; border-top: 1px solid var(--border); margin-top: 40px; padding: 34px 0; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; }
.footer__socials { display: flex; gap: 12px; }
.footer__socials a { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); font-size: 0.75rem; font-weight: 700; transition: .2s; }
.footer__socials a:hover { border-color: var(--purple); color: var(--text); }
.footer__copy { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 22px; }

/* ===== Botón flotante WhatsApp ===== */
.wa-float {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: #25d366; box-shadow: 0 10px 30px -8px rgba(37,211,102,0.7);
  transition: transform .2s, box-shadow .2s;
  animation: wa-pulse 2.6s ease-in-out infinite;
}
.wa-float:hover { transform: scale(1.08); box-shadow: 0 14px 36px -8px rgba(37,211,102,0.9); }
@keyframes wa-pulse {
  0%   { box-shadow: 0 10px 30px -8px rgba(37,211,102,0.7), 0 0 0 0 rgba(37,211,102,0.5); }
  70%  { box-shadow: 0 10px 30px -8px rgba(37,211,102,0.7), 0 0 0 16px rgba(37,211,102,0); }
  100% { box-shadow: 0 10px 30px -8px rgba(37,211,102,0.7), 0 0 0 0 rgba(37,211,102,0); }
}
@media (max-width: 520px) { .wa-float { right: 16px; bottom: 16px; width: 52px; height: 52px; } }

/* ===== Animaciones ===== */
/* Header al hacer scroll */
.site-header.scrolled { background: rgba(10, 11, 30, 0.9); box-shadow: 0 8px 30px -12px rgba(0,0,0,0.6); }

/* Reveal al entrar en viewport */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.is-visible { opacity: 1; transform: none; }
.reveal[data-delay="1"] { transition-delay: .08s; }
.reveal[data-delay="2"] { transition-delay: .16s; }
.reveal[data-delay="3"] { transition-delay: .24s; }
.reveal[data-delay="4"] { transition-delay: .32s; }

/* Entrada del hero */
@keyframes fadeUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.hero__content > * { animation: fadeUp .8s both; }
.hero__content > *:nth-child(1) { animation-delay: .05s; }
.hero__content > *:nth-child(2) { animation-delay: .15s; }
.hero__content > *:nth-child(3) { animation-delay: .25s; }
.hero__content > *:nth-child(4) { animation-delay: .35s; }
.hero__content > *:nth-child(5) { animation-delay: .45s; }

/* Flotar del código y la tarjeta */
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.code-window { animation: float 6s ease-in-out infinite; }
.hero__card { animation: float 6s ease-in-out infinite 1s; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.06); opacity: 1; } }
.orb { animation: pulse 7s ease-in-out infinite; }

/* Avión que se desliza */
@keyframes fly { 0%,100% { transform: translate(0,0) rotate(0); } 50% { transform: translate(10px,-8px) rotate(-4deg); } }
.cta__plane svg { animation: fly 5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .nav {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height .3s ease;
  }
  .nav--open { max-height: 320px; }
  .nav a { padding: 14px 20px; border-bottom: 1px solid var(--border); }
  .nav-toggle { display: flex; }
  .header__inner > .btn--primary { display: none; }

  .hero__inner { grid-template-columns: 1fr; gap: 60px; }
  .hero__visual { order: -1; min-height: 320px; }
  .about { grid-template-columns: 1fr; gap: 34px; }
}

@media (max-width: 720px) {
  .services { grid-template-columns: repeat(2, 1fr); }
  .projects { grid-template-columns: 1fr; }
  .contact { grid-template-columns: 1fr; padding: 30px 24px; }
}

@media (max-width: 460px) {
  .stats { grid-template-columns: 1fr; }
  .services { grid-template-columns: 1fr; }
}

/* ===== Página 404 ===== */
.error-page { position: relative; z-index: 1; padding: 70px 0 90px; }
.error-page__inner { display: flex; flex-direction: column; align-items: center; text-align: center; }
.error-page__code {
  font-size: clamp(5.5rem, 18vw, 11rem); font-weight: 800; line-height: 1;
  letter-spacing: -6px; margin: 18px 0 6px;
  filter: drop-shadow(0 20px 50px rgba(124, 92, 255, 0.35));
}
.error-page__title { font-size: clamp(1.5rem, 3.4vw, 2.2rem); font-weight: 700; letter-spacing: -0.5px; }
.error-page__lead { color: var(--muted); font-size: 1.05rem; max-width: 520px; margin: 16px 0 30px; }
.error-page__actions { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.error-page__window { margin: 48px auto 0; text-align: left; max-width: 480px; }
.error-page__links {
  list-style: none; display: flex; flex-wrap: wrap; gap: 10px;
  justify-content: center; margin-top: 40px;
}
.error-page__links a {
  display: inline-block; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.03);
  color: var(--muted); font-size: 0.9rem; transition: color .2s, border-color .2s, transform .2s;
}
.error-page__links a:hover { color: var(--text); border-color: var(--purple); transform: translateY(-2px); }

@media (max-width: 520px) {
  .error-page { padding: 46px 0 70px; }
  .error-page__code { letter-spacing: -3px; }
}
