:root {
  --primary: #6366F1;
  --secondary: #EC4899;
  --bg: #0f172a;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --navbar-bg-rgb: 15, 23, 42; /* modo oscuro */
}
body.light {
  --bg: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(-45deg, #0f172a, #1e293b, #334155, #0f172a);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  color: var(--text);
  line-height: 1.6;
}
@keyframes gradientBG {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
body.light {
  background: linear-gradient(-45deg, #f8fafc, #e0f2fe, #dbeafe, #f1f5f9);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
}
a {
  color: inherit;
  text-decoration: none;
}

/* ✅ Navbar fijo con botones */
html {
  scroll-behavior: smooth;
}
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background: rgba(15, 23, 42, 0.95); 
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #fff;
}
.nav-links-desktop-only {
  display: flex;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links-desktop-only a {
  color: #fff; 
  font-weight: 600;
  text-transform: uppercase;
  transition: color 0.3s;
  font-size: 0.95rem;
}
.nav-links-desktop-only a:hover {
  color: var(--secondary);
}
.nav-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
#themeToggle, #langToggle {
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 5px;
}
#themeToggle:hover, #langToggle:hover {
  transform: scale(1.05);
  background: var(--secondary);
  color: #fff;
}
/* Responsive para móvil */
@media (max-width: 768px) {
  /* Responsive para móvil */
@media (max-width: 768px) {
  .navbar {
    flex-wrap: wrap;
    padding: 10px;
  }

  /* ✅ OCULTAR los enlaces del navbar */
  .nav-links-desktop-only {
    display: none !important;
  }

  /* ✅ OCULTAR los botones de tema/idioma del navbar (aparecen en el menú lateral) */
  .nav-actions {
    display: none !important;
  }

  /* ✅ MOSTRAR el botón hamburguesa */
  .hamburger {
    display: block;
  }
}
}
header { 
  text-align: center;
  padding: 120px 20px 50px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
}
header h1 {
  font-size: 2.8rem;
  margin-bottom: 10px;
}
header p {
  font-size: 1.2rem;
  max-width: 650px;
  margin: 0 auto;
}
.container {
  max-width: 1100px;
  margin: auto;
  padding: 50px 20px;
}
h2 {
  font-size: 2rem;
  margin-bottom: 25px;
  text-align: center;
  position: relative;
}
h2::after {
  content: "";
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  display: block;
  margin: 12px auto 0;
  border-radius: 2px;
}
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.skill {
  background: rgba(99,102,241,.1);
  border: 1px solid var(--primary);
  padding: 8px 16px;
  border-radius: 30px;
  transition: .3s;
}
.skill:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-3px) rotate(3deg);
  box-shadow: 0 0 15px var(--primary);
}
.projects {
  display: grid;
  gap: 20px;
  margin-top: 30px;
}
@media(min-width:768px) {
  .projects {
    grid-template-columns: repeat(2, 1fr);
  }
}
.proj {
  background: #1e293b;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid #334155;
  transition: .3s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.proj:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
.proj h3 {
  color: var(--primary);
  margin-bottom: 10px;
}
.btn {
  align-self: flex-start;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: .3s;
}
.btn:hover { 
  opacity: .85;
}
.social-icons {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 15px;
}
.social-icons a {
  font-size: 1.8rem;
  color: var(--text);
  transition: .3s;
}
.social-icons a:hover {
  color: var(--primary);
  transform: scale(1.2);
}
footer {
  text-align: center;
  padding: 20px;
  font-size: .9rem;
  color: var(--muted);
}
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  animation: fade 1s forwards;
}
@keyframes fade {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: background 0.3s, transform 0.2s;
  z-index: 1000;
}
#backToTop:hover {
  background: var(--secondary);
  transform: scale(1.1);
}
.cv-download {
  margin-top: 30px;
  text-align: center;
}
.btn-cv {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: #e63946;
  color: #fff;
  font-size: 18px;
  font-weight: bold;
  border-radius: 8px;
  text-decoration: none;
  transition: 0.3s ease-in-out;
}
.btn-cv:hover {
  background: #b71c1c;
  transform: scale(1.05);
}
.hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 40px;
  flex-wrap: wrap;
}
.hero div {
  flex: 1 1 250px;
}
.profile-pic {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  object-fit: cover;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .hero {
    flex-direction: column;
    text-align: center;
  }
  .hero div {
    flex: 1 1 auto;
  }
  .profile-pic {
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
  }
}
/* Dropdown CV */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-content {
  display: none;
  position: absolute;
  background: #1e293b;
  min-width: 160px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border-radius: 8px;
  overflow: hidden;
  z-index: 1;
}
.dropdown-content a {
  color: #fff;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  transition: 0.3s;
}
.dropdown-content a:hover {
  background: var(--primary);
}
.dropdown:hover .dropdown-content {
  display: block;
}
/* Scroll reveal base */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 1s ease;
}
.reveal-left { 
  transform: translateX(-60px); 
}
.reveal-right { 
  transform: translateX(60px); 
}
.reveal-bottom { 
  transform: translateY(60px); 
}
.reveal-zoom { 
  transform: scale(0.8); 
}
.reveal.active {
  opacity: 1;
  transform: translateX(0) translateY(0) scale(1);
}
.hidden-section {
  opacity: 0;
  transform: translateY(40px);
  transition: all 1s ease-out;
}
.show-section {
  opacity: 1;
  transform: translateY(0);
}
#testimonials {
  padding: 60px 20px;
  text-align: center;
}
.testimonials-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
  margin-top: 30px;
}
.testimonial {
  background: rgba(99,102,241,.1);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 20px;
  max-width: 300px;
  transition: transform 0.3s, box-shadow 0.3s;
}
.testimonial:hover {
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.testimonial p {
  font-size: 1rem;
  margin-bottom: 10px;
}
.testimonial span {
  font-weight: 600;
  color: var(--secondary);
  font-size: 0.9rem;
}
body.light .proj {
  background: #fff;
  border: 1px solid #e2e8f0;
}
/* Loader */
#loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 0 20px;
}
#loader-text {
  color: var(--primary);
  font-size: clamp(1.5rem, 8vw, 3rem); /* ¡Clave! Se adapta al ancho */
  font-weight: 700;
  letter-spacing: 2px;
  text-align: center;
  white-space: normal; /* Permite saltos de línea */
  line-height: 1.2;
  max-width: 90%;
}
#loader.fade-out {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
/* ===== Menú Hamburguesa y Menú Lateral para Móvil ===== */

