/*
 * ========================================
 * 1. VARIABLES CSS 
 * ========================================
 */
:root {
  /* VARIABLES GENERALES */
  --color-dark-primary: #0A0E17;
  --color-black: #0A0E17;
  --color-white: #FFFFFF;
  --color-resalt-cian: #4ADEDE;
  
  /* VARIABLES DE FONDO */
  --color-bg-body: var(--color-black); 
  --color-bg-card: #1C253B;
  --color-bg-light: #F4F4F4;

  /* VARIABLES SOMBRA/CONTORNO Y TRANSICIONES */
  --shadow-hover: 0 0 10px rgba(74, 222, 222, 0.5);
  --transition-speed: 0.3s;
}

/*
 * ========================================
 * 2. ESTILOS BASE Y RESET
 * ========================================
 */
html {
  /* Base para rem (1rem = 10px) */
  font-size: 62.5%; 
}

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

body {
  font-family: Georgia, serif; 
  background-color: var(--color-bg-body); 
  color: var(--color-white);
  font-size: 1.6rem;
  line-height: 1.6;
}

/*
 * ========================================
 * 3. TIPOGRAFÍA Y ENLACES GENERALES
 * ========================================
 */

h1, h2 {
  color: var(--color-resalt-cian);
  text-shadow: none; 
}

p {
  color: var(--color-white);
}

a {
  text-decoration: none;
  /* Transición general para todos los enlaces */
  transition: color var(--transition-speed);
}

/*
 * ========================================
 * 4. HEADER Y NAVEGACIÓN
 * ========================================
 */

header {
  background-color: var(--color-black);
  padding: 2rem 3rem; 
  margin: 2rem auto 3rem; 
  display: flex; 
  flex-direction: row; 
  justify-content: space-between; 
  align-items: center; 
  max-width: 900px; 
  border-radius: 15px; 
  border: 1px solid var(--color-bg-card);
  transition: box-shadow var(--transition-speed) ease-in-out;
}

header:hover {
  box-shadow: var(--shadow-hover);
}

.header-titles {
  display: flex;
  flex-direction: column;
  text-align: left;
}

/* Estado inicial de la navegación (oculta en móvil/tablet) */
header nav {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.5s ease-in-out;
  padding: 0;
  margin: 0;
}

header nav ul {
  list-style: none;
  padding: 0;
  display: flex; 
  justify-content: flex-start; 
  gap: 1.5rem; 
  padding-left: 0;
}

header nav ul li a {
  color: var(--color-white);
  text-decoration: none;
  transition: color var(--transition-speed), outline var(--transition-speed);
}

header nav ul li a:hover,
header nav ul li a:focus {
  color: var(--color-resalt-cian);
  outline: 2px solid var(--color-resalt-cian);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Botón Hamburguesa */
.menu-toggle-checkbox {
  display: none; 
}

.menu-toggle {
  display: none; /* Se activa en media query max-width: 1023px */
  cursor: pointer;
  z-index: 1000;
  width: 30px;
  height: 24px;
  position: relative;
}

.menu-toggle .bar {
  display: block;
  width: 100%;
  height: 3px;
  margin: 5px 0;
  background-color: var(--color-white);
  transition: all 0.3s ease-in-out;
}

/* LÓGICA DE APERTURA Y CIERRE (CSS PURO) */
.menu-toggle-checkbox:checked ~ nav { 
  max-height: 300px; /* Despliega el menú */
}
.menu-toggle-checkbox:checked ~ .menu-toggle .bar:nth-child(2) {
  opacity: 0; 
}
.menu-toggle-checkbox:checked ~ .menu-toggle .bar:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.menu-toggle-checkbox:checked ~ .menu-toggle .bar:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}


/*
 * ========================================
 * 5. LAYOUT PRINCIPAL Y SECCIONES
 * ========================================
 */

main {
  max-width: 1400px; 
  margin: 0 auto;
  padding: 2rem; 
  background-color: var(--color-black);
  border-radius: 15px; 
  border: 1px solid var(--color-bg-card);
  transition: box-shadow var(--transition-speed) ease-in-out;
}

main:hover {
  box-shadow: var(--shadow-hover);
}

section {
  padding: 4rem 2rem;
  background-color: var(--color-bg-card);
  border-radius: 10px;
  transition: box-shadow var(--transition-speed) ease-in-out;
}

