/* ===== 共通ヘッダー（Figma: 不動産サービスサイト / Header）=====
   PC（1280px〜）: 白ピル型グローバルナビ ＋ ドロップダウン
   SP（〜1279px）: ハンバーガー ＋ 全画面メニュー
   マークアップは assets/js/header.js が生成する。 */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 1.5rem 1.25rem;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(11.65px);
  -webkit-backdrop-filter: blur(11.65px);
}
@media (min-width: 768px) {
  .site-header { padding: 1.5rem 3rem; }
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-family);
}

.site-header-logo { flex: 0 0 auto; width: 100%; max-width: 8rem; }
@media (min-width: 768px) {
  .site-header-logo { max-width: 11rem; }
}
.site-header-logo a { display: block; }
.site-header-logo img { display: block; width: 100%; }

.site-header-right { display: flex; align-items: center; gap: 1rem; }

/* ===== PC グローバルナビ ===== */

.gnav { display: none; }
@media (min-width: 1280px) {
  .gnav { display: block; }
}

.gnav-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 0;
  padding: 1rem 2rem;
  list-style: none;
  background: #fff;
  border-radius: 80px;
}

.gnav-item { position: relative; }

.gnav-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.1504px;
  color: var(--txt-base);
  white-space: nowrap;
  cursor: pointer;
}

.gnav-link .ic {
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  background: url(../img/plus-t.svg) center / 0.75rem no-repeat;
  transition: transform 0.25s ease;
}
/* 開いている間は ＋ を × に倒して状態を示す */
.gnav-item.open > .gnav-link .ic { transform: rotate(45deg); }

/* ドロップダウン */
.gnav-panel {
  position: absolute;
  top: calc(100% + 1.875rem);
  left: -1.25rem;
  min-width: max-content;
  margin: 0;
  padding: 1.25rem;
  list-style: none;
  background: #fff;
  border-radius: 1rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.5rem);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  transition-delay: 0.1s;
}
.gnav-item.open > .gnav-panel {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.gnav-panel a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.375rem 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.1504px;
  color: var(--txt-base);
  white-space: nowrap;
}
.gnav-panel a::after {
  content: "";
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  background: url(../img/arrow-r-t.svg) center / 0.75rem no-repeat;
  transition: transform 0.2s ease;
}
.gnav-panel a:hover { opacity: 0.7; }
.gnav-panel a:hover::after { transform: translateX(0.25rem); }

/* ===== お問い合わせボタン ===== */

.header-contact { display: none; }
@media (min-width: 768px) {
  .header-contact { display: block; }
}
.header-contact a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem 1.5rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #DDF159 0%, #ABEB57 100%);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.1504px;
  color: var(--txt-base);
  white-space: nowrap;
  transition: opacity 0.15s ease;
}
.header-contact a:hover { opacity: 0.9; }
/* 背景が暗いページ（診断ページなど）は白ボタンにする。ロゴの差し替えは header.js 側 */
.site-header-invert .header-contact a { background: #fff; }
.header-contact .ic {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--txt-base) url(../img/arrow-r-w.svg) center / 0.5rem no-repeat;
}

/* ===== ハンバーガー ===== */

.header-burger {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1875rem;
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--txt-base);
  cursor: pointer;
}
@media (min-width: 1280px) {
  .header-burger { display: none; }
}
.header-burger span {
  display: block;
  width: 1rem;
  height: 2px;
  border-radius: 1px;
  background: #fff;
  transition: opacity 0.25s ease;
}
/* 開いている間は中央の1本だけ残して「−」にする */
body.sp-menu-open .header-burger span:nth-child(1),
body.sp-menu-open .header-burger span:nth-child(3) { opacity: 0; }

/* ===== SP メニュー ===== */

.sp-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: rgba(72, 81, 87, 0.75);
  opacity: 0;
  visibility: hidden;
  /* 閉じるとき：ボタンが上へ抜けきるまで暗幕を残してから消す */
  transition: opacity 0.25s ease 0.15s, visibility 0s linear 0.4s;
}
body.sp-menu-open .sp-menu {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0s;
}
@media (min-width: 1280px) {
  .sp-menu { display: none; }
}

.sp-menu-panel {
  width: calc(100% - 2rem);
  max-width: 21.375rem;
  margin: 6.75rem auto 2rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fff;
  border-radius: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.25));
}

/* パネル内の各ボタンを上から順に、少し上からフェードインさせる。
   --i は header.js が各要素に振る連番。 */
/* 閉じるとき：上へ抜けながらフェードアウト（開くときより少し詰めた間隔） */
.sp-menu-panel > * {
  opacity: 0;
  transform: translateY(-0.75rem);
  transition: opacity 0.22s ease, transform 0.22s ease;
  transition-delay: calc(var(--i, 0) * 0.035s);
}
/* 開くとき：上から下りてくる */
body.sp-menu-open .sp-menu-panel > * {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
  transition-delay: calc(var(--i, 0) * 0.07s + 0.1s);
}

@media (prefers-reduced-motion: reduce) {
  .sp-menu-panel > *,
  body.sp-menu-open .sp-menu-panel > * {
    transform: none;
    transition: opacity 0.15s ease;
    transition-delay: 0s;
  }
}

.sp-menu-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 3.75rem;
  padding: 1.125rem 2.75rem;
  border: 2px solid #fff;
  border-radius: 1rem;
  background: linear-gradient(28.77deg, #93DD20 53.677%, #DAF935 103.38%);
  font: inherit;
  font-family: var(--font-family);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  letter-spacing: -0.1504px;
  color: #fff;
  text-align: center;
  cursor: pointer;
}

.sp-menu-btn .ic {
  position: absolute;
  right: 1.125rem;
  top: 50%;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #fff url(../img/plus-t.svg) center / 1rem no-repeat;
  transform: translateY(-50%);
  transition: transform 0.25s ease;
}
.sp-menu-item.open .sp-menu-btn .ic { transform: translateY(-50%) rotate(45deg); }

.sp-submenu {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}
.sp-menu-item.open .sp-submenu { grid-template-rows: 1fr; }
.sp-submenu > ul {
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
}
.sp-submenu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid #EDEDED;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: var(--txt-base);
}
.sp-submenu li:last-child a { border-bottom: 0; }
.sp-submenu a::after {
  content: "";
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  background: url(../img/arrow-r-t.svg) center / 0.75rem no-repeat;
}

.sp-menu-contact { margin-top: 0.5rem; }
.sp-menu-contact a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-height: 3.75rem;
  padding: 1.125rem 2.125rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, #DDF159 0%, #ABEB57 100%);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: -0.1504px;
  color: var(--txt-base);
}
.sp-menu-contact .ic {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--txt-base) url(../img/arrow-r-w.svg) center / 0.5rem no-repeat;
}

body.sp-menu-open { overflow: hidden; }
