/* =========================================================
   JP Global Nav (Figma PC_A / SP)
   ========================================================= */
.gnav {
  --gnav-red: #d70c1a;
  --gnav-black: #000;
  --gnav-gray: #999;
  --gnav-muted: #727272;
  --gnav-line: #cfcfcf;
  --gnav-sep: #979797;
  --gnav-panel: #f5f5f5;
  --gnav-font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Helvetica Neue", Meiryo, sans-serif;
  position: sticky;
  top: 0;
  z-index: 1000;
  font-family: var(--gnav-font);
  color: var(--gnav-black);
  background: #fff;
}

.gnav *,
.gnav *::before,
.gnav *::after {
  box-sizing: border-box;
}

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

.gnav button {
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

/* ---------- PC bar (Figma: 1440×96) ---------- */
.gnav__bar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  width: 100%;
  padding-right: 40px;
  background: #fff;
  overflow: visible;
}

.gnav__logo {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 28px 40px;
  background: var(--gnav-red);
  line-height: 0;
}

.gnav__logo-img {
  display: block;
  object-fit: contain;
}

.gnav__logo-img--pc {
  width: 320px;
  height: 40px;
}

.gnav__logo-img--sp {
  display: none;
}

.gnav__pc {
  display: flex;
  flex: 0 1 auto;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  margin-left: auto;
  margin-right: 40px;
}

.gnav__list {
  display: flex;
  align-items: stretch;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gnav__sep {
  flex: 0 0 auto;
  align-self: center;
  width: 1px;
  height: 18px;
  background: var(--gnav-sep);
  list-style: none;
}

.gnav__item {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.gnav button.gnav__trigger,
.gnav .gnav__label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #000;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 15px;
  font-style: normal;
  font-weight: 600;
  line-height: 100%; /* 15px */
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.gnav .gnav__item.is-disabled .gnav__label {
  color: #999;
  cursor: default;
  pointer-events: none;
}

/* Active underline (Figma open state) — ヘッダー下端寄り */
.gnav__item.has-dropdown.is-open > .gnav__trigger::after,
.gnav__item.has-dropdown:hover > .gnav__trigger::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -10px;
  height: 2px;
  background: var(--gnav-red);
}

/* ---------- Dropdown (speech bubble) ---------- */
/* アイテムをヘッダー高さまで伸ばしているので top:100% = ヘッダー下端 */
.gnav__dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  width: 206px;
  margin-left: -103px; /* 幅の半分：先端を文言中央に合わせる */
  padding-top: 8px;
  z-index: 30;
  background: transparent;
  border: 0;
  transform: none;
}

.gnav__item.has-dropdown.is-open > .gnav__dropdown,
.gnav__item.has-dropdown:hover > .gnav__dropdown {
  display: block;
}

.gnav__dropdown ul {
  position: relative;
  margin: 0;
  padding: 28px 20px 24px;
  list-style: none;
  background: #fff;
  border: 1px solid #000;
  border-radius: 8px;
}

/* 吹き出しの先端（パネル上辺中央） */
.gnav__dropdown ul::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  background: #fff;
  border-left: 1px solid #000;
  border-top: 1px solid #000;
  transform: rotate(45deg);
}

.gnav__dropdown li + li {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--gnav-line);
}

.gnav__dropdown a,
.gnav__dropdown span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.28px;
  line-height: normal;
  white-space: nowrap;
  color: var(--gnav-black);
}

.gnav__dropdown a:hover {
  color: var(--gnav-red);
}

.gnav__dropdown .is-disabled span {
  color: var(--gnav-gray);
  cursor: default;
}

.gnav__dropdown .is-disabled .gnav__arrow {
  opacity: 0.35;
}

.gnav__arrow {
  display: block;
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

/* ---------- SNS (PC) ---------- */
.gnav__sns--pc {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  align-self: center;
  gap: 12px;
}

.gnav__sns--pc a {
  display: block;
  line-height: 0;
}

.gnav__sns--pc img {
  display: block;
  width: 16px;
  height: 16px;
}

.gnav__hamburger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4.5px;
  margin: 0;
  padding: 4px;
  width: 40px;
  height: 40px;
  color: #fff;
  background: transparent;
  border-radius: 2px;
  box-sizing: border-box;
}

