/* Shared MemoraX header, navigation, and footer. */

:root {
  --mx-font-sans: Inter, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mx-content-width: 1285px;
  --mx-content-gutter: clamp(24px, 5.5vw, 68px);
}

html:lang(zh-Hans) {
  --mx-font-sans: "PingFang SC", "Noto Sans SC", Inter, "SF Pro Text", system-ui, sans-serif;
}

html:lang(zh-Hant) {
  --mx-font-sans: "PingFang TC", "Noto Sans TC", Inter, "SF Pro Text", system-ui, sans-serif;
}

html:lang(ja) {
  --mx-font-sans: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", Inter, system-ui, sans-serif;
}

html:lang(ko) {
  --mx-font-sans: "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", Inter, system-ui, sans-serif;
}

html:lang(ko) body {
  overflow-wrap: break-word;
  word-break: keep-all;
}

:where(h1, h2, h3) {
  text-wrap: balance;
}

@media (max-width: 560px) {
  :root {
    --mx-content-gutter: 20px;
  }
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) {
  --mx-shell-bg: #f4f7fb;
  --mx-shell-bg-deep: #e8eef5;
  --mx-shell-paper: #fbfdff;
  --mx-shell-ink: #102133;
  --mx-shell-muted: #607286;
  --mx-shell-rule: rgba(16, 33, 51, 0.18);
  --mx-shell-soft-rule: rgba(16, 33, 51, 0.1);
  --mx-shell-dark: #102133;
  --mx-shell-blue: #2867d9;
  --mx-shell-blue-deep: #1f55b5;
  --mx-shell-inverse-secondary: rgba(225, 239, 251, 0.72);
  --mx-shell-inverse-tertiary: rgba(225, 239, 251, 0.54);
  --mx-shell-logo-width: 128px;
  --mx-shell-width: var(--mx-content-width);
  --mx-shell-gutter: var(--mx-content-gutter);
  --mx-shell-header-height: 58px;
  color: var(--mx-shell-ink);
  font-family: var(--mx-font-sans);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer),
:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) *,
:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) *::before,
:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) *::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) :where(a, button) {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) button {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  cursor: pointer;
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) :where(img, svg) {
  display: block;
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) svg {
  width: 1em;
  height: 1em;
  flex: 0 0 auto;
}

:where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) :focus-visible {
  outline: 2px solid var(--mx-shell-blue);
  outline-offset: 3px;
}

.mx-shell-skip {
  position: fixed;
  top: 8px;
  left: 12px;
  z-index: 1000;
  padding: 8px 12px;
  background: #0b1b2a;
  color: #f4f7fb;
  font: 600 13px/1.4 Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.mx-shell-skip:focus {
  transform: translateY(0);
}

.mx-shell-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.mx-shell-inner {
  width: min(var(--mx-shell-width), calc(100% - (var(--mx-shell-gutter) * 2)));
  margin-right: auto;
  margin-left: auto;
}

body.mx-shell-menu-open {
  overflow: hidden;
}

/* Header */
.mx-shell-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--mx-shell-header-height);
  border-bottom: 1px solid var(--mx-shell-soft-rule);
  background: rgba(244, 247, 251, 0.96);
  backdrop-filter: blur(14px);
}

.mx-shell-header.is-scrolled {
  box-shadow: 0 8px 24px rgba(16, 33, 51, 0.06);
}

.mx-shell-header-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  height: 100%;
  align-items: center;
  gap: 24px;
}

.mx-shell-header-actions {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 20px;
}

.mx-shell-brand {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  color: var(--mx-shell-ink);
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.mx-shell-header .mx-shell-brand img,
.mx-shell-footer .mx-shell-brand img {
  display: block;
  width: var(--mx-shell-logo-width);
  height: auto;
  max-width: none;
  object-fit: contain;
}

.mx-shell-desktop-nav {
  display: flex;
  margin-left: 0;
  justify-content: center;
  align-self: stretch;
  align-items: center;
  gap: clamp(16px, 2vw, 30px);
}

.mx-shell-nav-group {
  position: relative;
  display: flex;
  height: 100%;
  align-items: center;
}

.mx-shell-nav-trigger {
  position: relative;
  display: inline-flex;
  height: 100%;
  align-items: center;
  gap: 5px;
  color: var(--mx-shell-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 150ms ease;
}

.mx-shell-header .mx-shell-nav-trigger {
  font-family: var(--mx-font-sans);
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.5 !important;
}

.mx-shell-nav-trigger::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--mx-shell-blue);
  content: "";
  opacity: 0;
  transform: scaleX(0.45);
  transition: opacity 150ms ease, transform 150ms ease;
}

