/* mobile-menu.css */
/* =========================================================
   MOBILE MENU
   ========================================================= */

/* Shared timing */
:root {
  --mm-main-duration: 420ms;
  --mm-submenu-duration: 320ms;
  --mm-main-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mm-submenu-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Toggle button */
.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 8px;
  border: none;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}

.mobile-menu-toggle span {
  display: block;
  width: 100%;
  height: 3px;
  background-color: #172B4D;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.2s ease;
}

.mobile-menu-toggle:focus {
  outline: none;
}

/* hamburger open animation */
.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* Keep icon color stable */
.mobile-menu-toggle span,
.mobile-menu-toggle.active span,
.mobile-menu-toggle:active span,
.mobile-menu-toggle:focus span,
.mobile-menu-toggle:focus-visible span {
  background-color: #172B4D !important;
}

/* hover accent only on real hover devices */
@media (hover: hover) and (pointer: fine) {
  .mobile-menu-toggle:hover span {
    background-color: #0C66E4 !important;
  }
}

/* =========================================================
   MOBILE DROPDOWN OVERLAY
   ========================================================= */

.mobile-dropdown {
  position: fixed;
  inset: 0;
  background: rgba(9, 30, 66, 0.28);
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.mobile-dropdown.active {
  opacity: 1;
  visibility: visible;
}

/* Main mobile menu panel: opens under sticky header */
.mobile-dropdown-content {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--mm-header-h, 64px);
  width: 100%;
  height: calc(100dvh - var(--mm-header-h, 64px));
  background: #ffffff;
  box-sizing: border-box;
  box-shadow: 0 10px 18px rgba(9, 30, 66, 0.14);

  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;

  transform: translateY(-100%);
  pointer-events: none;
  transition: transform var(--mm-main-duration) var(--mm-main-ease);

  will-change: transform;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  z-index: 10001;
}

.mobile-dropdown.active .mobile-dropdown-content {
  transform: translateY(0);
  pointer-events: auto;
}

/* =========================================================
   MENU LIST
   ========================================================= */

.mobile-menu {
  list-style: none;
  margin: 0;
  padding: 12px 0 0;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.mobile-menu > li {
  border-bottom: 1px solid rgba(9, 30, 66, 0.1);
  backface-visibility: hidden;
  transform: translateZ(0);
}

.mobile-menu > li > a {
  display: block;
  padding: 22px 20px;
  color: #172B4D;
  text-decoration: none;
  font-size: 22px;
  font-weight: 500;
  transition: background-color 0.2s ease;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.mobile-menu > li > a:hover {
  background-color: rgba(9, 30, 66, 0.035);
  color: #172B4D;
}

.mobile-menu > li > a:active {
  background-color: rgba(9, 30, 66, 0.06);
}

/* submenu chevron */
.mobile-submenu-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-right: 32px;
  position: relative;
}

.mobile-submenu-toggle::after {
  content: "›";
  font-size: 18px;
  font-weight: bold;
  position: absolute;
  right: 25px;
  top: 50%;
  transform: translateY(-50%);
}

.submenu-item-title {
  margin: 0 0 1px 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  color: #172B4D;
}

.submenu-item-title-link {
  display: inline-flex;
  align-items: center;
  color: #172B4D;
  text-decoration: none;
  background-image: linear-gradient(rgba(12, 102, 228, 0.95), rgba(12, 102, 228, 0.95));
  background-size: 100% 2px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 6px;
  transition: color 0.3s ease;
}

.submenu-item-title-link:hover,
.submenu-item-title-link:focus {
  color: #172B4D;
  text-decoration: none;
}

/* =========================================================
   SUBMENU OFFCANVAS
   ========================================================= */

.mobile-submenu-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  transform: translateX(100%);
  transition: transform var(--mm-submenu-duration) var(--mm-submenu-ease);
  will-change: transform;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  z-index: 10;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mobile-submenu-container.active {
  transform: translateX(0);
}

/* submenu header */
.mobile-submenu-header {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid rgba(9, 30, 66, 0.1);
  position: sticky;
  top: 0;
  z-index: 20;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.mobile-back-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-right: 12px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.mobile-back-btn:hover {
  background-color: rgba(9, 30, 66, 0.035);
}

.mobile-back-btn::before {
  content: "‹";
  font-size: 20px;
  font-weight: bold;
  color: #172B4D;
}

.mobile-submenu-title {
  font-size: 22px;
  font-weight: 600;
  color: #172B4D;
}

.mobile-submenu-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

/* submenu sections */
.submenu-section {
  padding: 20px;
  border-bottom: 1px solid rgba(9, 30, 66, 0.1);
}

.submenu-section:last-child {
  border-bottom: none;
}

.submenu-section-title {
  font-size: 14px;
  font-weight: 600;
  color: #6B778C;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 16px 0;
}

/* submenu item */
.submenu-item {
  display: flex;
  align-items: flex-start; 
  border-bottom: 1px solid rgba(9, 30, 66, 0.05);
  margin-top: 20px;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.submenu-item:last-child {
  border-bottom: none;
}

.submenu-item-icon {
  width: 36px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  margin-right: 16px;
}

.menu-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.submenu-item-content {
  flex: 1;
  min-width: 0;
  backface-visibility: hidden;
  transform: translateZ(0);
}

.submenu-item-title {
  font-size: 22px;
  font-weight: 600;
  color: #172B4D;
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.submenu-item-desc {
  font-size: 14px;
  color: #6B778C;
  margin: 0 0 12px 0;
  line-height: 1.4;
}

.submenu-item-link {
  font-size: 14px;
  font-weight: 600;
  color: #0C66E4;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.submenu-item-link:hover {
  color: #0C66E4;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* submenu footer */
.submenu-footer {
  background: rgba(9, 30, 66, 0.02);
  padding: 20px;
  border-top: 1px solid rgba(9, 30, 66, 0.1);
}

.submenu-help h4 {
  font-size: 14px;
  font-weight: 600;
  color: #172B4D;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.submenu-help p {
  font-size: 13px;
  color: #6B778C;
  margin: 0;
  line-height: 1.4;
}

/* =========================================================
   BODY SCROLL LOCK
   ========================================================= */

html.mobile-menu-open,
body.mobile-menu-open {
  overflow: hidden !important;
}

/* =========================================================
   HEADER / NAV RESPONSIVE (DESKTOP/TABLET)
   ========================================================= */

@media (max-width: 1024px) and (min-width: 581px) {
  #header #stuck_container .grid_12 {
    flex-wrap: nowrap !important;
  }

  #header .mm-nav {
    min-width: 0;
  }

  #header .mm-menu > li > a,
  #header .mm-trigger {
    padding: 8px 8px;
    font-size: 13px;
  }

  #header #stuck_container > .container {
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (max-width: 979px) {
  .nav {
    margin-top: 0 !important;
    float: none;
  }
}

@media (max-width: 780px) and (min-width: 581px) {
  #header #stuck_container > .container {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #header .sf-menu > li + li {
    margin-left: 0 !important;
  }
}

.select-menu {
  display: none !important;
}

#header .sf-menu > li + li {
  margin-left: 0 !important;
}

#header .mm-nav {
  margin-left: auto !important;
}

