/* ═══════════════════════════════════════════════
   CV — ÁLVARO SÁNCHEZ BENÍTEZ
   styles.css
═══════════════════════════════════════════════ */

/* ─── TOKENS ─────────────────────────────────── */
:root {
  --bg:       #0a0a0f;
  --bg2:      #10101a;
  --bg3:      #16162a;
  --surface:  rgba(255, 255, 255, 0.04);
  --border:   rgba(0, 212, 255, 0.15);
  --cyan:     #00d4ff;
  --green:    #00ff88;
  --text:     #e8e8f0;
  --muted:    #7a7a9a;
  --font:     'Inter', sans-serif;
  --mono:     'JetBrains Mono', monospace;
  --radius:   14px;
  --glow:     0 0 20px rgba(0, 212, 255, 0.3);
  --glow-g:   0 0 20px rgba(0, 255, 136, 0.3);
  --trans:    0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg:      #f0f4ff;
  --bg2:     #e4eaff;
  --bg3:     #d8e2ff;
  --surface: rgba(0, 0, 0, 0.04);
  --border:  rgba(0, 130, 200, 0.2);
  --cyan:    #0077cc;
  --green:   #009955;
  --text:    #111128;
  --muted:   #445566;
  --glow:    0 0 20px rgba(0, 119, 204, 0.2);
  --glow-g:  0 0 20px rgba(0, 153, 85, 0.2);
}

/* ─── RESET ──────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  overflow-x: hidden;
  transition: background var(--trans), color var(--trans);

  /* Evita arrastres accidentales sobre el fondo y elementos decorativos,
     pero permite seleccionar el contenido de texto útil */
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}

/* Los campos del formulario de contacto sí deben permitir escribir
   y seleccionar, si no el usuario no podría redactar su mensaje */
input,
textarea {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

img  { display: block; max-width: 100%; }
a    { color: var(--cyan); text-decoration: none; transition: color var(--trans); }
a:hover { color: var(--green); }

/* Foco visible por teclado, en línea con la estética cian/verde */
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ─── CANVAS BACKGROUND ──────────────────────── */
#canvas-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
  filter: blur(2px);
  transition: opacity 0.6s ease;
}

/* Foto de fondo difuminada que cambia según la experiencia visible
   en la sección "Experiencia" */
#exp-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  filter: blur(7px) saturate(0.75) brightness(0.38);
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* ─── NAVBAR ─────────────────────────────────── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 5vw, 3rem);
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  transition: transform var(--trans), background var(--trans);
}

[data-theme="light"] nav {
  background: rgba(240, 244, 255, 0.8);
}

nav.hidden {
  transform: translateY(-100%);
}

.nav-logo {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--cyan);
  letter-spacing: 0.05em;
  white-space: nowrap;
}


/* Nav logo como enlace — hereda el estilo del span, sin subrayado */
a.nav-logo {
  text-decoration: none;
  transition: color var(--trans), opacity var(--trans);
}
a.nav-logo:hover {
  color: var(--green);
  opacity: 0.85;
}
.nav-links {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Empuja el toggle de tema lejos del bloque de idiomas */
#theme-toggle {
  margin-left: 1.8rem;
}


/* Selector de idioma */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.lang-btn {
  display: flex;
  flex-direction: row;       /* bandera + texto en horizontal */
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.25s ease,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.25s ease;
}

.flag {
  width: 26px;
  height: 17px;
  border-radius: 3px;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.lang-code {
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  line-height: 1;
}

.lang-btn.active {
  opacity: 1;
  background: rgba(0, 212, 255, 0.08);
  transform: scale(1.05);
}

.lang-btn.active .lang-code {
  color: var(--cyan);
}

[data-theme="light"] .lang-btn.active {
  background: rgba(0, 119, 204, 0.08);
}

.lang-btn:hover:not(.active) {
  opacity: 0.72;
  transform: scale(1.04);
}

/* Separador visual eliminado — se usa solo espacio entre grupos */

/* Theme toggle — sol / luna */
#theme-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--trans), border-color var(--trans),
              transform var(--trans), box-shadow var(--trans);
}

#theme-toggle:hover {
  transform: rotate(-18deg) scale(1.06);
  border-color: var(--cyan);
  box-shadow: var(--glow);
}

#theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: color var(--trans);
}

/* Por defecto (oscuro): luna visible, sol oculto */
#theme-toggle .icon-moon { display: block; color: #c3c7ff; }
#theme-toggle .icon-sun  { display: none;  color: #fbbf24; }

