/* ══════════════════════════════════════════════════════════
   responsive-fix.css — Bilbao que ver
   Mejoras responsive globales + menú hamburguesa animado
   Cargar DESPUÉS de main.css y front-page.css
══════════════════════════════════════════════════════════ */

/* ─── 0. BASE: evitar overflow horizontal global ─────────────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, iframe, video, embed, object {
  max-width: 100%;
}

/* ─── 1. CONTENEDOR RESPONSIVO ───────────────────────────────────────── */
.bqv-container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* ─── 2. HEADER MEJORADO ─────────────────────────────────────────────── */
.bqv-header {
  height: 64px;
}

.bqv-header__inner {
  gap: clamp(12px, 2vw, 32px);
  height: 64px;
}

/* Logo nunca se corta */
.bqv-header__logo {
  font-size: clamp(14px, 2vw, 17px);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 0;
}

/* Nav links con gap responsivo */
.bqv-nav__list {
  gap: clamp(12px, 2vw, 32px);
}

/* CTA compacto en tablets */
@media (max-width: 900px) {
  .bqv-header__cta {
    padding: 6px 14px;
    font-size: 10px;
  }
}

/* ─── 3. MENÚ HAMBURGUESA — ANIMACIÓN FLUIDA ─────────────────────────── */

/* Botón: siempre visible en móvil, nunca en desktop */
.bqv-nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
  z-index: 1001;
  width: 40px;
  height: 40px;
  align-items: center;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.bqv-nav__toggle:hover {
  background: rgba(168,197,216,0.12);
}

.bqv-nav__toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-beige);
  border-radius: 2px;
  transform-origin: center;
  transition:
    background 0.25s ease,
    transform 0.35s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.25s ease,
    width 0.25s ease;
}

.bqv-header.is-scrolled .bqv-nav__toggle span {
  background: var(--color-navy);
}

/* Animación X al abrir */
.bqv-nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.bqv-nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.bqv-nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ─── 4. MENÚ MÓVIL — OVERLAY DESLIZANTE ────────────────────────────── */
.bqv-nav-mobile {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: var(--color-beige);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 80px clamp(28px, 8vw, 64px) 48px;
  overflow-y: auto;

  /* Estado cerrado */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition:
    opacity 0.35s cubic-bezier(0.23, 1, 0.32, 1),
    visibility 0.35s,
    transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);

  /* Reset del display: block del CSS original */
}

/* Quitar el display:none/block original (se controla con opacity+visibility) */
.bqv-nav-mobile {
  display: flex !important;
}

