/* Pastilla visible desde el inicio, con compactación suave al desplazar. */
.cabecera.nav-original {
  position: sticky; top: 16px; z-index: 50; display: block;
  width: calc(100% - 32px); max-width: 1080px; margin: 16px auto 0;
  padding: 0; background: none; border: 0; box-shadow: none; pointer-events: none;
  transition: max-width .3s ease;
}
.cabecera.nav-desplazada { max-width: 1000px; }
.nav-inner {
  position: relative; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; padding: 12px 22px; border-radius: 18px; pointer-events: auto;
  background: linear-gradient(180deg, #ffffff, #f5f8ff);
  border: 1px solid #cbd8f3;
  box-shadow: 0 8px 28px #14265b18, inset 0 1px 0 #fff;
  transition: background .3s ease, border-color .3s ease, box-shadow .3s ease;
}
.nav-desplazada .nav-inner {
  background: #fffffff0;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid #cbd8f3; box-shadow: 0 8px 28px #14265b18, inset 0 1px 0 #fff;
}
.cabecera.nav-original .nav-logo { display: flex; flex: none; align-items: center; gap: 16px; min-height: 44px; }
.nav-trayectoria {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 0 0 66px; width: 66px; height: 54px; padding: 6px 8px 9px;
  border: 1px solid #3d568e; border-radius: 9px 9px 16px 16px;
  background: linear-gradient(145deg, #294780, var(--azul-oscuro)); color: #dce7ff;
  box-shadow: inset 0 0 0 3px var(--azul-oscuro), inset 0 0 0 4px #ffffff26, 0 3px 8px #14265b16;
  font-size: 8px; font-weight: 600; line-height: 1.4; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
.nav-trayectoria strong { color: #fff; font-size: 21px; line-height: 1.15; font-weight: 750; letter-spacing: -.03em; }
.nav-trayectoria::after { content: ''; position: absolute; bottom: 6px; width: 22px; height: 2px; border-radius: 2px; background: #ff4053; }
.cabecera.nav-original .logo { width: 205px; height: auto; }
.cabecera.nav-original nav { display: block; width: auto; padding: 0; order: initial; }
.cabecera.nav-original .nav-links { display: flex; gap: 8px; align-items: center; margin: 0; padding: 0; list-style: none; }
.cabecera.nav-original .nav-links a {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 12px 14px; border: 0; border-radius: 8px;
  color: var(--azul-oscuro); font-size: 14px; line-height: 1.4; font-weight: 650;
  text-align: center; white-space: nowrap; background: transparent;
}
.cabecera.nav-original .nav-links a[aria-current=page] { background: #e7eeff; color: var(--azul); box-shadow: inset 0 -2px 0 var(--rojo); }
.cabecera.nav-original .nav-links a:hover,
.cabecera.nav-original .nav-links a:focus-visible { background: #e7eeff; color: var(--azul); }
.nav-hamburguesa { display: none; }
@media (min-width: 861px) {
  .cabecera.nav-original .nav-links a {
    transition: color .25s ease;
    text-decoration: none;
  }
  .cabecera.nav-original .nav-links a[aria-current=page],
  .cabecera.nav-original .nav-links a:hover,
  .cabecera.nav-original .nav-links a:focus-visible {
    background: transparent; box-shadow: none; color: var(--azul);
  }
  .cabecera.nav-original .nav-links a::after {
    content: ''; position: absolute; left: 14px; right: 14px; bottom: 5px;
    height: 2px; border-radius: 2px; background: var(--rojo);
    transform: scaleX(0); transform-origin: left center;
    transition: transform .28s ease;
    pointer-events: none;
  }
  .cabecera.nav-original .nav-links a[aria-current=page]::after,
  .cabecera.nav-original .nav-links a:hover::after,
  .cabecera.nav-original .nav-links a:focus-visible::after { transform: scaleX(1); }
}
@media (max-width: 860px) {
  .cabecera.nav-original { top: 0; width: 100%; margin-top: 0; }
  .nav-inner { padding: 10px 14px; flex-wrap: wrap; gap: 10px; }
  .nav-inner, .nav-desplazada .nav-inner {
    border-radius: 0; background: #f8faff; border: 0; border-bottom: 1px solid #dce4f5;
    backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .cabecera.nav-original .logo { width: clamp(155px, 42vw, 205px); }
  .cabecera.nav-original .nav-logo { gap: 10px; }
  .nav-trayectoria { flex-basis: 60px; width: 60px; height: 48px; padding: 5px 7px 8px; }
  .nav-trayectoria strong { font-size: 19px; }
  .cabecera.nav-original nav { width: 100%; }
  .cabecera.nav-original .nav-links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .cabecera.nav-original .nav-links a { white-space: normal; min-height: 48px; font-size: 14px; }
  .cabecera.nav-listo nav { width: auto; }
  .nav-listo .nav-hamburguesa {
    display: grid; place-items: center; width: 46px; height: 46px; padding: 10px;
    border: 1px solid #cbd8f3; border-radius: 10px; background: #edf3ff; color: var(--azul);
  }
  .nav-hamburguesa path { transform-box: view-box; transform-origin: 12px 12px; transition: transform .2s, opacity .2s; }
  /* Centrar cada trazo antes de girarlo: CSS aplica las funciones de derecha a izquierda. */
  .nav-abierto .linea-superior { transform: rotate(45deg) translateY(6px); }
  .nav-abierto .linea-media { opacity: 0; }
  .nav-abierto .linea-inferior { transform: rotate(-45deg) translateY(-6px); }
  .cabecera.nav-listo .nav-links { display: none; }
  .cabecera.nav-listo.nav-abierto .nav-links {
    display: flex; flex-direction: column; align-items: stretch; gap: 8px;
    position: fixed; top: var(--nav-bottom, 67px); bottom: 0;
    left: 0; right: 0; padding: 24px 18px max(24px, env(safe-area-inset-bottom));
    background: linear-gradient(160deg, #f8faff, #eaf0ff); border: 0;
    border-radius: 0; box-shadow: none; overflow-y: auto;
    animation: menu-entrada .22s ease-out;
  }
  .cabecera.nav-abierto .nav-links a { justify-content: flex-start; padding: 18px; font-size: 22px; min-height: 64px; }
  body.menu-movil-abierto { overflow: hidden; }
  html { scroll-padding-top: 105px; }
}
@keyframes menu-entrada { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cabecera.nav-original, .nav-inner, .nav-hamburguesa path { transition: none; }
  .cabecera.nav-listo.nav-abierto .nav-links { animation: none; }
  .cabecera.nav-original .nav-links a,
  .cabecera.nav-original .nav-links a::after { transition: none; }
}