/* Tema claro: sol visible, luna oculta */
[data-theme="light"] #theme-toggle .icon-moon { display: none; }
[data-theme="light"] #theme-toggle .icon-sun  { display: block; }

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--trans), opacity var(--trans);
}

/* ─── LAYOUT ──────────────────────────────────── */
main { position: relative; z-index: 1; }

section {
  padding: clamp(4rem, 8vw, 7rem) clamp(1rem, 8vw, 10rem);
  max-width: 1200px;
  margin: 0 auto;
}

/* Section label (eyebrow) */
.section-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.5rem;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 700;
  margin-bottom: 2.5rem;
  position: relative;
  display: inline-block;
}

h2::after {
  content: '';
  position: absolute;
  bottom: -6px; left: 0;
  width: 40px; height: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  border-radius: 2px;
}

/* ─── FADE-IN ANIMATION ───────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(90px) scale(0.88);
  transition: opacity 0.75s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Eyebrows y títulos de sección: bajan desde arriba, al contrario
   que el resto del contenido, para que el movimiento se note mucho
   más cuando ambos convergen en pantalla */
.fade-down {
  opacity: 0;
  transform: translateY(-70px) scale(0.94);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.fade-down.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Reveal escalonado dentro de cuadrículas: cada tarjeta sube un pelín
   más tarde que la anterior, para que el efecto se sienta orquestado
   en vez de simultáneo */
.edu-grid > .fade-in:nth-child(2) { transition-delay: 0.06s; }
.edu-grid > .fade-in:nth-child(3) { transition-delay: 0.12s; }
.edu-grid > .fade-in:nth-child(4) { transition-delay: 0.18s; }
.edu-grid > .fade-in:nth-child(5) { transition-delay: 0.24s; }
.edu-grid > .fade-in:nth-child(6) { transition-delay: 0.30s; }

.certs-grid > .fade-in:nth-child(2) { transition-delay: 0.05s;  }
.certs-grid > .fade-in:nth-child(3) { transition-delay: 0.10s;  }
.certs-grid > .fade-in:nth-child(4) { transition-delay: 0.15s;  }
.certs-grid > .fade-in:nth-child(5) { transition-delay: 0.20s;  }
.certs-grid > .fade-in:nth-child(6) { transition-delay: 0.25s;  }
.certs-grid > .fade-in:nth-child(7) { transition-delay: 0.30s;  }
.certs-grid > .fade-in:nth-child(8) { transition-delay: 0.35s;  }

.projects-grid > .fade-in:nth-child(2) { transition-delay: 0.06s; }
.projects-grid > .fade-in:nth-child(3) { transition-delay: 0.12s; }
.projects-grid > .fade-in:nth-child(4) { transition-delay: 0.18s; }
.projects-grid > .fade-in:nth-child(5) { transition-delay: 0.24s; }
.projects-grid > .fade-in:nth-child(6) { transition-delay: 0.30s; }

/* ── Movimientos específicos por componente ──────────────────────── */

/* Tarjetas de experiencia: entran desde la izquierda (la línea
   del timeline está a la izquierda, refuerza la dirección de lectura) */
.tl-item.fade-in {
  transform: translateX(-80px) translateY(40px) scale(0.92);
}
.tl-item.fade-in.visible {
  transform: translateX(0) translateY(0) scale(1);
}

/* Tarjetas de proyectos: ligera rotación para dar profundidad */
.project-card.fade-in {
  transform: translateY(80px) scale(0.87) rotate(-1.5deg);
}
.project-card.fade-in.visible {
  transform: translateY(0) scale(1) rotate(0deg);
}

/* Stats: entran rebotando desde abajo, más pronunciado */
.stat-card.fade-in {
  transform: translateY(70px) scale(0.78);
  transition-duration: 0.8s;
}
.stat-card.fade-in.visible {
  transform: translateY(0) scale(1);
}

/* Certificados: entran desde abajo con giro sutil */
.cert-badge.fade-in {
  transform: translateY(60px) scale(0.82) rotate(2deg);
}
.cert-badge.fade-in.visible {
  transform: translateY(0) scale(1) rotate(0deg);
}

/* Tarjetas de formación: entran desde abajo-derecha */
.edu-card.fade-in {
  transform: translateX(40px) translateY(60px) scale(0.9);
}
.edu-card.fade-in.visible {
  transform: translateX(0) translateY(0) scale(1);
}

/* Quien prefiera menos movimiento, lo recibe sin animación */
@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .fade-down {
    transition: none;
    opacity: 1;
    transform: none;
  }

  #exp-bg {
    transition: none;
  }

  #canvas-bg {
    transition: none;
  }

  .scroll-indicator-icon {
    animation: none;
  }
}

