/* =======================================================
   BASE / RESET
   ======================================================= */

section {
  scroll-snap-align: start;
}

:root {
  --layout-left: clamp(2.5rem, 9vw, 11rem);
  --content-gap: clamp(21rem, 24vw, 30rem);
  --section-padding-top: clamp(2rem, 5vw, 5rem);

  /* Paleta — misma identidad (navy + turquesa), organizada por tono/opacidad */
  --bg: #0b1930;
  --text: #ccd6f6;
  --text-heading: #e6ebfb;               /* titulares: gris muy claro, no blanco puro */
  --text-soft: #a6b4d8;
  --text-muted: #8892b0;

  --accent: #64ffda;
  --accent-strong: #8affe4;              /* hover / activo: mismo tono, un punto más claro */
  --accent-004: rgba(100, 255, 218, 0.04);
  --accent-008: rgba(100, 255, 218, 0.08);
  --accent-016: rgba(100, 255, 218, 0.16);
  --accent-030: rgba(100, 255, 218, 0.30);
  --accent-040: rgba(100, 255, 218, 0.40);

  --line-010: rgba(136, 146, 176, 0.10);
  --line-020: rgba(136, 146, 176, 0.20);
  --line-030: rgba(136, 146, 176, 0.30);

  /* Movimiento coordinado */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.22s;
  --dur-mid: 0.4s;
  --dur-slow: 0.7s;

  /* Tipografía: Space Grotesk en todo, Inter sólo en el side-nav de escritorio */
  --font-base: 'Space Grotesk', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-nav: 'Inter', 'Segoe UI', system-ui, sans-serif;

  /* Hueco extra bajo el nombre acoplado para el subtítulo "Full Stack Developer".
     El side-nav baja este valor y main.js lo suma a GAP_ABOVE_NAV para que la
     posición final del nombre NO cambie. Tocar solo aquí para reajustar. */
  --namesub-gap: 1.1rem;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--font-base);
}

body {
  background-color: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  text-decoration: none;
  color: inherit;
}

b {
  color: white;
}

img {
  max-width: 100%;
}

/* =======================================================
   ACCESIBILIDAD
   ======================================================= */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

