:root {
  /* Definimos el "ADN" de tu color principal (Azul) */
  --blue-h: 218;
  --blue-s: 100%;
  --blue-l: 55%;
  
  /* Definimos el "ADN" del fondo (Night) */
  --night-h: 225;
  --night-s: 50%;
  --night-l: 8%;

  /* --- Variables Unificadas --- */
  --blue: hsl(var(--blue-h), var(--blue-s), var(--blue-l));
  --blue-light: hsl(var(--blue-h), var(--blue-s), 68%);
  --blue-dim: hsla(var(--blue-h), var(--blue-s), var(--blue-l), 0.12);

  --night: hsl(var(--night-h), var(--night-s), var(--night-l));
  --night2: hsl(var(--night-h), var(--night-s), 11%);
  --night3: hsl(var(--night-h), var(--night-s), 15%);

  --text: hsl(var(--blue-h), 40%, 93%);
  --muted: hsl(var(--blue-h), 25%, 54%);
  --border: hsla(var(--blue-h), var(--blue-s), 68%, 0.15);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--night);
  color: var(--text);
  overflow-x: hidden;
}

/* ── NOISE OVERLAY ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
}

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 6vw;
  background: rgba(10,15,30,0.8);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
  z-index: 101; /* Asegura que el logo quede sobre el menú móvil */
}
.nav-logo svg { width: 36px; height: 36px; }
.nav-wordmark {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.5px;
}
.nav-wordmark span { color: var(--blue); }

.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a {
  color: var(--muted); text-decoration: none;
  font-size: 14px; font-weight: 500;
  transition: color .2s;
}
.nav-links a:hover { color: var(--text); }
.nav-cta {
  background: var(--blue); color: #fff;
  padding: 10px 22px; border-radius: 8px;
  font-size: 14px; font-weight: 500;
  text-decoration: none;
  transition: opacity .2s;
}
.nav-cta:hover { opacity: .85; }

/* ── BOTÓN HAMBURGUESA (Oculto en PC) ── */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  z-index: 101;
}
.mobile-toggle svg { width: 30px; height: 30px; }

/* ── HERO ── */
#hero {
  position: relative;
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 120px 6vw 80px;
  text-align: center;
  overflow: hidden;
}
#particles-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}
.hero-glow {
  position: absolute;
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(26,111,255,0.15) 0%, transparent 65%);
  top: 50%; left: 50%;
  transform: translate(-50%, -55%);
  pointer-events: none; z-index: 0;
}
.hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(90,159,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,159,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
  pointer-events: none; z-index: 0;
}
#hero > *:not(#particles-canvas):not(.hero-glow):not(.hero-grid) {
  position: relative; z-index: 2;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--blue-dim);
  border: 1px solid rgba(26,111,255,0.3);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 13px; color: var(--blue-light);
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp .6s .2s ease forwards;
}
.hero-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: var(--blue);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.4)} }

