/* ヘッダーの Solution／Service から開くメニュー。
   Figma: Header_Menu_PC / Solution open (3420:4692)・Service open (3420:4743)、Header_Menu_SP / accordion (3420:4766)
   HTML は views/partials/kn-header.ejs（PCのパネル）と kn-footer.ejs（SPの開閉）、データは lib/nav.js、動きは gmenu.js。
   lp.css は1日キャッシュされるので、このファイルに分けて kn-header.ejs から読み込んでいる。 */

/* --- PC：ナビの矢印と開いている印 --- */
.header-nav-link.has-menu .header-nav-chevron {
  position: absolute;
  left: calc(100% + 4px); /* 文字の右5pxに、幅8pxの矢印。ナビの間隔（40px）の中に収まる */
  top: 50%;
  width: 10px;
  height: 6px;
  margin-top: -3px;
  transition: transform 0.2s ease;
}

.header-nav-link.has-menu.is-open::after {
  width: 100%;
}

.header-nav-link.has-menu.is-open .header-nav-chevron {
  transform: rotate(180deg);
}

/* --- PC：パネル --- */
/* .header は mix-blend-mode: difference。パネルはその外に fixed で置き、ヘッダー（79px）の5px下に出す */
.gmenu {
  position: fixed;
  top: 84px;
  left: 50%;
  z-index: 101;
  box-sizing: border-box;
  width: min(1120px, calc(100% - 40px));
  margin: 0;
  padding: 28px 32px 32px;
  background: #fff;
  border: 1px solid #e5e7e6;
  box-shadow: 0 16px 40px rgba(26, 26, 26, 0.1);
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  text-align: left;
  color: #1a1a1a;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
}

.gmenu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

/* ナビからパネルへマウスを運ぶあいだに閉じないよう、パネルの上に当たり判定を足す */
.gmenu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -24px;
  height: 24px;
}

.gmenu *,
.gmenu *::before,
.gmenu *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

.gmenu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid #e5e7e6;
}

.gmenu-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.gmenu-label::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #b09253;
}

.gmenu a.gmenu-all {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  color: #b09253;
  letter-spacing: 0.04em;
}

.gmenu-arrow {
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid #b09253;
  border-radius: 50%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b09253' stroke-width='1.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 12h10M13 8l4 4-4 4'/%3E%3C/svg%3E") center / 24px 24px no-repeat;
  /* 枠線の分だけ絵が内側にずれるので戻す */
  background-origin: border-box;
  transition: background-color 0.2s ease;
}

.gmenu-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 20px;
  list-style: none;
}

.gmenu-grid > li {
  display: flex;
}

.gmenu a.gmenu-item {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  transition: background-color 0.2s ease;
}

.gmenu a.gmenu-item:hover,
.gmenu a.gmenu-item:focus-visible,
.gmenu a.gmenu-item.is-cta {
  background: #f5f5f2;
}

.gmenu a.gmenu-item.is-cta {
  justify-content: space-between;
}

.gmenu a.gmenu-item.is-cta:hover,
.gmenu a.gmenu-item.is-cta:focus-visible {
  background: #eeeee9;
}

.gmenu-name {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.6;
  color: #1a1a1a;
  letter-spacing: 0.04em;
}

/* Oract はロゴで出す。文字の行（32px）と同じ高さの中で上下中央に置く */
.gmenu-name.has-logo {
  align-items: center;
  height: 32px;
}

.gmenu img.gmenu-logo {
  display: block;
  width: 96px;
  height: 26.4px;
}

.gmenu-en {
  font-family: "Futura", "Poppins", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.08em;
  color: #b09253;
}

.gmenu-sub {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  color: #b09253;
  letter-spacing: 0.04em;
}

.gmenu-desc {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  color: #5a5a5a;
  letter-spacing: 0.04em;
}

.gmenu-cta-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.6;
  color: #b09253;
  letter-spacing: 0.04em;
}

/* 幅1100px未満では3列だと説明文（最長291px）が折り返すので、2列にして1行を保つ。
   診断の枠は1つだけ下の段に余るので、横いっぱいに広げる */
@media (max-width: 1099px) {
  .gmenu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gmenu-grid > li:has(> .is-cta) {
    grid-column: 1 / -1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gmenu,
  .header-nav-link.has-menu .header-nav-chevron {
    transition: none;
  }
}

/* --- SP：メニュー内の開閉 --- */
.mobile-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0;
  border: 0;
  background: none;
  font-family: "Futura", "Poppins", sans-serif;
  font-weight: 500;
  font-size: clamp(0.9562rem, 1.26vw, 1.125rem);
  line-height: 1.5;
  color: #333;
  text-align: left;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* ＋／− は線2本。開くと縦線を消して − にする */
.mobile-menu-toggle-icon {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
}

.mobile-menu-toggle-icon::before,
.mobile-menu-toggle-icon::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 50%;
  width: 12px;
  height: 1.5px;
  margin-top: -0.75px;
  border-radius: 1px;
  background: #333;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-menu-toggle-icon::after {
  transform: rotate(90deg);
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle-icon::after {
  transform: rotate(0deg);
  opacity: 0;
}

.mobile-menu-sub {
  margin: 0;
  padding: 0 0 12px 16px;
  list-style: none;
}

.mobile-menu-sub[hidden] {
  display: none;
}

/* lp.css の「.lp-page a { color: inherit }」に負けないよう、パネルから指定する */
.mobile-menu-panel .mobile-menu-sublink {
  display: block;
  padding: 9px 0;
  font-family: "Zen Kaku Gothic New", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
  letter-spacing: 0.04em;
  color: #5a5a5a;
  text-decoration: none;
}

.mobile-menu-panel .mobile-menu-sublink.is-all {
  font-weight: 500;
  color: #b09253;
}

@media (max-width: 768px) {
  /* パネルはPC専用。SP ではメニュー内の開閉に切り替える */
  .gmenu {
    display: none;
  }

  /* 配下ページ名が入るので、メニューの幅を広げて区切り線で並べる（Figma は 375 幅・左右 20px） */
  .mobile-menu-panel {
    width: 100%;
    max-width: 375px;
    padding: 72px 20px 32px;
  }

  .mobile-menu-list {
    gap: 0;
  }

  .mobile-menu-list > li {
    border-bottom: 1px solid #e5e7e6;
  }

  .mobile-menu-link,
  .mobile-menu-toggle {
    padding: 14px 0;
    font-size: 18px;
    line-height: 1.5;
  }
}

@media (max-width: 480px) {
  .mobile-menu-panel {
    width: 100%;
    max-width: none;
  }
}
