/* --- VARIABLES Y RESET --- */
:root {
  --bg-dark: #0f172a;
  /* Fondo principal oscuro */
  --bg-card: #1e293b;
  /* Fondo de tarjetas */
  --text-main: #e2e8f0;
  /* Texto blanco/gris claro */
  --text-muted: #94a3b8;
  /* Texto secundario */
  --accent: #00ffa3;
  /* VERDE BRILLANTE (Tu color de marca) */
  --accent-hover: #00d48a;
  --font-main: "Segoe UI", system-ui, sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-main);
  line-height: 1.6;
  overflow-x: hidden;
  width: 100%;
}

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

ul {
  list-style: none;
}

/* --- NAVBAR --- */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 5%;
  position: sticky;
  top: 0;
  background-color: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.navbar nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.navbar nav a:hover {
  color: var(--accent);
}

.btn-contact {
  border: 2px solid var(--accent);
  padding: 0.5rem 1.2rem;
  border-radius: 5px;
  color: var(--accent);
  font-weight: 600;
}

.btn-contact:hover {
  background-color: var(--accent);
  color: var(--bg-dark) !important;
}

/* --- HERO SECTION --- */
.hero {
  min-height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.photo-container {
  width: 165px;
  height: 165px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--accent);
  margin: 0 auto 1.5rem;
  box-shadow: 0 0 25px rgba(0, 255, 163, 0.4);
  aspect-ratio: 1 / 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--bg-card);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.photo-container:hover {
  transform: scale(1.05);
  box-shadow: 0 0 35px rgba(0, 255, 163, 0.6);
}

.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.title {
  font-size: clamp(2.3rem, 8vw, 3.8rem);
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.subtitle {
  font-size: clamp(1.1rem, 4vw, 1.6rem);
  color: var(--text-main);
  font-weight: 400;
  margin-bottom: 1.5rem;
  line-height: 1.4;
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.bio {
  max-width: 600px;
  color: var(--text-muted);
  font-size: clamp(0.95rem, 3vw, 1.1rem);
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}

.btn-cv {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background-color: transparent;
  color: var(--accent);
  border: 2px solid var(--accent);
  padding: 0.8rem 2.2rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  margin-top: 2rem;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 0 15px rgba(0, 255, 163, 0.1);
  cursor: pointer;
}

.btn-cv:hover {
  background-color: var(--accent);
  color: var(--bg-dark) !important;
  box-shadow: 0 0 25px rgba(0, 255, 163, 0.45);
  transform: translateY(-3px);
}

.social-links {
  margin-top: 2rem;
  display: flex;
  gap: 1.5rem;
  font-size: 2rem;
  justify-content: center;
}

.social-links a {
  transition: transform 0.3s ease, color 0.3s ease;
}

.social-links a:hover {
  color: var(--accent);
  transform: translateY(-5px);
}

/* --- SECCIONES GENERALES --- */
.section-container {
  padding: 4rem 5%;
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: 2rem;
  margin-bottom: 3rem;
  text-align: center;
  position: relative;
  display: block;
}

.section-title::after {
  content: "";
  display: block;
  width: 60px;
  height: 4px;
  background-color: var(--accent);
  margin: 0.5rem auto 0;
  border-radius: 2px;
}

/* --- SKILLS GRID & TECH ITEMS --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2.5rem;
}

.skill-card {
  background-color: var(--bg-card);
  padding: 2.5rem 2rem;
  border-radius: 16px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.skill-card:hover {
  transform: translateY(-8px);
  border-color: rgba(0, 255, 163, 0.4);
  box-shadow: 0 12px 30px rgba(0, 255, 163, 0.1);
}

.skill-card h3 {
  margin-bottom: 2rem;
  color: var(--text-main);
  font-size: 1.3rem;
  font-weight: 700;
  position: relative;
  padding-bottom: 0.75rem;
}

.skill-card h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 2px;
  background-color: var(--accent);
  opacity: 0.7;
}

.skill-card .tech-grid {
  display: flex;
  justify-content: center;
  gap: 1.5rem 1.2rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.tech-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 75px;
  min-height: 80px;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.tech-item:hover {
  transform: scale(1.18);
}

.tech-item i {
  font-size: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  width: 50px;
  transition: filter 0.3s ease;
}

.tech-item:hover i {
  filter: drop-shadow(0 0 8px rgba(0, 255, 163, 0.6));
}

.tech-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  word-break: break-word;
  line-height: 1.2;
  transition: color 0.3s ease;
}

.tech-item:hover span {
  color: var(--accent);
}

/* --- PROYECTOS GRID & BUTTONS --- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 2.5rem;
}

.project-card {
  background-color: var(--bg-card);
  padding: 2.2rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.project-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(0, 255, 163, 0.15);
  position: relative;
}

.project-card.featured::before {
  content: 'Reciente';
  position: absolute;
  top: -12px;
  left: 24px;
  background-color: var(--accent);
  color: var(--bg-dark);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.6rem;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 0 10px rgba(0, 255, 163, 0.4);
}

.project-card:hover {
  transform: translateY(-8px);
  border-color: var(--accent);
  box-shadow: 0 12px 30px rgba(0, 255, 163, 0.2);
}

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

.card-header h3 {
  font-size: 1.4rem;
  font-weight: 700;
}

.badge {
  background-color: rgba(0, 255, 163, 0.1);
  color: var(--accent);
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(0, 255, 163, 0.2);
}

.badge-private {
  background-color: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  padding: 0.25rem 0.7rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(239, 68, 68, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

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

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

.tags span {
  background-color: #2a3547;
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.project-card:hover .tags span {
  background-color: #334155;
  color: #e2e8f0;
}

.card-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.card-links a {
  color: var(--accent);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  position: relative;
}

.card-links a::after {
  content: '';
  position: absolute;
  width: 100%;
  transform: scaleX(0);
  height: 2px;
  bottom: -4px;
  left: 0;
  background-color: var(--accent);
  transform-origin: bottom right;
  transition: transform 0.25s ease-out;
}

.card-links a:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

.btn-demo {
  background: rgba(0, 255, 163, 0.08);
  color: var(--accent);
  border: 1px solid var(--accent);
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  width: auto;
}

.btn-demo:hover {
  background: var(--accent);
  color: var(--bg-dark);
  box-shadow: 0 0 15px rgba(0, 255, 163, 0.4);
  transform: translateY(-2px);
}

.btn-demo i {
  font-size: 1rem;
}

/* --- FOOTER --- */
footer {
  text-align: center;
  padding: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

.footer-links {
  margin-top: 1rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

/* --- RESPONSIVE (MÓVIL) --- */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1.2rem 5%;
  }

  .navbar nav {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.2rem;
  }
  
  .navbar nav a {
    font-size: 0.95rem;
  }

  .hero {
    min-height: auto;
    padding: 5rem 1rem;
  }

  .photo-container {
    width: 140px;
    height: 140px;
  }

  .typewriter-cursor {
    border-right-width: 2px;
  }

  .skills-grid, .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.8rem;
  }

  .tech-item {
    width: 65px;
    min-height: 70px;
  }

  .tech-item i {
    font-size: 2.2rem;
    height: 40px;
    width: 40px;
  }

  .tech-item span {
    font-size: 0.7rem;
  }

  .section-container {
    padding: 3.5rem 1.2rem;
  }

  .modal-content {
    width: 95%;
  }
}

/* --- EFECTO MÁQUINA DE ESCRIBIR ROTATIVO (JS HOOK) --- */
.typewriter-cursor {
  border-right: 3px solid var(--accent);
  padding-right: 4px;
  animation: cursorBlink 0.75s step-end infinite;
  white-space: nowrap;
  color: var(--accent);
  font-weight: 600;
  display: inline-block;
}

@keyframes cursorBlink {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent); }
}

