/* --- VARIABLES Y RESET --- */
:root {
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-dark: #0f172a;
  --color-card: #1e293b;
  --color-text-main: #d1d5db;
  --color-text-white: #ffffff;
  --color-border: #1f2937;

  --font-sans: "Inter", sans-serif;
  --font-mono: "Fira Code", monospace;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  background-color: var(--color-dark);
  color: var(--color-text-main);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s ease;
}
ul {
  list-style: none;
}

/* --- UTILIDADES --- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem;
}
.text-primary {
  color: var(--color-primary);
}
.text-white {
  color: var(--color-text-white);
}
.font-mono {
  font-family: var(--font-mono);
}
.font-bold {
  font-weight: 700;
}
.text-center {
  text-align: center;
}
.hidden {
  display: none !important;
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}
.btn-primary {
  background-color: var(--color-primary);
  color: white;
}
.btn-primary:hover {
  background-color: var(--color-primary-hover);
  transform: translateY(-2px);
}
.btn-outline {
  background-color: #1f2937;
  color: white;
  border: 1px solid #374151;
}
.btn-outline:hover {
  background-color: #374151;
}

/* --- NAVBAR --- */
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background-color: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  z-index: 1000;
  height: 70px;
  display: flex;
  align-items: center;
  transition: box-shadow 0.3s ease;
}
.navbar.scrolled {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  font-family: var(--font-mono);
  color: var(--color-primary);
  cursor: pointer;
}
.logo span {
  color: white;
}
.logo:hover span {
  color: var(--color-primary);
}
.logo:hover {
  color: white;
}

/* Desktop Menu */
.nav-links {
  display: none;
  align-items: center;
  gap: 2rem;
} /* Oculto por defecto en móvil */
.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-link:hover {
  color: var(--color-primary);
}
.nav-btn-contact {
  background-color: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
}
.nav-btn-contact:hover {
  background-color: var(--color-primary-hover);
}

/* Language Toggle */
.lang-switch {
  display: flex;
  background-color: #1f2937;
  padding: 0.25rem;
  border-radius: 9999px;
  border: 1px solid #374151;
  margin-left: 1rem;
}
.lang-btn {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  border: none;
  background: transparent;
  color: #9ca3af;
  transition: all 0.3s;
}
.lang-btn.active {
  background-color: var(--color-primary);
  color: white;
}