.mx-shell-nav-trigger svg {
  width: 13px;
  height: 13px;
  transition: transform 150ms ease;
}

.mx-shell-header .mx-shell-nav-trigger svg {
  width: 13px;
  height: 13px;
}

.mx-shell-nav-group:is(:hover, :focus-within) .mx-shell-nav-trigger,
.mx-shell-nav-group.is-open .mx-shell-nav-trigger,
.mx-shell-nav-group.is-current .mx-shell-nav-trigger {
  color: var(--mx-shell-blue);
}

.mx-shell-nav-group.is-open .mx-shell-nav-trigger::after,
.mx-shell-nav-group.is-current .mx-shell-nav-trigger::after {
  opacity: 1;
  transform: scaleX(1);
}

.mx-shell-nav-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.mx-shell-header .mx-shell-nav-trigger:focus-visible {
  outline: 0;
}

.mx-shell-dropdown {
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  z-index: 120;
  min-width: 250px;
  padding-top: 10px;
  transform: translateX(-50%);
}

.mx-shell-dropdown[hidden] {
  display: none;
}

.mx-shell-dropdown-list {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--mx-shell-rule);
  border-radius: 6px;
  background: var(--mx-shell-bg);
  box-shadow: 0 16px 34px rgba(16, 33, 51, 0.12);
  animation: mx-shell-dropdown-in 150ms ease-out;
}

.mx-shell-dropdown-link {
  display: flex;
  min-height: 39px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 10px;
  color: var(--mx-shell-muted);
  font-size: 13px;
  line-height: 1.35;
  transition: background 150ms ease, color 150ms ease, padding 150ms ease;
}

.mx-shell-dropdown-link svg {
  width: 14px;
  height: 14px;
  opacity: 0.68;
}

.mx-shell-dropdown-link span,
.mx-shell-mobile-submenu a span {
  position: relative;
}

.mx-shell-dropdown-link span::after,
.mx-shell-mobile-submenu a span::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.mx-shell-dropdown-link:is(:hover, :focus-visible),
.mx-shell-dropdown-link[aria-current="page"] {
  color: var(--mx-shell-blue);
}

.mx-shell-dropdown-link:is(:hover, :focus-visible) span::after,
.mx-shell-dropdown-link[aria-current="page"] span::after,
.mx-shell-mobile-submenu a:is(:hover, :focus-visible) span::after,
.mx-shell-mobile-submenu a[aria-current="page"] span::after {
  transform: scaleX(1);
  transform-origin: left;
}

.mx-shell-sign-in {
  display: inline-flex;
  align-items: center;
  color: var(--mx-shell-ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: color 150ms ease;
}

.mx-shell-sign-in:hover,
.mx-shell-sign-in:focus-visible {
  color: var(--mx-shell-blue);
}

.mx-shell-desktop-language {
  position: relative;
  display: flex;
  align-items: center;
}

.mx-shell-language-toggle {
  display: inline-flex;
  min-width: 38px;
  min-height: 34px;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  padding: 7px 0 7px 5px !important;
  color: var(--mx-shell-ink);
  font-size: 12px !important;
  font-weight: 700 !important;
}

.mx-shell-language-toggle svg {
  width: 13px;
  height: 13px;
  transition: transform 150ms ease;
}

.mx-shell-header .mx-shell-language-toggle svg {
  width: 13px;
  height: 13px;
}

.mx-shell-language-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.mx-shell-language-menu {
  position: absolute;
  top: calc(100% + 9px);
  right: -8px;
  z-index: 125;
  display: grid;
  min-width: 142px;
  gap: 2px;
  padding: 7px;
  border: 1px solid var(--mx-shell-rule);
  border-radius: 6px;
  background: var(--mx-shell-bg);
  box-shadow: 0 14px 28px rgba(16, 33, 51, 0.12);
  animation: mx-shell-dropdown-in 150ms ease-out;
}

.mx-shell-language-menu[hidden] {
  display: none;
}

.mx-shell-language-option {
  min-height: 34px;
  padding: 7px 9px !important;
  color: var(--mx-shell-muted) !important;
  font-size: 12px !important;
  text-align: left;
}

.mx-shell-language-option:is(:hover, :focus-visible),
.mx-shell-language-option[aria-selected="true"] {
  background: var(--mx-shell-bg-deep) !important;
  color: var(--mx-shell-ink) !important;
}

.mx-shell-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  margin-left: auto !important;
  align-items: center;
  justify-content: center;
  color: var(--mx-shell-ink) !important;
  transition: color 150ms ease, transform 150ms ease;
}