/* --- MATRIX CURSOR PARTICLES --- */
.matrix-particle {
  position: absolute;
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  pointer-events: none;
  animation: matrixFade 0.85s cubic-bezier(0.25, 1, 0.5, 1) forwards;
  z-index: 9999;
}

@keyframes matrixFade {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translateY(18px) scale(0.85);
  }
}

/* --- SCROLL REVEAL (INTERSECTION OBSERVER) --- */
.reveal {
  opacity: 0;
  transform: translateY(35px);
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays for beautiful sequential grids loading */
.skills-grid .skill-card:nth-child(1) { transition-delay: 0.05s; }
.skills-grid .skill-card:nth-child(2) { transition-delay: 0.15s; }
.skills-grid .skill-card:nth-child(3) { transition-delay: 0.25s; }

.projects-grid .project-card:nth-child(1) { transition-delay: 0.05s; }
.projects-grid .project-card:nth-child(2) { transition-delay: 0.15s; }
.projects-grid .project-card:nth-child(3) { transition-delay: 0.25s; }
.projects-grid .project-card:nth-child(4) { transition-delay: 0.35s; }

/* --- PREMIUM VIDEO MODAL LIGHTBOX --- */
body.modal-open {
  overflow: hidden;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 920px;
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 35px rgba(0, 255, 163, 0.18);
  transform: scale(0.92);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2001;
}

.modal.active .modal-content {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2005;
  line-height: 1;
}

.modal-close:hover {
  background: #ef4444;
  color: #fff;
  border-color: #ef4444;
  transform: rotate(90deg) scale(1.05);
}

.video-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #020617;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.modal-info {
  padding: 1.8rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(15, 23, 42, 0.3);
}

.modal-info h3 {
  color: var(--accent);
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.modal-info p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}