/* サイト共通ヘッダー（トップページの fv-search-comparison__header と同一の見た目）
   下層ページで .site-header ブロックとして使用する */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: 75px;
  border-bottom: 1px solid var(--c-surface-muted, #f1f5f8);
  background: #fff;
}

.site-header__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: min(1650px, calc(100vw - 160px));
  height: 100%;
  margin: 0 auto;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 0;
}

.site-header__brand img {
  display: block;
  width: auto;
  height: auto;
  max-width: 190px;
  max-height: 48px;
  object-fit: contain;
}

.site-header__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(30px, 2.5vw, 44px);
  padding-right: 0;
  white-space: nowrap;
}

/* ナビの通常状態は Navy（情報）、hover と現在地だけ Teal（行動・選択状態）。
   hover時は淡いTealの面を敷き、ヘッダー自体は白のまま保つ。 */
.site-header__nav a {
  color: var(--c-ink, #102A43);
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 6px;
  transition: color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

/* 面は box-shadow の広がりで描く。padding を足さないので寸法・字送りは変わらない。 */
.site-header__nav a:hover,
.site-header__nav a:focus-visible,
.site-header__nav a[aria-current="page"] {
  color: var(--c-action-text, #066A63);
  background: var(--c-action-soft, #EAF7F5);
  box-shadow: 0 0 0 7px var(--c-action-soft, #EAF7F5);
}

/* ドロップダウンの「⌄」（トップページと同じCSS三角） */
.site-header__nav a > span[aria-hidden="true"] {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 2px 0 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  font-size: 0;
  vertical-align: middle;
  transform: translateY(-3px) rotate(45deg);
}

.site-header__cta {
  display: flex;
  width: auto;
  height: clamp(38px, 2.7vw, 44px);
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 0;
  border-radius: 8px;
  color: #fff !important;
  background: var(--c-action, #087D76);
  box-shadow: none;
  font-size: clamp(12px, .93vw, 15px);
  font-weight: 700;
  text-decoration: none;
  transition: background .2s ease, box-shadow .2s ease; padding: 0 clamp(18px, 1.5vw, 26px);}

.site-header__cta:hover {
  background: var(--c-action-hover, #066A63);
  box-shadow: none;
}

/* 右側ユーティリティ（トップページの fv-search-comparison__header-utils と同じ見た目） */
.site-header__utils {
  display: flex;
  align-items: center;
  gap: clamp(15px, 1.3vw, 22px);
  justify-self: end;
}

.site-header__util {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--c-ink, #102A43);
  font-size: clamp(12px, .93vw, 15px);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: color .15s ease;
}

.site-header__util svg {
  width: 1.25em;
  height: 1.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header__util:hover,
.site-header__util:focus-visible {
  color: var(--c-action-text, #066A63);
}

.site-header__cta {
  padding: 0 clamp(18px, 1.5vw, 26px);
}

.site-header__menu-toggle {
  display: none;
}

/* メガメニュー（トップページの fv-search-comparison__mega-* と同じ見た目） */
@keyframes siteHeaderMegaIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.site-header__mega-menu[hidden],
.site-header__mega-panel[hidden] {
  display: none;
}

.site-header__mega-menu {
  position: absolute;
  z-index: 90;
  top: 100%;
  right: 0;
  left: 0;
  border-top: 1px solid var(--c-surface-muted);
  background: #fff;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  animation: siteHeaderMegaIn 0.18s ease-out;
}

.site-header__mega-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px 24px;
}

.site-header__mega-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 48px;
}

.site-header__mega-column {
  min-width: 0;
}

.site-header__mega-column h2 {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--c-ink);
  color: var(--color-navy, #102A43);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.site-header__mega-column ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-header__mega-column li + li {
  border-top: 1px solid var(--c-surface-muted);
}

.site-header__mega-column a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px;
  color: var(--color-navy, #102A43);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.18s ease;
}

.site-header__mega-column a:hover {
  color: var(--color-navy-soft);
}

.site-header__mega-close {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 32px auto 0;
  padding: 6px 16px;
  border: 0;
  color: var(--color-navy, #102A43);
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.18s ease;
}

.site-header__mega-column a:focus-visible,
.site-header__mega-close:focus-visible {
  outline: 3px solid rgba(60, 94, 126, 0.35);
  outline-offset: 3px;
  color: var(--color-navy-soft);
}

@media (max-width: 1000px) {
  .site-header__mega-menu {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header__mega-menu {
    animation: none;
  }
}

/* テーマ詳細はタブが position:sticky; top:0 のため、ヘッダーは従来どおり追従させない */
.theme-detail .site-header {
  position: static;
}

/* トップページと同じ縮小段階 */
@media (max-width: 1500px) {
  .site-header__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    width: min(1650px, calc(100vw - 160px));
  }

  .site-header__nav {
    padding-right: 0;
  }
}

/* トップページのヘッダーは 1200px 未満で 66px になる（home-fv.css）。同じ段階に合わせる。 */
@media (min-width: 1001px) and (max-width: 1199px) {
  .site-header {
    height: 66px;
  }
}

/* トップページと同じ 1001-1280px の圧縮段階 */
@media (min-width: 1001px) and (max-width: 1280px) {
  .site-header__inner {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 18px;
    width: min(1650px, calc(100vw - 160px));
  }

  .site-header__nav {
    justify-content: center;
    padding-right: 0;
  }

  .site-header__nav a {
    font-size: 13px;
  }

  .site-header__cta {
    width: auto;
    height: 44px;
  }
}

/* 1000px以下：トップページと同じハンバーガー構成 */
@media (max-width: 1000px) {
  .site-header {
    height: 66px;
    border-bottom: 1px solid var(--c-surface-muted);
  }

  .site-header__inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto 42px;
    gap: 8px;
    width: calc(100% - 24px);
    height: 100%;
    align-items: center;
  }

  .site-header__brand img {
    width: min(31vw, 122px);
    max-width: 122px;
    max-height: 38px;
  }

  .site-header__cta {
    width: auto;
    min-width: 0;
    height: 42px;
    padding-inline: 13px;
    border-radius: 999px;
    gap: 6px;
    font-size: 11px;
    white-space: nowrap;
  }

  .site-header__menu-toggle {
    display: inline-flex;
    width: 42px;
    height: 42px;
    padding: 9px 7px;
    align-items: stretch;
    justify-content: space-between;
    flex-direction: column;
    border: 0;
    border-radius: 7px;
    background: #fff;
    color: var(--c-ink);
    cursor: pointer;
  }

  .site-header__menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    border-radius: 999px;
    background: currentColor;
    transition: transform .18s ease, opacity .18s ease;
  }

  .site-header.is-mobile-menu-open .site-header__menu-toggle span:nth-child(1) {
    transform: translateY(10.5px) rotate(45deg);
  }

  .site-header.is-mobile-menu-open .site-header__menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  .site-header.is-mobile-menu-open .site-header__menu-toggle span:nth-child(3) {
    transform: translateY(-10.5px) rotate(-45deg);
  }

  .site-header__nav {
    position: absolute;
    top: 66px;
    right: 0;
    left: 0;
    z-index: 20;
    display: none;
    padding: 10px 18px 16px;
    align-items: stretch;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--c-surface-muted);
    border-bottom: 1px solid var(--c-border);
    background: #fff;
    box-shadow: 0 12px 24px rgba(15, 43, 70, .1);
    white-space: normal;
  }

  .site-header.is-mobile-menu-open .site-header__nav {
    display: flex;
  }

  .site-header__nav a {
    padding: 12px 2px;
    border-bottom: 1px solid var(--c-surface-muted, #f1f5f8);
    color: var(--c-ink);
    font-size: 14px;
  }
}

@media (max-width: 359px) {
  .site-header__inner {
    grid-template-columns: minmax(0, 1fr) auto 38px;
    gap: 5px;
    width: calc(100% - 16px);
  }

  .site-header__brand img {
    width: 104px;
  }

  .site-header__cta {
    height: 38px;
    padding-inline: 9px;
    font-size: 9.5px;
  }

  .site-header__menu-toggle {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header__menu-toggle span {
    transition: none;
  }
}
