/* ===== MOBILE FIRST — breakpoints ===== */

/* Tablet: ≥ 768px */
@media (min-width: 768px) {
  :root {
    --espacio-m: 2.5rem;
  }
}

/* Desktop: ≥ 1024px */
@media (min-width: 1024px) {
  :root {
    --espacio-m: 3rem;
  }
}

/* ===== HEADER RESPONSIVE ===== */
@media (max-width: 900px) {
  /* Vertical padding siempre presente — el alto del header no cambia al hacer scroll */
  .site-header {
    padding: 8px 0 6px;
  }

  /* Píldora solo cuando hay scroll */
  .site-header.is-scrolled {
    padding: 8px 12px 6px;
  }

  .site-header.is-scrolled .header__inner {
    border-radius: 28px;
  }

  .header__inner {
    padding: 0.65rem 1.25rem;
  }

  .nav-toggle {
    display: flex;
  }

  /* Con position: fixed en site-header, el portal JS usa getBoundingClientRect().bottom */
  .nav-principal {
    position: static;
  }

  .nav-principal__lista {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-fondo);
    border-bottom: 2px solid var(--color-dorado);
    padding: var(--espacio-s) var(--espacio-m);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
  }

  .nav-principal__lista.is-open {
    display: flex;
  }

  .nav-principal__item {
    width: 100%;
  }

  .nav-principal__item a {
    width: 100%;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(41, 74, 58, 0.1);
    border-radius: 0;
  }

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

  /* Dropdown Bibliotecas en móvil */
  .nav-bibl__toggle {
    width: 100%;
    justify-content: space-between;
    padding: 0.75rem 0.5rem;
    border-radius: 0;
    border-bottom: 1px solid rgba(41, 74, 58, 0.1);
    letter-spacing: 2.8px;
  }

  .nav-bibl__toggle.is-open {
    border-radius: 0;
    border-bottom: none;
  }

  .nav-bibl__dropdown {
    position: static;
    border-radius: 0 0 10px 10px;
    box-shadow: none;
    min-width: auto;
    padding-bottom: 0.25rem;
  }

  .nav-bibl__enlace {
    padding: 0.55rem 1.5rem;
  }
}

/* ===== FOOTER RESPONSIVE (manejado en layout.css) ===== */
@media (max-width: 600px) {
}

/* ===== HERO RESPONSIVE (index) ===== */
@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: 1fr !important;
    gap: var(--espacio-m) !important;
  }

  .hero__imagen {
    max-width: 400px;
    margin: 0 auto;
  }
}

/* ===== INTRO RESPONSIVE (index) ===== */
@media (max-width: 768px) {
  .intro__grid {
    grid-template-columns: 1fr !important;
  }
}

/* ===== PAISES RESPONSIVE — movido al final de inicio.css ===== */

/* ===== BIBLIOTECAS RESPONSIVE ===== */
@media (max-width: 900px) {
  .biblioteca__grid {
    grid-template-columns: 1fr !important;
  }

  .biblioteca__galeria {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 560px) {
  .biblioteca__galeria {
    grid-template-columns: 1fr !important;
  }
}

/* ===== BUSCADOR RESPONSIVE ===== */
@media (max-width: 768px) {
  .buscador__filtros {
    flex-direction: column;
    align-items: stretch;
  }

  .resultados__grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .resultados__grid {
    grid-template-columns: 1fr;
  }
}

/* ===== PRESENTACION RESPONSIVE ===== */
@media (max-width: 768px) {
  .creditos__grid {
    grid-template-columns: 1fr !important;
  }
}
