/**
 * Mobile Navigation Styles - Floating Glass & Refined Drawer
 * Story 1.6 / Quick Flow Redesign
 * Royal Emerald Design System
 */

/* ==========================================================================
   Hamburger Toggle
   ========================================================================== */
.vt-mobile-toggle {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.75rem;
  min-width: 56px;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10001;
}

.vt-mobile-toggle span {
  display: block;
  width: 28px;
  height: 2px;
  background-color: var(--wp--preset--color--ivory, #f5f0e8);
  margin: 6px 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  border-radius: 2px;
}

@media (max-width: 1023px) {
  .vt-mobile-toggle {
    display: flex;
  }
  .vt-primary-nav {
    display: none !important;
  }
}

/* Hamburger to X animation */
.vt-mobile-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}
.vt-mobile-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}
.vt-mobile-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* ==========================================================================
   Slide-Down Drawer
   ========================================================================== */
.vt-mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* Fallback */
  height: 100dvh; /* Modern mobile */
  min-height: -webkit-fill-available; /* iOS Safari fallback */
  background: #1a3a2a;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease, visibility 0.4s;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

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

.vt-drawer-inner {
  width: 100%;
  max-width: 600px;
  padding: 5rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 0.5rem;
}

/* ==========================================================================
   Navigation Links - Vertical Elegant Stack
   ========================================================================== */
