/**
 * サイトヘッダー
 */

.site-header {
  background: var(--wp--preset--color--white);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 管理バー表示中はその高さぶんずらす */
.admin-bar .site-header {
  top: 32px;
}

@media (max-width: 782px) {
  .admin-bar .site-header {
    top: 46px;
  }
}

/* ハンバーガーメニュー表示中は背面のスクロールをロック
   単純な overflow:hidden だとロックした瞬間に背面が一番上までスクロールされて
   しまうため、現在のスクロール位置を保持したまま body を position:fixed で固定する。
   （top の値は JS 側で現在のスクロール位置に応じて動的に設定） */
html.site-header-menu-open {
  overflow: hidden;
}

/* body を position:fixed で退避させている間、sticky なヘッダーも一緒に
   画面外へ流れてしまうため、開いている間だけ fixed に切り替えて画面上部に固定する */
html.site-header-menu-open .site-header {
  position: fixed;
  left: 0;
  right: 0;
}

body.site-header-menu-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

.site-header__inner {
  max-width: var(--wp--style--global--wide-size, 1200px);
  margin-inline: auto;
  padding: 12px var(--wp--custom--container--padding, 24px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* ブランディング（ロゴ＋クリニック名＋タグライン） */
.site-header__branding {
  flex: 0 0 auto;
}

.site-header__logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header__logo-mark {
  flex: 0 0 auto;
  display: block;
  line-height: 0;
}

.site-header__logo-mark .custom-logo-link,
.site-header__logo-mark .custom-logo {
  display: block;
}

.site-header__logo-mark .custom-logo {
  width: 41px;
  height: 41px;
}

.site-header__brand-text {
  display: flex;
  flex-direction: column;
  text-decoration: none;
}

.site-header__site-name {
  font-family: "YuGothic", "Yu Gothic", sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 16px;
  line-height: 17.5px;
  letter-spacing: 0;
  vertical-align: middle;
  color: var(--wp--preset--color--heading-text);
}

.site-header__tagline {
  display: block;
  font-family: "YuGothic", "Yu Gothic", sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 0;
  vertical-align: middle;
  color: var(--wp--preset--color--caption-text);
  margin-top: 2px;
}

/* 右側（診療時間 + ナビ + 予約ボタン） */
.site-header__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
}

.site-header__hours {
  display: flex;
  gap: 16px;
  font-family: "YuGothic", "Yu Gothic", sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: 10px;
  line-height: 16px;
  letter-spacing: 0;
  vertical-align: middle;
  color: var(--wp--preset--color--body-text);
}

.site-header__nav {
  width: 100%;
}

/* ハンバーガーボタン（1100px以下でのみ表示）
   モック通り、ヘッダー右上に隙間なくフラッシュ配置される正方形ボタン。 */
.site-header__menu-toggle {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  width: 50px;
  height: 50px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--wp--preset--color--primary);
  cursor: pointer;
  z-index: 1;
}

.site-header__menu-toggle-bar {
  display: block;
  width: 40%;
  height: 2px;
  background: var(--wp--preset--color--white);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}

.site-header__menu-toggle-label {
  color: var(--wp--preset--color--white);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.site-header__menu-toggle.is-active .site-header__menu-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.site-header__menu-toggle.is-active .site-header__menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.site-header__menu-toggle.is-active .site-header__menu-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.clinic-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  list-style: none;
  margin: 0;
  padding: 0;
}

.clinic-nav__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 10px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.clinic-nav__link:hover {
  opacity: 0.7;
}

.clinic-nav__ja {
  font-family: var(--wp--preset--font-family--heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--wp--preset--color--heading-text);
}

.clinic-nav__en {
  font-family: var(
    --wp--preset--font-family--heading,
    "YuMincho",
    "Yu Mincho",
    serif
  );
  font-weight: 600;
  font-style: normal;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  vertical-align: middle;
  color: #cd9ed7;
}

@media (max-width: 1100px) {
  .site-header__menu-toggle {
    display: flex;
  }

  /* 右上フラッシュ配置のボタン分、内側コンテンツと重ならないよう余白を確保 */
  .site-header__inner {
    padding-top: 4px;
    padding-bottom: 4px;
    padding-right: 60px;
    gap: 0;
  }

  .site-header__right {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .site-header__hours {
    display: none;
  }

  .site-header__nav {
    position: fixed;
    top: var(--site-header-bottom, 0px);
    left: 0;
    right: 0;
    width: auto;
    height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--wp--preset--color--white);
    padding: 0 var(--wp--custom--container--padding, 24px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      height 0.3s ease,
      opacity 0.3s ease,
      visibility 0.3s,
      padding 0.3s ease;
  }

  .site-header__nav.is-open {
    height: calc(100vh - var(--site-header-bottom, 0px));
    padding: 16px var(--wp--custom--container--padding, 24px);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .clinic-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .clinic-nav__link {
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 10px 4px;
  }
}

@media (max-width: 767px) {
  .site-header__inner {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ===================================================================
 * フローティングコンテンツ（画面右に固定表示するクイックアクセス）
 * header.php から全ページ共通で読み込む（template-parts/floating-cta.php）。
 * position:fixedのため、ページ内のどこに配置しても画面上の表示位置は同じ。
 * =================================================================== */
.floating-cta {
  position: fixed;
  top: 140px;
  right: 8px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.floating-cta__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 72px;
  overflow: hidden;
  background: var(--wp--preset--color--white);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  text-decoration: none;
  transition: opacity 0.3s ease;
}

.floating-cta__item:hover {
  opacity: 0.7;
}

/* ---- web予約：アイコンエリア（上段・全面グラデーション）／テキストエリア（下段・白背景） ---- */
.floating-cta__band {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
}

.floating-cta__band--icon {
  padding: 6px 0;
  background: var(--wp--preset--gradient--hero-gradient);
}

.floating-cta__band--icon img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.floating-cta__band--label {
  padding: 8px 4px 10px;
  background: var(--wp--preset--color--white);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--wp--preset--color--heading-text);
  text-align: center;
}

/* ---- アクセス：円形の色つき背景は使わず、ピンアイコン自体の配色（紫＋白）で見せる ---- */
.floating-cta__item--access {
  gap: 4px;
  padding: 14px 8px 12px;
}

.floating-cta__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.floating-cta__icon img {
  display: block;
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.floating-cta__label {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--wp--preset--color--heading-text);
  text-align: center;
}

@media (max-width: 767px) {
  .floating-cta {
    right: 0;
  }

  .floating-cta__item {
    width: 60px;
  }

  .floating-cta__band--icon {
    padding: 4px 0;
  }

  .floating-cta__band--icon img {
    width: 32px;
    height: 32px;
  }

  .floating-cta__band--label {
    padding: 6px 4px 8px;
    font-size: 10px;
  }

  .floating-cta__item--access {
    padding: 10px 6px;
  }

  .floating-cta__icon {
    width: 32px;
    height: 32px;
  }

  .floating-cta__icon img {
    width: 30px;
    height: 30px;
  }

  .floating-cta__label {
    font-size: 10px;
  }
}