.bqv-nav-mobile.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Lista del menú móvil */
.bqv-nav-mobile ul {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.bqv-nav-mobile ul li {
  border-bottom: 1px solid var(--color-warm);
  overflow: hidden;

  /* Animación stagger */
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.bqv-nav-mobile ul li:first-child {
  border-top: 1px solid var(--color-warm);
}

.bqv-nav-mobile.is-open ul li {
  opacity: 1;
  transform: translateY(0);
}

/* Delays stagger para cada ítem */
.bqv-nav-mobile.is-open ul li:nth-child(1) { transition-delay: 0.05s; }
.bqv-nav-mobile.is-open ul li:nth-child(2) { transition-delay: 0.10s; }
.bqv-nav-mobile.is-open ul li:nth-child(3) { transition-delay: 0.15s; }
.bqv-nav-mobile.is-open ul li:nth-child(4) { transition-delay: 0.20s; }
.bqv-nav-mobile.is-open ul li:nth-child(5) { transition-delay: 0.25s; }
.bqv-nav-mobile.is-open ul li:nth-child(6) { transition-delay: 0.30s; }

.bqv-nav-mobile ul a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  font-family: var(--font-serif);
  font-size: clamp(22px, 6vw, 32px);
  font-weight: 400;
  color: var(--color-navy);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.bqv-nav-mobile ul a::after {
  content: '→';
  font-size: 0.6em;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-family: var(--font-sans);
  font-style: normal;
}

.bqv-nav-mobile ul a:hover {
  color: var(--color-blue);
  padding-left: 4px;
}

.bqv-nav-mobile ul a:hover::after {
  opacity: 1;
  transform: translateX(0);
}

/* CTA especial en menú móvil */
.bqv-nav-mobile__cta {
  color: var(--color-blue) !important;
  font-weight: 500 !important;
}

/* Decoración del menú móvil */
.bqv-nav-mobile::before {
  content: '';
  position: absolute;
  top: -10%;
  right: -15%;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(44,107,142,0.06) 0%, transparent 65%);
  pointer-events: none;
}

/* ─── 5. BREAKPOINT PRINCIPAL (768px) ───────────────────────────────── */
@media (max-width: 768px) {
  .bqv-nav,
  .bqv-header__cta {
    display: none !important;
  }

  .bqv-nav__toggle {
    display: flex;
  }

  /* Header height en móvil */
  .bqv-header {
    height: 60px;
  }

  .bqv-header__inner {
    height: 60px;
    gap: 0;
    justify-content: space-between;
  }
}

/* ─── 6. HERO RESPONSIVO ─────────────────────────────────────────────── */
.bqv-hero__content {
  padding: clamp(80px, 12vh, 120px) 0 clamp(48px, 8vh, 80px);
}

.bqv-hero__desc {
  font-size: clamp(15px, 2vw, 17px);
}

@media (max-width: 768px) {
  .bqv-hero__actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .bqv-btn {
    width: 100%;
    justify-content: center;
    max-width: 320px;
  }
}

/* ─── 7. GRIDS RESPONSIVOS ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .bqv-grid--2,
  .bqv-grid--3,
  .bqv-grid {
    grid-template-columns: 1fr;
  }

  .bqv-grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .bqv-grid-hero {
    grid-template-columns: 1fr;
  }

  .bqv-grid-hero__main {
    grid-row: auto;
  }
}

@media (max-width: 400px) {
  .bqv-grid--4 {
    grid-template-columns: 1fr;
  }
}

/* ─── 8. BANNER RESPONSIVO ───────────────────────────────────────────── */
.bqv-banner {
  padding: clamp(24px, 4vw, 48px) clamp(20px, 5vw, 48px);
}

@media (max-width: 640px) {
  .bqv-banner {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-lg);
  }

  .bqv-banner__cta {
    width: 100%;
    justify-content: center;
  }

  .bqv-banner__text h2 {
    font-size: clamp(18px, 5vw, 24px);
  }
}

/* ─── 9. FOOTER RESPONSIVO ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .bqv-footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .bqv-footer__col--brand {
    grid-column: auto;
  }

  .bqv-footer__bottom {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}

/* ─── 10. CARDS RESPONSIVAS ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .bqv-card--horizontal {
    flex-direction: column;
  }

  .bqv-card--horizontal .bqv-card__img-wrap {
    flex: none;
    width: 100%;
  }

  .bqv-card--horizontal .bqv-card__img {
    aspect-ratio: 16 / 9;
    height: auto;
  }
}

/* ─── 11. PAGE HERO RESPONSIVO ───────────────────────────────────────── */
.bqv-page-hero {
  padding: clamp(88px, 14vh, 120px) 0 clamp(40px, 6vh, 60px);
}

.bqv-page-hero__desc {
  font-size: clamp(14px, 2vw, 16px);
  max-width: 100%;
}

/* ─── 12. CHIPS SCROLL EN MÓVIL ──────────────────────────────────────── */
@media (max-width: 640px) {
  .bqv-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
    margin-bottom: var(--space-lg);
  }

  .bqv-chips::-webkit-scrollbar {
    display: none;
  }

  .bqv-chip {
    flex-shrink: 0;
  }
}

/* ─── 13. TABLA DE CONTENIDOS RESPONSIVA ─────────────────────────────── */
@media (max-width: 520px) {
  .bqv-toc {
    padding: var(--space-md) var(--space-lg);
  }

  .bqv-toc ol {
    padding-left: 16px;
  }
}

/* ─── 14. MODAL RESPONSIVO ───────────────────────────────────────────── */
.bqv-modal__panel {
  max-height: 92vh;
  overflow-y: auto;
  width: min(680px, calc(100vw - 32px));
  margin: 16px;
}

