/*
 * StarX Capital shared responsive header.
 * Kept as the final header layer so legacy export and WordPress styles cannot
 * override menu geometry, visibility, or interaction states.
 */
body.starx-wp-classic .starx-header,
body.starx-wp-classic .starx-header * {
  box-sizing: border-box;
}

body.starx-wp-classic .starx-header {
  --sx-header-ink: #f7f8fb;
  --sx-header-muted: #aeb7c5;
  --sx-header-border: rgba(255,255,255,.11);
  position: sticky;
  top: 0;
  z-index: 5000;
  width: 100%;
  color: var(--sx-header-ink);
  background: rgba(8,10,15,.97);
  border-bottom: 1px solid var(--sx-header-border);
  isolation: isolate;
  overflow: visible;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  transition: background .2s ease, box-shadow .2s ease;
}

body.starx-wp-classic .starx-header.is-scrolled {
  background: rgba(5,7,11,.985);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}

body.starx-wp-classic .starx-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: 100%;
  min-height: 34px;
  padding: 0 var(--starx-header-padding-x, 56px);
  border-bottom: 1px solid rgba(255,255,255,.075);
  color: #aeb6c3;
  font: 500 11px/1.35 'DM Sans', system-ui, sans-serif;
}

body.starx-wp-classic .starx-topbar-copy {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #aeb6c3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.starx-wp-classic .starx-topbar-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 22px;
  white-space: nowrap;
}

body.starx-wp-classic .starx-topbar a,
body.starx-wp-classic .starx-language {
  color: #e0e5ed;
  font: inherit;
  text-decoration: none;
  transition: color .18s ease;
}

body.starx-wp-classic .starx-topbar a:hover,
body.starx-wp-classic .starx-topbar a:focus-visible,
body.starx-wp-classic .starx-language:hover {
  color: #ffad5c;
}

body.starx-wp-classic .starx-nav-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(164px, 208px) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(12px, 1.8vw, 26px);
  width: 100%;
  max-width: 1440px;
  min-height: var(--starx-header-height, 78px);
  height: var(--starx-header-height, 78px);
  margin-inline: auto;
  padding: 0 var(--starx-header-padding-x, 56px);
}

body.starx-wp-classic .starx-brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  width: auto;
  min-width: 0;
  max-width: 210px;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}

body.starx-wp-classic .starx-brand-logo {
  display: block;
  flex: 0 1 auto;
  width: min(calc(var(--starx-logo-size, 42px) * 4.1), 190px);
  max-width: 100%;
  height: auto;
  object-fit: contain;
  object-position: left center;
}

body.starx-wp-classic .starx-desktop-nav {
  display: flex;
  align-self: stretch;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  margin: 0;
  overflow: visible;
}

body.starx-wp-classic .starx-primary-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 100%;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-primary-menu > .starx-nav-item {
  position: static;
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  align-self: stretch;
  gap: 0;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-primary-menu > .starx-nav-item > .starx-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 42px;
  height: 42px;
  padding: 0 clamp(7px, .75vw, 12px);
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #e2e8f0;
  font: 600 var(--starx-nav-font-size, 13px)/1.25 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: color .18s ease, background .18s ease;
}

body.starx-wp-classic .starx-primary-menu > .starx-nav-item > .starx-nav-link:hover,
body.starx-wp-classic .starx-primary-menu > .starx-nav-item.is-open > .starx-nav-link,
body.starx-wp-classic .starx-primary-menu > .starx-nav-item.current-menu-item > .starx-nav-link,
body.starx-wp-classic .starx-primary-menu > .starx-nav-item.current-menu-ancestor > .starx-nav-link {
  color: #f28c34;
  background: rgba(242,140,52,.075);
}

body.starx-wp-classic .starx-menu-toggle {
  display: inline-grid;
  flex: 0 0 22px;
  place-items: center;
  width: 22px;
  height: 38px;
  margin: 0 2px 0 -4px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #cbd5e1;
  cursor: pointer;
  transition: color .18s ease, background .18s ease;
}

body.starx-wp-classic .starx-menu-toggle:hover,
body.starx-wp-classic .starx-menu-toggle:focus-visible,
body.starx-wp-classic .starx-nav-item.is-open > .starx-menu-toggle {
  color: #ffad5c;
  background: rgba(255,255,255,.055);
}

