/* ════════════════════════════════════════════════════
   VARIABLES — dark mode
   Paleta: negro profundo + azul eléctrico refinado
   Referencia: Stripe, Linear, Vercel — premium tech
   ════════════════════════════════════════════════════ */
:root {
  --bg:          #08080f;
  --bg-alt:      #0d0d18;
  --bg-card:     #11111f;
  --border:      rgba(255,255,255,0.07);
  --accent:      #5b8dee;
  --accent2:     #7c6dee;
  --accent-glow: rgba(91,141,238,0.20);
  --text:        #eef0f8;
  --text-muted:  #7a859e;
  --nav-bg:      rgba(8,8,15,0.88);
  --skill-bg:    rgba(91,141,238,0.10);
  --skill-border:rgba(91,141,238,0.25);
  --skill-text:  #8ab0f5;
  --btn-text:    #ffffff;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --transition:  0.25s ease;
}

/* ── Light mode ─────────────────────────────────────── */
/* Blanco limpio + azul — elegante, como una firma de consultoría */
[data-theme="light"] {
  --bg:          #f8f9ff;
  --bg-alt:      #eef1fb;
  --bg-card:     #ffffff;
  --border:      rgba(0,0,0,0.07);
  --accent-glow: rgba(91,141,238,0.12);
  --text:        #0c0f1e;
  --text-muted:  #5a6a85;
  --nav-bg:      rgba(248,249,255,0.92);
  --skill-bg:    rgba(91,141,238,0.08);
  --skill-border:rgba(91,141,238,0.22);
  --skill-text:  #3a6dd4;
  --btn-text:    #ffffff;
  --shadow:      0 4px 24px rgba(0,0,0,0.08);
}

/* ════════════════════════════════════════════════════
   ANIMACIONES
   ════════════════════════════════════════════════════ */

/* Gradiente que se desplaza — usado en círculo, logo y nombre */
@keyframes gradient-move {
  0%   { background-position: 0%   50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0%   50%; }
}


/* Flecha scroll */
@keyframes bounce {
  0%, 100% { transform: translateX(-50%) translateY(0);  }
  50%       { transform: translateX(-50%) translateY(8px); }
}

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

html { scroll-behavior: smooth; }

/* La transición en html hace que TODOS los elementos hereden el cambio suave */
html, body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

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

strong { color: var(--text); }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }

/* ════════════════════════════════════════════════════
   NAVBAR
   ════════════════════════════════════════════════════ */
nav {
  /* sticky: baja con la página pero se queda pegado al llegar al top */
  position: sticky; top: 0; width: 100%; z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.9rem 2rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  transition: background var(--transition);
}

