/* ==========================================================================
   1. VARIABLES DE COLOR (Modo Oscuro por defecto vs Modo Claro)
   ========================================================================== */
:root {
  /* Modo Oscuro (Predeterminado) */
  --bg-color: #0c0506;          /* Fondo base */
  --bg-secondary: #160a0c;     /* Tarjetas y contenedores */
  --bg-tertiary: #220e12;      /* Elementos destacados / Hover */
  
  --text-main: #fce8e8;        /* Texto principal */
  --text-muted: #b38f8f;       /* Texto secundario */
  --white: #ffffff;
  
  /* Gama de Rojos */
  --accent: #ff3344;           /* Rojo neón principal */
  --accent-bright: #ff5566;    /* Rojo brillante (Hover/Destacados) */
  --accent-glow: rgba(255, 51, 68, 0.25); /* Resplandor */
  
  --header-bg: rgba(12, 5, 6, 0.92);
  --footer-bg: #060203;
  --shadow: 0 10px 30px -15px rgba(0, 0, 0, 0.9);
  --border-line: rgba(255, 51, 68, 0.15);
  --input-border: rgba(255, 51, 68, 0.2);
}

[data-theme="light"] {
  /* Modo Claro */
  --bg-color: #fcf8f8;
  --bg-secondary: #f4ecec;
  --bg-tertiary: #e8dada;
  
  --text-main: #2b1a1c;
  --text-muted: #735255;
  --white: #1a080a;            /* Títulos oscuros para mayor contraste */
  
  --accent: #d91428;
  --accent-bright: #ff2238;
  --accent-glow: rgba(217, 20, 40, 0.2);
  
  --header-bg: rgba(252, 248, 248, 0.92);
  --footer-bg: #efe2e3;
  --shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.1);
  --border-line: rgba(217, 20, 40, 0.15);
  --input-border: rgba(217, 20, 40, 0.25);
}

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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
}

/* ==========================================================================
   2. NAVBAR CON BOTÓN A LA IZQUIERDA
   ========================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-line);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.header__content {
  display: flex;
  justify-content: space-between; /* Botón a la izquierda, navegación a la derecha */
  align-items: center;
  padding: 1.2rem 3rem;
  width: 100%;
  box-sizing: border-box;
}

/* Botón Sol / Luna */
.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-line);
  color: var(--accent);
  font-size: 1.2rem;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

.theme-toggle:hover {
  transform: scale(1.1);
  color: var(--accent-bright);
  border-color: var(--accent);
}

.header__main {
  display: flex;
  justify-content: flex-end;
}

.header__links {
  display: flex;
  list-style: none;
  gap: 2.2rem;
  margin: 0;
  padding: 0;
}

.header__link {
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-main);
  transition: color 0.3s ease;
}

.header__link:hover {
  color: var(--accent);
  text-shadow: 0 0 8px var(--accent-glow);
}

/* ==========================================================================
   3. SECCIONES CON PROFUNDIDAD Y LÍNEAS DIVISORAS
   ========================================================================== */
.section {
  padding: 6rem 1.5rem 4rem;
  max-width: 1000px;
  margin: 0 auto;
  position: relative;
}

/* Línea horizontal divisora en degradado */
.section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(
    90deg, 
    transparent 0%, 
    var(--border-line) 50%, 
    transparent 100%
  );
}

.section-title {
  font-size: 2rem;
  color: var(--white);
  margin-bottom: 2.5rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 0;
  width: 60%;
  height: 2px;
  background-color: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

/* ==========================================================================
   4. HERO / PRESENTACIÓN (Ajuste preciso de la foto de perfil)
   ========================================================================== */
.hero-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 1px;
  background: linear-gradient(
    90deg, 
    transparent 0%, 
    var(--border-line) 50%, 
    transparent 100%
  );
}

.hero-container {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  width: 100%;
}