body.starx-wp-classic .starx-menu-toggle svg {
  display: block;
  width: 12px;
  height: 12px;
  transition: transform .18s ease;
}

body.starx-wp-classic .starx-nav-item.is-open > .starx-menu-toggle svg {
  transform: rotate(180deg);
}

body.starx-wp-classic .starx-mega-panel {
  position: absolute;
  top: 100%;
  left: var(--starx-header-padding-x, 56px);
  right: var(--starx-header-padding-x, 56px);
  z-index: 5001;
  display: none;
  width: auto;
  min-width: 0;
  max-width: 1328px;
  max-height: min(68vh, 560px);
  margin-inline: auto;
  padding: 20px;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.13);
  border-top: 1px solid rgba(242,140,52,.28);
  border-radius: 0 0 16px 16px;
  background: rgba(12,16,24,.99);
  box-shadow: 0 24px 55px rgba(0,0,0,.48);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

body.starx-wp-classic .starx-nav-item.is-open > .starx-mega-panel,
body.starx-wp-classic .starx-nav-item:focus-within > .starx-mega-panel {
  display: block;
  animation: starxMenuFadeIn .16s ease both;
}

body.starx-wp-classic .starx-mega-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-mega-link-item {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-mega-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  height: auto;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: rgba(255,255,255,.025);
  color: #e8edf5;
  font: 600 13px/1.4 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  transition: border-color .18s ease, background .18s ease, color .18s ease;
}

body.starx-wp-classic .starx-mega-link:hover,
body.starx-wp-classic .starx-mega-link:focus-visible {
  border-color: rgba(242,140,52,.28);
  background: rgba(242,140,52,.09);
  color: #fff;
}

body.starx-wp-classic .starx-mega-link-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

body.starx-wp-classic .starx-mega-link-title {
  color: inherit;
  font-weight: 700;
}

body.starx-wp-classic .starx-mega-link small {
  display: block;
  color: #8f9bab;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.45;
}

body.starx-wp-classic .starx-mega-arrow {
  flex: 0 0 auto;
  color: #f28c34;
  font-size: 15px;
}

body.starx-wp-classic .starx-nav-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 16px;
  min-width: 0;
  margin: 0;
}

body.starx-wp-classic .starx-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 3px;
  color: #e5e7eb;
  font: 600 13px/1.2 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
}

body.starx-wp-classic .starx-login:hover {
  color: #ffad5c;
}

body.starx-wp-classic .starx-open-account {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-width: 150px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid #f28c34;
  border-radius: 999px;
  background: #f28c34;
  color: #f8fafc !important;
  font: 700 14px/1.2 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: background .18s ease, border-color .18s ease, transform .18s ease;
}

body.starx-wp-classic .starx-open-account:hover {
  transform: translateY(-1px);
  border-color: #ff9e47;
  background: #e9771f;
}

body.starx-wp-classic .starx-open-account span {
  font-size: 17px;
  line-height: 1;
}

body.starx-wp-classic .starx-mobile-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.17);
  border-radius: 9px;
  background: rgba(255,255,255,.045);
  color: #fff;
  cursor: pointer;
}

body.starx-wp-classic .starx-mobile-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}

body.starx-wp-classic .starx-mobile-toggle .starx-icon-close {
  display: none;
}

body.starx-wp-classic .starx-mobile-toggle[aria-expanded="true"] .starx-icon-menu {
  display: none;
}

body.starx-wp-classic .starx-mobile-toggle[aria-expanded="true"] .starx-icon-close {
  display: block;
}

body.starx-wp-classic .starx-mobile-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5002;
  display: none;
  width: 100%;
  max-height: calc(100dvh - 112px);
  padding: 12px var(--starx-header-padding-x, 28px) 22px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid rgba(255,255,255,.075);
  border-bottom: 1px solid rgba(255,255,255,.15);
  background: rgba(8,11,17,.995);
  box-shadow: 0 22px 48px rgba(0,0,0,.5);
}

body.starx-wp-classic .starx-mobile-panel.is-open:not([hidden]) {
  display: block;
  animation: starxMobileIn .16s ease both;
}

