/* ===== Variables — Azul oscuro, dorado, blanco ===== */
:root {
  --bg: #0a0e17;
  --bg-alt: #0f1629;
  --surface: #151d33;
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --accent: #d4af37;
  --accent-hover: #e5c558;
  --accent-soft: rgba(212, 175, 55, 0.15);
  --border: #1e3a5f;
  --success: #22c55e;
  --radius: 12px;
  --radius-sm: 8px;
  --font-sans: 'DM Sans', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --nav-height: 72px;
  --max-width: 960px;
  --animate-duration: 0.6s;
  --animate-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Animaciones ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes glow {
  0%, 100% { box-shadow: 0 0 20px rgba(212, 175, 55, 0.2); }
  50% { box-shadow: 0 0 32px rgba(212, 175, 55, 0.35); }
}

/* Reveal al hacer scroll */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--animate-ease), transform 0.7s var(--animate-ease);
}

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

/* Stagger hijos dentro de un .reveal.visible */
.reveal.visible .reveal-child {
  opacity: 0;
  animation: fadeInUp 0.6s var(--animate-ease) forwards;
}

.reveal.visible .reveal-child:nth-child(1) { animation-delay: 0.05s; }
.reveal.visible .reveal-child:nth-child(2) { animation-delay: 0.12s; }
.reveal.visible .reveal-child:nth-child(3) { animation-delay: 0.19s; }
.reveal.visible .reveal-child:nth-child(4) { animation-delay: 0.26s; }
.reveal.visible .reveal-child:nth-child(5) { animation-delay: 0.33s; }
.reveal.visible .reveal-child:nth-child(6) { animation-delay: 0.4s; }
.reveal.visible .reveal-child:nth-child(7) { animation-delay: 0.47s; }
.reveal.visible .reveal-child:nth-child(8) { animation-delay: 0.54s; }
.reveal.visible .reveal-child:nth-child(9) { animation-delay: 0.61s; }
.reveal.visible .reveal-child:nth-child(10) { animation-delay: 0.68s; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.visible { transition: none; }
  .hero.hero-loaded .hero-badge,
  .hero.hero-loaded .hero-title,
  .hero.hero-loaded .hero-rol,
  .hero.hero-loaded .hero-propuesta,
  .hero.hero-loaded .hero-ctas { animation: none; opacity: 1; transform: none; }
  .hero-photo, .hero-badge, .hero-title, .hero-rol, .hero-propuesta, .hero-ctas { opacity: 1; transform: none; }
  .proyecto-card:hover, .stack-card:hover, .laboral-card:hover,
  .formacion-card:hover, .skills-block:hover, .publicacion-card:hover { transform: none; }
  .btn:hover { transform: none; }
  .contacto-link:hover { transform: none; }
}

/* ===== Reset y base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ===== Utilidades ===== */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 4rem 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin: 0 0 2rem;
  letter-spacing: -0.02em;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 2px;
  opacity: 0.9;
}

.section-subtitle {
  color: var(--text-muted);
  margin: -1rem 0 2rem;
  font-size: 1rem;
}

/* ===== Navegación ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}

.nav.scrolled {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text);
}

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

.nav-links {
  display: flex;
  gap: 1.75rem;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: color 0.2s;
}

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

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 1.5rem;
    gap: 0.5rem;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s, opacity 0.25s, visibility 0.25s;
  }

  .nav-links.is-open {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links a {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-links a:last-child {
    border-bottom: none;
  }
}

/* ===== Hero ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* Hero: entrada escalonada al cargar */
.hero-photo,
.hero-badge,
.hero-title,
.hero-rol,
.hero-propuesta,
.hero-ctas {
  opacity: 0;
  transform: translateY(20px);
}