.hero-avatar-wrapper {
  flex-shrink: 0;
  width: 280px;
  height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Solución para fotos verticales no cuadradas (296x402) */
.hero-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 40%; /* Enfoca la parte superior/rostro de la foto */
  border: 3px solid var(--accent);
  box-shadow: 0 0 25px var(--accent-glow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.hero-avatar:hover {
  transform: scale(1.03);
  border-color: var(--accent-bright);
  box-shadow: 0 0 35px var(--accent-glow);
}

.hero-name { 
  color: var(--accent); 
  text-shadow: 0 0 12px var(--accent-glow);
}

.hero-content h1 {
  font-size: 2.8rem;
  color: var(--white);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.hero-content h2 {
  font-size: 1.5rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
  font-weight: 500;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 1.5rem;
}

.hero-socials {
  display: flex;
  gap: 1.5rem;
  font-size: 1.5rem;
  margin-bottom: 1.8rem;
}

.hero-socials a:hover {
  color: var(--accent);
  transform: translateY(-3px);
  filter: drop-shadow(0 0 5px var(--accent));
}

/* ==========================================================================
   5. BOTONES
   ========================================================================== */
.btn {
  display: inline-block;
  padding: 0.8rem 1.8rem;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.3s ease;
}

.btn-outline {
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
}

.btn-outline:hover {
  background: var(--accent-glow);
  border-color: var(--accent-bright);
  box-shadow: 0 0 15px var(--accent-glow);
}

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

.btn-primary:hover {
  background: var(--accent-bright);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* ==========================================================================
   6. CAREER & EDUCATION (Timeline)
   ========================================================================== */
.timeline {
  position: relative;
  max-width: 900px;
  margin: 2rem auto 0;
  padding-left: 20px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 39px;
  width: 2px;
  background: var(--border-line);
}

.timeline-item {
  position: relative;
  display: flex;
  gap: 1.8rem;
  margin-bottom: 2.5rem;
}

.timeline-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  z-index: 2;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.timeline-content {
  background: var(--bg-secondary);
  padding: 1.6rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  width: 100%;
  border: 1px solid var(--border-line);
  transition: transform 0.3s ease, border-color 0.3s ease, background-color 0.3s ease;
}

.timeline-content:hover {
  transform: translateY(-3px);
  background: var(--bg-tertiary);
  border-color: var(--accent);
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.timeline-role {
  color: var(--white);
  font-size: 1.25rem;
  font-weight: 600;
}

.timeline-company {
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
}

.timeline-date {
  color: var(--accent-bright);
  font-size: 0.85rem;
  background: var(--accent-glow);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: 500;
  border: 1px solid var(--border-line);
}

.timeline-location {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

.timeline-location i {
  color: var(--accent);
  margin-right: 4px;
}

.timeline-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.timeline-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.timeline-chips span {
  font-size: 0.75rem;
  color: var(--text-main);
  background: var(--accent-glow);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  border: 1px solid var(--border-line);
}

/* ==========================================================================
   7. SKILLS (TECHNICAL SKILLS & LANGUAGES)
   ========================================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  max-width: 950px;
  margin: 0 auto;
}

.skill-card {
  background: var(--bg-secondary);
  padding: 1.2rem 1.4rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-line);
  transition: all 0.3s ease;
}

.skill-card:hover {
  transform: translateY(-4px);
  background: var(--bg-tertiary);
  border-color: var(--accent);
  box-shadow: 0 8px 25px var(--accent-glow);
}

.skill-card__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-line);
  padding-bottom: 0.8rem;
}

.skill-icon {
  font-size: 2.2rem;
  color: var(--accent);
  transition: transform 0.3s ease, filter 0.3s ease;
}

.skill-card:hover .skill-icon {
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px var(--accent));
}

.skill-card__header h3 {
  color: var(--white);
  font-size: 1rem;
  font-weight: 600;
}

.skill-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.skill-list li {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.skill-list li i {
  color: var(--accent);
  font-size: 0.75rem;
}

/* ==========================================================================
   8. PROJECTS & ACTIVITIES
   ========================================================================== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-secondary);
  padding: 1.8rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--border-line);
  transition: all 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  background: var(--bg-tertiary);
  border-color: var(--accent);
  box-shadow: 0 10px 30px var(--accent-glow);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.project-icon { 
  font-size: 2rem; 
  color: var(--accent); 
}

.project-links a { font-size: 1.2rem; }
.project-links a:hover { 
  color: var(--accent-bright); 
  filter: drop-shadow(0 0 5px var(--accent));
}

.project-title { color: var(--white); margin-bottom: 0.2rem; }
.project-subtitle { color: var(--accent); font-size: 0.85rem; margin-bottom: 0.8rem; }
.project-description { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }

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

.project-tags span {
  font-size: 0.75rem;
  color: var(--text-main);
  background: var(--accent-glow);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border-line);
}

/* ==========================================================================
   9. CONTACT
   ========================================================================== */
.contact-section {
  padding: 6rem 1.5rem;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-line);
  transition: background 0.3s ease;
}

.contact-section::after {
  display: none;
}

.contact-content {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

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

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  text-align: left;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--white);
  font-size: 0.9rem;
}

.form-group input, .form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--input-border);
  background: var(--bg-color);
  color: var(--text-main);
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ==========================================================================
   10. FOOTER
   ========================================================================== */
.footer {
  background: var(--footer-bg);
  padding: 4rem 1.5rem 2rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-line);
  transition: background 0.3s ease;
}

.footer__container {
  max-width: 1000px;
  margin: 0 auto;
}

.footer__upper {
  display: flex;
  justify-content: space-between;
  margin-bottom: 3rem;
  flex-wrap: wrap;
  gap: 2rem;
}

.footer__title { color: var(--white); font-size: 1.2rem; margin-bottom: 0.5rem; }
.footer__desc { max-width: 400px; font-size: 0.9rem; }
.footer__socials { display: flex; gap: 1rem; font-size: 1.3rem; }
.footer__socials a:hover { 
  color: var(--accent); 
  transform: translateY(-2px);
}

.footer__lower {
  border-top: 1px solid var(--border-line);
  padding-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
}

/* ==========================================================================
   11. ADAPTACIÓN RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
  .header__links { display: none; }
  
  .header__content {
    padding: 1rem 1.5rem;
  }

  .hero-container {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .hero-avatar-wrapper {
    width: 200px;
    height: 200px;
  }

  .hero-content h1 { font-size: 2.2rem; }
  .hero-socials { justify-content: center; }
  
  .footer__upper { flex-direction: column; }
}

@media (max-width: 600px) {
  .timeline { padding-left: 0; }
  .timeline::before { left: 19px; }
  .timeline-icon { width: 32px; height: 32px; font-size: 0.9rem; }
  .timeline-item { gap: 1rem; }
}