/* Tema oscuro por defecto; el botón de la luna cambia a claro */
:root {
  --bg: #0a0d1a;
  --bg-2: #10152a;
  --card: rgba(255, 255, 255, 0.04);
  --borde: rgba(255, 255, 255, 0.09);
  --texto: #e7e9f3;
  --suave: #9aa1bd;
  --acento: #6d5dfc;
  --acento-2: #22d3ee;
  --degradado: linear-gradient(120deg, var(--acento), var(--acento-2));
  --sombra: 0 20px 50px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-2: #ffffff;
  --card: #ffffff;
  --borde: #e3e6f0;
  --texto: #171a2b;
  --suave: #5b617a;
  --sombra: 0 16px 40px rgba(30, 40, 90, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--texto);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
main { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
section { padding: 96px 0 24px; }
h1, h2, h3, .logo { font-family: "Space Grotesk", sans-serif; }

/* Barra superior */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 16px max(20px, calc((100% - 1080px) / 2));
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  transition: box-shadow 0.3s;
}
.nav.scroll { box-shadow: 0 1px 0 var(--borde); }
.logo { font-size: 1.4rem; font-weight: 700; }
.logo span { color: var(--acento-2); }
.nav nav { display: flex; gap: 24px; margin-left: auto; }
.nav nav a { color: var(--suave); font-size: 0.93rem; transition: color 0.2s; }
.nav nav a:hover { color: var(--texto); }
.tema {
  border: 1px solid var(--borde); background: var(--card); color: var(--texto);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center;
}

/* Portada */
.hero {
  min-height: min(100vh, 860px); display: flex; flex-direction: column; justify-content: center;
  position: relative; padding-top: 80px;
}
.blob {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.45; z-index: -1;
  animation: flotar 12s ease-in-out infinite alternate;
}
.b1 { width: 380px; height: 380px; background: var(--acento); top: 12%; right: 4%; }
.b2 { width: 300px; height: 300px; background: var(--acento-2); bottom: 12%; right: 26%; animation-delay: -6s; }
@keyframes flotar { to { transform: translate(-40px, 30px) scale(1.1); } }
.saludo { color: var(--acento-2); font-weight: 600; letter-spacing: 0.05em; }
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.8rem); line-height: 1.05; margin: 8px 0 12px;
  background: linear-gradient(120deg, var(--texto) 30%, var(--acento-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.rol { font-size: clamp(1.3rem, 3.4vw, 2rem); color: var(--suave); min-height: 1.4em; font-weight: 500; }
.cursor { color: var(--acento-2); animation: parpadeo 1s steps(1) infinite; margin-left: 2px; }
@keyframes parpadeo { 50% { opacity: 0; } }
.intro { max-width: 600px; margin: 22px 0 32px; color: var(--suave); font-size: 1.08rem; }
.intro strong { color: var(--texto); }
.ctas { display: flex; gap: 14px; flex-wrap: wrap; }
.ubicacion { margin-top: 36px; color: var(--suave); font-size: 0.92rem; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 12px; font-weight: 600;
  border: 1px solid var(--borde); background: var(--card);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-2px); border-color: var(--acento); }
.btn.primario { background: var(--degradado); border: none; color: #fff; box-shadow: 0 10px 30px rgba(109, 93, 252, 0.35); }
.btn.grande { font-size: 1.05rem; padding: 16px 28px; margin: 8px 0 24px; }

/* Títulos de sección */
.titulo { font-size: 2rem; margin-bottom: 36px; display: flex; align-items: center; gap: 14px; }
.titulo span { font-size: 1rem; color: var(--acento-2); font-family: "Inter", sans-serif; }
.titulo::after { content: ""; flex: 1; height: 1px; background: var(--borde); margin-left: 12px; }

/* Proyectos */
.proyectos { display: grid; gap: 28px; }
.proyecto {
  display: grid; grid-template-columns: 1.05fr 1fr; overflow: hidden;
  border: 1px solid var(--borde); border-radius: 20px; background: var(--card);
  box-shadow: var(--sombra); transition: transform 0.3s, border-color 0.3s;
}
.proyecto:nth-child(even) .portada { order: 2; }
.proyecto:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--acento) 60%, transparent); }
.portada { overflow: hidden; min-height: 260px; }
.portada img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s; }
.proyecto:hover .portada img { transform: scale(1.05); }
.info { padding: 30px; display: flex; flex-direction: column; gap: 12px; }
.tipo { color: var(--acento-2); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.info h3 { font-size: 1.6rem; }
.info > p { color: var(--suave); }
.info ul { padding-left: 18px; color: var(--suave); font-size: 0.94rem; }
.info li::marker { color: var(--acento); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags span {
  font-size: 0.8rem; padding: 5px 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--acento) 14%, transparent);
  color: color-mix(in srgb, var(--acento) 55%, var(--texto));
  border: 1px solid color-mix(in srgb, var(--acento) 25%, transparent);
}
.enlaces { display: flex; gap: 18px; margin-top: auto; padding-top: 6px; }
.enlaces a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.92rem; }
.enlaces a:hover { color: var(--acento-2); }
.mas { margin-top: 26px; color: var(--suave); }
.mas a { color: var(--acento-2); font-weight: 600; }

/* Habilidades */
.habilidades { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.grupo { border: 1px solid var(--borde); border-radius: 16px; padding: 22px; background: var(--card); }
.grupo h3 { margin-bottom: 14px; font-size: 1.1rem; }

/* Trayectoria */
.timeline { list-style: none; border-left: 2px solid var(--borde); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 34px 28px; }
.timeline li::before {
  content: ""; position: absolute; left: -8px; top: 5px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--degradado); box-shadow: 0 0 0 4px var(--bg);
}
.fecha { color: var(--acento-2); font-size: 0.85rem; font-weight: 600; }
.timeline h3 { font-size: 1.15rem; margin: 2px 0; }
.lugar { color: var(--texto); opacity: 0.8; font-size: 0.95rem; }
.timeline p:last-child { color: var(--suave); font-size: 0.94rem; }

/* Contacto */
.contacto { text-align: center; padding-bottom: 80px; }
.contacto .titulo { text-align: left; }
.contacto > p { color: var(--suave); max-width: 520px; margin: 0 auto 10px; font-size: 1.05rem; }
.redes { display: flex; justify-content: center; gap: 22px; }
.redes a { display: inline-flex; align-items: center; gap: 8px; color: var(--suave); font-weight: 600; }
.redes a:hover { color: var(--texto); }
footer { text-align: center; padding: 30px 20px; color: var(--suave); font-size: 0.85rem; border-top: 1px solid var(--borde); }

/* Animación de aparición */
.revelar { opacity: 0; transform: translateY(26px); transition: opacity 0.7s, transform 0.7s; transition-delay: calc(var(--i, 0) * 0.08s); }
.revelar.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .revelar { opacity: 1; transform: none; }
  .blob, .cursor { animation: none; }
}

/* Móvil */
@media (max-width: 760px) {
  main { padding: 0 16px; }
  .nav { gap: 14px; padding: 14px 16px; }
  .nav nav { gap: 14px; }
  .nav nav a:nth-child(n+3) { display: none; }
  .proyecto { grid-template-columns: 1fr; }
  .proyecto:nth-child(even) .portada { order: 0; }
  .portada { min-height: 200px; max-height: 240px; }
  .info { padding: 22px; }
  .b1 { width: 240px; height: 240px; }
  .b2 { width: 200px; height: 200px; }
}
