
#gnav{
  flex: 1;
  margin: 0;
}

#gnav ul {
  position: relative;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

/* 項目の間隔は画面幅に合わせて縮める（広い画面で60px、狭くなると最小18px） */
#gnav li{
  --nav-gap: clamp(18px, 3.4vw, 60px);
  position: relative;
  padding-left: var(--nav-gap);
}

#gnav li a{
  position: relative;
  display: block;
  white-space: nowrap;   /* 項目の途中で改行させない */
  color: #fff;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  letter-spacing: .1em;
  text-shadow: 0 0 6px rgba(0,0,0,0.15);
  transition: opacity .3s ease;
}

#gnav > div > ul > li > a:hover{
  opacity: .7;
}

#header.m_fixed #gnav li a{
  text-shadow: none;
}

#gnav li.contact{
  padding-left: clamp(16px, 2.8vw, 50px);
}

#header.m_fixed #gnav li a{
  color: #766a58;
}

/* ヘッダーのご予約はテーマで出すので、メニューに「ご予約」があってもPCでは二重に出さない */
#gnav li.contact{
  display: none;
}

/* ご予約ボタンの見た目は style.css「ご予約ボタン」で共通化 */
#gnav li.contact a:hover{
  opacity: 1;
}

#gnav :is(.menu-item-has-children, .page_item_has_children) {

}

/* 親項目のホバー・現在地：色は変えず、文字の下に細い線がすっと伸びる */
#gnav > div > ul > li > a::after{
  content: '';
  position: absolute;
  left: 0;
  bottom: -6px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform .4s cubic-bezier(.22, .61, .36, 1);
}

#gnav > div > ul > li > a:hover::after,
#gnav > div > ul > li:hover > a::after,
#gnav > div > ul > li.current-menu-item > a::after,
#gnav > div > ul > li.current_page_item > a::after,
#gnav > div > ul > li.current-menu-ancestor > a::after,
#gnav > div > ul > li.current_page_ancestor > a::after{
  transform: scaleX(1);
  transform-origin: left;
}

#gnav > div > ul > li > a:hover{
  opacity: 1;
}

#gnav ul li.contact a:hover,
#gnav ul li.contact.current-menu-item a {
  color: #fff!important;
}

#gnav li.contact a::after{
  display: none;
}

/* ---------- サブメニュー ----------
 * 生成りの半透明パネル（写真の上ではすりガラス）に、上向きの小さな三角。
 * 項目は左の短い線が、ホバーで伸びて文字が少し右へ */
#gnav :is(.sub-menu, .children) {
  display: block;            /* #gnav ul の横並びを打ち消す */
  position: absolute;
  top: 100%;
  left: calc(50% + var(--nav-gap, 0px) / 2);   /* 親項目の文字の中央（liの左余白を除いた中央） */
  width: max-content;
  min-width: 190px;
  margin-top: 20px;
  padding: 14px 0;
  background: rgba(252, 250, 246, .9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-radius: 10px;
  box-shadow: 0 14px 34px -14px rgba(60, 50, 38, .35);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 8px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.22, .61, .36, 1), visibility .35s;
  z-index: 5;
}

/* 親項目の文字の中央から出る三角 */
#gnav :is(.sub-menu, .children)::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 100%;
  margin-left: -7px;
  border: 7px solid transparent;
  border-bottom-color: rgba(252, 250, 246, .9);
}

/* 親項目とサブメニューの間でマウスが外れないよう、すき間を当たり判定で埋める */
#gnav :is(.sub-menu, .children)::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 22px;
}

#header.m_fixed #gnav :is(.sub-menu, .children){
  background: #fff;
  box-shadow: 0 14px 34px -14px rgba(60, 50, 38, .3), 0 0 0 1px #ece7df;
}

#header.m_fixed #gnav :is(.sub-menu, .children)::after{
  border-bottom-color: #fff;
}

#gnav :is(.sub-menu, .children) li,
#gnav :is(.sub-menu, .children) li:last-child{
  display: block;
  padding: 0;
  text-align: left;
  /* ホバーで開いた時に上から順にふわっと */
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .35s ease, transform .35s ease;
}

#gnav :is(.menu-item-has-children, .page_item_has_children):is(:hover, :focus-within) :is(.sub-menu, .children) li{
  opacity: 1;
  transform: none;
}

#gnav :is(.sub-menu, .children) li:nth-child(1) { transition-delay: .05s; }
#gnav :is(.sub-menu, .children) li:nth-child(2) { transition-delay: .1s; }
#gnav :is(.sub-menu, .children) li:nth-child(3) { transition-delay: .15s; }
#gnav :is(.sub-menu, .children) li:nth-child(4) { transition-delay: .2s; }
#gnav :is(.sub-menu, .children) li:nth-child(5) { transition-delay: .25s; }
#gnav :is(.sub-menu, .children) li:nth-child(6) { transition-delay: .3s; }

#gnav :is(.sub-menu, .children) li a,
#header.m_fixed #gnav :is(.sub-menu, .children) li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 30px 8px 24px;
  font-size: 14px;
  line-height: 24px;
  letter-spacing: .12em;
  color: #6c6151;
  text-shadow: none;
  transition: color .3s ease, background-color .3s ease;
}

#gnav :is(.sub-menu, .children) li a::before {
  content: '';
  display: block;
  flex-shrink: 0;
  width: 8px;
  height: 1px;
  background: #b9ad9b;
  transition: width .35s cubic-bezier(.22, .61, .36, 1), background-color .3s ease;
}

#gnav :is(.sub-menu, .children) li a:hover,
#gnav :is(.sub-menu, .children) li.current-menu-item a,
#gnav :is(.sub-menu, .children) li.current_page_item a {
  color: #4a4237;
  background: rgba(146, 133, 114, .08);
}

