﻿/* =========================
   Header / Global Nav (final)
   前提HTML:
   <div class="header_inner">
     .logo
     <nav class="nav"> <?php wp_nav_menu(container=false, menu_class='menu'); ?> </nav>
     <button class="hamburger">...</button>
   </div>
   ========================= */

#header{
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999999;
  background-color: #fff;
}

/* -------------------------
   Header layout
   ------------------------- */
#header .header_inner{
  width: calc(100% - 40px);
  height: 90px;
  margin: 0 auto;
  padding: 14px 20px;

  display: grid;
  grid-template-columns: auto 1fr auto; /* ロゴ / ナビ / ハンバーガー */
  align-items: center;
  column-gap: 20px;
}

#header .header_inner .logo{
  width: 230px;
}

/* -------------------------
   Hamburger button
   ------------------------- */
#header .header_inner .hamburger{
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  background: #2f2d32;
  position: relative;

  border: 0;
  padding: 0;
}

/* 3本線 */
#header .header_inner .hamburger__patty{
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  height: 2px;
  width: 50%;
  background: #f7f7f7;
  transition: all 0.8s cubic-bezier(0.86, 0, 0.07, 1);
}

#header .header_inner .hamburger__patty:nth-child(1){
  transform: translate(-50%, calc(-50% - 8px));
}
#header .header_inner .hamburger__patty:nth-child(3){
  transform: translate(-50%, calc(-50% + 8px));
}

/* 開いたら× */
#header .header_inner .hamburger.active .hamburger__patty{
  background: #c37a07; /* ←お好みの色（元は #ff6d00） */
}
#header .header_inner .hamburger.active .hamburger__patty:nth-child(1){
  transform: translate(-50%, -50%) rotate(45deg);
}
#header .header_inner .hamburger.active .hamburger__patty:nth-child(2){
  opacity: 0;
}
#header .header_inner .hamburger.active .hamburger__patty:nth-child(3){
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* -------------------------
   PC Global Nav
   ------------------------- */
#header .nav{
  display: block;
}

#header .nav > .menu{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

#header .nav > .menu > li{
  font-size: 1.6rem;
}

#header .nav > .menu > li:not(:last-child){
  margin-right: 1.75em;
}

#header .nav > .menu > li > a{
  font-weight: 500;
  letter-spacing: 0.1em;
  position: relative;
}

#header .nav > .menu > li > a::before{
  content: "";
  display: block;
  height: 2px;
  background-color: #3e5113;
  position: absolute;
  left: 50%;
  bottom: -0.5em;
  transform: translateX(-50%);
  transition: 0.3s;
  width: 0;
}

#header .nav > .menu > li > a:hover::before{
  width: 100%;
}

/* PC: ドロップダウン（あなたの既存仕様を残す） */
#header .nav > .menu > li > ul{
  position: absolute;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  transition: 0.66s;
  width: 100%;
  padding: 150px 30px 90px;
  top: 0;
  left: 0;
  background-color: #000333;
  display: grid;
  align-items: start;
  justify-content: center;
}

#header .nav > .menu > li > ul.active{
  opacity: 1;
  pointer-events: all;
}

#header .nav > .menu > li > ul > li{
  display: grid;
  grid-template-columns: auto 1fr;
  grid-gap: 30px;
}

#header .nav > .menu > li > ul > li > a{
  font-size: 1.33em;
  pointer-events: none;
  margin-left: 30px;
}

#header .nav > .menu > li > ul > li > ul{
  display: flex;
  flex-wrap: wrap;
}

#header .nav > .menu > li > ul > li > ul > li{
  margin: 0 30px 45px;
}

#header .nav > .menu > li > ul > li > ul > li > a{
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: space-between;
  grid-column-gap: 0.66em;
  padding: 0 0.5em 0.75em;
  border-bottom: 1px solid #ffffff;
  font-size: 1.1em;
  color: #fff;
}

#header .nav > .menu > li > ul > li > ul > li > a::after{
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-top: 2px solid #ffffff;
  border-right: 2px solid #ffffff;
  transform-origin: center center;
  transform: rotate(45deg);
}

#header .nav > .menu > li > ul > li > ul > li ul{
  padding-top: 0.25em;
}

#header .nav > .menu > li > ul > li > ul > li ul > li{
  margin-top: 1em;
  padding-left: 0.5em;
}

#header .nav > .menu > li > ul > li > ul > li ul > li > a{
  display: grid;
  grid-template-columns: repeat(2, auto);
  grid-column-gap: 0.25em;
  align-items: center;
  justify-content: start;
  color: #fff;
}

#header .nav > .menu > li > ul > li > ul > li ul > li > a::before{
  content: "-";
}

/* PC: 幅が狭いときの微調整 */
@media screen and (max-width:1200px){
  #header .nav > .menu > li:not(:last-child){
    margin-right: 1.25em;
  }
  #header .nav > .menu > li > ul > li{
    max-width: 850px;
  }
}

/* -------------------------
   SP (<=1024): Off-canvas menu
   ------------------------- */
@media screen and (max-width:1024px){

  /* SP: ヘッダーは「ロゴ / ボタン」で安定 */
  #header .header_inner{
    grid-template-columns: auto auto;
    column-gap: 12px;
  }

  #header .header_inner .logo{
    width: auto;
    max-width: min(230px, 60vw);
  }

  /* SP: ナビは固定ドロワー */
  #header .nav{
    display: flex;
    flex-flow: column nowrap;
    justify-content: flex-start;

    position: fixed;
    top: 0;
    right: 0;
    width: 350px;
    height: 100%;
    background: #2f2d32;

    clip-path: circle(0 at calc(350px - 5vw - 30px) calc(1vh + 30px));
    transition: all 0.8s cubic-bezier(0.86, 0, 0.07, 1);

    padding: 120px 20px 30px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    z-index: 1000000; /* ボタンより下 */
  }

  #header .nav.active{
    clip-path: circle(75% at 175px 50vh);
  }

  /* SP: WPメニューリンク表示（nav__linkは使わない） */
  #header .nav .menu{
    display: grid;
    gap: 14px;
  }

  #header .nav .menu a{
    display: block;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -1px;
    text-align: right;
    padding: 1vh 5vw;
    color: #efebe9;
    text-decoration: none;

    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
  }

  #header .nav.active .menu a{
    opacity: 1;
    transform: translateY(0);
  }

  /* ★開いた後も×を押せるように右上固定 */
  #header .header_inner .hamburger{
    position: fixed;
    top: 15px;
    right: 20px;
    z-index: 1000001;
    justify-self: end;
  }
}

/* -------------------------
   PC (>=1025): hide hamburger
   ------------------------- */
@media screen and (min-width:1025px){
  #header .header_inner .hamburger{
    display: none;
  }
}