/* =========================================================
 * header.css（完成版・基準）
 * - 横スクロール防止
 * - グローバルナビ（2階層 / 3階層 / メガ）安定
 * - ヘッダー内リンクはすべて下線なし
 * - サブメニューありに ▼ 表示
 * - トップ / サブメニューでホバー背景を統一
 * ======================================================= */


/* =========================================================
 * 1) Header base
 * ======================================================= */
.site-header{
  border-bottom: 1px solid #e0e0e0;
  font-size: 14px;
  color: #333;
  background: #fff;
  max-width: 100%;
}
.site-header *,
.site-header *::before,
.site-header *::after{
  box-sizing: border-box;
}


/* =========================================================
 * 2) Layout container
 * ======================================================= */
.header-inner{
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}


/* =========================================================
 * 3) Logo
 * ======================================================= */
.site-logo{
  text-decoration: none;
  color: inherit;
}
.logo-box{
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo-mark{
  width: 44px;
  height: auto;
  flex-shrink: 0;
}
.logo-text{
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  text-align: center;
}
.logo-jp{
  font-size: 24px;
  font-weight: 600;
  color: #222;
}
.logo-en{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #777;
}


/* =========================================================
 * 4) Top row（上段リンク / 検索）
 * ======================================================= */
.header-top{
  padding: 12px 0 8px;
  width: 100%;
}
.header-top-right{
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  min-width: 0;
}

/* Search button */
.header-search-link{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 18px 6px 16px;

  border-radius: 999px;
  background: #666;
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  white-space: nowrap;
}
.header-search-link:hover{
  background: #555;
}

.header-search-icon{
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  position: relative;
}
.header-search-icon::after{
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  border-radius: 2px;
  background: #fff;
  transform: rotate(45deg);
  right: -4px;
  bottom: -1px;
}

/* Top links（アクセス・医療関係の方など） */
.top-links ul{
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
}
.top-links a{
  font-size: 16px;
  color: #666;
  padding: 6px 8px;
  border-radius: 6px;
}
.top-links a:hover{
  background: #f0f5fb;
  color: #004b8d;
}


/* =========================================================
 * 5) Global nav base（メインナビ）
 * ======================================================= */
.header-main{
  width: 100%;
  border-top: 1px solid #f0f0f0;
}
.header-main-inner{
  width: 100%;
  min-width: 0;
}

.global-nav{
  flex: 1;
  min-width: 0;
}

.global-nav > ul{
  display: flex;
  align-items: center;
  flex-wrap: wrap;

  row-gap: 8px;
  column-gap: clamp(18px, 4vw, 64px);

  list-style: none;
  margin: 0;
  padding: 0;

  min-width: 0;
}

/* メインリンク */
.global-nav > ul > li > a{
  display: inline-block;
  padding: 10px 8px;
  font-size: 18px;
  color: #222;
  white-space: nowrap;
  border-radius: 6px;
}
.global-nav > ul > li > a:hover{
  background: #f0f5fb;
  color: #004b8d;
}
.global-nav a[aria-current="page"]{
  border-bottom: 2px solid #004b8d;
  font-weight: 600;
}


/* =========================================================
 * 5-1) サブメニューあり表示（▼ を付与）
 * - 孫メニュー矢印（11px）とサイズ統一
 * ======================================================= */
.global-nav > ul > li.menu-item-has-children > a{
  position: relative;
  padding-right: 18px;
}
.global-nav > ul > li.menu-item-has-children > a::after{
  content: "▼";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: .7;
}


/* =========================================================
 * 5-2) サイトマップボタン
 * ======================================================= */
.global-nav-sitemap{
  padding: 8px 28px;
  border-radius: 999px;
  background: #16a435;
  color: #fff;
  font-size: 16px;
  white-space: nowrap;
}
.global-nav-sitemap:hover{
  background: #12902e;
}


/* =========================================================
 * 6) Dropdown（2階層）
 * ======================================================= */
.global-nav > ul > li{
  position: relative;
}

/* パネル */
.global-nav .sub-menu{
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 1000;

  min-width: 225px;
  max-width: calc(100vw - 32px);

  margin-top: 0;
  padding: 8px 0;
  list-style: none;

  background: #fff;
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,.15);

  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: .22s ease;
}

.global-nav > ul > li:hover > .sub-menu,
.global-nav > ul > li:focus-within > .sub-menu{
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* サブメニュー項目 */
.global-nav .sub-menu a{
  display: block;
  padding: 6px 16px;
  font-size: 16px;
  color: #333;
}
.global-nav .sub-menu a:hover{
  background: #f0f5fb;
  color: #004b8d;
}


/* =========================================================
 * 診療科・部門（2番目メニュー）：サブメニュー幅を調整
 * ======================================================= */

.global-nav > ul > li:nth-child(2) > .sub-menu{
  min-width: 160px;
}


/* =========================================================
 * 7) 3階層（孫メニュー）
 * ======================================================= */

/* 矢印（▶） */
.global-nav .sub-menu > li.menu-item-has-children > a{
  position: relative;
  padding-right: 34px;
}
.global-nav .sub-menu > li.menu-item-has-children > a::after{
  content: "▶";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  opacity: .7;
}

/* 孫パネル */
.global-nav .sub-menu .sub-menu{
  position: absolute;
  top: 0;
  left: 100%;
  margin-left: 6px;

  min-width: 240px;
  max-width: calc(100vw - 32px);

  padding: 0;

  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
  
}

.global-nav .sub-menu > li:hover > .sub-menu,
.global-nav .sub-menu > li:focus-within > .sub-menu{
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

/* Hover bridge（子→孫で消えない対策） */
.global-nav .sub-menu > li{
  position: relative;
}
.global-nav .sub-menu > li::after{
  content: "";
  position: absolute;
  top: 0;
  right: -10px;
  width: 12px;
  height: 100%;
  background: transparent;
  
}



/* =========================================================
 * 8) Mega menu
 * ======================================================= */
/* 支援部門（3列孫メニュー）を限界まで詰める */
.global-nav .is-mega-3col > .sub-menu{
  width: min(540px, 90vw);   /* 全体幅を少し絞る */
  column-count: 3;
  column-width: 175px;      /* ← ここが最重要 */
  column-gap: 1px;
}

.global-nav .is-mega-2col > .sub-menu{
  width: min(480px, 90vw);
  column-count: 2;
  column-gap: 12px;
  padding: 0px;
}
.global-nav .is-mega-3col > .sub-menu > li,
.global-nav .is-mega-2col > .sub-menu > li{
  break-inside: avoid;
}
.global-nav .is-mega-3col > .sub-menu a,
.global-nav .is-mega-2col > .sub-menu a{
  white-space: normal;
  
}


/* =========================================================
 * 9) Responsive / overflow
 * ======================================================= */
@media (max-width: 768px){
  .header-inner{
    align-items: flex-start;
  }
  .global-nav > ul{
    justify-content: flex-start;
  }
}

@media (min-width: 769px){
  .global-nav > ul{
    justify-content: flex-start;
    margin-left: 80px;
  }
}

/* 横スクロール防止 */
.header-main{
  overflow-x: clip;
}
@supports not (overflow-x: clip){
  .header-main{
    overflow-x: hidden;
  }
}


/* =========================================================
 * 10) Header 内リンク：下線を完全に無効化
 * - common.css の a:hover underline 対策
 * ======================================================= */
.site-header a,
.site-header a:hover,
.site-header a:focus,
.site-header a:active,
.site-header a:visited{
  text-decoration: none !important;
}
