/**
 * Refinamiento Móvil, Targets Táctiles, Visor 360°, Bottom Sheet y Landscape.
 * Complementa a responsivo.css conservando la modularidad por debajo de 200 líneas.
 */

/* ─── BOTÓN HAMBURGUESA, BACKDROP Y FOCO ACCESIBLE ─── */
.nav-hamburger {
  background: transparent;
  border: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.nav-hamburger span { transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease; }
.nav-hamburger.abierto span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.abierto span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.abierto span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-menu-backdrop {
  position: fixed;
  inset: 70px 0 0 0;
  z-index: 98;
  background: rgba(10, 10, 12, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
}
.mobile-menu-backdrop.open { display: block; }

.mobile-menu { max-height: calc(100vh - 70px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.mobile-menu a { min-height: 44px; display: flex; align-items: center; }

.modal-acerca-handle { display: none; }

/* Contraste reforzado en insignia 360° sobre fotografías luminosas */
.panorama-badge {
  background: rgba(20, 20, 22, 0.86);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(216, 197, 184, 0.45);
  color: #F5F0EB;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

.nav-hamburger:focus-visible,
.gallery-item:focus-visible,
.video-thumb:focus-visible,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible,
.modal-acerca-cerrar:focus-visible {
  outline: 2px solid var(--gold2);
  outline-offset: 2px;
}

/* ─── TARGETS TÁCTILES >= 44×44px EN PANTALLAS MÓVILES ─── */
@media (max-width: 900px) {
  .lightbox-close,
  .lightbox-nav,
  .modal-acerca-cerrar,
  .footer-social a {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .wizard-step-node,
  .btn-secundario,
  .nav-logo,
  .btn-wizard-next,
  .btn-wizard-back,
  .btn-wizard-send {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* ─── VISOR 360° Y FOOTER COMPACTO MÓVIL (<= 768px) ─── */
@media (max-width: 768px) {
  .panorama-title-float {
    top: 0.75rem;
    max-width: calc(100vw - 8rem);
    padding: 0.42rem 0.95rem;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #panorama-viewer { width: 94vw; height: 70vh; margin-top: 2.5rem; }

  footer { padding: 0.65rem 1rem; }
  .footer-inner { flex-direction: column; text-align: center; gap: 0.25rem; }
  .footer-logo { min-height: auto; gap: 0.45rem; }
  .footer-logo img { height: 20px; }
  .footer-logo span { font-size: 0.8rem; }
  .footer-centro { gap: 0.1rem; }
  .footer-copy { font-size: 0.72rem; line-height: 1.3; }
  .footer-copy-sep { display: none; }
  .footer-derechos { display: block; }
  footer nav.footer-legal { gap: 0.15rem 0.5rem; }
  .footer-legal a { min-height: auto; padding: 0.15rem 0.25rem; font-size: 0.72rem; }
  .footer-social { display: none; }

  #contacto { padding: 2.5rem 0; }
  #contacto .divider { margin-bottom: 1.15rem; }
  .contacto-grid { margin-top: 1.25rem; gap: 0.6rem; }
  .contacto-card { padding: 0.72rem 1rem; gap: 0.85rem; align-items: center; border-radius: 12px; }
  .contacto-icon { width: 36px; height: 36px; border-radius: 10px; }
  .contacto-icon svg { width: 18px; height: 18px; }
  .contacto-label { font-size: 0.68rem; margin-bottom: 0.1rem; }
  .contacto-value { font-size: 0.9rem; line-height: 1.2; }
  .contacto-cta { margin-top: 1.25rem; }
}

/* ─── BOTTOM SHEET Y ESPACIADO PORTRAIT (<= 600px) ─── */
@media (max-width: 600px) {
  .modal-acerca-backdrop { align-items: flex-end; padding: 0; }

  .modal-acerca-tarjeta {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 22px 22px 0 0;
    border-bottom: none;
    animation: hojaInferiorEntrada 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  @keyframes hojaInferiorEntrada {
    from { opacity: 0; transform: translateY(36px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .modal-acerca-handle {
    display: block;
    width: 38px;
    height: 4px;
    border-radius: 999px;
    background: rgba(216, 197, 184, 0.35);
    margin: 0.65rem auto 0.15rem;
    flex-shrink: 0;
  }

  .modal-acerca-header { padding: 0.75rem 1.25rem 0.95rem; }
  .modal-acerca-cuerpo { padding: 1.15rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); }
  .modal-acerca-acciones { flex-direction: column; }
  .contacto-cta { padding: 2rem 1.25rem; }
}

/* ─── MÓVIL COMPACTO (360px / <= 400px) ─── */
@media (max-width: 400px) {
  .wizard-card { padding: 1.15rem 0.9rem; }
  .btn-wizard-back { padding: 0.6rem 0.65rem; font-size: 0.78rem; min-height: 44px; }
  .btn-wizard-send { padding: 0.6rem; font-size: 0.73rem; letter-spacing: 0.015em; gap: 0.35rem; min-height: 44px; }
  .btn-wizard-send svg { width: 15px; height: 15px; flex-shrink: 0; }
  .contacto-cta { padding: 1.75rem 1rem; }
  .contacto-cta .btn-primary { padding: 0.78rem 1.1rem; font-size: 0.84rem; gap: 0.45rem; white-space: nowrap; min-height: 44px; }
}

/* ─── LANDSCAPE MÓVIL (844×390 / <= 500px ALTO) ─── */
@media (max-height: 500px) {
  nav:not(.barra-inferior-movil):not(.footer-legal) { height: 56px; }
  .mobile-menu-backdrop { inset: 56px 0 0 0; }
  .mobile-menu { top: 56px; max-height: calc(100vh - 56px); padding: 0.75rem 1.5rem; gap: 0.25rem; }

  .modal-acerca-backdrop { align-items: center; padding: 0.75rem; }
  .modal-acerca-tarjeta { max-height: 92vh; border-radius: 16px; }
  .modal-acerca-handle { display: none; }
  .modal-acerca-header { padding: 0.65rem 1.15rem; }
  .modal-acerca-cuerpo { padding: 0.85rem 1.15rem; }

  #presupuesto { padding: 3.75rem 0 1.25rem; }
  .wizard-card { min-height: auto; padding: 0.9rem 1.25rem; }
  .wizard-progress-bar { margin-bottom: 0.65rem; padding-bottom: 0.5rem; }
  .wizard-context-pill { margin-bottom: 0.4rem; }
  .wizard-group-desc { margin-bottom: 0.6rem; }
  .wizard-extras-grid { max-height: 150px; overflow-y: auto; padding-right: 12px; -webkit-overflow-scrolling: touch; }
  .wizard-actions-bar { margin-top: 0.75rem; padding-top: 0.75rem; }

  #panorama-viewer { width: 88vw; height: 74vh; margin-top: 2rem; }
  .panorama-title-float { top: 0.5rem; font-size: 0.82rem; padding: 0.32rem 0.9rem; max-width: calc(100vw - 8rem); }
  footer { padding: 0.65rem 1.25rem; }
  .footer-social { display: none; }
}