.hero.hero-loaded .hero-photo {
  animation: fadeInUp 0.65s var(--animate-ease) forwards;
}
.hero.hero-loaded .hero-badge {
  animation: fadeInUp 0.65s var(--animate-ease) 0.06s forwards;
}
.hero.hero-loaded .hero-title {
  animation: fadeInUp 0.65s var(--animate-ease) 0.14s forwards;
}
.hero.hero-loaded .hero-rol {
  animation: fadeInUp 0.65s var(--animate-ease) 0.22s forwards;
}
.hero.hero-loaded .hero-propuesta {
  animation: fadeInUp 0.65s var(--animate-ease) 0.3s forwards;
}
.hero.hero-loaded .hero-ctas {
  animation: fadeInUp 0.65s var(--animate-ease) 0.38s forwards;
}

/* Foto de perfil en el hero */
.hero-photo {
  display: block;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  border: 3px solid var(--accent);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(212, 175, 55, 0.2);
}

@media (min-width: 640px) {
  .hero-photo {
    width: 200px;
    height: 200px;
    margin-top: 2rem;
    margin-bottom: 1.75rem;
  }
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
  border: 1px solid var(--border);
}

.hero-title {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem;
}

.hero-rol {
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 1rem;
}

.hero-propuesta {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0 0 2rem;
  line-height: 1.7;
}

.hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: 0 0 28px rgba(212, 175, 55, 0.4);
  transform: translateY(-2px);
}

.btn {
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.25s ease, transform 0.25s ease;
}

.btn-secondary:hover {
  box-shadow: 0 0 0 1px var(--text-muted);
}

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

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-muted);
  color: var(--text);
}

.hero-visual {
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  max-width: 520px;
  height: 100%;
  background: radial-gradient(ellipse 80% 60% at 70% 40%, var(--accent-soft) 0%, transparent 55%);
  pointer-events: none;
}

@media (max-width: 768px) {
  .hero-visual {
    width: 100%;
    max-width: none;
    opacity: 0.6;
  }
}

/* ===== Sobre mí ===== */
.sobre-mi-content p {
  margin: 0 0 1.25rem;
  max-width: 65ch;
}

.sobre-mi-content p:last-child {
  margin-bottom: 0;
}

/* ===== Stack ===== */
.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.stack-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.3s ease, transform 0.3s var(--animate-ease), box-shadow 0.3s ease;
}

.stack-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(212, 175, 55, 0.12);
}

.stack-card-wide {
  grid-column: 1 / -1;
  max-width: 400px;
}

.stack-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--accent);
}

.stack-card ul li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.stack-card ul li .stack-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  object-fit: contain;
  vertical-align: middle;
}

/* ===== Proyectos ===== */
.proyectos-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .proyectos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.proyecto-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.35s var(--animate-ease), box-shadow 0.35s ease;
}

.proyecto-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(212, 175, 55, 0.15);
}

.proyecto-card .proyecto-img-wrap {
  transition: opacity 0.3s ease;
}

.proyecto-card:hover .proyecto-img-wrap {
  opacity: 0.95;
}

.proyecto-img-wrap {
  display: block;
  margin: -1px -1px 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  background: var(--bg-alt);
}

.proyecto-img {
  width: 100%;
  height: auto;
  aspect-ratio: 640 / 340;
  object-fit: cover;
  vertical-align: middle;
}

.proyecto-card .proyecto-img-wrap {
  margin: -1px -1px 0;
}

.proyecto-card h3 {
  margin-top: 1.25rem;
}

.proyecto-card h3,
.proyecto-card > p,
.proyecto-card .proyecto-tech,
.proyecto-card .proyecto-link {
  padding-left: 1.75rem;
  padding-right: 1.75rem;
}

.proyecto-card .proyecto-link {
  padding-bottom: 1.75rem;
  display: inline-block;
}

.proyecto-card:hover {
  border-color: var(--accent);
}

.proyecto-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.proyecto-card p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.proyecto-tech {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent) !important;
  margin-bottom: 0.75rem;
}

.proyecto-link {
  display: inline-block;
  font-size: 0.9375rem;
  font-weight: 500;
  margin-top: 0.25rem;
}

.proyecto-link:hover {
  text-decoration: underline;
}