.gnav__hamburger-icon {
  display: none;
  width: 28px;
  height: 8px;
  line-height: 0;
}

.gnav__hamburger-icon img {
  display: block;
  width: 28px;
  height: 7.9px;
  object-fit: contain;
}

.gnav__hamburger-icon--open {
  display: block;
}

.gnav.is-drawer-open .gnav__hamburger-icon--open {
  display: none;
}

.gnav.is-drawer-open .gnav__hamburger-icon--close {
  display: block;
}

.gnav.is-drawer-open .gnav__hamburger-icon--close img {
  width: 27px;
  height: 9px;
}

.gnav__hamburger-text {
  font-family: Roboto, "Noto Sans JP", sans-serif;
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.63px;
  color: #fff;
}

.gnav__drawer,
.gnav__overlay {
  display: none;
}

.gnav__drawer-lang {
  display: none;
}

/* Narrow PC: shrink logo so menu + SNS keep breathing room (≈1440→1025) */
@media screen and (max-width: 1420px) {
  .gnav__bar {
    padding-right: 28px;
  }

  .gnav__logo {
    padding: 22px 28px;
  }

  .gnav__logo-img--pc {
    width: 260px;
    height: 32.5px;
  }

  .gnav__pc {
    margin-right: 28px;
    margin-left: 16px;
  }

  .gnav__list {
    gap: 16px;
  }
}

@media screen and (max-width: 1280px) {
  .gnav__bar {
    padding-right: 20px;
  }

  .gnav__logo {
    padding: 18px 20px;
  }

  .gnav__logo-img--pc {
    width: 210px;
    height: 26px;
  }

  .gnav__pc {
    margin-right: 16px;
    margin-left: 12px;
  }

  .gnav__list {
    gap: 12px;
  }

  .gnav__sns--pc {
    gap: 10px;
  }
}

@media screen and (max-width: 1160px) {
  .gnav__logo {
    padding: 16px 16px;
  }

  .gnav__logo-img--pc {
    width: 180px;
    height: 22.5px;
  }

  .gnav__pc {
    margin-right: 12px;
    margin-left: 8px;
  }

  .gnav__list {
    gap: 10px;
  }

  .gnav button.gnav__trigger,
  .gnav .gnav__label {
    font-size: 13px;
    letter-spacing: 0.2px;
  }
}

