/* ==========================================
   MOBILE SIDENAV STYLES
   ========================================== */

/* Evita que los elementos hijos de los botones capturen clics innecesarios */
#mobile-menu-btn, 
#close-mobile-menu {
  pointer-events: auto;
}

#mobile-menu-btn *, 
#close-mobile-menu * {
  pointer-events: none;
}

/* Fondo oscuro (Overlay) */
.mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000; /* Mayor que el header (z-index: 50) */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Estado ACTIVO cuando JS añade .is-open */
.mobile-nav-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

/* Panel lateral deslizante */
.mobile-nav-panel {
  /* Fallback por si la variable custom no existe */
  background-color: var(--color-surface-container-low, #ffffff);
  height: 100%;
  max-height: 100vh;
  width: 280px;
  max-width: 80vw; /* Asegura que no ocupe toda la pantalla en móviles muy pequeños */
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  position: relative;
  overflow-y: auto; /* Permite scroll si el contenido sobrepasa la pantalla */
  -webkit-overflow-scrolling: touch; /* Scroll suave en iOS */
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Desplazamiento desde la izquierda al abrir */
.mobile-nav-overlay.is-open .mobile-nav-panel {
  transform: translateX(0);
}

/* Botón de cerrar */
.mobile-nav-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: transparent;
  border: none;
  color: var(--color-primary, #1e293b);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* Título / Marca */
.mobile-nav-brand {
  /* Usamos --font-logo que es la variable declarada en headers.css */
  font-family: var(--font-logo, var(--font-garamond, serif));
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-primary, #1e293b);
  margin-bottom: 0.5rem;
}

/* Lista de enlaces */
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-link {
  font-family: var(--font-nav, sans-serif);
  color: var(--color-on-surface-variant, #64748b);
  text-decoration: none;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  font-size: 1rem;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-nav-link:hover {
  color: var(--color-primary, #1e293b);
  background-color: var(--color-surface-container-high, #f1f5f9);
}

.mobile-nav-link.active {
  color: var(--color-primary, #1e293b);
  font-weight: 600;
  background-color: var(--color-surface-container-high, #f1f5f9);
}


/* ==========================================
   RESET Y ESTILOS DEL SELECTOR MÓVIL
   ========================================== */
.mobile-lang-selector {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
  width: 100%;
}

.mobile-lang-options {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.5rem !important;
}

/* Reset agresivo de botones HTML para quitar bordes e impresiones grises */
.mobile-lang-options .lang-btn {
  background: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-family: inherit;
  font-size: 14px;
  color: #777777;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: color 0.2s ease, font-weight 0.2s ease;
}

.mobile-lang-options .lang-btn:hover {
  color: #1e293b;
}

/* Idioma Activo */
.mobile-lang-options .lang-btn.active {
  color: #1e293b !important;
  font-weight: 700 !important;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Separador | */
.mobile-lang-options .lang-divider {
  color: #cccccc;
  font-size: 13px;
  user-select: none;
}