/* Shared geometry for the existing landing, activity, stairs and theme headers. */
@font-face {
  font-family: "Memorial Header Pretendard";
  src: url("PretendardVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 45 920;
  font-display: swap;
}

/* Reserve the same width on pages with and without a vertical scrollbar. */
html { scrollbar-gutter: stable; }

body.hmh-unified-header {
  --hmh-height: 100px;
  --hmh-inset: clamp(24px, 3.4vw, 64px);
  --hmh-padding-left: max(var(--hmh-inset), env(safe-area-inset-left));
  --hmh-padding-right: max(var(--hmh-inset), env(safe-area-inset-right));
  --hmh-action-gap: 24px;
  --hmh-motion-width: 44px;
  --hmh-ink: #f8f5ed;
}

body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header),
body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) *,
body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) *::before,
body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) *::after {
  box-sizing: border-box !important;
  font-family: "Memorial Header Pretendard", "Pretendard", "Malgun Gothic", sans-serif !important;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) {
  position: fixed !important;
  inset: 0 0 auto !important;
  z-index: 50 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 24px !important;
  width: auto !important;
  max-width: none !important;
  height: var(--hmh-height) !important;
  min-height: var(--hmh-height) !important;
  margin: 0 !important;
  padding: 24px var(--hmh-padding-right) 24px var(--hmh-padding-left) !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  color: var(--hmh-ink) !important;
  line-height: 24px !important;
  transform: none !important;
}

body.hmh-unified-header :is(.memorial-navigation, .hmas-bg-navigation, .main-nav) {
  display: block !important;
  position: static !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .menu-list) {
  display: flex !important;
  align-items: center !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: clamp(24px, 2.8vw, 52px) !important;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .menu-list, .site-header .mobile-menu-list) li {
  position: relative;
  margin: 0 !important;
  padding: 0 !important;
  list-style: none !important;
}

body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .menu-list, .site-header .mobile-menu-list) :is(a, span),
body.hmh-unified-header :is(.memorial-home, .hmas-bg-home, .site-header .logo) {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  color: var(--hmh-ink) !important;
  background: transparent !important;
  font-size: clamp(14px, 1vw, 17px) !important;
  font-weight: 500 !important;
  font-style: normal !important;
  line-height: 24px !important;
  letter-spacing: -0.02em !important;
  text-decoration: none;
  text-shadow: 0 1px 10px rgb(0 0 0 / 35%) !important;
  white-space: nowrap !important;
}

body.hmh-unified-header :is(.memorial-home, .hmas-bg-home, .site-header .logo) {
  flex: 0 0 auto !important;
  font-size: 14px !important;
  letter-spacing: 0.04em !important;
}

body.hmh-unified-header :is(.memorial-header-actions, .hmas-bg-header-actions, .site-header .header-right) {
  display: flex !important;
  align-items: center !important;
  flex: 0 0 auto !important;
  gap: var(--hmh-action-gap) !important;
  margin: 0 0 0 auto !important;
  padding: 0 !important;
}

body.hmh-unified-header :is(.memorial-motion-toggle, .hmas-bg-motion-toggle, .memorial-menu-toggle, .hmas-bg-menu-toggle, .site-header .hamburger) {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  width: var(--hmh-motion-width) !important;
  height: 44px !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 12px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--hmh-ink) !important;
  line-height: 1 !important;
  cursor: pointer;
}

/* A blocked animation script must not move HOME into the reserved button slot. */
body.hmh-unified-header :is(.memorial-motion-toggle, .hmas-bg-motion-toggle)[hidden] {
  display: inline-flex !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.hmh-unified-header :is(.memorial-motion-toggle, .hmas-bg-motion-toggle) svg {
  width: 16px !important;
  height: 16px !important;
  fill: currentColor;
  stroke: none;
}

body.hmh-unified-header :is(.memorial-menu-toggle, .hmas-bg-menu-toggle, .site-header .hamburger) {
  display: none !important;
  width: 44px !important;
  border-radius: 0 !important;
}

/* The stairs-only tool sits below the bar so it cannot displace HOME. */
body.hmh-unified-header .memorial-header-actions > [data-action="list"] {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  right: var(--hmh-padding-right) !important;
  min-height: 40px;
  margin: 0 !important;
}

/* Keep the activity content at its former position when its header becomes fixed. */
body.hmh-unified-header .hmas-shell > .hmas-main { margin-top: 92px !important; }

/* Compatibility with the original Memory Theme header on ordinary pages. */
body.hmh-unified-header .site-header .header-inner {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  width: 100% !important;
  height: 44px !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.hmh-unified-header .site-header .header-left { gap: 0 !important; }
body.hmh-unified-header .site-header .header-right::after {
  content: "";
  display: block;
  flex: 0 0 var(--hmh-motion-width);
  width: var(--hmh-motion-width);
  height: 44px;
}
body.hmh-unified-header .site-header .mobile-menu { display: none !important; }

body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) a:hover,
body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .menu-list) :is(a[aria-current="page"], .current-menu-item > a, span[aria-current="page"]) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
}
body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) :is(a, button):focus-visible {
  outline: 2px solid #f6e9d2;
  outline-offset: 4px;
}
body.hmh-unified-header :is(.memorial-skip-link, .hmas-skip):focus { z-index: 51; }