/* Botón hamburguesa */
.hamburger {
  display: none; /* Solo visible en móvil */
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  padding: 10px;
  z-index: 1001;
}

/* Menú lateral */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -300px; /* Fuera de pantalla */
  width: 280px;
  height: 100%;
  background: var(--bg); /* Fondo sólido oscuro */
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); /* Soporte para Safari */
  z-index: 2000;
  transition: right 0.3s ease;
  box-shadow: -5px 0 15px rgba(0,0,0,0.3);
  border-left: 1px solid rgba(99, 102, 241, 0.3);
}

.mobile-menu.active {
  right: 0; /* Desliza hacia dentro */
  background: var(--bg);
}

.mobile-menu-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.close-menu {
  align-self: flex-end;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #fff;
  cursor: pointer;
  margin-bottom: 30px;
}

.mobile-nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.mobile-nav-links li {
  margin-bottom: 15px;
}

.mobile-nav-links a {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  display: block;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.3s;
}

.mobile-nav-links a:hover {
  background: rgba(99, 102, 241, 0.2);
  color: #6366F1;
}

.mobile-nav-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.mobile-nav-actions button {
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #6366F1;
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.mobile-nav-actions button:hover {
  background: #6366F1;
  color: #fff;
}

/* Ocultar elementos en móvil */
@media (max-width: 767px) {
  .desktop-only {
    display: none !important;
  }
  .hamburger {
    display: block;
  }
}

/* Mostrar navbar horizontal en escritorio */
@media (min-width: 768px) {
  .mobile-menu {
    display: none;
  }
}
/* ---------- FIX: Navbar dropdown visible y fondo sólido ---------- */
/* Variable para color del navbar (ya la tienes arriba, pero por si acaso) */
:root {
  --navbar-bg-rgb: 15, 23, 42;
}

/* Forzar fondo del navbar (no cambia con body.light) */
.navbar {
  background: rgba(var(--navbar-bg-rgb), 0.95) !important;
}

/* Forzar color de texto del navbar (siempre blanco) */
.navbar,
.navbar .nav-links a,
.navbar .nav-brand,
.nav-actions button,
.desktop-only .nav-links a {
  color: #fff !important;
}

/* Estilos para cuando la ul se muestre en columna (drop-down responsive) */
@media (max-width: 767px) {
  .navbar .nav-links {
    position: absolute;
    top: 60px;           /* ajusta si tu navbar es más alto */
    left: 0;
    width: 100%;
    flex-direction: column;
    background: rgba(var(--navbar-bg-rgb), 0.98);
    padding: 8px 0;
    gap: 0;
    z-index: 1500;
    box-shadow: 0 8px 30px rgba(0,0,0,.35);
  }

  .navbar .nav-links a {
    display: block;
    padding: 12px 18px;
    color: #fff !important;
    font-weight: 700;
    text-align: center;
  }

  .navbar .nav-links a:hover{
    background: rgba(255,255,255,0.04);
  }

  /* Si usas .nav-brand en la izquierda, evitar que tape el menú */
  .nav-brand { z-index: 1600; }
}

/* ---------- FIX: Menú lateral móvil (mobile-menu) ---------- */
.mobile-menu {
  background: rgba(var(--navbar-bg-rgb), 1) !important; /* fondo sólido */
  color: #fff;
  z-index: 2000;
}

/* Forzar color de los links dentro del menú lateral */
.mobile-menu .mobile-nav-links a {
  color: #fff !important;
}

/* Mejor contraste para el dropdown del CV */
.dropdown-content {
  background: rgba(15,23,42,0.98) !important;
}

/* Asegurar que botones de tema/idioma mantengan estilo visible */
#themeToggle, #langToggle, .mobile-nav-actions button {
  color: var(--primary) !important;
  background: #fff !important;
}

