/* Centralized mobile menu overlay + mobile header button styles (canonical source).
  IMPORTANT: many page-level custom-*.css files still contain legacy overrides.
  This file uses higher-specificity selectors so the mobile menu looks identical
  across all frontend pages (matches the current Home / index experience). */

:root {
  --rk-primary: var(--btn-1);
  --rk-dark: #111;
  --rk-overlay-dim: rgba(34, 34, 34, 0.18);
}

#mobileMenuOverlay {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--rk-overlay-dim);
  /* Keep above page-specific popups (Home has several fixed layers). */
  z-index: 1000001 !important;
  flex-direction: column;
  padding: 0;
  box-sizing: border-box;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  color: var(--rk-dark);
  overscroll-behavior: none;
}

#mobileMenuOverlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto !important;
}

/* Card container (centered) */
#mobileMenuOverlay .mobileMenuCard {
  background: linear-gradient(135deg, #fffbe7 0%, #fffde7 100%);
  border-radius: 28px;
  box-shadow: 0 12px 40px rgba(201, 161, 0, 0.3), 0 2px 12px rgba(255, 215, 0, 0.2);
  padding: 32px 24px 24px 24px;
  max-width: 420px;
  width: 90vw;
  min-height: 50vh;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  border: 2px solid rgba(201, 161, 0, 0.1);
}

/* Close bar (kept for existing markup) */
#mobileMenuOverlay .mobileMenuCloseBar {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 48px;
  border-bottom: 2px solid rgba(201, 161, 0, 0.2);
  margin-bottom: 20px;
  padding: 12px 0;
  background: transparent;
}

/* Close button (match index) */
#mobileMenuOverlay .close-btn {
  position: absolute !important;
  top: 18px !important;
  left: 18px !important;
  right: auto !important;
  margin: 0 !important;
  z-index: 1000002 !important;
  background: transparent;
  border: 2px solid #000 !important;
  cursor: pointer;
  font-size: 1.8rem;
  color: #000 !important;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.2s, transform 0.2s;
}

#mobileMenuOverlay .close-btn:hover {
  background: rgba(255, 215, 0, 0.1);
  transform: scale(1.06);
}

/* Links + toggles (uniform button sizing) */
#mobileMenuOverlay .mobileMenuCard ul {
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  max-width: 360px;
}

#mobileMenuOverlay .mobileMenuCard ul li {
  margin: 0 0 16px 0;
  text-align: center;
  width: 100%;
}

#mobileMenuOverlay .mobileMenuCard ul li a,
#mobileMenuOverlay .mobileMenuCard .mobile-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: linear-gradient(135deg, #ffe082 0%, #ffd54f 100%);
  color: #222 !important;
  border-radius: 16px !important;
  font-weight: 700;
  text-align: center;
  border: 2px solid rgba(201, 161, 0, 0.3) !important;
  transition: all 0.3s ease;
  margin-bottom: 12px !important;
  padding: 14px 16px !important;
  font-size: 0.95rem !important;
  box-sizing: border-box;
  box-shadow: 0 4px 12px rgba(201, 161, 0, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-decoration: none;
}

#mobileMenuOverlay .mobileMenuCard ul li a.active,
#mobileMenuOverlay .mobileMenuCard ul li a:hover,
#mobileMenuOverlay .mobileMenuCard .mobile-menu-toggle[aria-expanded='true'] {
  background: linear-gradient(135deg, #c9a100 0%, #ffb300 100%) !important;
  color: #000 !important;
  border: 2px solid #222 !important;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(201, 161, 0, 0.4);
}

#mobileMenuOverlay .mobileMenuCard ul li ul li a,
#mobileMenuOverlay .mobileMenuCard .mobile-submenu li a {
  background: linear-gradient(135deg, #fffde7 0%, #fff9c4 100%) !important;
  color: #c9a100 !important;
  font-size: 0.9rem !important;
  padding: 12px 18px !important;
  text-align: left !important;
  text-transform: uppercase !important;
  border-radius: 12px !important;
  font-weight: 600 !important;
  border: 1px solid rgba(201, 161, 0, 0.2) !important;
  transition: all 0.3s ease;
  display: block;
  margin: 8px 0;
  box-shadow: 0 2px 8px rgba(201, 161, 0, 0.1);
}