.mx-shell-header .mx-shell-menu-toggle svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.35;
}

.mx-shell-menu-toggle:hover {
  color: var(--mx-shell-blue) !important;
  transform: translateY(-1px);
}

/* Mobile navigation */
.mx-shell-menu {
  position: fixed;
  top: 58px;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 95;
  overflow-y: auto;
  border-bottom: 1px solid var(--mx-shell-rule);
  background: var(--mx-shell-bg);
  box-shadow: 0 18px 32px rgba(16, 33, 51, 0.08);
}

.mx-shell-menu[hidden] {
  display: none;
}

.mx-shell-menu-inner {
  display: flex;
  min-height: calc(100svh - 58px);
  flex-direction: column;
  gap: 30px;
  padding-top: 24px;
  padding-bottom: 30px;
}

.mx-shell-mobile-nav {
  display: grid;
}

.mx-shell-mobile-group {
  border-bottom: 1px solid var(--mx-shell-soft-rule);
}

.mx-shell-mobile-trigger {
  display: flex !important;
  width: 100%;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  color: var(--mx-shell-ink) !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  text-align: left;
  transition: color 150ms ease, padding 150ms ease;
}

.mx-shell-mobile-trigger:hover,
.mx-shell-mobile-group.is-current .mx-shell-mobile-trigger {
  color: var(--mx-shell-blue) !important;
}

.mx-shell-mobile-trigger svg {
  width: 17px;
  height: 17px;
  transition: transform 150ms ease;
}

.mx-shell-mobile-trigger > span {
  padding-bottom: 2px;
  background-image: linear-gradient(currentColor, currentColor);
  background-position: 100% 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  transition: background-size 180ms ease;
}

.mx-shell-menu .mx-shell-mobile-trigger:focus-visible {
  outline: 0;
  color: var(--mx-shell-blue) !important;
}

.mx-shell-mobile-trigger:is(:hover, :focus-visible) > span,
.mx-shell-mobile-group.is-current .mx-shell-mobile-trigger > span {
  background-position: 0 100%;
  background-size: 100% 1px;
}

.mx-shell-mobile-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.mx-shell-mobile-submenu {
  display: grid;
  gap: 2px;
  padding: 0 0 16px 16px;
}

.mx-shell-mobile-submenu[hidden] {
  display: none;
}

.mx-shell-mobile-submenu a {
  display: flex;
  min-height: 37px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--mx-shell-muted);
  font-size: 13px;
}

.mx-shell-mobile-submenu a:is(:hover, :focus-visible),
.mx-shell-mobile-submenu a[aria-current="page"] {
  color: var(--mx-shell-blue);
}

.mx-shell-mobile-submenu svg {
  width: 13px;
  height: 13px;
}

.mx-shell-mobile-sign-in {
  display: block;
  padding: 14px 0;
  border-top: 1px solid var(--mx-shell-soft-rule);
  color: var(--mx-shell-ink);
  font-weight: 650;
}

.mx-shell-mobile-language {
  display: flex;
  margin-top: auto;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding-top: 8px;
}