section:hover {
  box-shadow: var(--shadow-hover);
}

.intro-section,
#proyectos, 
#conocimientos,
#contacto {
  max-width: 900px; 
  margin: 2rem auto;
}

h2 {
  text-align: left;
  margin-bottom: 2rem; 
}


/*
 * ========================================
 * 6. SECCIÓN INTRODUCCIÓN Y SOBRE MÍ
 * ========================================
 */

.intro-section {
  display: flex;
  flex-direction: column; 
  align-items: center;
  gap: 3rem; 
  padding: 2rem; 
}

.mi-imagen {
  display: flex; 
  justify-content: center; 
  align-items: center; 
  max-width: 200px;
  height: 250px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--color-resalt-cian);
  transition: box-shadow var(--transition-speed) ease-in-out;
}

.mi-imagen:hover {
  box-shadow: var(--shadow-hover);
}

.mi-imagen img {
  width: 100%;
  height: 100%;
  border: 0.8rem solid var(--color-bg-card);
  box-shadow: 0 0 0 0.4rem var(--color-black);
  object-fit: cover;
}

#yo {
  display: block; 
  text-align: left; 
  margin: 0; 
  max-width: none;
  padding: 2rem; 
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-bg-card);
  border-radius: 10px; 
}


/*
 * ========================================
 * 7. SECCIÓN PROYECTOS (GRID LAYOUT)
 * ========================================
 */

.proyecto-lista {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 2rem;
  /* Móvil: 1 columna */
  grid-template-columns: minmax(0, 1fr); 
}

.proyecto-card {
  background-color: var(--color-black);
  border: 1px solid var(--color-bg-card);
  border-radius: 8px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.proyecto-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover); 
}

.proyecto-card h3 {
  color: var(--color-resalt-cian);
  font-size: 2rem;
}

/*
 * ========================================
 * 8. SECCIÓN CONOCIMIENTOS (GRID LAYOUT)
 * ========================================
 */

.conocimientos-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(2, 1fr); 
}

.skill-card {
    background-color: var(--color-black);
    border: 1px solid var(--color-bg-card);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start; 
    
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover); 
}

.skill-icon {
    width: 60px; 
    height: 60px;
    object-fit: contain;
    margin-bottom: 1rem;
}

.skill-card h3 {
    color: var(--color-resalt-cian);
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.skill-card p {
    font-size: 1.4rem;
    color: #b0c4de; 
}


/*
 * ========================================
 * 9. SECCIÓN CONTACTO (FLEXBOX)
 * ========================================
 */

.contacto-container {
  display: flex;
  flex-direction: column; 
  width: 100%;
  gap: 3rem; 
  padding-top: 2rem;
}

.contacto-info {
  flex: 1; 
  padding: 2rem;
  background-color: var(--color-black);
  border-radius: 8px;
  height: fit-content; 
  color: var(--color-white);
  font-weight: bold;
}

.contacto-info h3, .contact-form h3 {
  color: var(--color-resalt-cian);
  margin-bottom: 1.5rem;
  font-size: 2rem;
  text-align: center; 
}

/* ESTILOS DE ENLACES DE CONTACTO */
.contacto-info a {
    color: var(--color-white); 
    font-weight: normal;
}
.contacto-info a:hover {
    color: var(--color-resalt-cian); 
}

.contacto-info li {
  margin-bottom: 1.5rem;
  font-size: 1.7rem;
  list-style: none; 
}

.contacto-info li strong {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.8rem;
}

.contact-form {
  flex: 1; 
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 2rem;
  background-color: var(--color-black); 
  border-radius: 8px;
}

.contact-form label {
  font-weight: bold;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--color-white);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  padding: 1rem;
  border: 1px solid var(--color-bg-card);
  background-color: var(--color-bg-card);
  color: var(--color-white);
  border-radius: 5px;
  font-size: 1.6rem;
  width: 100%; 
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none; 
    border-color: var(--color-resalt-cian);
    box-shadow: 0 0 5px rgba(74, 222, 222, 0.8);
}

.contact-form textarea {
  resize: vertical;
}

.contact-form .button {
  margin-top: 2rem; 
  width: auto; 
  align-self: center; 
}