a:focus-visible,
button:focus-visible,
.resume-btn:focus-visible,
.lang-link:focus-visible,
.side-nav-link:focus-visible,
.project-item:focus-visible,
.cta-button:focus-visible {
  outline: 0.15rem solid var(--accent);
  outline-offset: 0.25rem;
  border-radius: 0.2rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =======================================================
   BARRA SUPERIOR (logo + sección activa + idioma + CV)
   ======================================================= */
.top-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.2vh 2.5vw;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.logo {
  display: block;
  line-height: 0;
}

.logo img {
  width: 3.5rem;
  height: auto;
  display: block;
  transition: transform var(--dur-mid) var(--ease-out), filter var(--dur-mid) var(--ease-out);
  filter: drop-shadow(0 0 0.3rem var(--accent-030));
}

.logo img:hover {
  transform: scale(1.05);
  filter: drop-shadow(0 0 0.6rem var(--accent-040));
}

/* zona izquierda de la barra: logo y, en móvil, la etiqueta de sección lo sustituye en su sitio */
.top-bar-brand {
  position: relative;
  display: flex;
  align-items: center;
}

/* etiqueta de sección activa — sólo visible en móvil (ver media query) */
.current-section {
  display: none;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lang-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border: 0.08rem solid var(--line-030);
  padding: 0.35rem 0.7rem;
  border-radius: 1.5rem;
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

.lang-link:hover {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
}

.uk {
  width: 1.4rem;
  height: auto;
  display: block;
}

.resume-btn {
  border: 0.08rem solid var(--accent);
  padding: 0.4rem 0.9rem;
  border-radius: 0.8rem;
  color: var(--accent);
  font-size: 0.9rem;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.resume-btn:hover {
  background: var(--accent-008);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

/* =======================================================
   BARRA SOCIAL
   ======================================================= */
.social-bar {
  position: fixed;
  left: 2.5vw;
  bottom: 5vh;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  z-index: 999;
}

.social-bar a {
  display: block;
  transition: transform var(--dur-mid) var(--ease-out);
}

.social-bar svg {
  width: 2.2rem;
  height: 2.2rem;
  display: block;
  color: var(--text-muted); /* estado apagado (equivale al grayscale de los PNG) */
  transition: color var(--dur-mid) var(--ease-out);
}

.social-bar a:hover {
  transform: translateY(-0.3rem);
}

.social-bar a:hover svg {
  color: #fff; /* se ilumina en hover (equivale a grayscale(0%)) */
}

/* =======================================================
   SIDE NAV
   ======================================================= */
.side-nav {
  position: fixed;
  left: 8.5vw;
  top: 45%;
  transform: translateY(calc(-50% + var(--namesub-gap))); /* baja para dejar sitio al subtítulo del nombre */
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.side-nav.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-nav-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-nav); /* Inter: única familia distinta, sólo aquí */
  transition: color var(--dur-fast) var(--ease-out);
}

.side-nav-line {
  width: 1.5rem;
  height: 0.12rem;
  background: var(--text-muted);
  transition: width var(--dur-mid) var(--ease-out), background var(--dur-mid) var(--ease-out);
}

.side-nav-link:hover,
.side-nav-link.active {
  color: var(--text);
}

.side-nav-link:hover .side-nav-line,
.side-nav-link.active .side-nav-line {
  width: 4.2rem;
  background: var(--accent);
}

/* =======================================================
   HOME
   ======================================================= */
.home {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8vw;
  position: relative;
}

.home-content {
  max-width: 60rem;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out);
}

.small-intro {
  color: var(--accent);
  margin-bottom: 1.2rem;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.name {
  font-size: clamp(2.7rem, 5.4vw, 4.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 500;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity var(--dur-slow) var(--ease-out);
}

/* Subtítulo bajo el nombre acoplado (solo desktop). position:absolute -> NO cuenta
   para la altura de .name, así que la medición y la posición final del nombre no
   cambian. Aparece cuando el nombre queda fijado arriba (.name.is-pinned). */
.name-subtitle {
  position: absolute;
  top: 100%;
  left: 0;
  font-size: 1.3rem;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--text-soft);
  white-space: nowrap;
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease-out);
}

.name.is-pinned .name-subtitle {
  opacity: 1;
}

.slogan {
  font-size: clamp(1.85rem, 3.6vw, 2.9rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}

.description {
  max-width: 40rem;
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
  font-size: 1rem;
}

.small-intro,
.slogan,
.description {
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

.cta-button {
  padding: 0.7rem 1.5rem;
  border: 0.08rem solid var(--accent);
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out);
}

.cta-button:hover {
  background: var(--accent-008);
  border-color: var(--accent-strong);
  color: var(--accent-strong);
}

/* =======================================================
   CURSOR LIGHT (solo dispositivos con puntero fino)
   ======================================================= */
.cursor-light {
  position: fixed;
  pointer-events: none;
  top: 0;
  left: 0;
  z-index: 999;
  mix-blend-mode: overlay;
  border-radius: 30%;
  width: 53vw;
  height: 53vw;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle, rgba(255, 255, 255, 0.4) 10%, rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle, rgba(255, 255, 255, 0.2) 20%, rgba(255, 255, 255, 0) 60%);
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity var(--dur-mid) var(--ease-out), width var(--dur-mid) var(--ease-out),
    height var(--dur-mid) var(--ease-out);
}

/* =======================================================
   SOBRE MÍ
   ======================================================= */
.about-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(15rem, var(--layout-left)) 1fr;
  column-gap: var(--content-gap);
  padding-top: var(--section-padding-top);
}

.about-text {
  grid-column: 2;
}

.about-text p {
  max-width: 46rem;
  line-height: 1.8;
  color: var(--text-soft);
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

/* Cascada ligada al scroll: .in-view lo alterna el sectionsObserver (js/main.js) —
   igual que el grid de Herramientas: se añade al entrar y se quita al salir del
   viewport, así que la animación se repite. Escalonado de 120 ms por párrafo, con
   un pequeño arranque de 80 ms. */
.about-text.in-view p {
  opacity: 1;
  transform: translateY(0);
}

.about-text.in-view p:nth-child(1) { transition-delay: 0.08s; }
.about-text.in-view p:nth-child(2) { transition-delay: 0.20s; }
.about-text.in-view p:nth-child(3) { transition-delay: 0.32s; }
.about-text.in-view p:nth-child(4) { transition-delay: 0.44s; }

@media (prefers-reduced-motion: reduce) {
  .about-text p {
    opacity: 1;
    transform: none;
  }
}

/* HOLLOW KNIGHT HOVER EFFECT — timings propios e intencionados (efecto de juego) */
.hk-trigger {
  position: relative;
  display: inline-block;
  cursor: url('../images/cursor/Unavaliable.cur') 16 16, pointer;
}

.hk-letter {
  display: inline-block;
  color: inherit;
  font-weight: 600;
  transition: color 0.15s ease, transform 0.15s ease;
}

.hk-space {
  width: 0.35em;
}

.hk-trigger.hk-active .hk-letter {
  color: #050505;
  animation: hk-letter-jump 0.9s ease infinite;
}

.hk-trigger.hk-active .hk-letter:nth-child(1)  { animation-delay: 0.00s; transition-delay: 0.00s; }
.hk-trigger.hk-active .hk-letter:nth-child(2)  { animation-delay: 0.05s; transition-delay: 0.05s; }
.hk-trigger.hk-active .hk-letter:nth-child(3)  { animation-delay: 0.10s; transition-delay: 0.10s; }
.hk-trigger.hk-active .hk-letter:nth-child(4)  { animation-delay: 0.15s; transition-delay: 0.15s; }
.hk-trigger.hk-active .hk-letter:nth-child(5)  { animation-delay: 0.20s; transition-delay: 0.20s; }
.hk-trigger.hk-active .hk-letter:nth-child(6)  { animation-delay: 0.25s; transition-delay: 0.25s; }
.hk-trigger.hk-active .hk-letter:nth-child(7)  { animation-delay: 0.30s; transition-delay: 0.30s; }
.hk-trigger.hk-active .hk-letter:nth-child(8)  { animation-delay: 0.35s; transition-delay: 0.35s; }
.hk-trigger.hk-active .hk-letter:nth-child(9)  { animation-delay: 0.40s; transition-delay: 0.40s; }
.hk-trigger.hk-active .hk-letter:nth-child(10) { animation-delay: 0.45s; transition-delay: 0.45s; }
.hk-trigger.hk-active .hk-letter:nth-child(11) { animation-delay: 0.50s; transition-delay: 0.50s; }
.hk-trigger.hk-active .hk-letter:nth-child(12) { animation-delay: 0.55s; transition-delay: 0.55s; }
.hk-trigger.hk-active .hk-letter:nth-child(13) { animation-delay: 0.60s; transition-delay: 0.60s; }

@keyframes hk-letter-jump {
  0%   { transform: translateY(0); }
  40%  { transform: translateY(-0.35em); }
  100% { transform: translateY(0); }
}

.hk-spark {
  position: fixed;
  width: 5px;
  height: 5px;
  background: #050505;
  border-radius: 1px;
  pointer-events: none;
  z-index: 3000;
  animation: hk-spark-fly 0.55s ease-out forwards;
}

@keyframes hk-spark-fly {
  0%   { transform: translate(0, 0) scale(1); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(0.2); opacity: 0; }
}

/* =======================================================
   HERRAMIENTAS
   ======================================================= */
.skills-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(15rem, var(--layout-left)) 1fr;
  column-gap: var(--content-gap);
  padding-top: var(--section-padding-top);
}

.tools-grid {
  grid-column: 2;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  max-width: 44rem;
}

.tool-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 1.25rem 0.85rem;
  border: 0.08rem solid var(--line-020);
  border-radius: 0.5rem;
  background: var(--accent-004);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out),
    border-color var(--dur-mid) var(--ease-out), background var(--dur-mid) var(--ease-out);
}

