/* =========================================
       1. VARIABLES Y CONFIGURACIÓN BASE
========================================= */
:root {
  --primary: #2563eb;
  --primary-dark: #1e40af;
  --text-main: #1f2937;
  --text-light: #6b7280;
  --bg-color: #f9fafb;
  --card-bg: #ffffff;
  --border: #e5e7eb;

  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.12);
  --glass-blur: 12px;

  /* Hero blobs */
  --blob-1: rgba(37, 99, 235, 0.15);
  --blob-2: rgba(139, 92, 246, 0.12);
  --blob-3: rgba(59, 130, 246, 0.10);

  /* Tech brand colors */
  --brand-html: #E34F26;
  --brand-css: #1572B6;
  --brand-js: #F7DF1E;
  --brand-astro: #BC52EE;
  --brand-wordpress: #21759B;
  --brand-elementor: #92003B;
  --brand-bootstrap: #7952B3;
  --brand-git: #F05032;
  --brand-github: #181717;
}

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

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--primary) var(--bg-color);
  scrollbar-width: thin;
}

body {
  background: linear-gradient(180deg, #f9fafb 0%, #f0f0ff 40%, #f5f8ff 70%, #f9fafb 100%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* =========================================
       2. ENCABEZADO Y NAVEGACIÓN
========================================= */
header {
  position: sticky;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  padding: 1rem 0;
  overflow: visible;
}

nav {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2rem;
  position: relative;
  height: 100%;
}

.logo {
  font-weight: 800;
  font-size: 1.5rem;
  text-decoration: none;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--primary);
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.9rem;
  position: relative;
  display: flex;
  align-items: center;
  line-height: 1;
}

.nav-links a:hover {
  color: var(--primary);
}

.switch-mode {
  background-color: #000;
  color: #33ff33 !important;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: monospace;
  font-size: 1rem;
  text-decoration: none;
  border: 1px solid #33ff33;
  transition: all 0.3s;
}

.switch-mode:hover {
  background-color: #33ff33;
  color: #000 !important;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.lang-toggle {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 6px;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.lang-toggle:hover {
  background: var(--primary);
  color: #ffffff;
}


/* =========================================
       3. MENÚ MÓVIL
========================================= */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
}

.bar {
  display: block;
  width: 25px;
  height: 3px;
  margin: 5px auto;
  background-color: var(--text-main);
  transition: all 0.3s ease-in-out;
  border-radius: 2px;
}

/* =========================================
       4. DISEÑO GENERAL
========================================= */
section {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

h1 {
  font-size: 3.5rem;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-main);
  letter-spacing: -1px;
}

h1 span {
  color: var(--primary);
}

h2 {
  font-size: 2rem;
  margin-bottom: 2.5rem;
  text-align: center;
  position: relative;
}

h2::after {
  content: "";
  display: block;
  width: 50px;
  height: 4px;
  background: var(--primary);
  margin: 0.5rem auto 0;
  border-radius: 2px;
}

/* =========================================
       5. SECCIÓN PRINCIPAL
========================================= */
#inicio {
  text-align: center;
  padding-top: 8rem;
  padding-bottom: 6rem;
  position: relative;
  overflow: hidden;
}

/* Background blobs */
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
}

.hero-blob--1 {
  width: 400px;
  height: 400px;
  background: var(--blob-1);
  top: -80px;
  right: -60px;
  animation: blob-float-1 12s ease-in-out infinite;
}

.hero-blob--2 {
  width: 350px;
  height: 350px;
  background: var(--blob-2);
  bottom: -60px;
  left: -40px;
  animation: blob-float-2 15s ease-in-out infinite;
}

.hero-blob--3 {
  width: 250px;
  height: 250px;
  background: var(--blob-3);
  top: 40%;
  left: 50%;
  animation: blob-float-1 18s ease-in-out infinite reverse;
}

/* Glass container */
.hero-glass {
  position: relative;
  z-index: 1;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  padding: 3rem 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
  max-width: 900px;
  margin: 0 auto;
}

/* Section intro label */
.section-intro {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 3px;
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
  padding: 0.4rem 1.2rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
}

/* Staggered entrance animations */
.hero-anim {
  opacity: 0;
  animation: fade-slide-up 0.7s ease-out forwards;
}

.hero-anim:nth-child(1) { animation-delay: 0.1s; }
.hero-anim:nth-child(2) { animation-delay: 0.25s; }
.hero-anim:nth-child(3) { animation-delay: 0.4s; }
.hero-anim:nth-child(4) { animation-delay: 0.55s; }
.hero-anim:nth-child(5) { animation-delay: 0.7s; }
.hero-anim:nth-child(6) { animation-delay: 0.85s; }

.subtitle {
  font-size: 1.25rem;
  color: var(--text-light);
  max-width: 800px;
  margin: 0 auto 3rem auto;
}

.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  color: white;
  padding: 0.85rem 2rem;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37, 99, 235, 0.35);
  color: white;
  background: linear-gradient(135deg, var(--primary-dark), #6d28d9);
}

.btn-glow {
  animation: glow-pulse 3s ease-in-out infinite;
}

