/* ============================================================
   VARIABLES PRINCIPALES – TEMA MATRIX VERDE
   ============================================================ */
:root {
  --bg-main: #050806;
  --bg-elevated: #0c130f;

  /* Verde neon matrix */
  --accent: #00ff85;
  --accent-soft: rgba(0, 255, 133, 0.25);

  /* Texto más verdoso */
  --text-main: #e8ffe8;
  --text-muted: #7affc4;

  --border-soft: #1a2a22;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

/* ============================================================
   RESETEO GENERAL
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: radial-gradient(circle at top left, #0b1f17 0%, #050806 60%);
  color: var(--text-main);
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
}

/* ============================================================
   PRELOADER
   ============================================================ */
#preloader {
  position: fixed;
  inset: 0;
  background: #050806;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   LAYOUT (SIDEBAR + CONTENIDO)
   ============================================================ */
.layout {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  background: rgba(5, 8, 6, 0.95);
  padding: 2.5rem 1.6rem;
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.avatar {
  display: flex;
  justify-content: center;
}

/* FOTO CON GLOW VERDE */
.avatar-img {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 18px rgba(0, 255, 133, 0.5);
  animation: avatarGlow 3s infinite ease-in-out;
}

@keyframes avatarGlow {
  0% { box-shadow: 0 0 12px rgba(0, 255, 133, 0.3); }
  50% { box-shadow: 0 0 25px rgba(0, 255, 133, 0.7); }
  100% { box-shadow: 0 0 12px rgba(0, 255, 133, 0.3); }
}

.name {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
}

.role {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* NAV LINKS */
.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.nav-link {
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  text-decoration: none;
  border-radius: 999px;
  transition: 0.2s ease;
}

.nav-link:hover {
  color: var(--accent);
  background: rgba(0, 255, 133, 0.07);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* FOOTER EN SIDEBAR */
.sidebar-footer {
  margin-top: auto;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.sidebar-footer a {
  text-decoration: none;
  color: var(--accent);
  font-size: 1.4rem;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  transition: 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-footer a:hover {
  border-color: var(--accent);
  background: rgba(0, 255, 133, 0.1);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(0, 255, 133, 0.4);
}

/* ============================================================
   CONTENIDO GENERAL
   ============================================================ */
.content {
  padding: 3rem;
}

.section {
  margin-bottom: 4rem;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--accent);
}

.section-line {
  width: 55px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 10px;
  margin: 0.4rem 0 1.4rem;
}

/* ============================================================
   HERO
   ============================================================ */
.hero-section {
  background: radial-gradient(circle at top left, #134d35 0%, #0b1f17 60%);
  padding: 3rem 2rem;
  border-radius: var(--radius-lg);
  margin-bottom: 4rem;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(0, 255, 133, 0.08);
}

/* FONDO DEL HERO (YA NO BLOQUEA CLICS) */
.hero-bg {
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 15% 5%, rgba(0, 255, 133, 0.15), transparent 60%),
    radial-gradient(circle at 85% 90%, rgba(0, 180, 120, 0.18), transparent 60%);
  pointer-events: none;   /* 🔥 NO CAPTA CLICS */
  z-index: 0;
}

/* CONTENIDO DEL HERO SOBRE EL FONDO */
.hero-content {
  position: relative;
  z-index: 1;             /* 🔥 SE VE Y SE CLICKEA ENCIMA DEL FONDO */
  max-width: 600px;
}

.hero-title {
  font-size: 2.7rem;
  margin-bottom: 0.4rem;
}

.hero-title span {
  color: var(--accent);
}

.hero-subtitle {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.hero-dynamic {
  color: #a4ffd6;
  min-height: 1.3rem;
  margin-bottom: 1.2rem;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  padding: 0.6rem 1.4rem;
  border-radius: 999px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: 0.2s ease;
  border: 1px solid transparent;
}

.primary-btn {
  background: var(--accent);
  color: #000;
}

.primary-btn:hover {
  background: #1aff90;
}

.ghost-btn {
  border: 1px solid var(--border-soft);
  color: var(--text-main);
}

.ghost-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   GRIDS Y UTILIDADES
   ============================================================ */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.info-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
  color: var(--text-muted);
}

.info-list span {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   SKILLS (CORREGIDO)
   ============================================================ */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1.2rem;
}

.skill-block {
  background: #0b281c;
  padding: 1.2rem;
  border-radius: var(--radius-lg);
  border: 1px solid #1b3c2b;
  box-shadow: 0 0 10px rgba(0, 255, 133, 0.06);
}

/* FIX COMPLETO DE DESCUDRE EN TAGS */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.tags span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.8rem;
  background: rgba(0, 255, 133, 0.10);
  border: 1px solid rgba(0, 255, 133, 0.25);
  color: var(--accent);
  font-size: 0.78rem;
  border-radius: 999px;
  white-space: nowrap;
}

/* ============================================================
   PROYECTOS
   ============================================================ */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.4rem;
}

.project-card {
  background: #0b281c;
  padding: 1.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid #1a3a29;
  box-shadow: 0 0 14px rgba(0, 255, 133, 0.08);
}

.project-tag {
  color: var(--accent);
  font-size: 0.85rem;
}

.project-desc {
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.project-links a {
  padding: 0.4rem 0.9rem;
  text-decoration: none;
  color: var(--text-muted);
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  transition: 0.2s ease;
}

.project-links a:hover {
  color: var(--accent);
  background: rgba(0, 255, 133, 0.07);
  border-color: var(--accent);
}

/* ============================================================
   CONTACTO + FORMULARIO
   ============================================================ */
.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
}

.contact-form {
  background: #0b281c;
  padding: 1.3rem;
  border-radius: var(--radius-lg);
  border: 1px solid #1a3a29;
  display: grid;
  gap: 0.8rem;
}

.contact-form input,
.contact-form textarea {
  background: #05140d;
  color: var(--text-main);
  border: 1px solid #175033;
  border-radius: var(--radius-md);
  padding: 0.6rem;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
}

.contact-form label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.form-alert {
  background: rgba(0, 255, 133, 0.15);
  border: 1px solid var(--accent);
  padding: 0.8rem 1rem;
  color: var(--accent);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.hidden {
  display: none;
}

.close-alert {
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 1.3rem;
  cursor: pointer;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  margin-top: 3rem;
  padding-top: 1.4rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-soft);
  text-align: center;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 1rem 1.3rem;
    border-bottom: 1px solid var(--border-soft);
    gap: 1rem;
  }

  .nav-links {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .content {
    padding: 1.5rem;
  }

  .grid-2,
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .hero-buttons {
    flex-direction: column;
  }
}