.mx-shell-mobile-language-label {
  color: var(--mx-shell-ink);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.mx-shell-mobile-language-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.mx-shell-mobile-language-options button {
  color: var(--mx-shell-muted);
  font-size: 12px;
}

.mx-shell-menu .mx-shell-mobile-language-options button {
  font-family: var(--mx-font-sans);
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  color: var(--mx-shell-muted) !important;
}

.mx-shell-mobile-language-options button:is(:hover, :focus-visible),
.mx-shell-mobile-language-options button[aria-pressed="true"] {
  color: var(--mx-shell-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.mx-shell-menu .mx-shell-mobile-language-options button:is(:hover, :focus-visible),
.mx-shell-menu .mx-shell-mobile-language-options button[aria-pressed="true"] {
  color: var(--mx-shell-ink) !important;
}

/* Footer */
.mx-shell-footer {
  padding: 46px 0 26px;
  background: var(--mx-shell-dark);
  color: var(--mx-shell-bg);
}

.mx-shell-footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
  gap: 56px;
  padding-bottom: 58px;
  border-bottom: 1px solid rgba(225, 239, 251, 0.22);
}

.mx-shell-footer-brand {
  max-width: 290px;
}

.mx-shell-footer .mx-shell-brand {
  color: var(--mx-shell-bg);
}

.mx-shell-footer .mx-shell-brand img {
  filter: none;
}

.mx-shell-footer .mx-shell-footer-brand p {
  margin: 18px 0 0;
  color: var(--mx-shell-inverse-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.mx-shell-socials {
  display: flex;
  gap: 10px;
  margin-top: 23px;
}

.mx-shell-footer .mx-shell-socials a {
  display: inline-flex;
  width: 31px;
  height: 31px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mx-shell-paper);
  border-radius: 50%;
  background: var(--mx-shell-paper);
  color: var(--mx-shell-ink);
  font-size: 12px;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.mx-shell-footer .mx-shell-socials a:is(:hover, :focus-visible) {
  border-color: var(--mx-shell-blue);
  background: var(--mx-shell-blue);
  color: var(--mx-shell-paper);
}

.mx-shell-footer .mx-shell-socials svg {
  width: 15px;
  height: 15px;
}

.mx-shell-footer-nav {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
}

.mx-shell-footer-group {
  display: flex;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.mx-shell-footer .mx-shell-footer-group h2 {
  margin: 0 0 6px;
  color: var(--mx-shell-inverse-tertiary);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-transform: uppercase;
}

.mx-shell-footer .mx-shell-footer-group a {
  position: relative;
  color: var(--mx-shell-bg);
  font-size: 13px;
  line-height: 1.35;
  transition: color 150ms ease;
}

.mx-shell-footer-group a::after {
  position: absolute;
  right: 0;
  bottom: -3px;
  left: 0;
  height: 1px;
  background: currentColor;
  content: "";
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 180ms ease;
}

.mx-shell-footer-group a:is(:hover, :focus-visible) {
  color: var(--mx-shell-paper);
}

.mx-shell-footer-group a:is(:hover, :focus-visible)::after {
  transform: scaleX(1);
  transform-origin: left;
}

.mx-shell-footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-top: 20px;
  color: var(--mx-shell-inverse-tertiary);
  font-size: 11px;
}

.mx-shell-footer-bottom > span:first-child {
  display: flex;
  flex-wrap: wrap;
  gap: 0 7px;
}

.mx-shell-icp:hover {
  color: var(--mx-shell-inverse-secondary);
}

@keyframes mx-shell-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .mx-shell-header-inner { grid-template-columns: minmax(0, 1fr) auto; }
  .mx-shell-header-actions { gap: 12px; }
  .mx-shell-desktop-nav {
    display: none;
  }

  .mx-shell-menu-toggle {
    display: inline-flex;
  }

  .mx-shell-footer-top {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

@media (min-width: 961px) {
  .mx-shell-menu {
    display: none !important;
  }
}

@media (max-width: 820px) {
  .mx-shell-footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 32px 24px;
  }
}

@media (max-width: 560px) {
  :where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) {
    --mx-shell-gutter: 20px;
    --mx-shell-logo-width: 116px;
  }

  .mx-shell-header-inner {
    gap: 12px;
  }

  .mx-shell-menu-inner {
    gap: 24px;
    padding-top: 16px;
    padding-bottom: 24px;
  }

  .mx-shell-footer {
    padding-top: 35px;
  }

  .mx-shell-footer-top {
    gap: 34px;
    padding-bottom: 40px;
  }

  .mx-shell-footer-nav {
    gap: 30px 20px;
  }

  .mx-shell-footer-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  :where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) *,
  :where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) *::before,
  :where(.mx-shell-header, .mx-shell-menu, .mx-shell-footer) *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .mx-shell-skip,
  .mx-shell-header,
  .mx-shell-menu,
  .mx-shell-footer {
    display: none !important;
  }
}