.copy-email-btn {
  background: var(--primary);
  animation: none;
}

.copy-email-btn:hover {
  background: var(--primary-dark);
}

/* =========================================
       6. STACK DE TECNOLOGÍAS
========================================= */
.tech-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.tech-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 0.8rem;
  border-radius: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  width: 110px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.35s ease,
              border-color 0.35s ease;
  cursor: default;
}

.tech-item:hover {
  transform: translateY(-6px) scale(1.04);
}

.tech-icon {
  width: 48px;
  height: 48px;
  fill: var(--text-main);
  transition: fill 0.3s ease, filter 0.3s ease;
}

.tech-item span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: 0.5px;
  transition: color 0.3s ease;
}

/* Brand color hovers */
.tech-item[data-tech="html5"]:hover { border-color: var(--brand-html); box-shadow: 0 4px 20px rgba(227, 79, 38, 0.25); }
.tech-item[data-tech="html5"]:hover .tech-icon { fill: var(--brand-html); }
.tech-item[data-tech="html5"]:hover span { color: var(--brand-html); }

.tech-item[data-tech="css3"]:hover { border-color: var(--brand-css); box-shadow: 0 4px 20px rgba(21, 114, 182, 0.25); }
.tech-item[data-tech="css3"]:hover .tech-icon { fill: var(--brand-css); }
.tech-item[data-tech="css3"]:hover span { color: var(--brand-css); }

.tech-item[data-tech="javascript"]:hover { border-color: var(--brand-js); box-shadow: 0 4px 20px rgba(247, 223, 30, 0.3); }
.tech-item[data-tech="javascript"]:hover .tech-icon { fill: var(--brand-js); }
.tech-item[data-tech="javascript"]:hover span { color: #b8a000; }

.tech-item[data-tech="astro"]:hover { border-color: var(--brand-astro); box-shadow: 0 4px 20px rgba(188, 82, 238, 0.25); }
.tech-item[data-tech="astro"]:hover .tech-icon { fill: var(--brand-astro); }
.tech-item[data-tech="astro"]:hover span { color: var(--brand-astro); }

.tech-item[data-tech="wordpress"]:hover { border-color: var(--brand-wordpress); box-shadow: 0 4px 20px rgba(33, 117, 155, 0.25); }
.tech-item[data-tech="wordpress"]:hover .tech-icon { fill: var(--brand-wordpress); }
.tech-item[data-tech="wordpress"]:hover span { color: var(--brand-wordpress); }

.tech-item[data-tech="elementor"]:hover { border-color: var(--brand-elementor); box-shadow: 0 4px 20px rgba(146, 0, 59, 0.25); }
.tech-item[data-tech="elementor"]:hover .tech-icon { fill: var(--brand-elementor); }
.tech-item[data-tech="elementor"]:hover span { color: var(--brand-elementor); }

.tech-item[data-tech="bootstrap"]:hover { border-color: var(--brand-bootstrap); box-shadow: 0 4px 20px rgba(121, 82, 179, 0.25); }
.tech-item[data-tech="bootstrap"]:hover .tech-icon { fill: var(--brand-bootstrap); }
.tech-item[data-tech="bootstrap"]:hover span { color: var(--brand-bootstrap); }

.tech-item[data-tech="git"]:hover { border-color: var(--brand-git); box-shadow: 0 4px 20px rgba(240, 80, 50, 0.25); }
.tech-item[data-tech="git"]:hover .tech-icon { fill: var(--brand-git); }
.tech-item[data-tech="git"]:hover span { color: var(--brand-git); }

.tech-item[data-tech="github"]:hover { border-color: var(--brand-github); box-shadow: 0 4px 20px rgba(24, 23, 23, 0.2); }
.tech-item[data-tech="github"]:hover .tech-icon { fill: var(--brand-github); }
.tech-item[data-tech="github"]:hover span { color: var(--brand-github); }

.mobile-only {
  display: none !important;
}

/* =========================================
       7. PROYECTOS
========================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.card {
  background: var(--card-bg);
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: row;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-color: var(--primary);
}

.card-thumb {
  width: 140px;
  min-height: 100%;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--bg-color);
}

.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}

.card:hover .card-thumb img {
  transform: scale(1.05);
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  min-width: 0;
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.card p {
  color: var(--text-light);
  font-size: 0.9rem;
}

.status-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 1rem;
  width: fit-content;
}

.status-deployed {
  background-color: #dcfce7;
  color: #166534;
}

.status-dev {
  background-color: #fef9c3;
  color: #854d0e;
}

/* Card Styling */
.card-link {
  text-decoration: none;
  display: flex;
}

/* =========================================
       8. PERFIL DE USUARIO
========================================= */
.profile-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 4rem;
  background: var(--card-bg);
  padding: 3rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.profile-sidebar {
  text-align: center;
  border-right: 1px solid var(--border);
  padding-right: 2rem;
}

.profile-ring-wrapper {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  cursor: pointer;
}

.profile-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 4px solid white;
  box-shadow: none !important;
  position: relative;
  z-index: 2;
}

