/* =========================================
   1. VARIABLES Y TEMA
   ========================================= */
:root {
  --bg-color: #f4f7f6;
  --text-color: #333;
  --primary: #29b3db;
  --secondary: #9a5ae8;
  --accent: #ff3670;
  --card-bg: #fff;
  --font-main: "Poppins", sans-serif;
  --font-alt: "Nunito", sans-serif;
  --nav-bg: rgba(255, 255, 255, 0.8);
  --nav-border: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0d1117;
    --text-color: #c9d1d9;
    --card-bg: #161b22;
    --primary: #58a6ff;
    --secondary: #bc8cff;
    --nav-bg: rgba(22, 27, 34, 0.7);
    --nav-border: rgba(255, 255, 255, 0.1);
  }
}

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

body {
  font-family: var(--font-main);
  background: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  transition: background 0.3s ease;
  padding-top: 80px; /* Espacio para el nav fijo */
}

/* =========================================
   2. NAVBAR FLOTANTE (ESTILO CÁPSULA)
   ========================================= */
.navegacion-flotante {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 900px;
  height: 60px;
  background: var(--nav-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--nav-border);
  border-radius: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 25px;
  z-index: 1000;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.logo-nav {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--primary);
  letter-spacing: 1px;
}

.enlaces-nav {
  display: flex;
  gap: 25px;
  list-style: none;
}

.enlaces-nav a {
  text-decoration: none;
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 500;
  transition: 0.3s;
  opacity: 0.8;
}

.enlaces-nav a:hover {
  color: var(--primary);
  opacity: 1;
}

.idioma-nav {
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.7;
}
.idioma-nav .activo {
  font-weight: bold;
  color: var(--text-color);
  opacity: 1;
}

/* Responsive Nav */
@media (max-width: 768px) {
  .enlaces-nav {
    display: none;
  } /* Ocultar links en móvil para simplificar sin JS */
  .navegacion-flotante {
    justify-content: center;
  }
  .logo-nav {
    margin-right: auto;
  }
  .idioma-nav {
    margin-left: auto;
  }
}

/* =========================================
   3. HERO & ANIMACIONES
   ========================================= */
section {
  min-height: auto; /* Permitir que la altura se ajuste al contenido si es necesario */
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  view-timeline-name: --section-scroll;
}

header {
  height: 90vh; /* Ajuste por el nav */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: radial-gradient(
    circle at center,
    rgba(41, 179, 219, 0.1),
    transparent 70%
  );
}

h2.titulo-seccion {
  font-size: 2.5rem;
  margin-bottom: 20px;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  color: transparent;
  font-family: var(--font-alt);
  font-weight: 800;
}

/* Animaciones Scroll */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.revelar-desplazamiento {
  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 10% cover 30%;
}
.revelar-desplazamiento-derecha {
  animation: fadeInUp linear both;
  animation-timeline: view();
  animation-range: entry 10% cover 30%;
}
@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
.zoom-desplazamiento {
  animation: scaleIn linear both;
  animation-timeline: view();
  animation-range: entry 10% cover 30%;
}

/* Hero Texto */
h1 {
  font-size: 3.5rem;
  margin-bottom: 10px;
  font-weight: 800;
}
.contenedor-escritura {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 3px solid var(--accent);
  font-size: 1.2rem;
  color: var(--accent);
  width: 0;
  animation:
    typing 3.5s steps(40, end) forwards,
    blink 0.75s step-end infinite;
}
@keyframes typing {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}
@keyframes blink {
  from,
  to {
    border-color: transparent;
  }
  50% {
    border-color: var(--accent);
  }
}