@media (max-width: 520px) {
  .bqv-modal__panel {
    width: calc(100vw - 16px);
    margin: 8px;
    max-height: 96vh;
    border-radius: var(--radius-md);
  }

  .bqv-modal__body {
    padding: var(--space-lg) var(--space-md);
  }

  .bqv-modal__img-wrap {
    aspect-ratio: 16 / 9;
  }
}

/* ─── 15. SINGLE POST RESPONSIVO ─────────────────────────────────────── */
@media (max-width: 640px) {
  .bqv-single {
    padding: var(--space-2xl) clamp(16px, 5vw, 28px);
  }
}

/* ─── 16. CARRUSEL RESPONSIVO ────────────────────────────────────────── */
@media (max-width: 768px) {
  .bqv-flip-card {
    flex: 0 0 calc(100vw - 40px) !important;
    max-width: calc(100vw - 40px);
  }
}

/* ─── 17. BARRIO CARDS ───────────────────────────────────────────────── */
@media (max-width: 640px) {
  .bqv-barrio-card {
    height: 240px;
  }
}

@media (max-width: 400px) {
  .bqv-barrio-card {
    height: 200px;
  }
}

/* ─── 18. OVERFLOW SAFETY — textos largos ────────────────────────────── */
.bqv-card__title,
.bqv-section__title,
.bqv-page-hero__title,
.bqv-modal__title {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ─── 19. TABLA RESPONSIVA (si hay tablas en contenido) ──────────────── */
.bqv-single__content table,
.entry-content table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

/* ─── 20. BREADCRUMB RESPONSIVO ──────────────────────────────────────── */
@media (max-width: 520px) {
  .bqv-breadcrumb {
    flex-wrap: wrap;
    font-size: 10px;
    gap: 4px;
    margin-bottom: var(--space-md);
  }
}

/* ─── 21. ANIMACIONES SCROLL FADE ────────────────────────────────────── */

/* Asegurar que la animación se ve bien en todos los tamaños */
@media (prefers-reduced-motion: reduce) {
  .bqv-card,
  .bqv-section__header,
  .bqv-banner,
  .bqv-callout,
  .bqv-barrio-card,
  .bqv-quickcat,
  .bqv-toc,
  .bqv-page-hero__content {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .bqv-nav-mobile {
    transition: none !important;
  }

  .bqv-nav-mobile ul li {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ─── 22. FOCUS VISIBLE (accesibilidad) ──────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-blue);
  outline-offset: 2px;
}

.bqv-nav__toggle:focus-visible {
  outline: 2px solid var(--color-mid);
  outline-offset: 2px;
  border-radius: 8px;
}

/* ─── 23. AJUSTE BODY CUANDO MENÚ ABIERTO ───────────────────────────── */
body.bqv-menu-open {
  overflow: hidden;
  /* iOS safari: evitar scroll */
  position: fixed;
  width: 100%;
}

/* ─── 24. TIPOGRAFÍA FLUIDA GLOBAL ───────────────────────────────────── */
@media (max-width: 480px) {
  .bqv-section {
    padding: var(--space-2xl) 0;
  }

  .bqv-section--lg {
    padding: 48px 0;
  }

  .bqv-section__subtitle {
    font-size: 14px;
  }

  .bqv-callout {
    padding: var(--space-md) var(--space-lg);
  }

  .bqv-callout p {
    font-size: 13px;
  }
}

/* ─── 25. FOOTER TEXTO PEQUEÑO ───────────────────────────────────────── */
@media (max-width: 480px) {
  .bqv-footer {
    padding: var(--space-xl) 0 var(--space-lg);
  }

  .bqv-footer__grid {
    gap: 24px;
  }

  .bqv-footer__tagline {
    font-size: 12px;
  }

  .bqv-footer__links a {
    line-height: 2;
    font-size: 13px;
  }
}

/* ─── 26. SAFE AREA (iPhone con notch) ───────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  .bqv-footer {
    padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom));
  }

  .bqv-nav-mobile {
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }
}
