/* ============================
   - ESTILOS GENERALES.
============================= */
:root {
  --dark: #071739;
  --primary: #4B6382;
  --secondary: #A4B5C4;
  --light: #CDD5DB;
  --accent: #A68868;
  --highlight: #E3C39D;
  --font-main: 'Segoe UI', sans-serif;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--dark);
  color: var(--light);
  line-height: 1.6;
  scroll-behavior: smooth;
}

/* ============================
   - HEADER.
============================= */
.header {
  position: sticky;
  top: 0;
  background-color: rgba(7, 23, 57, 0.95);
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.8rem;
  color: var(--highlight);
}

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

.nav-links a {
  text-decoration: none;
  color: var(--light);
  font-weight: 500;
  transition: color 0.3s;
}

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

/* Botón CV especial en navegación */
.btn-cv {
  background-color: var(--accent) !important;
  color: var(--dark) !important;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.3s, transform 0.2s;
}

.btn-cv:hover {
  background-color: var(--highlight) !important;
  transform: scale(1.05);
}

/* Hamburger Menu Button */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger .bar {
  width: 100%;
  height: 3px;
  background-color: var(--highlight);
  border-radius: 3px;
  transition: all 0.3s ease;
}

/* Animación cuando está activo */
.hamburger.active .bar:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

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

.hamburger.active .bar:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* ============================
   - SECCIONES.
============================= */
.seccion {
  padding: 4rem 0;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: auto;
}

/* ============================
   - PRESENTACION.
============================= */
.presentacion-contenido {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}

.texto {
  flex: 1 1 50%;
  text-align: center;
}

.texto h2 {
  font-size: 2.5rem;
  color: var(--highlight);
  margin-bottom: 1rem;
}

.foto {
  flex: 1 1 40%;
  display: flex;
  justify-content: center;
}

.foto-perfil {
  width: 470px;
  height: 200%;
  border-radius: 40%;
  border: 3px solid var(--highlight);
  display: flex;
  object-fit: contain;
}

/* ============================
   - PROYECTOS.
============================= */
.proyectos {
  background-color: #0d2240;
}

.proyectos h2 {
  font-size: 2.2rem;
  color: var(--highlight);
  margin-bottom: 1rem;
}

.subtexto {
  margin-bottom: 2rem;
  color: var(--secondary);
}

.grid-proyectos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.tarjeta-proyecto {
  background-color: var(--primary);
  padding: 1.5rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s;
  /* Flexbox para alinear botones al fondo */
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.tarjeta-proyecto:hover {
  transform: translateY(-5px);
}

/* Ranking Badge */
.ranking-badge {
  display: inline-block;
  background-color: var(--accent);
  color: var(--dark);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.8rem;
}

/* Project Description */
.proyecto-desc {
  font-size: 0.95rem;
  color: var(--light);
  margin-bottom: 1rem;
  line-height: 1.5;
}

/* Tech Tags */
.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.tag {
  background-color: var(--dark);
  color: var(--secondary);
  padding: 0.3rem 0.7rem;
  border-radius: 15px;
  font-size: 0.8rem;
  border: 1px solid var(--secondary);
}

/* Highlighted Cards (Top 3) */
.tarjeta-proyecto.destacado {
  border: 2px solid var(--highlight);
  background: linear-gradient(145deg, var(--primary), #3a5068);
}

.tarjeta-proyecto.destacado .ranking-badge {
  background-color: var(--highlight);
}

/* ============================
   - BOTON VISITAR PAGINAS.
============================= */
.btn-visitar {
  display: inline-block;
  background-color: var(--accent);
  color: var(--dark);
  padding: 0.8rem 1.5rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: bold;
  margin-top: auto;
  /* Empuja el botón al fondo de la tarjeta */
  transition: background 0.3s;
}

.btn-visitar:hover {
  background-color: var(--highlight);
}

/* ============================
   - CERTIFICACIONES.
============================= */
.certificaciones {
  background-color: var(--dark);
  padding: 5rem 0;
  position: relative;
}

/* Línea decorativa superior */
.certificaciones::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--highlight), transparent);
}

.certificaciones h2 {
  font-size: 2.2rem;
  color: var(--highlight);
  margin-bottom: 0.5rem;
  text-align: center;
}

.certificaciones .subtexto {
  text-align: center;
  margin-bottom: 2.5rem;
}

