/* ============================================================
   Modern Mobile Menu — InteractiveMenu + submenus
   ============================================================ */

:root {
  --component-inactive-color: var(--color-fog);
  --component-bg: var(--color-pure-white);
  --component-shadow: var(--color-ash);
  --component-active-bg: var(--color-paper-mist);
  --component-line-inactive-color: var(--color-ash);
  --component-active-color-default: var(--color-notion-blue, #ea580c);
}

.fx-portal-active {
  --component-active-color-default: var(--portal-accent, #f97316);
}

/* ---- Dock shell — always viewport-centered ---- */
.fx-mobile-menu-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  width: min(440px, calc(100% - 32px));
  z-index: 110;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  margin: 0 auto;
  padding: 0 0 calc(12px + env(safe-area-inset-bottom, 0px));
  transform: none;
  pointer-events: none;
}

@media (max-width: 1023px) {
  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
  }

  #main-body:not(.fx-portal__main),
  .fx-bleed,
  .fx-shell__main {
    overflow-x: clip;
    max-width: 100%;
  }

  #main-body.fx-portal__main,
  .fx-portal__page {
    overflow-x: clip;
  }

  .fx-mobile-menu-dock {
    display: flex;
  }

  .fx-burger,
  .fx-sheet,
  .fx-sheet-overlay {
    display: none !important;
  }

  body.fx-has-mobile-dock .fx-portal__main,
  body.fx-has-mobile-dock #main-body,
  body.fx-has-mobile-dock .fx-bleed,
  body.fx-has-mobile-dock.page-homepage {
    padding-bottom: calc(var(--spacing-48) + 96px) !important;
  }
}

/* ---- InteractiveMenu ---- */
.menu {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  width: 100%;
  background: var(--component-bg);
  border: 1px solid var(--component-shadow);
  border-radius: 9999px;
  box-shadow: 0 2px 8px rgba(28, 25, 23, .06), 0 8px 24px rgba(28, 25, 23, .1);
}

.menu__item {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  border-radius: 9999px;
  cursor: pointer;
  color: var(--component-inactive-color);
  text-decoration: none;
  font: inherit;
  position: relative;
  transition: color .2s ease, background .2s ease;
  -webkit-tap-highlight-color: transparent;
}

.menu__item.active {
  color: var(--component-active-color, var(--component-active-color-default));
  background: var(--component-active-bg);
}

.menu__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.menu__icon .icon,
.menu__icon i {
  font-size: 17px;
  line-height: 1;
}

.menu__item.active .menu__icon .icon,
.menu__item.active .menu__icon i {
  animation: iconBounce .6s ease;
}

.menu__text {
  display: block;
  margin: 0;
  font-size: 10px;
  font-weight: 600;
  text-transform: lowercase;
  line-height: 1.2;
  letter-spacing: .02em;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity .2s ease, max-height .2s ease;
  position: relative;
  white-space: nowrap;
}

.menu__text.active {
  opacity: 1;
  max-height: 16px;
  margin-top: 2px;
}

.menu__text.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -3px;
  transform: translateX(-50%);
  width: var(--lineWidth, 0);
  height: 2px;
  border-radius: 1px;
  background: var(--component-active-color, var(--component-active-color-default));
  transition: width .3s ease;
}

/* ---- Submenu panel (card above dock — no full-screen scrim) ---- */
.fx-mobile-submenu {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  z-index: 109;
  pointer-events: none;
  visibility: hidden;
  width: auto;
  max-width: min(440px, calc(100% - 32px));
  margin: 0 auto;
}

.fx-mobile-submenu[data-open="true"] {
  pointer-events: auto;
  visibility: visible;
}

.fx-mobile-submenu__backdrop {
  display: none;
}

.fx-mobile-submenu__panel {
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--color-pure-white);
  border: 1px solid var(--color-ash);
  border-radius: 20px;
  box-shadow:
    0 4px 12px rgba(28, 25, 23, .08),
    0 16px 40px rgba(28, 25, 23, .12);
  transform: translateY(12px) scale(.98);
  opacity: 0;
  transition: transform .28s cubic-bezier(.16, 1, .3, 1), opacity .28s ease;
}

.fx-mobile-submenu[data-open="true"] .fx-mobile-submenu__panel {
  transform: translateY(0);
  opacity: 1;
}

.fx-mobile-submenu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-ash);
  background: var(--color-paper-mist);
}

.fx-mobile-submenu__head strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-charcoal);
  text-transform: capitalize;
}

.fx-mobile-submenu__close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--color-fog);
  cursor: pointer;
}

.fx-mobile-submenu__close:hover {
  background: var(--color-paper-mist);
  color: var(--color-charcoal);
}

.fx-mobile-submenu__list {
  list-style: none;
  margin: 0;
  padding: 8px;
}

.fx-mobile-submenu__link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: background .15s ease;
}

.fx-mobile-submenu__link:hover {
  background: var(--color-paper-mist);
}

.fx-mobile-submenu__link > i {
  width: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 15px;
  color: var(--color-fog);
  text-align: center;
}

.fx-mobile-submenu__link span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fx-mobile-submenu__link b {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-charcoal);
  line-height: 1.3;
}

.fx-mobile-submenu__link small {
  font-size: 12px;
  color: var(--color-fog);
  line-height: 1.35;
}

/* ---- Locale / currency picker (mobile submenu) ---- */
.fx-mobile-submenu__locale {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--color-ash);
  background: var(--color-paper-mist);
}

.fx-mobile-locale-form .fx-locale-picker {
  gap: 10px;
}

.fx-mobile-locale-form .fx-locale-picker__label {
  margin-bottom: 6px;
}

.fx-mobile-locale-form .fx-locale-picker__trigger {
  width: 100%;
  max-width: none;
}

@keyframes iconBounce {
  0%, 100% { transform: translateY(0); }
  20% { transform: translateY(-0.3em); }
  40% { transform: translateY(0); }
  60% { transform: translateY(-0.1em); }
  80% { transform: translateY(0); }
}