body.hmh-unified-header.admin-bar :is(.memorial-header, .hmas-bg-header, .site-header) { top: 32px !important; }
@media (max-width: 782px) {
  body.hmh-unified-header.admin-bar :is(.memorial-header, .hmas-bg-header, .site-header) { top: 46px !important; }
}

@media (max-width: 760px) {
  body.hmh-unified-header {
    --hmh-height: 50px;
    --hmh-padding-left: max(4px, env(safe-area-inset-left));
    --hmh-padding-right: max(8px, env(safe-area-inset-right));
    --hmh-action-gap: 12px;
    --hmh-motion-width: 32px;
  }
  body.hmh-unified-header :is(.memorial-header, .hmas-bg-header, .site-header) {
    padding: 3px var(--hmh-padding-right) 3px var(--hmh-padding-left) !important;
    gap: 12px !important;
  }
  body.hmh-unified-header :is(.memorial-home, .hmas-bg-home, .site-header .logo) {
    font-size: 12px !important;
    font-weight: 600 !important;
  }
  body.hmh-unified-header :is(.memorial-motion-toggle, .hmas-bg-motion-toggle) { padding: 8px !important; }
  body.hmh-unified-header :is(.memorial-menu-toggle, .hmas-bg-menu-toggle, .site-header .hamburger) { display: inline-flex !important; }
  body.hmh-unified-header :is(.memorial-menu-toggle, .hmas-bg-menu-toggle) span {
    position: absolute;
    width: 22px;
    height: 1px;
    background: currentColor;
  }
  body.hmh-unified-header :is(.memorial-navigation, .hmas-bg-navigation, .site-header .mobile-menu) {
    display: none !important;
    position: absolute !important;
    top: 100% !important;
    left: max(8px, env(safe-area-inset-left)) !important;
    right: max(8px, env(safe-area-inset-right)) !important;
    width: auto !important;
    max-height: calc(100dvh - var(--hmh-height) - 16px) !important;
    margin: 0 !important;
    padding: 20px 24px !important;
    overflow-y: auto;
    /* Background only: keep the menu text fully opaque. */
    background: rgba(8, 14, 33, 0.5) !important;
    box-shadow: none !important;
  }
  body.hmh-unified-header .main-nav { display: none !important; }
  body.hmh-unified-header .site-header .mobile-menu { display: none; }
  body.hmh-unified-header .site-header .mobile-menu[style*="block"],
  body.hmh-unified-header .memorial-header[data-menu-open="true"] .memorial-navigation,
  body.hmh-unified-header .hmas-bg-header[data-menu-open="true"] .hmas-bg-navigation,
  body.hmh-unified-header.hme-no-js .memorial-navigation { display: block !important; }
  body.hmh-unified-header.hme-no-js .memorial-menu-toggle { display: none !important; }
  body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .mobile-menu-list) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
  }
  body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .mobile-menu-list) :is(a, span) {
    font-size: 16px !important;
  }
  body.hmh-unified-header :is(.memorial-menu, .hmas-bg-menu, .site-header .mobile-menu-list) .sub-menu {
    display: block !important;
    position: static !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 4px 0 4px 16px !important;
    background: transparent !important;
  }
  body.hmh-unified-header .site-header .hamburger { font-size: 0 !important; }
  body.hmh-unified-header .site-header .hamburger::before,
  body.hmh-unified-header .site-header .hamburger::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 1px;
    background: currentColor;
  }
  body.hmh-unified-header .site-header .hamburger::before { transform: translateY(-4px); }
  body.hmh-unified-header .site-header .hamburger::after { transform: translateY(4px); }
  body.hmh-unified-header .hmas-shell > .hmas-main { margin-top: 62px !important; }
}