/* Logo como enlace al home — hereda el gradiente, sin subrayado */
a.logo {
  font-size: 1.3rem; font-weight: 800;
  background: linear-gradient(-45deg, #5b8dee, #7c6dee, #38bdf8, #6366f1, #5b8dee);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
  animation: gradient-move 4s ease infinite;
  text-decoration: none;
}
a.logo:hover { text-decoration: none; opacity: 0.85; }

/* Hamburguesa oculta en desktop; CSS móvil la activa */
#menu-toggle { display: none; }

.nav-links {
  list-style: none;
  display: flex; gap: 2rem;
}
.nav-links a {
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  transition: color var(--transition);
}
.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-controls { display: flex; gap: 0.5rem; flex-shrink: 0; }

.btn-ctrl {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-ctrl:hover {
  border-color: var(--accent);
  color: var(--accent);
}
/* Botón con icono SVG — tamaño fijo para que no cambie al cargar el SVG */
.btn-icon {
  width: 38px; height: 34px;
  padding: 0;
}
.btn-icon svg {
  width: 17px; height: 17px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════
   SECCIONES — estructura común
   ════════════════════════════════════════════════════ */
section {
  padding: 4.5rem 2rem;
  max-width: 960px;
  margin: 0 auto;
}

.section-alt {
  background-color: var(--bg-alt);
  max-width: 100%;
  padding: 4.5rem 2rem;
  transition: background-color 0.3s ease;
}
.section-alt > * { max-width: 960px; margin-left: auto; margin-right: auto; }

section h2 {
  font-size: 2rem; font-weight: 700;
  margin-bottom: 2.5rem;
}
.accent { color: var(--accent); }

/* ════════════════════════════════════════════════════
   HERO
   ════════════════════════════════════════════════════ */
#hero {
  min-height: 100vh;
  display: flex; flex-direction: column;
  justify-content: center;
  /* sin padding-top extra: la nav es sticky (está en el flujo normal) */
  position: relative;
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4rem;
}

/* Texto izquierda */
.hero-text { flex: 1; }

.saludo {
  font-family: monospace;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.hero-text h1 {
  font-size: clamp(2.4rem, 5vw, 4.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 0.5rem;
  /* Gradiente animado en el nombre */
  /* Nombre: blanco que deriva suavemente hacia el azul — sutil y elegante */
  background: linear-gradient(-45deg, #eef0f8, #5b8dee, #7c6dee, #38bdf8, #eef0f8);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradient-move 6s ease infinite;
  /* Fix crítico: sin esto el clip corta los descendentes (g, y, p...) */
  padding-bottom: 0.12em;
  display: block;
}

.titulo {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.hero-desc {
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 2.5rem;
  font-size: 1.05rem;
}

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

/* Foto derecha */
.hero-foto { flex-shrink: 0; }

/* Borde de gradiente animado + glow que respira */
.foto-ring {
  width: 260px; height: 260px;
  border-radius: 50%;
  padding: 4px;
  /* Gradiente con más colores y gran tamaño → movimiento visible */
  background: linear-gradient(-45deg, #5b8dee, #7c6dee, #38bdf8, #6366f1, #4f8fcc, #38bdf8, #5b8dee);
  background-size: 400% 400%;
  animation: gradient-move 5s ease infinite;
}
.foto-ring img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  /* Separación entre imagen y borde gradiente */
  border: 4px solid var(--bg);
  display: block;
  transition: border-color var(--transition);
}

/* Icono ratón scroll al fondo del hero */
.scroll-hint {
  position: absolute; bottom: 2.5rem; left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  opacity: 0.55;
  text-decoration: none;
  animation: scroll-drift 2.8s ease-in-out infinite;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.scroll-hint svg {
  width: 1.25rem; height: auto;
  display: block;
}
/* Ruedecilla: se desliza y desvanece en bucle */
.scroll-hint .scroll-wheel {
  animation: wheel-drop 2.8s ease-in-out infinite;
}
.scroll-hint:hover {
  opacity: 1;
  color: var(--accent);
  text-decoration: none;
}

@keyframes scroll-drift {
  0%, 100% { transform: translateX(-50%) translateY(0);  opacity: 0.55; }
  50%       { transform: translateX(-50%) translateY(5px); opacity: 0.85; }
}
@keyframes wheel-drop {
  0%        { transform: translateY(0);   opacity: 1; }
  40%       { transform: translateY(5px); opacity: 0; }
  41%       { transform: translateY(0);   opacity: 0; }
  70%, 100% { transform: translateY(0);   opacity: 1; }
}

/* ════════════════════════════════════════════════════
   BOTONES
   ════════════════════════════════════════════════════ */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: 10px;
  font-weight: 600; font-size: 0.95rem;
  transition: all var(--transition);
  cursor: pointer;
}
/* ── Botón relleno: gradiente animado de fondo ── */
.btn-primary {
  background: linear-gradient(-45deg, #5b8dee, #7c6dee, #38bdf8, #6366f1, #5b8dee);
  background-size: 300% 300%;
  animation: gradient-move 4s ease infinite;
  color: #ffffff;
  font-weight: 600;
  border: 2px solid transparent;
}
.btn-primary:hover {
  opacity: 0.88;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ── Botón outline: borde con gradiente animado, interior transparente ── */
/* Truco CSS: border-box aplica el gradiente AL BORDE,
   padding-box rellena el interior con el color de fondo → queda "hueco" */
.btn-outline {
  border: 2px solid transparent;
  background:
    linear-gradient(var(--bg), var(--bg)) padding-box,
    linear-gradient(-45deg, #5b8dee, #7c6dee, #38bdf8, #6366f1, #5b8dee) border-box;
  background-size: auto, 300% 300%;
  animation: gradient-move 4s ease infinite;
  color: var(--accent);
}
.btn-outline:hover {
  color: var(--text);
  text-decoration: none;
  transform: translateY(-1px);
}

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

.about-text p {
  color: var(--text-muted);
  margin-bottom: 1.1rem;
  font-size: 1.02rem;
}

.about-skills h3 {
  font-size: 1rem; font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 1.2rem;
}

.skills { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.skill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--skill-bg);
  border: 1px solid var(--skill-border);
  color: var(--skill-text);
  padding: 0.35rem 1rem;
  border-radius: 99px;
  font-size: 0.85rem; font-weight: 500;
  transition: transform 0.2s ease, box-shadow 0.2s ease,
              border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  cursor: default;
}
.skill-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: middle;
  filter: brightness(0) invert(1) opacity(0.55);
  transition: filter 0.2s ease;
}
.skill:hover {
  background: var(--bg-card);
  border-color: var(--accent);
  color: var(--text);   /* blanco en dark, negro en light — funciona en ambos */
  transform: scale(1.09);
  box-shadow: 0 0 16px rgba(91,141,238,0.30), 0 4px 12px rgba(0,0,0,0.30);
}
.skill:hover .skill-icon {
  /* color de marca real — fondo oscuro = buen contraste */
  filter: grayscale(0) opacity(1);
}

/* Tema claro: iconos negros semitransparentes por defecto */
[data-theme="light"] .skill-icon {
  filter: brightness(0) opacity(0.45);
}
[data-theme="light"] .skill:hover .skill-icon {
  filter: grayscale(0) opacity(1);
}

/* ════════════════════════════════════════════════════
   CV
   ════════════════════════════════════════════════════ */
#cv { text-align: center; }
#cv p {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 1.05rem;
}

/* ════════════════════════════════════════════════════
   CONTACTO
   ════════════════════════════════════════════════════ */
#contacto p {
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.contact-links {
  display: flex; flex-direction: column;
  gap: 0.75rem; margin-top: 1.8rem;
}

.contact-item {
  display: inline-flex; align-items: center; gap: 0.75rem;
  color: var(--text-muted);
  padding: 0.9rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 340px;
  transition: all var(--transition);
  font-size: 0.95rem;
}
.contact-item:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateX(4px);
  text-decoration: none;
}

/* Icono SVG dentro de los contact-items */
.contact-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.contact-icon svg {
  width: 22px;
  height: 22px;
  transition: color var(--transition);
}

/* Colores de marca en hover — LinkedIn azul, GitHub el color del tema */
.contact-linkedin .contact-icon svg { color: #0A66C2; }
.contact-github   .contact-icon svg { color: var(--text-muted); }

.contact-linkedin:hover .contact-icon svg { color: #0A66C2; }
.contact-github:hover   .contact-icon svg { color: var(--text); }

/* ════════════════════════════════════════════════════
   TIMELINE — Experiencia
   ════════════════════════════════════════════════════ */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 0 16px 16px 0;
  padding: 1.75rem 2rem;
  transition: all var(--transition);
}
.timeline-item:hover {
  box-shadow: var(--shadow);
  transform: translateX(5px);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.job-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.2rem;
}

.job-company {
  color: var(--accent);
  font-size: 0.93rem;
  font-weight: 500;
}

.job-meta { text-align: right; }

.job-dates {
  display: block;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.job-location {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.job-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.job-bullets li {
  position: relative;
  padding-left: 1.3rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.job-bullets li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.8rem;
  top: 0.18em;
}

/* ════════════════════════════════════════════════════
   FORMACIÓN — Education
   ════════════════════════════════════════════════════ */
.edu-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.edu-item {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.4rem;
  transition: all var(--transition);
}

.edu-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.edu-year {
  font-family: monospace;
  font-size: 0.78rem;
  color: var(--skill-text);
  background: var(--skill-bg);
  border: 1px solid var(--skill-border);
  padding: 0.22rem 0.6rem;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.22rem;
  min-width: 76px;
  text-align: center;
}

.edu-info { flex: 1; }

.edu-name {
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.18rem;
}

.edu-org {
  font-size: 0.87rem;
  color: var(--text-muted);
}

.edu-extra {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.4rem;
  flex-wrap: wrap;
}

.edu-badge {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.18rem 0.6rem;
  border-radius: 99px;
  background: var(--skill-bg);
  border: 1px solid var(--skill-border);
  color: var(--skill-text);
}

.edu-badge-progress {
  background: rgba(91,141,238,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

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

/* ════════════════════════════════════════════════════
   FOOTER
   ════════════════════════════════════════════════════ */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.footer-copy {
  margin-bottom: 0.55rem;
}

.footer-made {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-tech-item {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  cursor: default;
  transition: color var(--transition);
}

.footer-tech-item img {
  width: 13px;
  height: 13px;
  vertical-align: middle;
  filter: grayscale(1) opacity(0.5);
  transition: filter var(--transition);
}

.footer-tech-item:hover img {
  filter: grayscale(0) opacity(1);
}

.footer-sep {
  opacity: 0.3;
  user-select: none;
}

.footer-sep--div {
  opacity: 0.2;
  margin: 0 0.2rem;
  font-size: 0.9em;
}

/* ════════════════════════════════════════════════════
   SCROLL TO TOP — botón flotante abajo-derecha
   Oculto por defecto; JS añade .visible al bajar 300px
   ════════════════════════════════════════════════════ */
#scroll-top {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  /* Mismo gradiente animado que los botones primarios */
  background: linear-gradient(-45deg, #5b8dee, #7c6dee, #38bdf8, #6366f1, #5b8dee);
  background-size: 300% 300%;
  animation: gradient-move 4s ease infinite;
  color: #ffffff;
  /* Oculto → visible con transición suave */
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
  z-index: 98;
  box-shadow: 0 4px 20px rgba(91,141,238,0.35);
}

#scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#scroll-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 30px rgba(91,141,238,0.55);
}

#scroll-top svg {
  width: 20px; height: 20px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* Navbar móvil: hamburguesa antes del idioma */
  nav { padding: 0.9rem 1.25rem; }
  #menu-toggle { display: inline-flex; order: -1; }

  /* Los links se convierten en un dropdown absoluto debajo de la nav */
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 0.5rem 1.5rem 1rem;
    gap: 0;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li   { border-bottom: 1px solid var(--border); }
  .nav-links li:last-child { border-bottom: none; }
  .nav-links a    { display: block; padding: 0.75rem 0; font-size: 0.95rem; }

  /* Hero: foto arriba, texto abajo */
  .hero-inner {
    flex-direction: column-reverse;
    text-align: center; gap: 2.5rem;
  }
  .foto-ring { width: 200px; height: 200px; }
  .hero-btns { justify-content: center; }
  .hero-desc { margin-left: auto; margin-right: auto; }

  /* About: una columna */
  .about-grid { grid-template-columns: 1fr; gap: 2.5rem; }

  /* Timeline: header en columna en móvil */
  .job-header  { flex-direction: column; }
  .job-meta    { text-align: left; }
  .timeline-item { padding: 1.25rem 1rem; }

  /* Education: año encima del título en móvil muy pequeño */
  .edu-item    { gap: 0.9rem; }

  section { padding: 3rem 1.25rem; }
  .contact-item { max-width: 100%; }
}

@media (max-width: 480px) {
  .hero-text h1 { font-size: 2.5rem; }
}
