/* 受験生サイト グローバルメニュー（親/子）— inc/menu-hoshi.php が出力する .hmenu 専用
   親: 文字サイズは従来どおり（bolder）。左に黄色の縦バー。URL が空/# の親はリンクしない見出し。
   子: 親より2px小さく（親15px→13px）・太字（700）。閲覧中ページ(.is-current)とマウスオーバー中の項目はグレー背景。
   プルダウン（menu-popup）は PC・タブレット・スマホとも親の直下に開く（全端末とも親の文字か＋/－のクリック・タップでのみ開閉。ホバーでは開かない）。
   色・寸法は下の変数で調整する。 */
.hmenu {
  --hm-accent: #ffe600;       /* 親の黄色バー */
  --hm-current-bg: #efefef;   /* 閲覧中ページの背景 */
  --hm-line: #dcdcdc;         /* 灰色罫線 */
  --hm-line-left: 14px;       /* 罫線の開始位置（バー8px＋余白6px） */
  --hm-bar-top: 1px;          /* 黄色バー上下の余白（隣のバーとの白い隙間 = 上＋下 = 2.5px） */
  --hm-bar-bottom: 1.5px;
  --hm-child-diff: 2px;       /* 親との文字サイズ差（大きくしたいときは数値を小さく） */
  --hm-plus-size: 10px;       /* 「＋」の長さ */
  --hm-plus-weight: .5px;     /* 「＋」の線の太さ */
}
.hmenu .hm-item { position: relative; list-style: none; }
.hmenu .hm-sub { margin: 0; padding: 0; list-style: none; }

/* 親 */
.hmenu .hm-parent > .hm-label,
.hmenu .hm-single > .hm-label {
  position: relative;
  display: block;
  padding: 10px 44px 10px 20px;
  color: inherit;
  font-weight: bolder;
  text-decoration: none;
}
.hmenu .hm-parent > .hm-label::before {          /* 黄色の縦バー */
  content: "";
  position: absolute;
  left: 0; top: var(--hm-bar-top); bottom: var(--hm-bar-bottom);
  width: 8px;
  background: var(--hm-accent);
}

/* 灰色罫線: 親の上（先頭にも）と、親と最初の子の間。黄色バーとは繋げず右から引く。
   プルダウンの親は、閉じている間は次の親の上罫線がそのまま下罫線になるので下は不要（二重線防止）。
   開いている間は子との境目に他の親と同じ罫線を引く */
.hmenu .hm-parent::before,
.hmenu .hm-single::before,
.hmenu .hm-parent:not(.hm-popup) > .hm-label::after,
.hmenu .hm-popup.is-open > .hm-label::after {
  content: "";
  position: absolute;
  left: var(--hm-line-left); right: 0;
  height: 1px;
  background: var(--hm-line);
}
.hmenu .hm-parent::before,
.hmenu .hm-single::before { top: 0; }
.hmenu .hm-parent:not(.hm-popup) > .hm-label::after,
.hmenu .hm-popup.is-open > .hm-label::after { bottom: 0; }

/* リンクしない見出し（span）。開閉できる親だけ指カーソル */
.hmenu .hm-nolink > span.hm-label { cursor: default; }
.hmenu .hm-popup > span.hm-label,
.hmenu .hm-collapsible > span.hm-label { cursor: pointer; }

/* 子 */
.hmenu .hm-child > a {
  display: block;
  padding: 10px 10px 10px 38px;
  color: inherit;
  font-size: calc(1em - var(--hm-child-diff));
  font-weight: 700;
  line-height: 1.5;
  text-decoration: none;
}
.hmenu .hm-child.is-current > a,
.hmenu .hm-parent:not(.hm-popup).is-current > .hm-label,
.hmenu .hm-popup.is-open:not(.is-pinned) > .hm-label { background: var(--hm-current-bg); }
/* プルダウン親（入試情報）は開いている間グレー。ただし配下ページ閲覧中（.is-pinned）は子の閲覧中項目だけをグレーにし、親は元の色 */
/* マウスオーバー（閲覧中ページと同じグレー）。リンクしない見出し(span)は対象外。＋ボタン上でも親の背景を変える */
@media (hover: hover) {
  .hmenu .hm-child > a:hover,
  .hmenu .hm-parent > a.hm-label:hover,
  .hmenu .hm-single > a.hm-label:hover,
  .hmenu .hm-parent:has( > .hm-toggle:hover ) > .hm-label { background: var(--hm-current-bg); opacity: 1; }
}

/* 「＋/－」ボタン（プルダウン・折りたたみの親） */
.hmenu .hm-toggle {
  position: absolute;
  right: 4px; top: 0;
  width: 40px; height: 43px;
  padding: 0; border: 0;
  background: none;
  cursor: pointer;
  color: inherit;
}
.hmenu .hm-toggle span,
.hmenu .hm-toggle span::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: var(--hm-plus-size); height: var(--hm-plus-weight);
  background: currentColor;
  transform: translate(-50%, -50%);
}
.hmenu .hm-toggle span::before { transform: translate(-50%, -50%) rotate(90deg); transition: opacity .2s; }
.hmenu .hm-toggle[aria-expanded="true"] span::before { opacity: 0; }

/* 開閉: 全表示（既定）／折りたたみ／プルダウン */
.hmenu .hm-collapsible > .hm-sub,
.hmenu .hm-popup > .hm-sub { display: none; }
.hmenu .hm-collapsible.is-open > .hm-sub,
.hmenu .hm-popup.is-open > .hm-sub { display: block; }

/* PC: 資料請求ボタンと「入試情報」の間は、ボタン同士の間（5px）に揃える（共通CSSの .header__mainmenu は上下25px） */
.header__mainmenu.hmenu--pc { padding-top: 5px; }

/* スマホ */
.hmenu--sp .hm-child > a { padding-left: 40px; }
.hmenu--sp .hm-toggle { height: 46px; }