/* Mobile Controls Wrapper */
.mobile-controls-wrapper {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  background: none;
  border: none;
  color: #9ca3af;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Mobile Menu Dropdown */
.mobile-menu {
  position: fixed;
  top: 70px;
  left: 0;
  width: 100%;
  background-color: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem;
  display: none;
  flex-direction: column;
  gap: 1rem;
  z-index: 999;
}
.mobile-menu.open {
  display: flex;
}

/* --- MEDIA QUERIES PARA MENU --- */
@media (min-width: 768px) {
  .nav-links {
    display: flex;
  } /* Mostrar menu desktop */
  .mobile-controls-wrapper {
    display: none;
  } /* Ocultar controles moviles (switch + burger) */
}
@media (max-width: 767px) {
  .nav-links {
    display: none;
  } /* Asegurar ocultar menu desktop */
  .mobile-controls-wrapper {
    display: flex;
  } /* Mostrar controles moviles */
}

/* --- HERO SECTION --- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 70px;
  overflow: hidden;
}
.hero-content {
  text-align: center;
  z-index: 10;
  padding: 0 1rem;
}
.badge {
  display: inline-block;
  padding: 0.375rem 1rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 9999px;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--color-primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
  color: white;
}

/* --- CORRECCIÓN DEL GRADIENTE EN TEXTO --- */
.hero h1 span.highlight {
  background: linear-gradient(to right, var(--color-primary), #a855f7);
  /* Propiedades estándar y compatibilidad para evitar warnings */
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.25rem;
  color: #9ca3af;
  max-width: 800px;
  margin: 0 auto 2.5rem auto;
}
.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Blobs & Typing */
.blob {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  filter: blur(80px);
  z-index: 1;
  opacity: 0.4;
  animation: move 10s infinite alternate;
}
.blob-1 {
  background-color: #9333ea;
  top: 0;
  left: 0;
}
.blob-2 {
  background-color: var(--color-primary);
  bottom: 0;
  right: 0;
  animation-delay: 2s;
}
@keyframes move {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(20px, -20px) scale(1.1);
  }
}
.typing-cursor::after {
  content: "|";
  animation: blink 1s step-start infinite;
  color: var(--color-primary);
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}

/* --- SECTIONS GENERAL --- */
section {
  padding: 5rem 0;
}
.section-title {
  font-size: 2rem;
  font-weight: bold;
  color: white;
  margin-bottom: 1rem;
}
.section-desc {
  color: #9ca3af;
  margin-bottom: 3rem;
}

/* --- ABOUT ME --- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  align-items: center;
}
.timeline {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.timeline-item {
  border-left: 2px solid rgba(59, 130, 246, 0.3);
  padding-left: 1.5rem;
  position: relative;
}
.timeline-dot {
  position: absolute;
  left: -9px;
  top: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: var(--color-primary);
}
.timeline-dot.gray {
  background-color: #4b5563;
}
.timeline-title {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}
.timeline-date {
  font-size: 0.875rem;
  color: var(--color-primary);
}
.timeline-place {
  color: #6b7280;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* Code Card */
.code-card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  padding: 1.5rem;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.code-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot-red {
  background-color: #ef4444;
}
.dot-yellow {
  background-color: #eab308;
}
.dot-green {
  background-color: #22c55e;
}
pre {
  overflow-x: auto;
  color: #d1d5db;
  font-size: 0.9rem;
}
.syn-purple {
  color: #c084fc;
}
.syn-yellow {
  color: #fde047;
}
.syn-blue {
  color: #60a5fa;
}
.syn-green {
  color: #4ade80;
}

/* --- SKILLS --- */
.bg-card-transparent {
  background-color: rgba(30, 41, 59, 0.3);
}
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.skill-card {
  background-color: var(--color-card);
  padding: 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  transition: border-color 0.3s;
}
.skill-card:hover {
  border-color: rgba(59, 130, 246, 0.5);
}
.skill-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.25rem;
}
.icon-blue {
  background-color: rgba(59, 130, 246, 0.1);
  color: #60a5fa;
}
.icon-green {
  background-color: rgba(34, 197, 94, 0.1);
  color: #4ade80;
}
.icon-purple {
  background-color: rgba(168, 85, 247, 0.1);
  color: #c084fc;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.tag {
  padding: 0.25rem 0.75rem;
  background-color: #1f2937;
  border: 1px solid #374151;
  border-radius: 9999px;
  font-size: 0.875rem;
  color: #d1d5db;
}

/* --- PROJECTS --- */
.projects-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3rem;
}
.projects-link {
  color: var(--color-primary);
  font-weight: 500;
  display: none;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}
.project-card {
  background-color: var(--color-card);
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.project-card:hover {
  transform: translateY(-5px);
}
.project-img {
  height: 12rem;
  background-color: #374151;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 1rem;
}
.project-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--color-dark), transparent);
  opacity: 0.6;
}
.project-content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.project-links {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  padding-top: 1rem;
}
.project-links a {
  font-size: 0.875rem;
  color: #d1d5db;
}
.project-links a:hover {
  color: var(--color-primary);
}

/* --- CONTACT --- */
.contact-section {
  background: linear-gradient(
    to bottom,
    rgba(30, 41, 59, 0.3),
    var(--color-dark)
  );
}
.contact-form {
  max-width: 500px;
  margin: 0 auto;
  background-color: var(--color-card);
  padding: 2rem;
  border-radius: 1rem;
  border: 1px solid var(--color-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.form-group {
  margin-bottom: 1rem;
  text-align: left;
}
.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: #9ca3af;
}
.form-input,
.form-textarea {
  width: 100%;
  background-color: var(--color-dark);
  border: 1px solid #374151;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  color: white;
  font-family: inherit;
}
.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary);
}
.social-links {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
}
.social-links a {
  font-size: 1.5rem;
  color: #9ca3af;
}
.social-links a:hover {
  color: white;
}

/* --- FOOTER --- */
footer {
  border-top: 1px solid var(--color-border);
  padding: 2rem 0;
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
}

/* --- RESPONSIVE FINAL TWEAKS --- */
@media (min-width: 768px) {
  .hero h1 {
    font-size: 4.5rem;
  }
  .about-grid {
    grid-template-columns: 1fr 1fr;
  }
  .projects-link {
    display: inline-flex;
    align-items: center;
  }
}
@media (max-width: 767px) {
  .projects-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Animación Fade In JS */
.fade-in-text {
  animation: fadeIn 0.5s ease-in-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
