/**
 * Wito Projects — mobile navigation (drawer, overlay, hamburger)
 * Loads on viewports ≤992px; overrides bundle defaults.
 */

/* ── Hamburger trigger ── */
.wito-menu-btn {
  display: none;
  position: relative;
  z-index: 1002;
  flex-shrink: 0;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 48px;
  min-height: 48px;
  padding: 0.5rem 0.85rem 0.5rem 0.65rem;
  margin: 0;
  border: 1px solid rgba(45, 22, 80, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #2d1650;
  cursor: pointer;
  box-sizing: border-box;
  box-shadow: 0 2px 12px rgba(15, 31, 53, 0.08);
  transition:
    background-color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.2s ease;
}

.wito-menu-btn:hover {
  border-color: rgba(170, 68, 0, 0.35);
  box-shadow: 0 4px 16px rgba(170, 68, 0, 0.12);
}

.wito-menu-btn:focus-visible {
  outline: 2px solid #aa4400;
  outline-offset: 3px;
}

.wito-menu-btn.active {
  background: #2d1650;
  border-color: #2d1650;
  color: #fff;
  box-shadow: 0 4px 20px rgba(45, 22, 80, 0.25);
}

/* Higher specificity — beats legacy bundle .wito-menu-btn span rules */
.wito-menu-btn .wito-menu-icon {
  position: relative;
  display: block;
  width: 22px;
  height: 18px;
  flex-shrink: 0;
  overflow: visible;
  transform: none;
  background: transparent;
}

.wito-menu-btn .wito-menu-label {
  position: static;
  display: inline;
  width: auto;
  height: auto;
  transform: none;
  background: transparent;
  font: inherit;
  line-height: 1;
  white-space: nowrap;
}

.wito-menu-btn .wito-menu-icon > .wito-menu-line {
  position: absolute !important;
  left: 0;
  display: block;
  width: 100%;
  height: 2px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: currentColor;
  transform: none;
  transition:
    top 0.32s cubic-bezier(0.65, 0, 0.35, 1),
    transform 0.32s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.2s ease,
    width 0.22s ease;
}

.wito-menu-btn .wito-menu-icon > .wito-menu-line:nth-of-type(1) {
  top: 0;
}

.wito-menu-btn .wito-menu-icon > .wito-menu-line:nth-of-type(2) {
  top: 8px;
  width: 72%;
}

.wito-menu-btn .wito-menu-icon > .wito-menu-line:nth-of-type(3) {
  top: 16px;
}

.wito-menu-btn.active .wito-menu-icon > .wito-menu-line:nth-of-type(1) {
  top: 8px;
  width: 100%;
  transform: rotate(45deg);
}

.wito-menu-btn.active .wito-menu-icon > .wito-menu-line:nth-of-type(2) {
  opacity: 0;
  width: 0;
}

.wito-menu-btn.active .wito-menu-icon > .wito-menu-line:nth-of-type(3) {
  top: 8px;
  width: 100%;
  transform: rotate(-45deg);
}

.wito-menu-label {
  font-family: var(--nav-font, Roboto, system-ui, sans-serif);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 380px) {
  .wito-menu-label {
    display: none;
  }
  .wito-menu-btn {
    padding: 0.5rem;
    border-radius: 12px;
  }
}

@media (min-width: 993px) {
  .wito-menu-btn {
    display: none;
  }
}

/* Drawer has its own close control — hide header pill to avoid stacked circles */
.wito-menu-btn.active {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Overlay ── */
.wito-mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 22, 40, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.wito-mobile-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ── Drawer panel ── */
.wito-mobile-menu,
#mobile-menu.wito-mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  width: min(100%, 380px) !important;
  max-width: 92vw;
  height: 100dvh;
  max-height: 100%;
  padding: 0 !important;
  margin: 0;
  background: linear-gradient(165deg, #1a3350 0%, #0f1f35 48%, #0a1628 100%) !important;
  box-shadow: -24px 0 64px rgba(0, 0, 0, 0.45);
  transform: translate3d(100%, 0, 0);
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition:
    transform 0.4s cubic-bezier(0.8, 0, 0.2, 1),
    visibility 0.4s ease;
}

.wito-mobile-menu.active,
#mobile-menu.wito-mobile-menu.active {
  transform: translate3d(0, 0, 0) !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* Override bundle transition:none on first paint */
.wito-mobile-menu,
.wito-mobile-overlay {
  transition-property: transform, opacity, visibility !important;
}

.wito-menu-btn {
  transition:
    background-color 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    opacity 0.2s ease,
    visibility 0.2s ease !important;
}

.wito-mobile-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  padding: max(1.25rem, env(safe-area-inset-top, 0px) + 0.75rem) 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.wito-mobile-menu-title {
  font-family: var(--heading-font, Roboto, sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.wito-menu-close {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.wito-menu-close::before,
.wito-menu-close::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.wito-menu-close::before {
  transform: rotate(45deg);
}

.wito-menu-close::after {
  transform: rotate(-45deg);
}

.wito-menu-close:hover {
  opacity: 0.85;
  transform: scale(1.05);
}

.wito-menu-close:focus-visible {
  outline: 2px solid #aa4400;
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Nav links ── */
.wito-mobile-menu .wito-mobile-nav,
.wito-mobile-menu nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem 0 1rem;
}

.wito-mobile-nav-main {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wito-mobile-nav-main li {
  margin: 0;
  padding: 0;
}

.wito-mobile-menu a {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0.85rem 1.5rem;
  font-family: var(--nav-font, Roboto, sans-serif);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.92) !important;
  text-decoration: none !important;
  border-left: 3px solid transparent;
  transition:
    color 0.2s ease,
    background-color 0.2s ease,
    border-color 0.2s ease,
    padding-left 0.25s ease;
}

.wito-mobile-menu a:hover,
.wito-mobile-menu a:focus-visible {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08);
  border-left-color: #aa4400;
  padding-left: 1.65rem;
  outline: none;
}

.wito-mobile-menu a.active,
.wito-mobile-menu a[aria-current="page"] {
  color: #fff !important;
  background: rgba(170, 68, 0, 0.18);
  border-left-color: #aa4400;
  font-weight: 600;
}

.wito-mobile-nav-section {
  margin-top: 0.5rem;
  padding-top: 0.25rem;
}

.wito-mobile-nav-locations-label {
  display: block;
  margin: 0;
  padding: 1rem 1.5rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.wito-mobile-nav-locations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.5rem;
  margin: 0;
  padding: 0 1rem 0.5rem;
  border-top: none;
}

.wito-mobile-nav-locations a {
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.85) !important;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.wito-mobile-nav-locations a:hover,
.wito-mobile-nav-locations a:focus-visible {
  background: rgba(170, 68, 0, 0.25);
  border-color: rgba(170, 68, 0, 0.45);
  padding-left: 0.75rem;
}

/* ── Drawer footer CTA ── */
.wito-mobile-menu-foot {
  flex-shrink: 0;
  padding: 1rem 1.25rem max(1.25rem, env(safe-area-inset-bottom, 0px) + 0.75rem);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.15);
}

.wito-mobile-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  padding: 0.85rem 1.25rem;
  font-family: var(--nav-font, Roboto, sans-serif);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none !important;
  color: #fff !important;
  background: linear-gradient(135deg, #aa4400 0%, #8a3600 100%);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(170, 68, 0, 0.35);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.wito-mobile-cta:hover,
.wito-mobile-cta:focus-visible {
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(170, 68, 0, 0.45);
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.wito-mobile-phone {
  display: block;
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7) !important;
  text-decoration: none !important;
}

.wito-mobile-phone:hover {
  color: #fff !important;
}

/* Stagger link reveal when open */
.wito-mobile-menu.active .wito-mobile-nav-main a {
  animation: wito-nav-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.wito-mobile-menu.active .wito-mobile-nav-main li:nth-child(1) a {
  animation-delay: 0.05s;
}
.wito-mobile-menu.active .wito-mobile-nav-main li:nth-child(2) a {
  animation-delay: 0.08s;
}
.wito-mobile-menu.active .wito-mobile-nav-main li:nth-child(3) a {
  animation-delay: 0.11s;
}
.wito-mobile-menu.active .wito-mobile-nav-main li:nth-child(4) a {
  animation-delay: 0.14s;
}
.wito-mobile-menu.active .wito-mobile-nav-main li:nth-child(5) a {
  animation-delay: 0.17s;
}

@keyframes wito-nav-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (min-width: 993px) {
  .wito-mobile-menu,
  .wito-mobile-menu.active,
  .wito-mobile-overlay,
  .wito-mobile-overlay.active {
    transform: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
    opacity: 0 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wito-mobile-menu,
  .wito-mobile-overlay,
  .wito-menu-btn,
  .wito-menu-btn .wito-menu-line {
    transition: none !important;
  }
  .wito-mobile-menu.active .wito-mobile-nav-main a {
    animation: none;
  }
}