body.starx-wp-classic .starx-mobile-panel[hidden] {
  display: none !important;
}

body.starx-wp-classic .starx-mobile-menu,
body.starx-wp-classic .starx-mobile-menu .sub-menu {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-mobile-menu > li {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  min-width: 0;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid rgba(255,255,255,.075);
  list-style: none;
}

body.starx-wp-classic .starx-mobile-menu > li > a {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 52px;
  padding: 12px 4px;
  color: #eef2f7;
  font: 650 14px/1.35 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  overflow-wrap: anywhere;
}

body.starx-wp-classic .starx-mobile-menu > li > a:hover,
body.starx-wp-classic .starx-mobile-menu > li.current-menu-item > a,
body.starx-wp-classic .starx-mobile-menu > li.current-menu-ancestor > a {
  color: #ffad5c;
}

body.starx-wp-classic .starx-mobile-submenu-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255,255,255,.09);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: #cbd5e1;
  cursor: pointer;
}

body.starx-wp-classic .starx-mobile-submenu-toggle svg {
  display: block;
  width: 15px;
  height: 15px;
  transition: transform .18s ease;
}

body.starx-wp-classic .starx-mobile-menu > li.is-open > .starx-mobile-submenu-toggle svg {
  transform: rotate(180deg);
}

body.starx-wp-classic .starx-mobile-panel .starx-mobile-menu .sub-menu {
  display: none;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  padding: 3px 0 14px 10px;
}