@media (min-width: 781px) {
  #header .mm-menu {
    gap: 30px !important;
  }
}

@media (max-width: 780px) and (min-width: 581px) {
  #header .mm-menu {
    gap: clamp(2px,
      calc(2px + (10 - 2) * ((100vw - 581px) / (780 - 581))),
      10px) !important;
  }
}

/* =========================================================
   MOBILE / TOUCH
   ========================================================= */

@media (max-width: 580px), (hover: none) and (pointer: coarse) {
  .mobile-menu-toggle {
    display: flex !important;
  }

  #header .mm-nav {
    display: none !important;
  }

  #header #mm-detail {
    display: none !important;
  }

  #header .mm-menu {
    gap: 0 !important;
  }

  .mobile-menu {
    padding-top: 12px !important;
  }

  #header {
    box-shadow: 0 10px 18px rgba(9, 30, 66, 0.14);
  }
}

/* Keep header visible over open mobile menu */
@media (max-width: 580px), (hover: none) and (pointer: coarse) {
  body.mobile-menu-open #header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 10003 !important;
    background: #ffffff !important;
    box-shadow: 0 10px 18px rgba(9, 30, 66, 0.14) !important;
  }

  body.mobile-menu-open .page {
    padding-top: var(--mm-header-h, 64px) !important;
    box-sizing: border-box;
  }

  body.mobile-menu-open .mobile-dropdown {
    z-index: 10000 !important;
  }

  body.mobile-menu-open .mobile-dropdown-content {
    z-index: 10001 !important;
  }

  body.mobile-menu-open .mobile-submenu-container {
    z-index: 10002 !important;
  }
}

/* =========================================================
   SAFETY / WRAPPING / TOUCH
   ========================================================= */

@media (max-width: 580px), (hover: none) and (pointer: coarse) {
  .mobile-dropdown,
  .mobile-dropdown-content,
  #mainMenu,
  .mobile-submenu-container,
  .mobile-submenu-content {
    overflow-x: hidden !important;
    touch-action: pan-y !important;
  }

  .mobile-menu > li > a,
  .submenu-item-title,
  .submenu-item-desc,
  .submenu-item-link {
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .submenu-item-content {
    min-width: 0;
  }
}