#mobileMenuOverlay .mobileMenuCard ul li ul li a.active,
#mobileMenuOverlay .mobileMenuCard ul li ul li a:hover,
#mobileMenuOverlay .mobileMenuCard .mobile-submenu li a.active,
#mobileMenuOverlay .mobileMenuCard .mobile-submenu li a:hover {
  background: linear-gradient(135deg, #c9a100 0%, #ffb300 100%) !important;
  color: #000 !important;
  border: 1px solid #222 !important;
  transform: translateX(4px);
}

/* mobile-submenu toggle logic (JS uses .open + aria-expanded) */
.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-submenu.open {
  max-height: 600px;
}

/* Arrow (uniform size) */
.submenu-arrow {
  transition: transform 0.3s ease;
  display: inline-block;
  margin-left: 10px;
  font-size: 1.2rem;
}

.mobile-menu-toggle[aria-expanded='true'] .submenu-arrow {
  transform: rotate(180deg);
}

/* Prevent background scroll when menu open */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* Mobile header buttons (burger + BOOK ONLINE) – consistent across pages */
#mobileMenuBtn.menu__btn {
  background: linear-gradient(135deg, #ffd54f 0%, #ffb300 100%) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 16px rgba(201, 161, 0, 0.4) !important;
  border: none !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s, box-shadow 0.3s;
  width: 56px;
  height: 56px;
  padding: 12px;
}

#mobileMenuBtn.menu__btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(201, 161, 0, 0.4);
}

#mobileMenuBtn.menu__btn img {
  height: 28px;
  width: 28px;
}

.book-btn-mobile-header {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: linear-gradient(90deg, #c8aa00 0%, #ffb300 100%) !important;
  border-color: transparent !important;
  color: #222 !important;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.4px;
  box-shadow: 0 2px 8px 0 #ffd70033;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}

.book-btn-mobile-header:hover,
.book-btn-mobile-header:focus {
  background: linear-gradient(90deg, #c8aa00 0%, #ffb300 100%) !important;
  color: #000 !important;
  text-decoration: none;
}

@media (max-width:991.98px) {
  #mobileMenuOverlay {
    padding: 18px;
  }

  /* Unified mobile header positions (match current index) */
  #mobileMenuBtn.menu__btn {
    position: fixed !important;
    top: 40px !important;
    right: 18px !important;
    left: auto !important;
    width: 36px !important;
    height: 36px !important;
    padding: 6px !important;
    z-index: 100002 !important;
    margin: 0 !important;
  }

  #mobileMenuBtn.menu__btn img {
    height: 18px !important;
    width: 18px !important;
  }

  .book-btn-mobile-header {
    position: fixed !important;
    top: 40px !important;
    right: 64px !important;
    z-index: 100003 !important;
    width: auto !important;
    max-width: calc(100vw - 90px) !important;
    margin: 0 !important;
  }

  /* When an image popup is open, keep mobile buttons visible but behind popups.
     Do NOT hide them; instead lower their stacking order and disable pointer events
     so popup controls remain accessible while the buttons remain visible underneath. */
  body.gallery-modal-open #mobileMenuBtn.menu__btn,
  body.gallery-modal-open .book-btn-mobile-header,
  body.krakatau-popup-open #mobileMenuBtn.menu__btn,
  body.krakatau-popup-open .book-btn-mobile-header {
    display: inline-flex !important;
    z-index: 9 !important;
    pointer-events: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
}

@media (max-width:600px) {
  #mobileMenuOverlay {
    padding: 12px;
  }

  #mobileMenuOverlay .mobileMenuCard {
    max-width: 95vw !important;
    width: 95vw !important;
    padding: 28px 20px 20px 20px !important;
    border-radius: 24px;
  }

  #mobileMenuOverlay .close-btn {
    top: 12px !important;
    left: 12px !important;
  }
}