body.starx-wp-classic .starx-mobile-panel .starx-mobile-menu > li.is-open > .sub-menu {
  display: grid !important;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu > li {
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu a {
  display: flex;
  align-items: center;
  min-height: 42px;
  height: auto;
  padding: 9px 11px;
  border: 1px solid rgba(255,255,255,.055);
  border-radius: 7px;
  background: #121925;
  color: #c3ccd8;
  font: 550 12px/1.4 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  overflow-wrap: anywhere;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu a:hover {
  border-color: rgba(242,140,52,.25);
  background: rgba(242,140,52,.09);
  color: #fff;
}

body.starx-wp-classic .starx-mobile-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding-top: 17px;
}

body.starx-wp-classic .starx-mobile-actions > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: #f1f5f9;
  font: 700 13px/1.2 'DM Sans', system-ui, sans-serif;
  text-decoration: none;
  overflow-wrap: anywhere;
}

body.starx-wp-classic .starx-mobile-actions > .starx-mobile-cta {
  border-color: #f28c34;
  background: #f28c34;
  color: #111318;
}

body.starx-wp-classic .starx-mobile-actions > .starx-device-trade {
  grid-column: 1 / -1;
}

body.starx-wp-classic .starx-header a:focus-visible,
body.starx-wp-classic .starx-header button:focus-visible {
  outline: 2px solid #ffad5c;
  outline-offset: 3px;
}

@keyframes starxMenuFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes starxMobileIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Compact desktop remains a full desktop menu; tablet switches to the drawer. */
@media (max-width: 1360px) and (min-width: 1201px) {
  body.starx-wp-classic .starx-nav-shell {
    grid-template-columns: minmax(148px, 168px) minmax(0, 1fr) auto;
    gap: 12px;
  }
  body.starx-wp-classic .starx-brand-logo { width: min(calc(var(--starx-logo-size, 38px) * 4.1), 174px); }
  body.starx-wp-classic .starx-primary-menu > .starx-nav-item > .starx-nav-link {
    padding-inline: 6px;
    font-size: 12px;
  }
  body.starx-wp-classic .starx-menu-toggle {
    flex-basis: 18px;
    width: 18px;
  }
  body.starx-wp-classic .starx-nav-actions { gap: 10px; }
  body.starx-wp-classic .starx-open-account {
    min-width: 132px;
    min-height: 44px;
    padding-inline: 14px;
    font-size: 12px;
  }
  body.starx-wp-classic .starx-login { font-size: 12px; }
}

@media (max-width: 1200px) {
  body.starx-wp-classic .starx-nav-shell {
    grid-template-columns: minmax(0, 1fr) 44px;
    min-height: var(--starx-header-height, 72px);
    height: var(--starx-header-height, 72px);
  }
  body.starx-wp-classic .starx-desktop-nav,
  body.starx-wp-classic .starx-nav-actions {
    display: none !important;
  }
  body.starx-wp-classic .starx-mobile-toggle { display: inline-flex; }
  body.starx-wp-classic .starx-brand { max-width: 220px; }
  body.starx-wp-classic .starx-mega-panel { display: none !important; }
}

@media (max-width: 760px) {
  body.starx-wp-classic .starx-topbar {
    min-height: 31px;
    height: 31px;
    gap: 8px;
    padding-inline: 12px;
    font-size: 9px;
  }
  body.starx-wp-classic .starx-topbar-actions { gap: 9px; }
  body.starx-wp-classic .starx-topbar-trade,
  body.starx-wp-classic .starx-language { display: none !important; }
  body.starx-wp-classic .starx-topbar-copy { max-width: none; }
  body.starx-wp-classic .starx-nav-shell {
    min-height: var(--starx-header-height, 66px);
    height: var(--starx-header-height, 66px);
  }
  body.starx-wp-classic .starx-brand-logo { width: min(calc(var(--starx-logo-size, 34px) * 4.1), 156px); }
  body.starx-wp-classic .starx-mobile-panel {
    max-height: calc(100dvh - 98px);
    padding-top: 8px;
  }
}

@media (max-width: 420px) {
  body.starx-wp-classic .starx-nav-shell { gap: 8px; }
  body.starx-wp-classic .starx-brand-logo { width: min(calc(var(--starx-logo-size, 34px) * 3.9), 140px); }
  body.starx-wp-classic .starx-mobile-toggle { width: 40px; height: 40px; }
  body.starx-wp-classic .starx-mobile-panel { padding-inline: 14px; }
  body.starx-wp-classic .starx-mobile-panel .starx-mobile-menu .sub-menu { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 340px) {
  body.starx-wp-classic .starx-topbar-copy { max-width: 190px; }
  body.starx-wp-classic .starx-topbar-actions { gap: 6px; }
  body.starx-wp-classic .starx-brand-logo { width: min(calc(var(--starx-logo-size, 30px) * 3.8), 126px); }
}

@media (prefers-reduced-motion: reduce) {
  body.starx-wp-classic .starx-header *,
  body.starx-wp-classic .starx-header *::before,
  body.starx-wp-classic .starx-header *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Reference-style three-column mega menu headings and nested mobile groups. */
body.starx-wp-classic .starx-mega-group-item {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  margin: 0;
  padding: 2px 8px 8px;
  border-right: 1px solid rgba(255,255,255,.075);
  list-style: none;
}

body.starx-wp-classic .starx-mega-group-item:last-child { border-right: 0; }

body.starx-wp-classic .starx-mega-group-heading {
  min-height: 28px;
  margin: 0 0 9px;
  padding: 0 10px 8px;
  border-bottom: 1px solid rgba(242,140,52,.2);
}

body.starx-wp-classic .starx-mega-group-heading h3 {
  margin: 0;
  color: #f28c34;
  font: 750 10px/1.35 'DM Sans', system-ui, sans-serif;
  letter-spacing: .105em;
  text-transform: uppercase;
}

body.starx-wp-classic .starx-mega-group-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.starx-wp-classic .starx-mega-group-links > li { min-width: 0; }

body.starx-wp-classic .starx-mega-group-links .starx-mega-link {
  min-height: 58px;
  padding: 9px 10px;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu > li.menu-item-has-children {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: center;
  min-width: 0;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu > li.menu-item-has-children > a {
  min-width: 0;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: #f3a15a;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu > li.menu-item-has-children > .starx-mobile-submenu-toggle {
  width: 34px;
  height: 34px;
}

body.starx-wp-classic .starx-mobile-panel .starx-mobile-menu .sub-menu > li.is-open > .sub-menu {
  display: grid !important;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px 0 12px 8px;
}

body.starx-wp-classic .starx-mobile-menu .sub-menu .sub-menu a {
  min-height: 44px;
  background: rgba(255,255,255,.045);
  font-size: 12px;
}

@media (max-width: 420px) {
  body.starx-wp-classic .starx-mobile-panel .starx-mobile-menu .sub-menu > li.is-open > .sub-menu {
    grid-template-columns: minmax(0, 1fr);
  }
}