#gnav :is(.sub-menu, .children) li a:hover::before,
#gnav :is(.sub-menu, .children) li.current-menu-item a::before,
#gnav :is(.sub-menu, .children) li.current_page_item a::before {
  width: 18px;
  background: #928572;
}

#gnav :is(.menu-item-has-children, .page_item_has_children):hover :is(.sub-menu, .children),
#gnav :is(.menu-item-has-children, .page_item_has_children):focus-within :is(.sub-menu, .children) {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

#spnav, .menu-trigger, .overlay, .overlay.open {
  display: none;
}

@media screen and (max-width: 1080px) {
#gnav ul li a{
  font-size: 15px;
}
}

@media screen and (max-width: 1000px) {
  #gnav { display: none; }
  .menu-trigger {
    cursor: pointer;
    display: block;
    position: fixed;
    right: 10px;
    top: 7px;
    padding: 8px 8px 2px;
    z-index: 1000;
  }
  .menu-trigger span {
    background-color: #fff;
    display: block;
    height: 2px;
    margin-bottom: 6px;
    transition: transform 0.3s ease-in-out, background-color 0.3s ease;
    width: 24px;
  }
   .menu-trigger.active {
    background: rgba(255,255,255,0);
  }
  .menu-trigger.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }
  .menu-trigger.active span:nth-child(2) {
    opacity: 0;
  }
  .menu-trigger.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }
  .menu-trigger.active span { background-color: #fff; }

  /* スクロールでヘッダーが白背景（m_fixed）になったら、線をロゴと同じ色に。開いている時は白のまま */
  header:has(#header.m_fixed) ~ .menu-trigger span { background-color: #665d50; }
  header:has(#header.m_fixed) ~ .menu-trigger.active span { background-color: #fff; }

  /* HERO上はページの余白（--frame）の分だけ内側に。固定ヘッダーになったら元の位置 */
  .menu-trigger {
    top: calc(var(--frame) + 13px);
    right: calc(var(--frame) + 10px);
    transition: top .3s ease, right .3s ease;
  }
  header:has(#header.m_fixed) ~ .menu-trigger,
  .menu-trigger.active {
    top: 7px;
    right: 10px;
  }

  /* ---------- スマホメニュー本体 ---------- */
  #spnav {
    background-color: rgba(74, 66, 55, .97);
    display: block;
    overflow: auto;
    height: 100%;
    padding: 80px 0 40px;
    position: fixed;
    right: -85%;
    top: 0;
    transition: right .35s ease-in-out;
    width: 85%;
    max-width: 420px;
    z-index: 999;
  }
  #spnav.open { right: 0; }
  #spnav ul {
    list-style-type: none;
    padding: 0;
    width: 86%;
    margin: 0 auto;
  }
  #spnav > div > ul > li {
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, .15);
  }
  #spnav li a {
    color: #ffffff;
    display: block;
    padding: 18px 48px 18px 4px;
    position: relative;
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    letter-spacing: .12em;
  }

  /* メニューの「ご予約」は下のボタンで出すので重複させない */
  #spnav li.contact { display: none; }

  /* ---------- 下層メニュー ---------- */
  #spnav :is(.sub-menu, .children) {
    display: none;
    width: 100%;
    margin: 0 0 14px;
    padding: 2px 0 2px 16px;
    border-left: 1px solid rgba(255, 255, 255, .35);
  }
  #spnav :is(.sub-menu, .children) li a {
    padding: 9px 0;
    font-size: 14px;
    color: #fff;
    letter-spacing: .1em;
    white-space: normal;
  }
  #spnav :is(.sub-menu, .children) li a::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 1px;
    margin: 0 10px 4px 0;
    background: currentColor;
    vertical-align: middle;
  }

  /* 開閉ボタン：丸の中に線で＋を描き、開くと縦線が消えて－になる
   * （common.js が入れる「＋／－」の文字は隠して、線で表示） */
  .toggle-icon {
    position: absolute;
    top: 16px;
    right: 0;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: 50%;
    font-size: 0;
    color: transparent;
    cursor: pointer;
    z-index: 2;
    transition: background-color .3s ease, border-color .3s ease;
  }
  .toggle-icon::before,
  .toggle-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 1px;
    margin: -.5px 0 0 -6px;
    background: #fff;
    transition: transform .3s ease, opacity .3s ease;
  }
  .toggle-icon::after {
    transform: rotate(90deg);
  }
  .toggle-icon.open {
    background: rgba(255, 255, 255, .15);
    border-color: rgba(255, 255, 255, .8);
  }
  .toggle-icon.open::after {
    transform: rotate(0deg);
    opacity: 0;
  }

  /* ---------- メニュー下のボタン（ご予約・お問い合わせ） ---------- */
  .sp_btns {
    display: grid;
    gap: 12px;
    width: 86%;
    margin: 32px auto 0;
  }
  .sp_btns .con_btn { display: block; }
  .sp_btns a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
  }
  .sp_contact a {
    gap: 8px;
    padding: 12px 20px;
    border: 1px solid rgba(255, 255, 255, .6);
    border-radius: 999px;
    color: #fff;
    font-size: 15px;
    letter-spacing: .15em;
    transition: background-color .3s ease;
  }
  .sp_contact a::before {
    content: '';
    width: 17px;
    height: 17px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='14' rx='2.5'/%3E%3Cpath d='M3.5 7l8.5 6 8.5-6'/%3E%3C/svg%3E") no-repeat center / contain;
  }
  .sp_contact a:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
  }
  
  .overlay {
    background-color: rgba(0, 0, 0, .2);
    display: none;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 998;
  }
  .overlay.open { display: block; }
}