.tools-grid.in-view .tool-card {
  opacity: 1;
  transform: translateY(0);
}

/* cascada por filas (grid de 4 columnas) */
.tools-grid.in-view .tool-card { transition-delay: 0.08s; }
.tools-grid.in-view .tool-card:nth-child(n + 5) { transition-delay: 0.16s; }
.tools-grid.in-view .tool-card:nth-child(n + 9) { transition-delay: 0.24s; }

.tools-grid.in-view .tool-card:hover {
  transform: translateY(-0.3rem);
  border-color: var(--line-030);
  background: var(--accent-008);
  transition-delay: 0s; /* respuesta inmediata al hover, sin el retardo de la cascada */
}

.tool-icon {
  color: var(--text-heading);
  width: 2.4rem;
  height: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--dur-fast) var(--ease-out), filter var(--dur-mid) var(--ease-out);
}

.tool-icon svg {
  width: 100%;
  height: 100%;
}

/* hover: icono en blanco puro + contorno según la silueta (drop-shadow apilado) */
.tool-card:hover .tool-icon {
  color: #fff;
  filter: drop-shadow(0 0 2px var(--accent-030));
}

.tool-name {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

/* =======================================================
   PROYECTOS
   ======================================================= */
.projects-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(15rem, var(--layout-left)) 1fr;
  column-gap: clamp(21rem, 20vw, 30rem);
  padding-top: var(--section-padding-top);
  align-items: start;
  padding-left: 3rem;
}