/* ─── HERO ───────────────────────────────────── */
#hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 80px;
  max-width: 100%;
  margin: 0;
}

/* Indicador de scroll — convención de UX para señalar que hay más
   contenido debajo del pliegue; desaparece en cuanto el usuario
   empieza a hacer scroll, para no estorbar después */
.scroll-indicator {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.scroll-indicator.hidden {
  opacity: 0;
}

.scroll-indicator-icon {
  font-size: 1.2rem;
  color: var(--cyan);
  animation: scrollBounce 1.8s ease-in-out infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(8px); }
}

.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 8vw, 10rem);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: center;
  width: 100%;
}

.hero-greeting {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--green);
  margin-bottom: 0.8rem;
  letter-spacing: 0.1em;
}

.hero-name {
  font-size: clamp(2.2rem, 5.5vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text) 60%, var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Typewriter */
#typewriter {
  font-family: var(--mono);
  font-size: clamp(0.95rem, 2.2vw, 1.25rem);
  color: var(--cyan);
  min-height: 2em;
  margin-bottom: 1.5rem;
}

#typewriter::after {
  content: '|';
  animation: blink 0.7s infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-bio {
  color: var(--muted);
  max-width: 520px;
  margin-bottom: 2rem;
  line-height: 1.8;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all var(--trans);
  cursor: pointer;
  border: none;
  font-family: var(--font);
}

.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #000;
}

.btn-primary:hover {
  box-shadow: var(--glow-g);
  transform: translateY(-2px);
  color: #000;
}

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

.btn-outline:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow);
  color: var(--cyan);
}

/* Social links */
.hero-socials {
  display: flex;
  gap: 0.7rem;
  margin-top: 2rem;
}

.social-link {
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--trans);
}

.social-link svg { width: 20px; height: 20px; display: block; }

/* Iconos con colores oficiales de cada marca */
.social-link.brand-linkedin { color: #0a66c2; }
.social-link.brand-whatsapp { color: #25d366; }
/* Gmail usa colores propios dentro del SVG (multicolor) */

.social-link:hover {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: var(--glow);
  transform: translateY(-3px);
}

.social-link.brand-linkedin:hover {
  color: #0a66c2;
  border-color: #0a66c2;
  box-shadow: 0 0 20px rgba(10, 102, 194, 0.4);
}

.social-link.brand-whatsapp:hover {
  color: #25d366;
  border-color: #25d366;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.45);
}

.social-link.brand-gmail:hover {
  border-color: #ea4335;
  box-shadow: 0 0 20px rgba(234, 67, 53, 0.35);
}

/* Photo */
.hero-photo {
  position: relative;
  width: clamp(130px, 18vw, 200px);
  flex-shrink: 0;
}

.photo-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid var(--border);
  box-shadow: var(--glow), 0 0 0 8px rgba(0, 212, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(3rem, 7vw, 4.5rem);
}

/* ─── SOBRE MÍ ────────────────────────────────── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.about-text { color: var(--muted); line-height: 1.9; }
.about-text p { margin-bottom: 1rem; }

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  text-align: center;
  transition: border-color var(--trans), box-shadow var(--trans);
}

.stat-card:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow);
}

.stat-num {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--cyan);
  font-family: var(--mono);
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.3rem;
}

/* ─── SKILLS ─────────────────────────────────── */
/* ─── TIMELINE (EXPERIENCIA) ─────────────────── */
/* Scrim lateral: gradiente semitransparente detrás del timeline
   que garantiza contraste legible con cualquier foto de fondo */
#experiencia {
  position: relative;
}

#experiencia::before {
  content: '';
  position: fixed;
  inset: 0;
  background: linear-gradient(
    100deg,
    rgba(10, 10, 15, 0.55) 0%,
    rgba(10, 10, 15, 0.20) 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

[data-theme="light"] #experiencia::before {
  background: linear-gradient(
    100deg,
    rgba(240, 244, 255, 0.50) 0%,
    rgba(240, 244, 255, 0.15) 60%,
    transparent 100%
  );
}

/* El scrim solo aparece cuando hay una foto activa (clase añadida por JS) */
#experiencia.has-bg::before {
  opacity: 1;
}

.timeline {
  position: relative;
  padding-left: 2rem;
  z-index: 1;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--cyan), transparent);
}