/* ---------- SP Header (Figma 434:316) ---------- */
@media screen and (max-width: 1024px) {
  .gnav__bar {
    position: relative;
    min-height: 54px;
    padding: 16px 20px;
    background: #d70c1a;
    justify-content: center;
    align-items: center;
  }

  .gnav__logo {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding: 0;
    background: transparent;
    line-height: 0;
  }

  .gnav__logo-img--pc {
    display: none;
  }

  .gnav__logo-img--sp {
    display: block;
    width: 176.471px;
    height: 22.279px;
  }

  .gnav__pc,
  .gnav__sns--pc {
    display: none;
  }

  .gnav__hamburger {
    display: flex;
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    z-index: 2;
  }

  .gnav__overlay {
    display: none;
    position: fixed;
    inset: 54px 0 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 998;
  }

  .gnav.is-drawer-open .gnav__overlay {
    display: block;
  }

  /* 右パネル 300px・高さはコンテンツ次第（Figma 434:690） */
  .gnav__drawer {
    display: none;
    position: fixed;
    top: 54px;
    right: 0;
    left: auto;
    bottom: auto;
    width: 300px;
    max-width: 85vw;
    max-height: calc(100vh - 54px);
    max-height: calc(100dvh - 54px);
    height: auto;
    background: #fff;
    z-index: 999;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  }

  .gnav.is-drawer-open .gnav__drawer {
    display: block;
  }

  .gnav__drawer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    height: auto;
    min-height: 0;
    padding: 24px 32px;
    box-sizing: border-box;
  }

  .gnav__accordion {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .gnav__acc-item {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .gnav__acc-trigger,
  .gnav__acc-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 0;
    color: #000;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 14px;
    font-style: normal;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.28px;
    text-align: left;
  }

  .gnav__acc-text {
    flex: 1 1 auto;
    min-width: 0;
  }

  /* 閉じ: 右 / 開き: 上（右向きSVGを -90deg）— Figma 434:382 */
  .gnav__acc-arrow {
    display: block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    transform: rotate(0deg);
    transform-origin: center center;
    transition: transform 0.2s ease;
  }

  /* 右向き → 反時計90度 = 上向き */
  .gnav__acc-item.is-open > .gnav__acc-trigger .gnav__acc-arrow {
    transform: rotate(-90deg);
  }

  .gnav__acc-line {
    display: block;
    width: 100%;
    height: 0;
    margin-top: 12px;
    border-top: 1px solid #000;
  }

  /* PCの is-disabled 親と同じ：グレー・非操作（開閉矢印なし） */
  .gnav__acc-item--static .gnav__acc-label,
  .gnav__acc-item.is-disabled .gnav__acc-label {
    color: #999;
    cursor: default;
    pointer-events: none;
  }

  .gnav__acc-item.is-disabled > .gnav__acc-line,
  .gnav__acc-item--static > .gnav__acc-line {
    border-top-color: #ccc;
  }

  .gnav__acc-panel {
    display: none;
    width: 100%;
    margin: 8px 0 0;
    padding: 0 0 0 16px;
    list-style: none;
    background: transparent;
  }

  .gnav__acc-item.is-open > .gnav__acc-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .gnav__acc-panel li {
    border-top: 1px solid #e5e5e5;
  }

  .gnav__acc-panel li:first-child {
    border-top: 0;
  }

  .gnav__acc-panel a,
  .gnav__acc-panel .gnav__acc-nolink {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 0;
    color: #000;
    font-family: "Noto Sans JP", sans-serif;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.26px;
    line-height: 1.4;
  }

  .gnav__acc-panel a:hover {
    color: var(--gnav-red);
  }

  .gnav__acc-panel .gnav__acc-nolink {
    cursor: default;
  }

  .gnav__acc-panel .gnav__arrow {
    display: block;
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
  }

  .gnav__drawer-sns {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-top: 0;
    padding: 0;
  }

  .gnav__drawer-sns img {
    display: block;
    width: 18px;
    height: 18px;
    object-fit: contain;
  }

  .gnav__drawer-lang {
    display: none;
  }

  body.gnav-lock {
    overflow: hidden;
  }
}

@media screen and (max-width: 480px) {
  .gnav__logo-img--sp {
    width: 160px;
    height: auto;
  }
}

/* ---------- Chat FAB (Figma 434:65) ---------- */
.chat-fab {
  position: fixed;
  right: 40px;
  bottom: 40px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 24px;
  background: #005bd2;
  border: 2px solid #fff;
  border-radius: 999px;
  box-sizing: border-box;
  color: #fff;
  font-family: "Noto Sans JP", sans-serif;
  font-size: 16px;
  font-style: normal;
  font-weight: 600;
  line-height: 26px;
  letter-spacing: 0.16px;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-fab:hover {
  opacity: 0.92;
  color: #fff;
  text-decoration: none;
}

.chat-fab__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  line-height: 0;
}

.chat-fab__icon img {
  display: block;
  width: 21.5px;
  height: 20.5px;
}

.chat-fab__label {
  display: inline-block;
}

/* SP Chat FAB (Figma 434:745) */
@media screen and (max-width: 1024px) {
  .chat-fab {
    right: 19px;
    bottom: 19px;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    line-height: 26px;
    letter-spacing: 0.14px;
  }

  .chat-fab__icon {
    width: 20px;
    height: 20px;
  }

  .chat-fab__icon img {
    width: 18px;
    height: 17px;
  }
}

/* Hide / neutralize legacy header pieces when new gnav is present */
body.has-gnav #header {
  background: transparent;
  min-width: 0;
  width: 100%;
  overflow: visible;
}

body.has-gnav #header > h1,
body.has-gnav #header .c_language,
body.has-gnav #sp_h,
body.has-gnav .hamburger-menu,
body.has-gnav #sidebarMenu,
body.has-gnav #footer_fixed_box,
body.has-gnav #top_menu,
body.has-gnav .top_language {
  display: none !important;
}