.projects-list {
  grid-column: 2;
  max-width: 48rem; /* desktop: más ancho para el texto de cada proyecto (móvil lo pisa a 100%) */
  display: flex;
  flex-direction: column;
  gap: 2.8rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

.projects-list.in-view {
  opacity: 1;
  transform: translateY(0);
}

.project-item {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.6rem;
  align-items: center;
  padding: 1.8rem;
  border-radius: 0.4rem;
  border: 0.08rem solid transparent;
  transition: background var(--dur-mid) var(--ease-out), border-color var(--dur-mid) var(--ease-out),
    opacity var(--dur-mid) var(--ease-out);
}

.projects-list:hover .project-item {
  opacity: 0.4;
}

.projects-list .project-item:hover {
  opacity: 1;
  background: var(--accent-004);
  border-color: var(--line-020);
}

.project-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.5rem;
  overflow: hidden;
}

.project-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-title {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.project-arrow {
  color: var(--accent);
  font-size: 1rem;
  transition: transform var(--dur-fast) var(--ease-out);
}

.project-item:hover .project-arrow {
  transform: translate(0.15rem, -0.15rem);
}

.project-desc {
  color: var(--text-soft);
  font-size: 0.95rem;
  margin: 0.4rem 0 0.8rem;
  max-width: 44rem; /* acompaña al ensanche de .projects-list para que la descripción use el ancho extra */
}

.project-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  background: var(--accent-008);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

/* =======================================================
   CONTACTO
   ======================================================= */
.contact-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(15rem, var(--layout-left)) 1fr;
  column-gap: var(--content-gap);
  padding-top: var(--section-padding-top);
  padding-left: 4rem;
  align-items: start;
}

.contact-info {
  grid-column: 2;
  max-width: 39rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}

.contact-info.in-view {
  opacity: 1;
  transform: translateY(0);
}

.contact-lead {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--text-soft);
  margin-bottom: 2.2rem;
}

.contact-methods {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  margin-bottom: 2.5rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.contact-icon {
  color: #fff; /* icono en blanco; el borde usa --accent-030 por su cuenta */
  width: 2.2rem;
  height: 2.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.08rem solid var(--accent-030);
  border-radius: 50%;
  flex-shrink: 0;
}

.contact-icon svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

.contact-item > div {
  display: flex;
  flex-direction: column;
}

.contact-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.2rem;
}

.contact-value {
  color: var(--text);
  font-size: 1.05rem;
  transition: color var(--dur-fast) var(--ease-out);
}

a.contact-value:hover {
  color: var(--accent-strong);
}

.contact-cta {
  display: inline-block;
  border-radius: 1.5rem;
}

/* =======================================================
   FOOTER — crédito discreto, alineado con el contenido de las secciones
   ======================================================= */
.site-footer {
  padding: 3rem 2vw 4rem; /* mismo eje X que `section` */
}

.footer-inner {
  /* misma rejilla que .about-content / .skills-content: el texto cae en la columna 2 */
  display: grid;
  grid-template-columns: minmax(15rem, var(--layout-left)) 1fr;
  column-gap: var(--content-gap);
}

.footer-credit {
  grid-column: 2;
  max-width: 46rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--text-muted);
}

.footer-credit a {
  color: var(--text-soft);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--line-030);
  text-underline-offset: 0.15em;
  transition: color var(--dur-fast) var(--ease-out),
    text-decoration-color var(--dur-fast) var(--ease-out);
}