h1.hero-tagline {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: clamp(15px, 1.6vw, 22px);
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--muted);
  opacity: 0;
  animation: fadeUp .7s .65s ease forwards;
  text-align: center;
}
h1.hero-tagline .accent { color: #e8eeff; font-weight: 400; }

.hero-icon-wrap {
  margin-bottom: 14px;
  opacity: 0;
  animation: fadeUp .6s .25s ease forwards;
}
.hero-icon-wrap svg { width: 48px; height: 48px; }

.hero-wordmark-big {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(64px, 11vw, 120px);
  letter-spacing: -4px;
  color: white;
  line-height: 1;
  margin-bottom: 18px;
  opacity: 0;
  animation: fadeUp .7s .4s ease forwards;
}
.hero-wordmark-big span { color: var(--blue); }

.hero-actions {
  margin-top: 32px;
  display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  opacity: 0;
  animation: fadeUp .7s .82s ease forwards;
}
.btn-primary {
  background: var(--blue); color: #fff;
  padding: 14px 30px; border-radius: 10px;
  font-size: 15px; font-weight: 500;
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  box-shadow: 0 0 30px rgba(26,111,255,0.35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 40px rgba(26,111,255,0.5); }
.btn-ghost {
  background: transparent; color: var(--text);
  padding: 14px 30px; border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 15px; font-weight: 500;
  text-decoration: none;
  transition: border-color .2s, background .2s;
}
.btn-ghost:hover { border-color: rgba(90,159,255,0.4); background: var(--blue-dim); }

.hero-stats {
  margin-top: 60px;
  display: flex; gap: 48px; flex-wrap: wrap; justify-content: center;
  opacity: 0;
  animation: fadeUp .7s 1.05s ease forwards;
}
.stat { text-align: center; }
.stat-num {
  font-family: 'Syne', sans-serif;
  font-size: 32px; font-weight: 800;
  color: var(--text);
}
.stat-num span { color: var(--blue); }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 4px; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SECTIONS ── */
section {
  position: relative; z-index: 1;
  padding: 100px 6vw;
}
.section-label {
  font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--blue); margin-bottom: 14px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: -1.5px;
  line-height: 1.1;
  max-width: 600px;
}
.section-sub {
  margin-top: 16px;
  color: var(--muted); font-size: 17px;
  max-width: 480px; line-height: 1.7; font-weight: 300;
}

/* ── SERVICES ── */
#servicios { background: var(--night2); }
.services-header { margin-bottom: 60px; }
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.service-card {
  background: var(--night);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  transition: border-color .3s, transform .3s;
  cursor: default;
}
.service-card:hover {
  border-color: rgba(26,111,255,0.4);
  transform: translateY(-4px);
}
.service-icon {
  width: 48px; height: 48px;
  background: var(--blue-dim);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px;
}
.service-icon svg { width: 24px; height: 24px; stroke: var(--blue); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.service-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  margin-bottom: 10px; letter-spacing: -.3px;
}
.service-card p { color: var(--muted); font-size: 15px; line-height: 1.7; font-weight: 300; }
.service-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tag {
  font-size: 11px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px;
  background: var(--blue-dim);
  color: var(--blue-light);
  border: 1px solid rgba(26,111,255,0.2);
}

/* ── PROYECTOS & MOCKUPS REFACTORIZADOS ── */
#proyectos { background: var(--night); }
.projects-grid {
  margin-top: 60px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}
.project-card {
  background: var(--night3);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .3s, border-color .3s;
}
.project-card:hover { transform: translateY(-5px); border-color: rgba(26,111,255,0.35); }
.project-thumb {
  height: 200px;
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; padding: 20px;
}
.thumb-cyber { background: linear-gradient(135deg, #060d1a, #0a1930); }
.thumb-vidiam { background: linear-gradient(135deg, #04120a, #071a0f); }

.mockup-grid { position: absolute; inset: 0; background-size: 30px 30px; }
.grid-blue { background-image: linear-gradient(rgba(26,111,255,0.07) 1px, transparent 1px), linear-gradient(90deg, rgba(26,111,255,0.07) 1px, transparent 1px); }
.grid-green { background-image: linear-gradient(rgba(16,200,90,0.06) 1px, transparent 1px), linear-gradient(90deg, rgba(16,200,90,0.06) 1px, transparent 1px); }

.mockup-browser {
  position: relative; z-index: 1; width: 90%;
  border-radius: 10px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.browser-blue { background: #0d1f3c; border: 1px solid rgba(26,111,255,0.3); }
.browser-green { background: #071a0f; border: 1px solid rgba(16,200,90,0.25); }

.mockup-header { height: 28px; display: flex; align-items: center; gap: 6px; padding: 0 12px; }
.header-blue { background: #060f1e; border-bottom: 1px solid rgba(26,111,255,0.2); }
.header-green { background: #040d07; border-bottom: 1px solid rgba(16,200,90,0.15); }

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

.mock-urlbar {
  flex: 1; height: 14px; border-radius: 4px; margin-left: 8px;
  display: flex; align-items: center; padding: 0 8px;
}
.url-blue { background: #0d1f3c; }
.url-green { background: #071a0f; }
.mock-icon-lock { width: 4px; height: 4px; border-radius: 50%; margin-right: 5px; }
.lock-blue { background: #1A6FFF; }
.lock-green { background: #10c85a; }
.mock-url-text { height: 5px; width: 60%; border-radius: 2px; }
.text-blue { background: rgba(26,111,255,0.3); }
.text-green { background: rgba(16,200,90,0.25); }

.mockup-body { padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.mock-line { border-radius: 2px; }
.line-main-blue { height: 10px; width: 50%; background: linear-gradient(90deg, #1A6FFF, #5A9FFF); border-radius: 3px; }
.line-main-green { height: 10px; width: 55%; background: linear-gradient(90deg, #10c85a, #5de89a); border-radius: 3px; }
.line-sub1 { height: 7px; width: 90%; background: rgba(255,255,255,0.08); }
.line-sub2 { height: 7px; width: 70%; background: rgba(255,255,255,0.06); }

.mock-buttons { display: flex; gap: 6px; margin-top: 4px; }
.mock-btn { height: 22px; width: 80px; border-radius: 4px; }
.btn-solid-blue { background: #1A6FFF; opacity: .8; }
.btn-outline-blue { background: rgba(26,111,255,0.2); border: 1px solid rgba(26,111,255,0.3); }

.mock-btn-large {
  flex: 1; height: 32px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
}
.btn-green-dim { background: rgba(16,200,90,0.12); border: 1px solid rgba(16,200,90,0.2); }
.mock-btn-inner-line { width: 60%; height: 6px; background: rgba(16,200,90,0.4); border-radius: 2px; }

.mockup-badge {
  position: absolute; right: 18px; bottom: 14px; width: 36px; height: 36px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}
.badge-blue { background: rgba(26,111,255,0.15); border: 1px solid rgba(26,111,255,0.3); }
.badge-green { background: rgba(16,200,90,0.1); border: 1px solid rgba(16,200,90,0.25); }

.project-info { padding: 22px; }
.project-info h3 { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.project-info p { color: var(--muted); font-size: 14px; line-height: 1.6; font-weight: 300; }
.project-tech { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

.project-link {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 14px;
  font-size: 13px; text-decoration: none; font-weight: 500; transition: color .2s;
}
.link-blue { color: var(--blue-light); }
.link-green { color: #5de89a; }
.project-link:hover { color: #fff; }

.project-cta { margin-top: 40px; text-align: center; font-size: 14px; color: var(--muted); }
.project-cta a { color: var(--blue-light); text-decoration: none; font-weight: 500; margin-left: 4px; }

/* ── SOBRE MÍ ── */
#sobre { background: var(--night2); }
.sobre-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}
.sobre-avatar {
  width: 100%; aspect-ratio: 1;
  max-width: 400px;
  border-radius: 20px;
  background: var(--night3);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.sobre-avatar::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(26,111,255,0.15), transparent 60%);
}
.avatar-initials {
  font-family: 'Syne', sans-serif;
  font-size: 80px; font-weight: 800;
  color: var(--blue); opacity: .4;
  z-index: 1;
}
.sobre-text .section-title { max-width: 100%; }
.sobre-text p {
  margin-top: 20px;
  color: var(--muted); font-size: 16px;
  line-height: 1.8; font-weight: 300;
}
.skills-list {
  margin-top: 30px;
  display: flex; flex-wrap: wrap; gap: 10px;
}
.skill-pill {
  padding: 8px 16px; border-radius: 999px;
  background: var(--night);
  border: 1px solid var(--border);
  font-size: 13px; color: var(--text); font-weight: 500;
}

/* ── CONTACTO ── */
#contacto { background: var(--night); }
.contact-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.contact-info p { color: var(--muted); font-size: 16px; line-height: 1.8; font-weight: 300; margin-top: 16px; }
.contact-detail {
  margin-top: 36px;
  display: flex; flex-direction: column; gap: 16px;
}
.contact-item {
  display: flex; align-items: center; gap: 14px;
}
.contact-item-icon {
  width: 40px; height: 40px;
  background: var(--blue-dim);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-item-icon svg { width: 18px; height: 18px; stroke: var(--blue); fill: none; stroke-width: 1.8; stroke-linecap: round; }
.contact-item-text { font-size: 15px; color: var(--text); }
.contact-item-text small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* Form */
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--muted); }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--night2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  transition: border-color .2s;
  outline: none;
  resize: vertical;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--blue); }
.form-group select option { background: var(--night2); }
.form-submit {
  background: var(--blue); color: #fff;
  border: none; border-radius: 10px;
  padding: 14px 28px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px; font-weight: 500;
  cursor: pointer;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 0 28px rgba(26,111,255,0.3);
}
.form-submit:hover { opacity: .85; transform: translateY(-1px); }
.form-note { font-size: 12px; color: var(--muted); text-align: center; }

/* Success message */
.form-success {
  display: none;
  text-align: center; padding: 40px 20px;
  background: rgba(26,111,255,0.08);
  border: 1px solid rgba(26,111,255,0.3);
  border-radius: 16px;
}
.form-success h3 { font-family: 'Syne', sans-serif; font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.form-success p { color: var(--muted); }

/* ── FOOTER ── */
footer {
  position: relative; z-index: 1;
  padding: 40px 6vw;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
}
footer p { font-size: 13px; color: var(--muted); }
.footer-links { display: flex; gap: 24px; }
.footer-links a { font-size: 13px; color: var(--muted); text-decoration: none; transition: color .2s; }
.footer-links a:hover { color: var(--text); }

/* ── WHATSAPP FLOTANTE ── */
.wa-float {
  position: fixed; bottom: 28px; right: 28px; z-index: 99;
  width: 56px; height: 56px;
  background: #25D366;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(37,211,102,0.45);
  text-decoration: none;
  transition: transform .2s, box-shadow .2s;
  animation: waPop .5s 2s ease both;
}
.wa-float:hover { transform: scale(1.1); box-shadow: 0 6px 32px rgba(37,211,102,0.6); }
.wa-float svg { width: 30px; height: 30px; fill: white; }
.wa-tooltip {
  position: absolute; right: 66px; bottom: 50%;
  transform: translateY(50%);
  background: #fff; color: #111;
  font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 8px;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  opacity: 0; pointer-events: none;
  transition: opacity .2s;
}
.wa-tooltip::after {
  content: '';
  position: absolute; right: -6px; top: 50%;
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right: none;
  border-left-color: #fff;
}
.wa-float:hover .wa-tooltip { opacity: 1; }
@keyframes waPop {
  from { opacity: 0; transform: scale(0.5); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── RESPONSIVE & MOBILE MENU (Actualizado) ── */
@media (max-width: 768px) {
  nav { padding: 16px 5vw; }
  
  /* Mostramos el botón hamburguesa */
  .mobile-toggle { display: block; }
  
  /* Ocultamos el botón "Hablemos" original del nav en móviles */
  .nav-cta { display: none; } 

  /* Transformamos los links en un menú lateral deslizable */
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%; /* Empieza fuera de la pantalla */
    width: 70vw;
    height: 100vh;
    background: rgba(10, 15, 30, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    transition: right 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 100;
  }
  
  /* Esta clase se añadirá con JS cuando hagan clic */
  .nav-links.active {
    right: 0; /* Desliza el menú hacia adentro */
  }

  .nav-links a {
    font-size: 20px;
    font-weight: 600;
  }

  /* Ajustes generales para móviles */
  section { padding: 70px 5vw; }
  .sobre-inner,
  .contact-inner { grid-template-columns: 1fr; gap: 40px; }
  .sobre-avatar { max-width: 200px; margin: 0 auto; }
  .form-row { grid-template-columns: 1fr; }
  .hero-stats { gap: 28px; }
}