.tl-item {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.tl-content {
  position: relative;
  width: 100%;
}

.tl-dot {
  position: absolute;
  left: -2.4rem;
  top: 0.3rem;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: var(--glow);
  border: 2px solid var(--bg);
}

.tl-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--cyan);
  margin-bottom: 0.35rem;
  letter-spacing: 0.05em;
}

.tl-card {
  background: rgba(10, 10, 15, 0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: border-color var(--trans), box-shadow var(--trans), transform var(--trans),
              background var(--trans);
}

[data-theme="light"] .tl-card {
  background: rgba(240, 244, 255, 0.90);
}

.tl-card:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow);
}

/* Tarjeta resaltada mientras está enfocada en el scroll */
.tl-item.active .tl-card {
  background: rgba(10, 10, 15, 0.92);
  border-color: var(--cyan);
  box-shadow: var(--glow), 0 0 50px rgba(0, 212, 255, 0.18);
  transform: scale(1.02);
}

[data-theme="light"] .tl-item.active .tl-card {
  background: rgba(240, 244, 255, 0.96);
}

/* El texto secundario gana contraste cuando la foto está de fondo */
.tl-item.active .tl-desc {
  color: #a8a8c0;
}

[data-theme="light"] .tl-item.active .tl-desc {
  color: #334155;
}

.tl-item.active .tl-dot {
  background: var(--green);
  box-shadow: var(--glow-g);
  transform: scale(1.3);
}

.tl-dot {
  transition: background var(--trans), box-shadow var(--trans), transform var(--trans);
}

.tl-role {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.tl-company {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
  margin-bottom: 0.8rem;
}

.tl-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.tl-desc p + p {
  margin-top: 0.9rem;
}

.tl-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.9rem;
}

.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.2);
  color: var(--cyan);
}

/* ─── FORMACIÓN ──────────────────────────────── */
.edu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.2rem;
}

.edu-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  transition: all var(--trans);
}

.edu-card:hover {
  border-color: var(--green);
  box-shadow: var(--glow-g);
  transform: translateY(-3px);
}

.edu-icon { font-size: 1.8rem; margin-bottom: 0.8rem; }

.edu-year {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--green);
  margin-bottom: 0.35rem;
  letter-spacing: 0.1em;
}

.edu-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.edu-inst {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ─── CERTIFICACIONES ────────────────────────── */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 1rem;
}

.cert-badge {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
  transition: all var(--trans);
}

.cert-badge:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow);
  transform: translateY(-3px);
}

.cert-icon { font-size: 2rem; margin-bottom: 0.6rem; }
.cert-name { font-size: 0.8rem; font-weight: 600; margin-bottom: 0.25rem; line-height: 1.3; }
.cert-issuer { font-size: 0.7rem; color: var(--muted); font-family: var(--mono); }
.cert-year { font-size: 0.68rem; color: var(--green); margin-top: 0.4rem; font-family: var(--mono); }

/* ─── PROYECTOS ──────────────────────────────── */
.projects-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.filter-btn {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 0.35rem 0.9rem;
  border-radius: 50px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all var(--trans);
  letter-spacing: 0.05em;
}

.filter-btn:hover,
.filter-btn.active {
  background: var(--cyan);
  color: #000;
  border-color: var(--cyan);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--trans);
}

.project-card:hover {
  border-color: var(--cyan);
  box-shadow: var(--glow);
  transform: translateY(-4px);
}

.project-card.hidden { display: none; }

.project-thumb {
  height: 150px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.2rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.project-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(0, 255, 136, 0.05));
}

.project-body { padding: 1.3rem; }

.project-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.project-desc {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
  line-height: 1.7;
}

/* ─── CONTACTO ───────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 3rem;
  align-items: start;
}

.contact-info p {
  color: var(--muted);
  margin-bottom: 2rem;
  line-height: 1.8;
}

.contact-items {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.contact-item span:first-child {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.contact-item span:first-child svg { width: 18px; height: 18px; display: block; }
.contact-item .ci-whatsapp { color: #25d366; }

/* Item de contacto clicable (WhatsApp) */
a.contact-link { text-decoration: none; transition: color var(--trans); }
a.contact-link:hover { color: #25d366; }
a.contact-link:hover span:first-child { border-color: #25d366; box-shadow: 0 0 14px rgba(37, 211, 102, 0.3); }

/* Form card */
.form-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.form-group { margin-bottom: 1.2rem; }

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  transition: border-color var(--trans), box-shadow var(--trans);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

#form-status {
  margin-top: 0.8rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  min-height: 1.2em;
}

/* ─── FOOTER ─────────────────────────────────── */
footer {
  text-align: center;
  padding: 2.5rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  font-family: var(--mono);
  position: relative;
  z-index: 1;
}

footer span { color: var(--cyan); }

.footer-sub {
  margin-top: 0.4rem;
  font-size: 0.72rem;
  opacity: 0.6;
}

.footer-copyright {
  margin-top: 1.2rem;
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.55;
}



/* ─── WHATSAPP FAB ───────────────────────────── */
#whatsapp-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 52;
  display: flex;
  align-items: center;
  gap: 0;
  background: #25d366;
  color: #fff;
  border-radius: 50px;
  height: 72px;
  width: 72px;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  /* La transición de width crea el efecto pill expansible */
  transition: width 0.38s cubic-bezier(0.16, 1, 0.3, 1),
              background 0.3s ease,
              box-shadow 0.3s ease;
  /* El transform para el movimiento de scroll lo gestiona JS en will-change */
  will-change: transform;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.45);
}