.vt-mobile-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: center;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.vt-mobile-nav li {
  margin: 0;
  width: 100%;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

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

/* Staggered delays */
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(1) { transition-delay: 0.1s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(2) { transition-delay: 0.15s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(3) { transition-delay: 0.2s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(4) { transition-delay: 0.25s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(5) { transition-delay: 0.3s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(6) { transition-delay: 0.35s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(7) { transition-delay: 0.4s; }
.vt-mobile-drawer.is-open .vt-mobile-nav li:nth-child(8) { transition-delay: 0.45s; }

.vt-mobile-nav a {
  display: block;
  padding: 1.5rem 0.5rem;
  min-height: 56px;
  color: #f5f0e8 !important;
  font-family: var(--wp--preset--font-family--playfair-display, 'Playfair Display', serif);
  font-size: clamp(1.6rem, 5.5vw, 2.2rem);
  font-weight: 400;
  text-decoration: none;
  letter-spacing: 0.04em;
  line-height: 1.25;
  transition: color 0.3s ease, background-color 0.3s ease, transform 0.2s ease;
  border-bottom: 1px solid rgba(201, 169, 110, 0.12);
  text-align: center;
}

.vt-mobile-nav li:last-child a {
  border-bottom: none;
}

.vt-mobile-nav a:hover,
.vt-mobile-nav a:focus {
  color: var(--wp--preset--color--gold, #c9a96e);
  background-color: rgba(255, 255, 255, 0.02);
  transform: translateX(4px);
}

/* Active Page Indicator */
.vt-mobile-nav .current-menu-item a {
  border-left: 2px solid #c9a96e;
  color: #c9a96e !important;
  padding-left: calc(0.5rem + 2px);
  text-align: left;
}

/* Header Fade on Menu Open */
.vt-header-bar.is-menu-open {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* Sticky Drawer CTA */
.vt-drawer-cta {
  position: fixed;
  bottom: env(safe-area-inset-bottom);
  left: 0;
  width: 100%;
  padding: 1rem;
  background: rgba(26,58,42,0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(201,169,110,0.2);
  text-align: center;
}
.vt-drawer-cta .vt-cta-button {
  display: inline-block;
  padding: 0.875rem 2rem;
  background: #c9a96e;
  color: #1a3a2a;
  font-family: var(--wp--preset--font-family--playfair-display, 'Playfair Display', serif);
  font-size: 1.1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 2px;
  letter-spacing: 0.05em;
  transition: background 0.3s ease;
}
.vt-drawer-cta .vt-cta-button:hover {
  background: #b8955d;
}

/* Focus-visible */
.vt-mobile-nav a:focus-visible,
.vt-mobile-toggle:focus-visible {
  outline: 2px solid var(--wp--preset--color--gold, #c9a96e);
  outline-offset: 4px;
}

/* ==========================================================================
   Close Button
   ========================================================================== */
.vt-drawer-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--wp--preset--color--ivory, #f5f0e8);
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.5rem;
  min-width: 56px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s ease, transform 0.3s ease;
  z-index: 10001;
}

.vt-drawer-close:hover,
.vt-drawer-close:focus {
  color: var(--wp--preset--color--gold, #c9a96e);
  transform: rotate(90deg);
}

/* ==========================================================================
   Glass-Morphism Header on Scroll
   ========================================================================== */
.vt-header-bar {
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
  z-index: 9999;
}

.vt-header-bar.is-scrolled {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  max-width: 1200px;
  background: rgba(26, 58, 42, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 169, 110, 0.2);
  border-radius: 16px;
  padding: 0.75rem 1.5rem !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1023px) {
  .vt-header-bar.is-scrolled {
    width: calc(100% - 1.5rem);
    top: 0.75rem;
    padding: 0.5rem 1rem !important;
  }
}

/* ==========================================================================
   Responsive Adjustments
   ========================================================================== */
@media (max-width: 375px) {
  .vt-mobile-nav a {
    font-size: 1.35rem;
    padding: 1rem 0.75rem;
  }
  .vt-mobile-drawer {
    padding-top: 70px;
  }
}

/* ==========================================================================
   Mobile Header Layout Repair
   ========================================================================== */
@media (max-width: 1023px) {
  .vt-header-bar {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 72px;
    padding: 0.75rem 1rem !important;
    gap: 1rem;
    box-sizing: border-box;
  }

  .vt-header-bar .wp-block-site-logo {
    flex: 0 1 auto;
    line-height: 0;
    margin: 0 !important;
  }

  .vt-header-bar .wp-block-site-logo img,
  .vt-header-bar .custom-logo {
    display: block;
    width: auto !important;
    max-width: 112px !important;
    max-height: 56px !important;
    height: auto !important;
    object-fit: contain;
  }

  .vt-header-bar .wp-block-buttons {
    display: none !important;
  }

  .vt-mobile-menu-trigger {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    margin-left: auto;
  }

  .vt-mobile-toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    width: 92px;
    height: 48px;
    min-width: 92px;
    min-height: 48px;
    padding: 0 0 0 3rem;
    gap: 6px;
  }

  .vt-mobile-toggle::before {
    content: "Menu";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--wp--preset--color--gold, #c9a96e);
    font-family: var(--wp--preset--font-family--inter, 'Inter', sans-serif);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
  }

  .vt-mobile-toggle[aria-expanded="true"]::before {
    content: "Close";
  }

  .vt-mobile-toggle span {
    flex: 0 0 auto;
    width: 30px;
    height: 3px;
    background-color: var(--wp--preset--color--gold, #c9a96e);
    margin: 0;
  }

  .vt-header-bar.is-scrolled {
    top: 0.5rem;
    width: calc(100% - 1rem);
    min-height: 64px;
    padding: 0.5rem 0.875rem !important;
    border-radius: 8px;
  }

  .vt-mobile-drawer {
    align-items: stretch;
    background:
      linear-gradient(180deg, rgba(201, 169, 110, 0.12), rgba(26, 58, 42, 0) 28%),
      #1a3a2a !important;
    height: 100vh;
    height: 100dvh;
    padding: calc(env(safe-area-inset-top) + 4.75rem) 1.25rem calc(env(safe-area-inset-bottom) + 6.25rem);
  }

  .vt-drawer-inner {
    align-items: stretch;
    justify-content: flex-start;
    max-width: none;
    padding: 0;
    gap: 1rem;
  }

  .vt-mobile-nav,
  .vt-mobile-nav .wp-block-navigation__container {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    gap: 0 !important;
  }

  .vt-mobile-nav .wp-block-navigation-item {
    width: 100%;
  }

  .vt-mobile-nav a,
  .vt-mobile-nav .wp-block-navigation-item__content {
    display: block !important;
    width: 100%;
    min-height: 0;
    padding: 1rem 0 !important;
    border-bottom: 1px solid rgba(201, 169, 110, 0.22);
    color: #f5f0e8 !important;
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
    line-height: 1.2;
    text-align: left;
    transform: none;
  }

  .vt-mobile-nav .current-menu-item a,
  .vt-mobile-nav .current-menu-item .wp-block-navigation-item__content {
    border-left: 0;
    color: #c9a96e !important;
    padding-left: 0 !important;
    text-align: left;
  }

  .vt-drawer-cta {
    background: #0f2d20;
    border-top-color: rgba(201, 169, 110, 0.32);
    box-sizing: border-box;
    padding: 1rem 1.25rem calc(env(safe-area-inset-bottom) + 1rem);
  }

  .vt-drawer-cta .vt-cta-button {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    box-sizing: border-box;
    font-size: 1.1rem;
  }
}
