/* ============================================================================
   chrome.css — nav y footer compartidos del sitio (páginas interiores).
   Fuente única de la "carcasa" que inyecta scripts/build-partials.js desde
   src/partials/. La home mantiene su propio nav (template Mustache + index.scss);
   estos estilos replican los mismos tokens del sistema (src/scss/variables.scss).
   Markup con clases jdp-* sobre <div> a propósito: los CSS por página estilan
   header/nav/footer por selector de elemento y no deben alcanzar este chrome.
   ========================================================================== */

.jdp-header {
  position: sticky;
  top: 0;
  /* Por encima de cualquier contenido: los CSS por página usan hasta z-index 100
     y el desplegable de Biblioteca vive dentro de este contexto de apilamiento. */
  z-index: 500;
  background: rgba(8, 8, 16, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.jdp-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.jdp-logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #E8E8F0;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.jdp-logo-dot { color: #0070F3; }

.jdp-menu {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}
.jdp-menu li { margin: 0; }
.jdp-menu a {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1vw, 1rem);
  font-weight: 500;
  color: #8888A0;
  text-decoration: none;
  transition: color 150ms ease;
}
.jdp-menu a:hover { color: #F0F0F5; }

.jdp-menu a.jdp-boletin { color: #4d9bff; }
.jdp-menu a.jdp-boletin:hover { color: #F0F0F5; }

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

.jdp-lang {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.75rem, 1vw, 0.875rem);
  font-weight: 600;
  letter-spacing: 0.08em;
}
.jdp-lang-option {
  padding: 2px 0.5rem;
  color: #8888A0;
  text-decoration: none;
  border-radius: 4px;
  transition: color 150ms ease;
}
.jdp-lang-option:hover { color: #F0F0F5; }
.jdp-lang-option.jdp-lang-active {
  color: #4d9bff;
  background: rgba(0, 112, 243, 0.15);
  padding: 2px 0.75rem;
}
.jdp-lang-sep { color: rgba(255, 255, 255, 0.12); }

/* ── Dropdown Biblioteca ─────────────────────────────────────────────────── */
.jdp-has-dropdown { position: relative; }

.jdp-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1vw, 1rem);
  font-weight: 500;
  line-height: inherit;
  color: #8888A0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 150ms ease;
}
.jdp-dropdown-toggle:hover { color: #F0F0F5; }

.jdp-caret {
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 150ms ease;
}
.jdp-has-dropdown:hover .jdp-caret,
.jdp-has-dropdown:focus-within .jdp-caret,
.jdp-has-dropdown.is-open .jdp-caret { transform: rotate(225deg) translateY(2px); }

.jdp-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  min-width: 190px;
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  background: #111120;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
  z-index: 200;
}
/* puente invisible: el puntero puede viajar del toggle al panel sin cerrarlo */
.jdp-dropdown::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}
.jdp-dropdown li { margin: 0; }
.jdp-dropdown a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
}
.jdp-dropdown a:hover { color: #F0F0F5; background: rgba(255, 255, 255, 0.04); }

.jdp-has-dropdown:hover .jdp-dropdown,
.jdp-has-dropdown:focus-within .jdp-dropdown,
.jdp-has-dropdown.is-open .jdp-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ── Toggle móvil ────────────────────────────────────────────────────────── */
.jdp-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.jdp-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: #8888A0;
  border-radius: 2px;
  transition: transform 250ms ease, opacity 250ms ease;
}

/* Colapsa a hamburguesa (mismo umbral que la home) */
@media (max-width: 1100px) {
  .jdp-header { position: relative; }
  .jdp-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #080810;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
    gap: 1rem;
    z-index: 99;
  }
  .jdp-menu.is-open { display: flex; }
  .jdp-toggle { display: flex; }

  /* Dropdown como acordeón inline dentro del menú móvil */
  .jdp-has-dropdown { position: static; width: 100%; }
  .jdp-dropdown-toggle { width: 100%; justify-content: flex-start; }
  .jdp-dropdown {
    position: static;
    min-width: 0;
    margin: 0.5rem 0 0;
    padding: 0 0 0 1rem;
    background: none;
    border: none;
    box-shadow: none;
    opacity: 1;
    visibility: hidden;
    transform: none;
    display: none;
  }
  .jdp-dropdown::before { display: none; }
  .jdp-dropdown a { padding: 0.5rem 0; }
  /* En táctil solo el click (.is-open) lo abre */
  .jdp-has-dropdown:hover .jdp-dropdown,
  .jdp-has-dropdown:focus-within .jdp-dropdown { display: none; }
  .jdp-has-dropdown.is-open .jdp-dropdown { display: block; visibility: visible; transform: none; }
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.jdp-footer {
  position: relative;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin-top: 4rem;
  padding: 2.5rem 1.5rem 2rem;
}
.jdp-footer::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 20%;
  right: 20%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 112, 243, 0.3), transparent);
  pointer-events: none;
}

.jdp-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  text-align: center;
}

.jdp-footer-nav,
.jdp-footer-social {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
}
.jdp-footer-nav a,
.jdp-footer-social a,
.jdp-footer-copy a {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 1vw, 1rem);
  color: #828299;
  text-decoration: none;
  transition: color 150ms ease;
}
.jdp-footer-social a { font-size: clamp(0.75rem, 1vw, 0.875rem); }
.jdp-footer-nav a:hover,
.jdp-footer-social a:hover,
.jdp-footer-copy a:hover { color: #F0F0F5; }

.jdp-footer-copy {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  color: #828299;
}

@media (prefers-reduced-motion: reduce) {
  .jdp-caret, .jdp-dropdown, .jdp-toggle span, .jdp-menu a, .jdp-lang-option { transition: none; }
}