.footer-credit a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentColor;
}

/* =======================================================
   SECCIÓN GENÉRICA
   ======================================================= */
section {
  min-height: 100vh;
  height: auto;
  padding: 10vh 2vw;
}

/* =======================================================
   TABLET
   ======================================================= */
@media (max-width: 1024px) {
  .home { padding: 0 7vw; }
  .name { font-size: clamp(2.3rem, 6.2vw, 3.6rem); }
  .slogan { font-size: clamp(1.7rem, 4.6vw, 2.4rem); }
  .description { font-size: 0.95rem; }
  .tools-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =======================================================
   MÓVIL — layout vertical apilado (<= 768px)
   ======================================================= */
@media (max-width: 768px) {
  html {
    /* la barra superior es fija en móvil: evita que las anclas queden ocultas tras ella */
    scroll-padding-top: 4.5rem;
    /* sin scroll-snap en móvil: provocaba paradas con huecos entre secciones cortas */
    scroll-snap-type: none;
  }

  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-top: 3.9rem; /* hueco para la barra superior fija */
  }

  /* el cursor personalizado no aplica en táctil */
  .cursor-light {
    display: none !important;
  }

  /* 1 · Barra superior fija durante toda la navegación */
  .top-bar {
    position: fixed;
    pointer-events: auto;
    padding: 0.7rem 1rem;
    background: rgba(11, 25, 48, 0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    /* sin línea recta: separación suave por sombra tenue */
    box-shadow: 0 0.5rem 1rem -0.5rem rgba(0, 0, 0, 0.45);
  }

  .logo img { width: 2.4rem; height: 2.4rem; } /* alto explícito: altura de barra estable antes de cargar */
  .top-bar-actions { gap: 0.6rem; }
  .lang-link { padding: 0.3rem 0.55rem; font-size: 0.8rem; }
  .resume-btn { padding: 0.35rem 0.75rem; font-size: 0.85rem; }

  /* la etiqueta de sección ocupa el sitio del logo (izquierda) y hace crossfade con él */
  .current-section {
    display: block;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) translateY(4px);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    /* mismo gris/blanco que el <h2> en página: el título no cambia de color al acoplarse */
    color: var(--text-heading);
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }

  .top-bar-brand .logo {
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }

  .top-bar-brand.is-section .logo {
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
  }

  .top-bar-brand.is-section .current-section {
    opacity: 1;
    transform: translateY(-50%);
  }

  .top-bar-brand.is-section .current-section.is-swapping {
    opacity: 0;
    transform: translateY(-50%) translateY(-4px);
  }

  /* 2 · Contenido */
  main {
    order: 1;
    width: 100%;
  }

  section {
    min-height: 0;
    padding: 3rem 1.5rem;
    scroll-snap-align: none;
  }

  /* HOME en flujo vertical, sin posiciones fijas */
  .home {
    height: auto;
    min-height: 0;
    padding: 2.5rem 1.5rem 1rem;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .home-content { max-width: 100%; }
  .home-content br { display: none; }

  .small-intro {
    font-size: 0.95rem;
    margin-bottom: 0.6rem;
  }

  .name {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    white-space: normal;
    pointer-events: auto;
    font-size: clamp(2.2rem, 9vw, 3rem);
    line-height: 1.1;
    margin-bottom: 1rem;
  }

  /* el subtítulo del nombre es solo desktop */
  .name-subtitle { display: none; }

  .slogan {
    font-size: clamp(1.6rem, 7vw, 2.2rem);
    margin-bottom: 1rem;
  }

  .description {
    font-size: 0.92rem;
    max-width: 100%;
    margin-bottom: 0;
  }

  .cta-button {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
  }

  /* layouts de 2 columnas -> 1 columna */
  .about-content,
  .skills-content,
  .projects-content,
  .contact-content {
    display: block;
    padding: 0;
  }

  .about-text p {
    max-width: 100%;
    font-size: 1rem;
  }

  /* Título de sección visible SOLO en móvil — reutiliza el <h2 class="sr-only"> */
  main .section-heading {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 1.5rem;
    overflow: visible;
    clip: auto;
    white-space: normal;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-heading);
    transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
  }

  /* al acoplarse a la cabecera, el título de la página se desvanece hacia arriba
     mientras setHeaderSection() hace aparecer la etiqueta en la barra (traspaso continuo) */
  main .section-heading.is-docked {
    opacity: 0;
    transform: translateY(-0.6rem);
  }

  /* Reveal escalonado = detalle de escritorio (secciones a pantalla completa).
     En móvil, con secciones cortas apiladas, dejaba contenido en opacity:0 mientras
     el observer enganchaba la siguiente sección -> hueco vacío antes de Proyectos.
     En móvil: contenido siempre visible. */
  .about-text p,
  .tools-grid .tool-card,
  .projects-list,
  .contact-info {
    opacity: 1;
    transform: none;
  }

  /* Herramientas: 3 columnas en móvil */
  .tools-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.7rem;
    max-width: 100%;
  }

  .tool-card { padding: 1rem 0.5rem; }
  .tool-icon { width: 2.1rem; height: 2.1rem; }
  .tool-name { font-size: 0.72rem; }

  /* Proyectos — estilo referencia: apilados, texto arriba e imagen debajo */
  .projects-list {
    max-width: 100%;
    gap: 3rem;
  }

  .project-item {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0;
    border: none;
    border-radius: 0;
  }

  .project-body { order: 1; }

  /* la imagen es un apoyo, no la protagonista: tamaño contenido y alineada a la izquierda */
  .project-thumb {
    order: 2;
    width: 100%;
    max-width: 14rem;
    align-self: flex-start;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
  }

  /* sin hover táctil: todos los proyectos a opacidad completa y sin fondo/borde */
  .projects-list:hover .project-item,
  .projects-list .project-item:hover {
    opacity: 1;
    background: none;
    border-color: transparent;
  }

  .project-item:hover .project-arrow {
    transform: none;
  }

  .project-title { font-size: 1.2rem; }

  .contact-info { max-width: 100%; }

  /* 3 · Navegación en fila, estática, bajo el contenido */
  .side-nav {
    position: static;
    order: 2;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    padding: 2.5rem 1rem 0.5rem;
  }

  .side-nav-line { display: none; }

  .side-nav-link {
    border: 0.08rem solid var(--line-030);
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    font-size: 0.72rem;
  }

  .side-nav-link.active {
    border-color: var(--accent);
    color: var(--accent);
  }

  /* 4 · Redes sociales en fila, al final */
  .social-bar {
    position: static;
    order: 3;
    flex-direction: row;
    justify-content: center;
    gap: 1.8rem;
    padding: 1.5rem 1rem 2.5rem;
  }

  .social-bar svg {
    width: 1.9rem;
    height: 1.9rem;
    color: #fff; /* en móvil (sin hover) los iconos van iluminados, como el grayscale(0%) anterior */
  }

  /* 5 · Footer: último en el apilado, mismos márgenes que el resto del contenido */
  .site-footer {
    order: 4;
    width: 100%;
    padding: 2.5rem 1.5rem 3rem;
  }

  .footer-inner { display: block; }
  .footer-credit { max-width: 100%; }
}

/* =======================================================
   MÓVIL MEDIANO (<= 480px)
   ======================================================= */
@media (max-width: 480px) {
  .small-intro { font-size: 0.85rem; }
  .name { font-size: clamp(2rem, 10vw, 2.6rem); }
  .slogan { font-size: clamp(1.4rem, 8vw, 1.9rem); }
  .description { font-size: 0.85rem; }

  section { padding: 2.5rem 1.2rem; }
  .site-footer { padding: 2rem 1.2rem 2.5rem; }
}

/* =======================================================
   MÓVIL PEQUEÑO (<= 380px)
   ======================================================= */
@media (max-width: 380px) {
  .top-bar-actions { gap: 0.45rem; }
  .lang-link { padding: 0.28rem 0.45rem; font-size: 0.75rem; }
  .resume-btn { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

  .current-section { font-size: 0.7rem; letter-spacing: 0.1em; }
  main .section-heading { font-size: 0.76rem; letter-spacing: 0.1em; }

  .tools-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .tool-card { padding: 1rem 0.55rem; }
  .tool-icon { width: 2rem; height: 2rem; }
  .tool-name { font-size: 0.74rem; }

  .side-nav-link { font-size: 0.68rem; padding: 0.45rem 0.75rem; }
}
