/* 全ページ共通：通常ヘッダー */
.mg-header {
  position: relative;
  z-index: 20;
  color: #fff;
  background: #2b346c;
  background-size: 85px 100px;
}

.mg-header * {
  box-sizing: border-box;
  font-weight: 400;
}

.mg-header a {
  color: inherit;
  text-decoration: none;
}

.mg-header__row {
  max-width: 1280px;
  height: 110px;
  margin: auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 280px 1fr;
  align-items: center;
  gap: 20px;
}

.mg-header__open,
.mg-header__tel {
  font-family: Georgia,"Times New Roman",serif;
  font-size: 24px;
  white-space: nowrap;
  letter-spacing: .03em;
}

.mg-header__open small,
.mg-header__tel small {
  font-size: 18px;
}

.mg-header__tel {
  text-align: right;
}

.mg-header__logo {
  display: block;
  width: 240px;
  max-width: 100%;
  margin: auto;
}

.mg-header__logo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 66px;
  object-fit: contain;
  filter: invert(1);
  mix-blend-mode: screen;
}

.mg-header__nav {
  max-width: 1120px;
  margin: 0 auto;
}

.mg-header__nav ul {
  display: flex;
  justify-content: center;
  list-style: none;
  padding: 0;
  margin: 0;
}

.mg-header__nav li {
  flex: 1;
  min-width: 0;
}

.mg-header__nav a {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 70px;
  padding: 10px 6px;
  line-height: 1.5;
}

.mg-header__en {
  font-family: Georgia,"Times New Roman",serif;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.mg-header__jp {
  font-size: 12px;
}

.mg-header a:hover,
.mg-header a[aria-current="page"] {
  color: #d2c49f;
}

.mg-header a:focus-visible,
.mg-header button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -3px;
}

.mg-header__title {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 12px;
  background: #a0a3b7;
  color: #fff;
  font-size: 12px;
  font-weight: 400;
  line-height: 36px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mg-header {
  margin-bottom: 36px;
}

.mg-header__toggle,
.mg-header__phone,
.mg-header__info {
  display: none;
}

@media (max-width:1119px) {
  .mg-header {
    margin-bottom: 28px;
    padding-top: 0;
  }

  .mg-header__title {
    top: 100%;
    height: 28px;
    line-height: 28px;
    background: #a0a3b7;
    font-size: 10px;
    text-align: center;
    color: #fff;
  }

  .mg-header__row {
    height: 74px;
    padding: 0 12px;
    grid-template-columns: 44px minmax(0,1fr) 44px;
    gap: 12px;
  }

  .mg-header__open,
  .mg-header__tel {
    display: none;
  }


  .mg-header__logo img {
    max-height: 54px;
  }

  .mg-header__toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 6px;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: pointer;
  }

  .mg-header__toggle span {
    display: block;
    width: 30px;
    height: 3px;
    background: currentColor;
    transition: transform .2s,opacity .2s;
  }

  .mg-header__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .mg-header__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .mg-header__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  .mg-header__phone {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 25px;
  }

  /* ヘッダー全体のfont-weight: 400を電話アイコンに適用しない */
  .mg-header__phone .fa-solid {
    font-weight: 900;
  }

  .mg-header__info {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 16px;
    padding: 10px 8px 12px;
    font-size: 14px;
    line-height: 1.4;
    background: #2b346c;
  }

  .mg-header__info span {
    white-space: nowrap;
  }

  .mg-header__nav {
    display: none;
    position: absolute;
    top: calc(100% + 28px);
    left: 0;
    width: 100%;
    background: #2b346c;
    box-shadow: 0 8px 15px #0003;
    max-height: 70vh;
    overflow: auto;
  }

  .mg-header__nav.is-open {
    display: block;
  }

  .mg-header__nav ul {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 8px 12px 16px;
  }

  .mg-header__nav a {
    min-height: 65px;
    border-bottom: 1px solid #ffffff30;
  }

}

@media (prefers-reduced-motion:reduce) {
  .mg-header__toggle span {
    transition: none;
  }

}

/* 全ページ共通：スクロール後の固定ヘッダー */
.mg-sticky-header {
  --header-background: #2b346c;
  --header-accent: #cdaf87;
  position: fixed;
  inset: 0 0 auto;
  z-index: 1000;
  color: #fff;
  background-size: 85px 100px;
  box-shadow: 0 3px 10px rgb(0 0 0 / 18%);
  transform: translateY(-110%);
  visibility: hidden;
  transition: transform 0.5s ease, visibility 0.5s;
}

.mg-sticky-header.is-visible {
  transform: translateY(0);
  visibility: visible;
  background: #2b346c;
}