/* Opcional: hace la transición del mobile-menu un poco más suave */
.mobile-menu, .mobile-menu.active {
  transition: right 0.28s cubic-bezier(.2,.9,.3,1), background .2s;
}
/* Opcional: hace la transición del mobile-menu un poco más suave */
.mobile-menu, .mobile-menu.active {
  transition: right 0.28s cubic-bezier(.2,.9,.3,1), background .2s;
}

/* ===== FIX DEFINITIVO PARA MENÚ MÓVIL ===== */

/* Forzar visibilidad en móvil */
@media (max-width: 767px) {
  .mobile-menu {
    display: block !important;
    right: -100%;
    width: 280px;
    max-width: 320px;
    height: 100vh;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.98) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mobile-menu.active {
    display: block !important;
    right: 0 !important;
    background: rgba(15, 23, 42, 0.98) !important;
  }
}

/* Asegurar que el contenido sea visible */
.mobile-menu .mobile-nav-links a {
  color: white !important;
  opacity: 1 !important;
}

.mobile-menu-content {
  padding: 20px;
}
/* Alinear botones de tema e idioma */
.mobile-nav-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px; /* Espacio entre botones y el menú */
  padding-top: 15px;
}

.mobile-nav-actions button {
  background: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  transition: all 0.3s ease;
}

.mobile-nav-actions button:hover {
  background: var(--secondary);
  color: #fff;
}