.certificado-container {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.certificado-card {
  background: linear-gradient(145deg, var(--primary), #3a5068);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  max-width: 650px;
  border: 2px solid var(--highlight);
  transition: transform 0.3s, box-shadow 0.3s;
}

.certificado-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 50px rgba(227, 195, 157, 0.2);
}

.certificado-img {
  width: 100%;
  height: auto;
  display: block;
}

.certificado-info {
  padding: 1.5rem;
  text-align: center;
  background-color: rgba(7, 23, 57, 0.6);
}

.certificado-info h3 {
  color: var(--highlight);
  margin-bottom: 0.5rem;
  font-size: 1.3rem;
}

.certificado-info p {
  margin: 0.3rem 0;
}

.certificado-fecha {
  display: inline-block;
  background-color: var(--accent);
  color: var(--dark);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: bold;
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* ============================
   - CONTACTO.
============================= */
.contacto {
  text-align: center;
  background-color: #0d2240;
  padding: 5rem 0;
  position: relative;
}

/* Línea decorativa superior */
.contacto::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--highlight), transparent);
}

.contacto h2 {
  font-size: 2.2rem;
  margin-bottom: 1rem;
  color: var(--highlight);
}

.info-contacto {
  list-style: none;
  margin: 1rem 0;
  line-height: 2;
}

/* ============================
   - BOTONES CONTACTO.
============================= */
.btn-contacto {
  display: inline-block;
  background-color: var(--accent);
  color: var(--dark);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 1.5rem;
  transition: background 0.3s;
}

.btn-contacto:hover {
  background-color: var(--highlight);
}

.btn-github {
  display: inline-block;
  background-color: var(--accent);
  color: var(--dark);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 1.5rem;
  transition: background 0.3s;
}

.btn-github:hover {
  background-color: var(--highlight);
}

.btn-instagram {
  display: inline-block;
  background-color: var(--accent);
  color: var(--dark);
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin-top: 1.5rem;
  transition: background 0.3s;
}

.btn-instagram:hover {
  background-color: var(--highlight);
}

/* ============================
   - FOOTER.
============================= */
.footer {
  background-color: var(--dark);
  text-align: center;
  padding: 1rem 0;
  color: var(--secondary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

/* ============================
   - BOTON VOLVER ARRIBA.
============================= */
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background-color: var(--accent);
  color: var(--dark);
  border: none;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  background-color: var(--highlight);
  transform: translateY(-5px);
}

/* ============================
   - ANIMACIONES.
============================= */
.fade-in {
  animation: fadeIn 1.5s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================
   - RESPONSIVE
============================= */
@media screen and (max-width: 768px) {
  body {
    font-size: 16px;
    padding: 0 1rem;
    overflow-x: hidden;
    align-content: center;
  }

  header {
    padding: 1rem 0;
  }

  .nav {
    flex-wrap: wrap;
    position: relative;
  }

  .logo {
    font-size: 1.4rem;
  }

  /* Mostrar hamburger en mobile */
  .hamburger {
    display: flex;
  }

  /* Ocultar nav-links por defecto en mobile */
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: rgba(7, 23, 57, 0.98);
    padding: 1rem;
    gap: 0.5rem;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1000;
  }

  /* Mostrar nav-links cuando está activo */
  .nav-links.active {
    display: flex;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links li a {
    font-size: 1.1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    display: block;
    background-color: var(--primary);
    color: var(--light);
    transition: background 0.3s;
  }

  .nav-links li a:hover {
    background-color: var(--accent);
    color: var(--dark);
  }

  .nav-links .btn-cv {
    background-color: var(--accent) !important;
    color: var(--dark) !important;
  }

  .presentacion-contenido {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
  }

  .texto h2 {
    font-size: 1.8rem;
  }

  .texto p {
    font-size: 1rem;
    line-height: 1.6;
    padding: 0.1rem;
  }

  .foto img.foto-perfil {
    width: 300px;
    height: auto;
    border-radius: 40%;
    object-fit: cover;
    margin-top: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
  }

  .foto img.foto-perfil:hover {
    transform: scale(1.05);
  }

  .grid-proyectos {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }

  .contacto {
    padding: 3rem 1rem;
    text-align: center;
  }

  .contacto h2 {
    font-size: 1.8rem;
  }

  .contacto p,
  .info-contactol li {
    font-size: 1rem;
  }

  .info-contacto {
    padding: 0;
    margin: 1.5rem 0;
  }

  .btn-github,
  .btn-contacto,
  .btn-instagram {
    width: 100%;
    margin: 0.5rem 0;
    font-size: 1rem;
  }

  .footer {
    padding: 1rem 0;
    text-align: center;
    background-color: var(--dark);
    color: var(--secondary);
    font-size: 0.9rem;
    margin-top: 2rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  }

  .footer p {
    margin: 0;
  }
}