.pegatinas-principales {
  margin-top: 20px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.pegatina {
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: bold;
  color: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.pegatina-angular {
  background: #dd0031;
}
.pegatina-ionic {
  background: #3880ff;
}
.pegatina-java {
  background: #f7df1e;
}
.pegatina-dotnet {
  background: #007acc;
}
.pegatina-cloud {
  background: #29b3db;
}

.pegatina-react {
  background: #20232a;
  color: #61dafb;
}
.pegatina-next {
  background: #000;
  border: 1px solid #fff;
}
.pegatina-ia {
  background: linear-gradient(45deg, #ff00cc, #333399);
}
.indicador-desplazamiento {
  position: absolute;
  bottom: 30px;
  font-size: 2rem;
  animation: bounce 2s infinite;
}
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-20px);
  }
  60% {
    transform: translateY(-10px);
  }
}

/* =========================================
   4. SECCIONES: SOBRE MÍ, EXP, FORMACIÓN
   ========================================= */

/* Flip Card */
.cuadricula-sobre-mi {
  display: flex;
  gap: 50px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1000px;
}
.contenedor-voltear {
  width: 300px;
  height: 400px;
  perspective: 1000px;
}
.interior-voltear {
  width: 100%;
  height: 100%;
  transition: transform 0.8s;
  transform-style: preserve-3d;
  position: relative;
}
.contenedor-voltear:hover .interior-voltear {
  transform: rotateY(180deg);
}
.frente-voltear,
.dorso-voltear {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  background: var(--card-bg);
}
.frente-voltear img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.dorso-voltear {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  border: 2px solid var(--primary);
}
.texto-sobre-mi {
  max-width: 500px;
  line-height: 1.6;
}

/* Timeline (Experiencia) */
.linea-tiempo {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
}
.linea-tiempo::after {
  content: "";
  position: absolute;
  width: 2px;
  background: var(--primary);
  top: 0;
  bottom: 0;
  left: 20px; /* Linea a la izquierda */
}
.item-linea-tiempo {
  padding: 10px 40px;
  position: relative;
  margin-bottom: 30px;
}
.punto-linea-tiempo {
  width: 16px;
  height: 16px;
  background: var(--secondary);
  position: absolute;
  left: 13px;
  top: 15px;
  border-radius: 50%;
  z-index: 10;
  border: 3px solid var(--bg-color);
}
.contenido-linea-tiempo {
  background: var(--card-bg);
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--secondary);
}
.fecha-linea-tiempo {
  font-size: 0.8rem;
  color: var(--text-color);
  opacity: 0.7;
  font-weight: bold;
  display: block;
  margin-bottom: 10px;
}

