/* ==========================================================================
   VARIABLES & PALETA DE COLORES
   ========================================================================== */
:root {
  /* Colores Base del Cliente */
  --brand-primary: rgb(91, 200, 0);
  --brand-primary-hover: rgb(75, 170, 0);
  --brand-secondary: #C3C3C3;
  --brand-tertiary: #1E1E1E;
  --font-main: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --max-width: 1200px;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-full: 9999px;
  --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* TEMA OSCURO (Por defecto) */
[data-theme="dark"] {
  --bg-body: var(--brand-tertiary);
  --bg-card: rgba(35, 35, 35, 0.7);
  --bg-card-hover: rgba(45, 45, 45, 0.9);
  --bg-nav: rgba(30, 30, 30, 0.8);
  --text-main: #FFFFFF;
  --text-muted: var(--brand-secondary);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-hover: var(--brand-primary);
  --shadow-color: rgba(0, 0, 0, 0.5);
  --glow-color: rgba(91, 200, 0, 0.12);
}

/* TEMA CLARO */
[data-theme="light"] {
  --bg-body: #F4F6F8;
  --bg-card: #FFFFFF;
  --bg-card-hover: #FFFFFF;
  --bg-nav: rgba(244, 246, 248, 0.85);
  --text-main: #141414;
  --text-muted: #555555;
  --border-color: rgba(0, 0, 0, 0.1);
  --border-hover: var(--brand-primary);
  --shadow-color: rgba(0, 0, 0, 0.06);
  --glow-color: rgba(91, 200, 0, 0.15);
}

/* RESET & BASE */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-main);
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
  position: relative;
}

/* Luz ambiental superior */
.bg-glow {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1000px;
  height: 500px;
  background: radial-gradient(circle, var(--glow-color) 0%, rgba(0, 0, 0, 0) 70%);
  z-index: -1;
  pointer-events: none;
  filter: blur(80px);
}

/* ==========================================================================
   ENCABEZADO & NAVEGACIÓN
   ========================================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border-color);
  transition: background 0.3s ease;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: -0.5px;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--brand-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.theme-toggle:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.btn-personal {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-primary);
  color: #1E1E1E;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  transition: var(--transition);
}

.btn-personal:hover {
  background: var(--brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(91, 200, 0, 0.3);
}

/* ==========================================================================
   HERO SECTION (OBJETIVO)
   ========================================================================== */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: rgba(91, 200, 0, 0.1);
  border: 1px solid var(--brand-primary);
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand-primary);
  margin-bottom: 1.5rem;
}

.hero-title {
  font-size: clamp(2.2rem, 5vw, 4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
  margin-bottom: 1.5rem;
  max-width: 900px;
}

.highlight-text {
  color: var(--brand-primary);
}

.hero-objective {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--text-muted);
  max-width: 780px;
  margin-bottom: 2.5rem;
}

/* ==========================================================================
   SECCIÓN BENEFICIOS Y CONTRIBUCIÓN
   ========================================================================== */
.info-section {
  max-width: var(--max-width);
  margin: 0 auto 5rem;
  padding: 0 1.5rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition);
  box-shadow: 0 4px 20px var(--shadow-color);
}

.info-card:hover {
  border-color: var(--brand-primary);
  transform: translateY(-4px);
}

.info-icon {
  width: 48px;
  height: 48px;
  background: rgba(91, 200, 0, 0.1);
  color: var(--brand-primary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.info-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.info-card p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
}

/* ==========================================================================
   SECCIÓN DE PROYECTOS (OPEN SOURCE)
   ========================================================================== */
.projects-section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
}

.section-header {
  margin-bottom: 2.5rem;
  text-align: left;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  box-shadow: 0 4px 20px var(--shadow-color);
}

.project-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--brand-primary);
  transform: translateY(-4px);
}

.project-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.project-logo-slot {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(91, 200, 0, 0.08);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  overflow: hidden;
}

.project-logo-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.project-description {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tag {
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  color: var(--text-muted);
}

.project-footer {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-project {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  transition: var(--transition);
}

.btn-project:hover {
  color: var(--brand-primary);
}

/* ==========================================================================
   FOOTER (NUEVA ESTRUCTURA)
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 4rem 1.5rem 2.5rem;
  background: rgba(0, 0, 0, 0.15);
  background-color: transparent;
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 450px;
}

.footer-socials {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  transition: var(--transition);
  text-decoration: none;
}

.social-link:hover {
  color: var(--brand-primary);
  border-color: var(--brand-primary);
  transform: translateY(-3px);
  box-shadow: 0 4px 12px var(--shadow-color);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-link {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  text-decoration: underline;
}

#scrollToTopBtn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background-color: #1e293b;
  /* Color oscuro elegante (Slate) */
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  z-index: 1000;

  /* Transiciones para suavizar la aparición y el hover */
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Estado visible cuando se hace scroll */
#scrollToTopBtn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Efecto al pasar el cursor (Hover) */
#scrollToTopBtn:hover {
  background-color: #0f172a;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

/* Efecto al hacer clic */
#scrollToTopBtn:active {
  transform: translateY(-1px);
}

/* ==========================================================================
   RESPONSIVIDAD
   ========================================================================== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero {
    padding-top: 3.5rem;
  }

  .nav-container {
    padding: 0.8rem 1rem;
  }

  .btn-personal span {
    display: none;
  }

  .btn-personal {
    padding: 0.55rem;
    border-radius: 50%;
  }

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}