.ring-svg {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 216px;
  height: 216px;
  z-index: 1;
  transform: rotate(-90deg);
}

.ring-svg circle {
  fill: none;
  stroke-width: 6px;
}

.ring-bg {
  stroke: var(--border);
}

.ring-anim {
  stroke: var(--primary);
  stroke-dasharray: 654;
  stroke-dashoffset: 654;
  transition: stroke-dashoffset 0.6s ease-in-out;
}

#user-profile:hover .ring-anim {
  stroke-dashoffset: 0;
}

.bio-box h3,
.skills-box h3 {
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.label {
  font-weight: 600;
  color: var(--text-main);
  margin-right: 0.5rem;
}

.bio-text {
  color: var(--text-light);
  margin-top: 1.5rem;
  line-height: 1.8;
}

/* Profile and Stats */
.profile-stats {
  margin-top: 1rem;
}

/* =========================================
       9. HABILIDADES
========================================= */
.skills-category {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-light);
  margin: 1.5rem 0 0.6rem;
}

.skills-category:first-of-type {
  margin-top: 0;
}

.skills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-tag {
  display: inline-block;
  padding: 0.35rem 0.9rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
  background: rgba(37, 99, 235, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.25s ease;
  cursor: default;
}

/* Entrada escalonada */
.skill-tag {
  opacity: 0;
  transform: translateY(10px);
}

.skill-tag.tag-visible {
  animation: tag-pop 0.4s ease-out forwards;
}

/* Hover */
.skill-tag:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* Brillo en cadena (vecinos) */
.skill-tag.tag-glow {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.3);
}

/* Progress Bars */
.progress-initial {
  width: 0;
}

/* =========================================
       10. CONTACTO Y PIE DE PÁGINA
========================================= */
.network-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 600px;
  margin: 0 auto;
}

.data-row {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.data-row:last-child {
  border-bottom: none;
}

.value-link,
.social-links a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.social-links a {
  margin-left: 1rem;
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  width: 100%;
  padding: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  opacity: 0.7;
}

/* Contact Section */
.contact-intro {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 2rem;
}

.contact-section {
  text-align: center;
  margin-top: 2rem;
}

/* Contact Buttons */
.copy-email-btn {
  background-color: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}

/* =========================================
       KEYFRAMES
========================================= */
@keyframes blob-float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-15px, 15px) scale(0.95); }
}

@keyframes blob-float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-25px, 15px) scale(1.08); }
  66% { transform: translate(20px, -25px) scale(0.92); }
}

@keyframes fade-slide-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes tag-pop {
  0% { opacity: 0; transform: translateY(10px) scale(0.9); }
  70% { transform: translateY(-2px) scale(1.03); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(37, 99, 235, 0.3); }
  50% { box-shadow: 0 0 25px rgba(37, 99, 235, 0.5); }
}

/* Scroll-triggered reveal */
.section-reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.section-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* =========================================
       11. DISEÑO RESPONSIVO (Móvil)
========================================= */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: 1fr;
  }

  .hero-glass {
    padding: 2rem 1.2rem;
    border-radius: 16px;
  }

  .hero-blob--1 { width: 200px; height: 200px; }
  .hero-blob--2 { width: 180px; height: 180px; }
  .hero-blob--3 { width: 120px; height: 120px; }

  .tech-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.8rem !important;
    margin-bottom: 2rem;
  }

  .tech-item {
    width: 100% !important;
    padding: 0.8rem 0.4rem;
    border-radius: 12px;
  }

  .tech-icon {
    width: 36px;
    height: 36px;
  }

  .card {
    flex-direction: column;
  }

  .card-thumb {
    width: 100%;
    height: 160px;
    min-height: auto;
  }

  .mobile-toggle {
    display: block !important;
  }

  .mobile-toggle.active .bar:nth-child(2) {
    opacity: 0;
  }

  .mobile-toggle.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .mobile-toggle.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding: 0;
    border-bottom: none;
    z-index: 200;
  }

  .nav-links.active {
    display: flex;
    padding: 0.5rem 0 1.5rem;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    gap: 0;
  }

  .nav-links a {
    width: 100%;
    height: 60px;
    display: flex !important;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #f3f4f6;
    font-size: 1.1rem;
    margin: 0;
    padding: 0;
  }

  .nav-links .switch-mode {
    width: auto !important;
    height: auto !important;
    display: inline-flex !important;
    margin-top: 1rem !important;
    padding: 0.8rem 1.5rem !important;
    border-bottom: 1px solid #33ff33;
    border-radius: 6px;
  }

  .mobile-only {
    display: flex !important;
    flex-direction: column;
    align-items: center;
  }

  h1 {
    font-size: 2.5rem;
  }

  .tech-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
    margin-bottom: 2rem;
  }

  .tech-item {
    gap: 0.3rem;
  }

  .tech-icon {
    width: 40px;
    height: 40px;
  }

  .tech-item span {
    font-size: 0.7rem;
  }

  .profile-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
  }

  .profile-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 2rem;
  }

  .data-row {
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .social-links {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 0.2rem;
  }

  .social-links a {
    margin: 0 10px;
  }
}