/* Educación Cards */
.cuadricula-educacion {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.tarjeta-educacion {
  background: var(--card-bg);
  padding: 30px;
  border-radius: 15px;
  width: 250px;
  text-align: center;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
  border-top: 5px solid var(--primary);
  transition: 0.3s;
}
.tarjeta-educacion:hover {
  transform: translateY(-5px);
}
.estado-educacion {
  display: inline-block;
  margin-top: 15px;
  padding: 5px 15px;
  border-radius: 20px;
  font-size: 0.8rem;
  background: rgba(41, 179, 219, 0.1);
  color: var(--primary);
  font-weight: bold;
}
.estado-educacion.finalizado {
  background: rgba(40, 167, 69, 0.1);
  color: #28a745;
}

/* Skills Glass */
.contenedor-cristal {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
}
.cristal {
  width: 160px;
  height: 200px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 15px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: 0.5s;
  transform: rotate(calc(var(--r) * 1deg));
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}
.cristal:hover {
  transform: rotate(0deg) scale(1.1) translateY(-10px);
  z-index: 10;
  background: rgba(255, 255, 255, 0.1);
}
.icono-habilidad {
  width: 60px;
  height: 60px;
  margin-bottom: 15px;
}

/* =========================================
   5. PROYECTOS & CONTACTO
   ========================================= */
.cuadricula-proyectos {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  width: 100%;
  max-width: 1200px;
}

/* Layout en Cruz para escritorio (4 cartas) */
@media (min-width: 1024px) {
  .cuadricula-proyectos {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto; /* Solo 2 filas */
    justify-items: center;
    align-items: center;
  }

  .tarjeta-proyecto {
    width: 100%;
    max-width: 380px;
  }

  .tarjeta-proyecto:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
  }
  .tarjeta-proyecto:nth-child(2) {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .tarjeta-proyecto:nth-child(3) {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }
  .tarjeta-proyecto:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
  }
}
.tarjeta-proyecto {
  flex: 1 1 300px;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
}
.tarjeta-proyecto:hover {
  transform: translateY(-10px);
}
.contenedor-imagen-tarjeta {
  height: 160px;
  background: #20232a;
  overflow: hidden;
}
.imagen-proyecto {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s;
}
.tarjeta-proyecto:hover .imagen-proyecto {
  transform: scale(1.1);
}
.contenido-tarjeta {
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.contenido-tarjeta h3 {
  margin-bottom: 10px;
  color: var(--text-color);
}
.contenido-tarjeta p {
  font-size: 0.9rem;
  margin: 10px 0 20px 0;
  opacity: 0.8;
  flex-grow: 1;
}
.etiqueta {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 5px;
  font-size: 0.75rem;
  background: rgba(154, 90, 232, 0.1);
  color: var(--secondary);
  margin-right: 5px;
  border: 1px solid var(--secondary);
}
.boton-proyecto {
  text-decoration: none;
  padding: 10px;
  text-align: center;
  border-radius: 5px;
  font-weight: bold;
  background: var(--text-color);
  color: var(--bg-color);
  transition: 0.3s;
}
.boton-proyecto:hover {
  opacity: 0.8;
}
/* Estilos Project Cards */
.tarjeta-neon {
  border: 1px solid var(--primary);
  box-shadow: 0 0 10px rgba(41, 179, 219, 0.2);
}
.tarjeta-cristal {
  border: 1px solid var(--secondary);
}
.tarjeta-limpia {
  border-left: 5px solid #28a745;
}
.tarjeta-ludica {
  border-bottom: 5px solid #ff9800;
}

/* Contacto */
.contacto-principal {
  width: 350px;
  height: 500px;
  background: linear-gradient(to bottom, #161b22, #0d1117);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 5px 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  border: 1px solid var(--primary);
}
#chk {
  display: none;
}
.registro {
  position: relative;
  width: 100%;
  height: 100%;
}
.registro label,
.inicio-sesion label {
  color: var(--primary);
  font-size: 2em;
  justify-content: center;
  display: flex;
  margin: 40px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.5s ease-in-out;
}
.registro input,
.registro textarea {
  width: 60%;
  background: #e0dede;
  margin: 10px auto;
  display: block;
  padding: 10px;
  border: none;
  border-radius: 5px;
}
.registro input {
  height: 40px;
}
.registro button {
  width: 60%;
  height: 40px;
  margin: 20px auto;
  display: block;
  background: var(--primary);
  color: #fff;
  border: none;
  font-weight: bold;
  cursor: pointer;
  border-radius: 5px;
}
.inicio-sesion {
  height: 460px;
  background: #eee;
  border-radius: 60% / 10%;
  transform: translateY(-180px);
  transition: 0.8s ease-in-out;
}
.inicio-sesion label {
  color: #333;
  transform: scale(0.6);
}
#chk:checked ~ .inicio-sesion {
  transform: translateY(-500px);
}
#chk:checked ~ .inicio-sesion label {
  transform: scale(1);
}
#chk:checked ~ .registro label {
  transform: scale(0.6);
}
.contenedor-enlaces-sociales {
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  margin-top: 20px;
}
.boton-social {
  width: 60%;
  padding: 10px;
  text-align: center;
  text-decoration: none;
  color: white;
  border-radius: 5px;
  font-weight: bold;
}
.linkedin {
  background: #0077b5;
}
.github {
  background: #333;
}
.instagram {
  background: #d62976;
}

/* Footer */
footer {
  height: 250px;
  background: #000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  color: white;
}
.caja-pie-pagina span {
  font-size: 3em;
  font-weight: bold;
  display: inline-block;
  transition: 0.5s;
  color: var(--secondary);
}
.caja-pie-pagina:hover span {
  transform: translateY(-20px);
  color: var(--primary);
  text-shadow: 0 0 20px var(--primary);
}