#whatsapp-fab:hover {
  width: 200px;
  background: #20ba5a;
  box-shadow: 0 10px 40px rgba(37, 211, 102, 0.70);
  color: #fff;
}

#whatsapp-fab svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-left: 20px;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

#whatsapp-fab:hover svg {
  transform: scale(1.15) rotate(-8deg);
}

.fab-label {
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.22s ease 0.12s,
              transform 0.22s ease 0.12s;
  padding-left: 8px;
  padding-right: 18px;
  pointer-events: none;
}

#whatsapp-fab:hover .fab-label {
  opacity: 1;
  transform: translateX(0);
}

/* Quien prefiera menos movimiento: sin transform JS */
@media (prefers-reduced-motion: reduce) {
  #whatsapp-fab { will-change: auto; }
}

/* ─── BARRA DE PROGRESO DE LECTURA (Jakob — orientación) ─ */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  z-index: 200;
  border-radius: 0 2px 2px 0;
  pointer-events: none;
  transition: width 0.08s linear;
}


/* Enlace activo en navbar — scroll spy (Jakob: orientación familiar) */
.nav-links a.spy-active {
  color: var(--cyan);
}

.nav-links a.spy-active::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--cyan);
  border-radius: 2px;
  margin-top: 2px;
  animation: underlineIn 0.3s ease forwards;
}

@keyframes underlineIn {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}


/* CTA principal del hero más grande y prominente (Fitts) */
.btn-hero-cta {
  padding: 0.85rem 2rem;
  font-size: 1rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 20px rgba(0, 212, 255, 0.25);
}

.btn-hero-cta:hover {
  box-shadow: 0 6px 28px rgba(0, 212, 255, 0.45);
  transform: translateY(-3px);
}


/* Targets táctiles mínimos 44×44 px (Fitts — móvil, WCAG 2.5.5) */
@media (max-width: 900px) {
  .nav-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .filter-btn {
    min-height: 44px;
    padding: 0.55rem 1rem;
  }

  .cert-badge,
  .edu-card {
    cursor: pointer;
  }
}


/* Etiquetas de grupo en formación (Miller — agrupa ≤7 items) */
.edu-group-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--green);
  margin-top: 2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.edu-group-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--green), transparent);
  opacity: 0.3;
}

.edu-group-label:first-of-type {
  margin-top: 0;
}

/* ─── RESPONSIVE ─────────────────────────────── */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-photo { margin: 0 auto; }
  .hero-bio   { margin: 0 auto 2rem; }

  .hero-ctas,
  .hero-socials { justify-content: center; }

  .about-grid   { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }

  /* Mobile nav */
  .hamburger { display: flex; }

  .nav-links {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    background: var(--bg2);
    backdrop-filter: blur(16px);
    padding: 0 2rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    border-bottom: 1px solid var(--border);
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.4s ease;
  }

  nav.menu-open .nav-links {
    max-height: 70vh;
    opacity: 1;
    padding: 1.2rem 2rem 1.5rem;
  }

  .nav-links a {
    display: block;
    padding: 0.8rem 0;
    font-size: 0.92rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

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

  /* El icono hamburguesa se convierte en X al abrir el menú */
  nav.menu-open .hamburger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  nav.menu-open .hamburger span:nth-child(2) {
    opacity: 0;
  }

  nav.menu-open .hamburger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

@media (max-width: 600px) {
  section          { padding: 3rem 1rem; }
  .about-stats     { grid-template-columns: 1fr 1fr; }
  .projects-grid   { grid-template-columns: 1fr; }
  .certs-grid      { grid-template-columns: repeat(2, 1fr); }
}