.mg-sticky-header * {
  box-sizing: border-box;
}

.mg-sticky-header a {
  color: inherit;
  text-decoration: none;
}

.mg-sticky-header a:hover,
.mg-sticky-header a[aria-current='page'] {
  color: var(--header-accent);
}

.mg-sticky-header a:focus-visible,
.mg-sticky-header button:focus-visible {
  outline: 2px solid var(--header-accent);
  outline-offset: -4px;
}

/* PC：横並びの固定ナビゲーション */
.mg-sticky-header__bar {
  display: none;
}

.mg-sticky-header__nav ul {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.mg-sticky-header__nav a {
  display: flex;
  min-height: 72px;
  padding: 12px 5px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  line-height: 1.5;
}

.mg-sticky-header__nav a span:first-child {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 16px;
  font-weight: 400;
}

.mg-sticky-header__nav a span:last-child {
  font-size: 11px;
  font-weight: 400;
}

/* 下層ページの旧ヘッダーはページ先頭に残し、本文と一緒にスクロールさせる */
.mg-sticky-enabled .l-header,
.mg-sticky-enabled .l-header-up-sub,
.mg-sticky-enabled .l-header-sp__bg-sub,
.mg-sticky-enabled .l-header .c-hamburger {
  position: absolute;
}

/* スマホ：ロゴ・開閉ボタン・電話を一段にまとめる */
@media (max-width: 1119px) {
  .mg-sticky-header__bar {
    display: grid;
    grid-template-columns: 56px 1fr 56px;
    height: 64px;
    align-items: center;
  }

  .mg-sticky-header__logo {
    justify-self: center;
  }

  .mg-sticky-header__logo img {
    display: block;
    width: 180px;
    max-width: 100%;
    max-height: 48px;
    object-fit: contain;
    filter: invert(1);
    mix-blend-mode: screen;
  }

  .mg-sticky-header__toggle {
    display: flex;
    width: 56px;
    height: 56px;
    padding: 17px 14px;
    flex-direction: column;
    justify-content: space-between;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .mg-sticky-header__toggle span {
    width: 28px;
    height: 2px;
    background: #fff;
    transition: transform 0.2s, opacity 0.2s;
  }

  .is-menu-open .mg-sticky-header__toggle span:first-child {
    transform: translateY(10px) rotate(45deg);
  }

  .is-menu-open .mg-sticky-header__toggle span:nth-child(2) {
    opacity: 0;
  }

  .is-menu-open .mg-sticky-header__toggle span:last-child {
    transform: translateY(-10px) rotate(-45deg);
  }

  .mg-sticky-header__phone {
    padding: 18px;
    font-size: 22px;
    text-align: center;
  }

  .mg-sticky-header__nav {
    display: none;
    max-height: calc(100dvh - 64px);
    overflow-y: auto;
    border-top: 1px solid rgb(255 255 255 / 20%);
  }

  .is-menu-open .mg-sticky-header__nav {
    display: block;
  }

  .mg-sticky-header__nav ul {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-sticky-header,
  .mg-sticky-header__toggle span {
    transition: none;
  }
}

/* スマホメニュー：画面下端まで背景を広げ、背面のページをスクロールさせない */
@media (max-width: 1119px) {
  html:has(.mg-header__nav.is-open),
  html:has(.mg-sticky-header.is-menu-open) {
    overflow: hidden;
  }

  .mg-header:has(.mg-header__nav.is-open) {
    width: 100vw;
    z-index: 1100;
  }

  .mg-header__nav.is-open {
    position: fixed;
    top: var(--mg-menu-top);
    bottom: 0;
    height: auto;
    max-height: none;
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
    box-shadow: none;
  }

  .mg-sticky-header.is-menu-open {
    background-color: #2b346c;
  }

  .is-menu-open .mg-sticky-header__nav {
    height: calc(100vh - 64px);
    height: calc(100dvh - 64px);
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom);
    overscroll-behavior: contain;
  }
}

/* 共通スマホメニュー：一覧の下に表示するMUSOバナー */
.mg-header__nav .mg-menu-banner,
.mg-sticky-header__nav .mg-menu-banner {
  display: none;
}

@media (max-width: 1119px) {
  .mg-header__nav .mg-menu-banner,
  .mg-sticky-header__nav .mg-menu-banner {
    display: block;
    width: calc(100% - 40px);
    max-width: 600px;
    min-height: 0;
    margin: 24px auto 32px;
    padding: 0;
    border: 0;
  }

  .mg-menu-banner img {
    display: block;
    width: 100%;
    height: auto;
  }
}
