/* ===== Serapia Global Navigation v1.0 ===== */

/* WordPress管理バー対応
   ※ LP テンプレートは body_class() 非使用のため body.admin-bar は付かない。
      WordPress が <html> に付与する wp-toolbar クラスで判定する。        */
html.wp-toolbar .sr-nav { top: 32px !important; }
@media screen and (max-width: 782px) {
  html.wp-toolbar .sr-nav { top: 46px !important; }
  html.wp-toolbar .sr-nav__menu {
    top: calc(64px + 46px) !important;
    max-height: calc(100vh - 64px - 46px) !important;
  }
}

/* Cocoon標準ヘッダーを非表示（sr-navで代替） */
#header,
.header-container,
.header-container-in,
.header-container-in.hlt-top-menu {
  display: none !important;
}

/* 既存ページ内インラインヘッダーを非表示 */
.serapia-lp .serapia-header { display: none !important; }

/* ----- ナビ本体 ----- */
.sr-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  background: rgba(250, 248, 244, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid #e6dfd2;
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", sans-serif;
  box-sizing: border-box;
}

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

.sr-nav__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

/* ----- ロゴ ----- */
.sr-nav__logo {
  text-decoration: none;
  flex-shrink: 0;
  line-height: 1.4;
}
.sr-nav__logo:hover { opacity: 0.8; }

.sr-nav__logo-main {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #4a3828;
  letter-spacing: 0.04em;
}
.sr-nav__logo-sub {
  display: block;
  font-size: 9px;
  font-weight: 500;
  color: #3a6b48;
  letter-spacing: 0.14em;
}

/* ----- メニュー全体 ----- */
.sr-nav__menu {
  display: flex;
  align-items: center;
}

.sr-nav__list {
  display: flex;
  align-items: center;
  list-style: none;
  gap: 0;
}

.sr-nav__list > li {
  position: relative;
}

/* ----- リンク & ドロップトグル共通 ----- */
.sr-nav__list > li > a,
.sr-nav__drop-toggle {
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 500;
  color: #4a3828;
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.18s, background 0.18s;
  line-height: 1;
}

.sr-nav__list > li > a:hover,
.sr-nav__drop-toggle:hover {
  color: #3a6b48;
  background: rgba(58, 107, 72, 0.07);
}

/* ----- 矢印 ----- */
.sr-nav__arrow {
  font-size: 9px;
  transition: transform 0.2s;
  display: inline-block;
  line-height: 1;
}
.sr-nav__has-drop.is-open .sr-nav__arrow {
  transform: rotate(180deg);
}

/* ----- ドロップダウン（PC） ----- */
.sr-nav__dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: #ffffff;
  border: 1px solid #e6dfd2;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(74, 56, 40, 0.13);
  padding: 10px;
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 6px;
  min-width: 360px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
  z-index: 100;
}

.sr-nav__has-drop.is-open .sr-nav__dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.sr-nav__dropdown li {
  list-style: none;
}

.sr-nav__dropdown li a {
  display: block;
  padding: 8px 12px;
  font-size: 12.5px;
  color: #2e2418;
  text-decoration: none;
  border-radius: 4px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.sr-nav__dropdown li a:hover {
  color: #3a6b48;
  background: rgba(58, 107, 72, 0.07);
}

/* ----- LINE相談ボタン ----- */
.sr-nav__line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
  padding: 9px 16px;
  background: #06c755;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.18s, transform 0.18s;
  line-height: 1;
}
.sr-nav__line:hover {
  background: #05b34a;
  color: #ffffff;
  transform: translateY(-1px);
}
.sr-nav__line svg {
  flex-shrink: 0;
}

/* ----- ハンバーガーボタン ----- */
.sr-nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.sr-nav__burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: #4a3828;
  border-radius: 2px;
  transition: all 0.22s;
  transform-origin: center;
  flex-shrink: 0;
}
.sr-nav__burger.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.sr-nav__burger.is-open span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.sr-nav__burger.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ===== スマートフォン（〜768px） ===== */
@media (max-width: 768px) {

  /* ナビ内側：ロゴ左 / ハンバーガー右 を明示 */
  .sr-nav__inner {
    padding: 0 16px;
    justify-content: space-between;
  }

  /* ハンバーガー：外部CSSに負けないよう !important で強制表示 */
  .sr-nav .sr-nav__burger {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    order: 2;
    margin-left: auto;
  }

  /* PC用メニューはスマホで非表示（opened時のみ表示） */
  .sr-nav .sr-nav__menu {
    display: none !important;
    position: fixed;
    top: 64px;
    left: 0; right: 0;
    z-index: 9999;
    background: #faf8f4;
    border-bottom: 1px solid #e6dfd2;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 24px;
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 8px 24px rgba(74, 56, 40, 0.1);
    -webkit-overflow-scrolling: touch;
  }
  /* 開いたとき */
  .sr-nav .sr-nav__menu.is-open {
    display: flex !important;
  }

  .sr-nav__list {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .sr-nav__list > li { width: 100%; }

  .sr-nav__list > li > a,
  .sr-nav__drop-toggle {
    width: 100%;
    padding: 13px 14px;
    font-size: 15px;
    border-radius: 6px;
    justify-content: space-between;
  }

  /* SP: アコーディオン型ドロップダウン */
  .sr-nav__dropdown {
    position: static;
    transform: none !important;
    opacity: 1;
    pointer-events: none;
    display: none;
    grid-template-columns: 1fr 1fr;
    box-shadow: none;
    border: none;
    background: #f2ede4;
    border-radius: 6px;
    padding: 6px 8px;
    margin: 4px 0 6px 8px;
    min-width: unset;
    width: calc(100% - 8px);
  }
  .sr-nav__has-drop.is-open .sr-nav__dropdown {
    display: grid;
    pointer-events: auto;
  }
  .sr-nav__dropdown li a {
    padding: 10px 14px;
    font-size: 13px;
    white-space: normal;
  }

  /* LINE相談ボタン */
  .sr-nav__line {
    margin: 14px 0 0;
    justify-content: center;
    padding: 15px;
    font-size: 15px;
    border-radius: 8px;
  }
}

/* ===== タブレット調整（769px〜1024px） ===== */
@media (min-width: 769px) and (max-width: 1024px) {
  .sr-nav__list > li > a,
  .sr-nav__drop-toggle {
    padding: 8px 8px;
    font-size: 12px;
  }
  .sr-nav__line {
    padding: 9px 12px;
    font-size: 12px;
    margin-left: 8px;
  }
}