/*
 * ========================================
 * 10. BOTONES Y PIE DE PÁGINA
 * ========================================
 */

.button {
  display: inline-block;
  background-color: var(--color-bg-card);
  color: var(--color-resalt-cian);
  padding: 1rem 2rem; 
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid var(--color-resalt-cian);
  transition: all var(--transition-speed);
  cursor: pointer;
}

.button:hover {
  background-color: var(--color-resalt-cian);
  color: var(--color-black);
  box-shadow: none; 
}

#yo .button {
  margin-top: 2rem; 
}

footer {
  max-width: 900px; 
  margin: 3rem auto 2rem; 
  border-radius: 15px; 
  display: flex; 
  justify-content: center; 
  align-items: center; 
  padding: 1rem;
  background-color: var(--color-black);
  border: 1px solid var(--color-bg-card);
  transition: box-shadow var(--transition-speed) ease-in-out;
}

footer:hover {
  box-shadow: var(--shadow-hover);
}


/*
 * ========================================
 * 11. MEDIA QUERIES (RESPONSIVIDAD)
 * ========================================
 */

/* --- VISIBILIDAD DE MENÚ HAMBURGUESA (0px a 1023px) --- */
@media (max-width: 1023px) {

  /* HACE EL ÍCONO DE HAMBURGUESA VISIBLE */
  .menu-toggle {
    display: block; 
    flex-shrink: 0;
  }

  /* FUERZA EL HEADER A ENVOLVER EL CONTENIDO Y LA NAVEGACIÓN A OCUPAR TODO EL ANCHO */
  header {
      flex-wrap: wrap; 
  }
  
  header nav {
    width: 100%; 
    flex-basis: 100%;
  }

  /* ESTABLECE EL FORMATO DE LISTA VERTICAL */
  header nav ul {
    flex-direction: column; 
    gap: 1.5rem; 
    padding: 1rem 0 2rem; 
    background-color: var(--color-black); 
  }
}


/* --- LAYOUT PARA TABLET/LAPTOP PEQUEÑA (min-width: 768px) --- */
@media (min-width: 768px) {
  
  /* Secciones a dos columnas */
  .intro-section {
    flex-direction: row; 
    align-items: flex-start; 
    padding: 2rem; 
  }

  .mi-imagen {
    flex: 0 0 250px; 
  }
  
  /* GRID: Proyectos en 2 columnas */
  .proyecto-lista {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* GRID: Conocimientos en 3 columnas */
  .conocimientos-grid {
    grid-template-columns: repeat(3, 1fr); 
  }
  
  /* CONTACTO: Dos columnas de igual altura */
  .contacto-container {
    flex-direction: row; 
    align-items: stretch;
  }
  
  .contact-form .button {
    align-self: flex-start; 
  }

  .contacto-info h3, .contact-form h3 {
    text-align: left; 
  }
}


/* --- LAYOUT PARA ESCRITORIO ESTÁNDAR (min-width: 1024px) --- */
@media (min-width: 1024px) { 
  
  /* Desactiva el menú de hamburguesa y activa el horizontal */
  .menu-toggle {
    display: none;
  }
  
  header nav {
    max-height: initial;
    overflow: visible;
    flex-basis: auto;
  }
  
  /* Restablece la navegación horizontal */
  header nav ul {
    flex-direction: row;
  }
  
  /* CORRECCIÓN DE ANCHURA: Proyectos a 3 columnas para que sean más estrechos */
  .proyecto-lista {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* --- LAYOUT PARA ESCRITORIO GRANDE (min-width: 1400px) --- */
@media (min-width: 1400px) {
  
  /* GRID: Conocimientos en 4 columnas */
  .conocimientos-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
}


/* --- AJUSTES ESPECÍFICOS DE MÓVILES EXTREMOS (max-width: 500px) --- */
@media (max-width: 500px) {
  
  /* Proyecto y Conocimientos a 1 columna */
  .proyecto-lista {
    grid-template-columns: minmax(0, 1fr);
  }
  .conocimientos-grid {
    grid-template-columns: 1fr;
  }
  
  /* Ajustes estéticos */
  header, main, footer { 
    box-shadow: none;
    border-radius: 0;
    border: none;
    margin: 0;
  }
  main {
    padding: 1rem;
  }
}