/*
 * ヘッダー・フッター（Twenty Twenty-Fiveの header/footer template part）専用の見た目調整。
 * ナビ項目・テンプレート構造そのもの（wp_navigation / wp_template_part / wp_template）は
 * 一切変更しない。既存のコアブロックが出力するクラス名（.wp-block-site-title /
 * .wp-block-navigation 等）をそのまま利用し、見た目（配色・余白・角丸・hover）だけを整える。
 *
 * 本文（page/postのcontent）側のブロックへ誤って影響しないよう、すべてのセレクタを
 * 実DOMで確認した header.wp-block-template-part / footer.wp-block-template-part 配下に
 * scopeしている（.wp-block-navigation や .wp-block-site-title は本文側にも同名クラスが
 * 出現し得るため、prefixなしでは使わない）。
 *
 * このファイルはフロント全ページで常時読み込まれる（wp-admin・REST・Cronには影響しない）。
 */

/* ---------------------------------------------------------------------
 * ヘッダー。
 * ------------------------------------------------------------------- */

header.wp-block-template-part {
	background: var( --qlm-color-bg );
	border-bottom: 1px solid var( --qlm-color-border );
}

header.wp-block-template-part .wp-block-group.alignwide {
	max-width: 1160px;
	margin-left: auto;
	margin-right: auto;
	padding-top: 14px;
	padding-bottom: 14px;
}

header.wp-block-template-part .wp-block-site-title,
header.wp-block-template-part .wp-block-site-title a {
	color: var( --qlm-color-primary );
	font-weight: 700;
	font-size: 1.2rem;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
}

/* ヘッダー行はflexbox（space-between）で、ナビ項目数が多い場合にサイト名側のflexアイテムが
   縮んでテキストが2行に折り返り、欠けて見える不具合の対策。サイト名側を縮めさせない
   （flex-shrink:0）ことで、ナビ側だけが必要に応じて折り返る／詰まるようにする。 */
header.wp-block-template-part .wp-block-site-title {
	flex-shrink: 0;
}

header.wp-block-template-part .wp-block-navigation__container {
	gap: 4px 22px;
}

/* colorはコア側に!important付きの既定ルールがあるため、同じ強さで上書きする
   （他プロパティは!important不要）。 */
header.wp-block-template-part .wp-block-navigation-item__content {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 0.3em;
	color: var( --qlm-color-text ) !important;
	font-size: 0.95rem;
	font-weight: 600;
	border-radius: var( --qlm-radius-button );
}

header.wp-block-template-part .wp-block-navigation-item__content:hover,
header.wp-block-template-part .wp-block-navigation-item__content:focus-visible {
	color: var( --qlm-color-secondary ) !important;
}

header.wp-block-template-part .current-menu-item > .wp-block-navigation-item__content,
body:has( .qlm-finder ) header.wp-block-template-part a[href*="/finder/"],
body:has( .qlm-qcompare ) header.wp-block-template-part a[href*="/compare/"],
body:has( .qlm-list ) header.wp-block-template-part a[href*="/qualifications/"] {
	padding-inline: .8rem;
	background: var( --qlm-color-bg-section );
	color: var( --qlm-color-secondary ) !important;
	font-weight: 700;
}

/* ハンバーガー／閉じるボタン：既定の24x24pxはタップ領域として小さいため、
   アイコン自体の見た目は保ちつつ、タップ領域だけを44px以上へ広げる。
   display は変更しない（Twenty Twenty-Fiveのレスポンシブ表示/非表示切り替えロジックに
   影響してしまうため、paddingのみでタップ領域を広げる）。 */
header.wp-block-template-part .wp-block-navigation__responsive-container-open,
header.wp-block-template-part .wp-block-navigation__responsive-container-close {
	padding: 10px;
	color: var( --qlm-color-primary );
}

/* オーバーレイメニュー（スマホ）：Twenty Twenty-Five標準のロジック・開閉動作は変更せず、
   配色のみを資格のカチのトーンに合わせる。 */