/* ===== Experiencia laboral ===== */
.laboral-list {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.laboral-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: border-color 0.3s ease, transform 0.3s var(--animate-ease), box-shadow 0.3s ease;
}

.laboral-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(212, 175, 55, 0.1);
}

.laboral-header {
  margin-bottom: 1rem;
}

.laboral-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.laboral-empresa {
  color: var(--accent);
  font-size: 0.9375rem;
  margin: 0 0 0.25rem;
}

.laboral-fechas {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  margin: 0;
}

.laboral-tareas {
  margin: 0;
}

.laboral-tareas li {
  padding: 0.4rem 0;
  padding-left: 1.25rem;
  position: relative;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.laboral-tareas li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-family: var(--font-mono);
}

/* ===== Formación y cursos ===== */
.formacion-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 640px) {
  .formacion-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.formacion-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.3s ease, transform 0.3s var(--animate-ease), box-shadow 0.3s ease;
}

.formacion-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.formacion-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
}

.formacion-lugar {
  color: var(--accent);
  font-size: 0.9375rem;
  margin: 0 0 0.25rem;
}

.formacion-fechas {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-family: var(--font-mono);
  margin: 0 0 0.5rem;
}

.formacion-desc {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin: 0;
  line-height: 1.55;
}

.subsection-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  color: var(--text);
}

.cursos-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cursos-badge {
  display: inline-block;
  font-size: 0.8125rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
}

/* Certificados Microsoft: mitad azul mitad blanco, diagonal, efectos */
.cursos-badge-ms {
  position: relative;
  overflow: hidden;
  color: #0f1629;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, #0078d4 0%, #0078d4 50%, #f8fafc 50%, #f8fafc 100%);
  border: 1px solid rgba(0, 120, 212, 0.5);
  box-shadow: 0 2px 8px rgba(0, 120, 212, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  font-weight: 500;
  transition: transform 0.3s var(--animate-ease), box-shadow 0.3s ease, filter 0.3s ease;
}

/* Línea diagonal de separación con efecto */
.cursos-badge-ms::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, transparent 48%, rgba(255, 255, 255, 0.4) 50%, transparent 52%);
  pointer-events: none;
}

.cursos-badge-ms::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.cursos-badge-ms:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 24px rgba(0, 120, 212, 0.4), 0 0 0 1px rgba(0, 120, 212, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  filter: brightness(1.05);
}

/* ===== Publicaciones ===== */
.publicacion-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: border-color 0.3s ease, transform 0.3s var(--animate-ease), box-shadow 0.3s ease;
}

.publicacion-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
}

.publicacion-card h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.publicacion-link {
  font-size: 0.9375rem;
  font-weight: 500;
}

/* ===== Skills e idiomas ===== */
.skills-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.skills-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: border-color 0.3s ease, transform 0.3s var(--animate-ease), box-shadow 0.3s ease;
}

.skills-block:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.skills-block h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--accent);
}

.skills-block p {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.skills-idiomas {
  grid-column: 1 / -1;
  max-width: 100%;
}

/* ===== Perfil ===== */
.perfil-content p {
  margin: 0 0 1.25rem;
  max-width: 65ch;
}

.perfil-content p:last-child {
  margin-bottom: 0;
}

/* ===== Contacto ===== */
.section-contact {
  padding-bottom: 5rem;
}

.contacto-intro {
  color: var(--text-muted);
  margin: 0 0 2rem;
}

.contacto-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 400px;
}

.contacto-link {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 500;
  transition: border-color 0.2s, background 0.2s;
}

.contacto-link:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
  transform: translateX(6px);
}

.contacto-link {
  transition: border-color 0.2s, background 0.2s, color 0.2s, transform 0.25s var(--animate-ease);
}

.contacto-icon {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  width: 1.5rem;
  text-align: center;
}

.contacto-cv {
  margin-top: 0.5rem;
  border-color: var(--accent);
  color: var(--accent);
}

.contacto-cv:hover {
  background: var(--accent-soft);
}

/* ===== Footer ===== */
.footer {
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}