header.wp-block-template-part .wp-block-navigation__responsive-container.is-menu-open {
	background: var( --qlm-color-bg );
}

/* オーバーレイのcolor（has-contrast-color等）はコアの!important付きルールで文字色を強制するため、
   同じ強さで上書きする（他プロパティは!important不要）。 */
header.wp-block-template-part .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: 1.05rem;
	padding: 0.2em 0.3em;
	color: var( --qlm-color-primary ) !important;
}

header.wp-block-template-part .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:hover,
header.wp-block-template-part .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content:focus-visible {
	color: var( --qlm-color-secondary ) !important;
}

/* ---------------------------------------------------------------------
 * フッター。
 * ------------------------------------------------------------------- */

footer.wp-block-template-part {
	background: var( --qlm-color-bg-section );
	border-top: 1px solid var( --qlm-color-border );
}

/* padding-top/bottomはテンプレート側のinline styleで指定されているため、
   上書きには!importantが必要（Twenty Twenty-Fiveの初期フッターは余白が大きめのため調整）。 */
footer.wp-block-template-part .wp-block-group.has-global-padding {
	padding-top: 40px !important;
	padding-bottom: 28px !important;
}

footer.wp-block-template-part .wp-block-spacer {
	height: 24px !important;
}

footer.wp-block-template-part .wp-block-site-title,
footer.wp-block-template-part .wp-block-site-title a {
	color: var( --qlm-color-primary );
	font-weight: 700;
	font-size: 1.15rem;
	text-decoration: none;
}

footer.wp-block-template-part .wp-block-site-tagline {
	color: var( --qlm-color-text-muted );
}

/* colorはコア側に!important付きの既定ルールがあるため、同じ強さで上書きする
   （他プロパティは!important不要）。 */
footer.wp-block-template-part .wp-block-navigation-item__content {
	color: var( --qlm-color-text-muted ) !important;
	font-size: 0.92rem;
	padding: 0.2em 0;
}

footer.wp-block-template-part .wp-block-navigation-item__content:hover,
footer.wp-block-template-part .wp-block-navigation-item__content:focus-visible {
	color: var( --qlm-color-secondary ) !important;
}

footer.wp-block-template-part p.wp-block-paragraph {
	color: var( --qlm-color-text-muted );
}

footer.wp-block-template-part a {
	color: var( --qlm-color-secondary );
}

/* The theme navigation collapses out of view on narrow screens.  These three
 * page-local tabs keep the primary qualification journeys reachable without
 * introducing a second JavaScript menu. */
.qlm-mobile-page-nav {
	display: none;
}

@media ( max-width: 480px ) {
	header.wp-block-template-part .wp-block-site-title,
	header.wp-block-template-part .wp-block-site-title a {
		font-size: 1.05rem;
	}

	.qlm-mobile-page-nav {
		display: grid;
		grid-template-columns: repeat( 3, minmax( 0, 1fr ) );
		gap: 4px;
		width: 100%;
		margin: 0 0 .75rem;
		padding: 4px;
		border: 1px solid var( --qlm-color-border );
		border-radius: 12px;
		background: var( --qlm-color-bg-section );
		box-sizing: border-box;
	}

	.qlm-mobile-page-nav a {
		display: grid;
		place-items: center;
		min-width: 0;
		min-height: 44px;
		padding: .5rem .2rem;
		border-radius: 9px;
		color: var( --qlm-color-text ) !important;
		font-size: .76rem;
		font-weight: 700;
		line-height: 1.25;
		text-align: center;
		text-decoration: none;
		overflow-wrap: anywhere;
	}

	.qlm-mobile-page-nav a[aria-current="page"] {
		background: var( --qlm-color-bg );
		color: var( --qlm-color-secondary ) !important;
		box-shadow: 0 1px 3px rgba( 29, 53, 87, .1 );
	}

	.qlm-mobile-page-nav a:focus-visible {
		outline: 3px solid rgba( 0, 142, 230, .28 );
		outline-offset: 1px;
	}
}
