/* =============================================================================
   03-header-footer.css
   サイト共通のヘッダー・グローバルナビ・フッター
   ============================================================================= */

@layer layout {

	/* ==========================================================================
	   Header
	   ========================================================================== */
	.site-header {
		border-bottom: 1px solid #ddd;
		position: relative;        /* .site-hamburger の絶対配置基準 */
	}

	/* ==========================================================================
	   Mobile Hamburger（≤1024px のみ表示）
	   ========================================================================== */
	.site-hamburger {
		display: none;             /* PC は非表示。タブレット以下で flex に切替 */
		position: absolute;
		top: 12px;
		right: 12px;
		z-index: 1050;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 1px solid #d8dee8;
		border-radius: 8px;
		background: #fff;
		cursor: pointer;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 5px;
		transition: background 0.15s ease, border-color 0.15s ease;
	}
	.site-hamburger:hover { background: var(--color-accent-soft, #f4f7fb); }
	.site-hamburger:focus-visible {
		outline: 2px solid var(--color-primary, #1c70c5);
		outline-offset: 2px;
	}

	.site-hamburger-bar {
		display: block;
		width: 22px;
		height: 2px;
		background: var(--color-primary, #333);
		border-radius: 2px;
		transition: transform 0.2s ease, opacity 0.2s ease;
	}

	/* 開いている状態：3本線 → × */
	.site-hamburger.is-open .site-hamburger-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	.site-hamburger.is-open .site-hamburger-bar:nth-child(2) { opacity: 0; }
	.site-hamburger.is-open .site-hamburger-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

	@media (max-width: 1024px) {
		.site-hamburger { display: flex; }
	}

	/* ==========================================================================
	   Mobile Drawer（≤1024px）
	   ========================================================================== */
	.site-drawer {
		position: fixed;
		inset: 0;
		z-index: 1040;
		visibility: hidden;
	}
	.site-drawer.is-open { visibility: visible; }

	/* ドロワー展開中は背景スクロールを止める */
	body.is-drawer-open { overflow: hidden; }

	.site-drawer-overlay {
		position: absolute;
		inset: 0;
		background: rgba(0, 0, 0, 0.45);
		opacity: 0;
		transition: opacity 0.22s ease;
	}
	.site-drawer.is-open .site-drawer-overlay { opacity: 1; }

	.site-drawer-panel {
		position: absolute;
		top: 0;
		right: 0;
		height: 100%;
		width: min(86vw, 360px);
		background: #fff;
		box-shadow: -8px 0 24px rgba(0, 0, 0, 0.18);
		display: flex;
		flex-direction: column;
		transform: translateX(100%);
		transition: transform 0.25s ease;
		overflow: hidden;
	}
	.site-drawer.is-open .site-drawer-panel { transform: translateX(0); }

	.site-drawer-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 14px 16px;
		border-bottom: 1px solid #eef1f6;
		background: #f7f9fc;
	}
	.site-drawer-title {
		font-size: 14px;
		font-weight: 700;
		letter-spacing: 0.05em;
		color: var(--color-text, #333);
	}
	.site-drawer-close {
		width: 36px;
		height: 36px;
		border: 0;
		background: transparent;
		font-size: 20px;
		line-height: 1;
		color: #555;
		cursor: pointer;
		border-radius: 6px;
		transition: background 0.15s ease;
	}
	.site-drawer-close:hover { background: rgba(0, 0, 0, 0.06); }

	.site-drawer-body {
		flex: 1;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		padding: 8px 0 24px;
	}

	.site-drawer-section { padding: 12px 0; }
	.site-drawer-section + .site-drawer-section { border-top: 1px solid #f0f3f7; }

	.site-drawer-section-title {
		margin: 0;
		padding: 4px 20px 8px;
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.08em;
		color: #8a93a3;
		text-transform: uppercase;
	}

	.site-drawer-list {
		list-style: none;
		padding: 0;
		margin: 0;
	}
	.site-drawer-list li { margin: 0; }
	.site-drawer-list a {
		display: flex;
		flex-direction: column;
		gap: 2px;
		padding: 12px 20px;
		text-decoration: none;
		color: var(--color-text, #1f2937);
		font-size: 14px;
		font-weight: 600;
		transition: background 0.15s ease, color 0.15s ease;
	}
	.site-drawer-list a:hover,
	.site-drawer-list a:focus {
		background: var(--color-accent-soft, #f4f7fb);
		color: var(--color-primary);
		outline: none;
	}

	.site-drawer-link-name { display: block; line-height: 1.4; }
	.site-drawer-link-desc {
		display: block;
		font-size: 11px;
		font-weight: 400;
		color: #6b7785;
		line-height: 1.4;
	}

	/* CTA セクション（見積もり）はオレンジ系で目立たせる */
	.site-drawer-cta { padding-top: 16px; }
	.site-drawer-list-cta a {
		flex-direction: row;
		align-items: center;
		gap: 12px;
		margin: 6px 16px;
		padding: 12px 14px;
		background: #fff4ec;
		border: 1px solid #f4c98c;
		border-radius: 8px;
		color: var(--color-accent, #f24e00);
	}
	.site-drawer-list-cta a:hover,
	.site-drawer-list-cta a:focus {
		background: #ffe5d2;
		color: var(--color-accent, #f24e00);
	}
	.site-drawer-list-cta .fa-calculator { font-size: 16px; }

	.site-drawer-quote-link--solo {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 10px;
		margin: 6px 16px;
		padding: 14px;
		background: var(--color-accent, #f24e00);
		color: #fff;
		border-radius: 8px;
		text-decoration: none;
		font-weight: 700;
	}
	.site-drawer-quote-link--solo:hover,
	.site-drawer-quote-link--solo:focus { background: var(--color-accent-dark, #d63f00); color: #fff; }


	.header-container {
		max-width: 1240px;
		margin: 0 auto;
		padding: 0 32px;
		display: flex;
		justify-content: space-between;
		align-items: center;

		@media (max-width: 1024px) { flex-direction: column; gap: 12px; }
		@media (max-width: 600px)  { padding: 0 16px; }
	}

	.header-top {
		border-bottom: 1px solid #f0f0f0;
		padding: 8px 0;
	}
	.header-tagline-area {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 6px;

		/* モバイル（ヘッダーが縦並びになる幅）ではロゴ・商材名ラベルを中央寄せ */
		@media (max-width: 1024px) { align-items: center; }
	}
	.header-tagline {
		font-size: 11px;
		color: #666;
		margin: 0;

		@media (max-width: 1024px) { text-align: center; }
	}
	.header-tagline-logo-link { display: inline-block; line-height: 0; }
	.header-tagline-logo { height: 40px; width: auto; display: block; }

	/* ロゴ＋商材名ラベルを横並びにする行 */
	.header-logo-row { display: flex; align-items: center; gap: 12px; }

	/* 商材名ラベル：MV と同系色（--color-primary）の角丸バッジ＋白抜き文字。
	   ロゴ（高さ40px）と同レベルで目立たせるため、ロゴより少し小さい約34px角丸に。 */
	.header-product-label {
		display: inline-block;
		background-color: var(--color-primary);
		color: #fff;
		border-radius: 8px;
		padding: 7px 16px;
		font-size: 20px;
		font-weight: bold;
		line-height: 1;
		letter-spacing: 0.06em;
		white-space: nowrap;

		@media (max-width: 600px) { font-size: 16px; padding: 6px 12px; border-radius: 6px; }
	}
	.header-utility { display: flex; align-items: center; gap: 20px; }
	.header-tel {
		font-size: 18px;
		font-weight: bold;
		color: #002b6b;
		position: relative;

		span {
			display: block;
			font-size: 10px;
			font-weight: normal;
			color: #666;
			margin-top: 2px;
		}
	}
	.header-btns { display: flex; gap: 10px; }

	.btn-contact {
		border: 1px solid #004494;
		color: #004494;
		padding: 6px 15px;
		border-radius: 4px;
		font-size: 13px;
		text-decoration: none;
	}
	.btn-quote {
		background: #f24e00;
		color: #fff;
		padding: 6px 15px;
		border-radius: 4px;
		font-size: 13px;
		text-decoration: none;
		font-weight: bold;
	}

	/* ----- 見積りドロップダウン -----
	   header.php が jamble_quote_menu フィルタから項目を受け取ったときに描画する。
	   トグルは .btn-quote と併用し、マウスオーバー／フォーカス／クリックで開く。
	   各サイトのブランド色は --color-* トークンを参照（未定義時はフォールバック）。 */
	.quote-dropdown { position: relative; display: inline-block; }

	.quote-dropdown-toggle {
		border: 1px solid #f24e00;   /* 隣の .btn-contact と同じ 1px border で高さを揃える */
		cursor: pointer;
		font-family: inherit;
		display: inline-flex;
		align-items: center;
		gap: 6px;
		line-height: 1.4;

		.fa-caret-down { font-size: 11px; }
	}
	.quote-dropdown-toggle:hover,
	.quote-dropdown.is-open .quote-dropdown-toggle {
		background: #d54400;
		border-color: #d54400;
	}

	.quote-dropdown-menu {
		position: absolute;
		top: calc(100% + 6px);
		right: 0;
		min-width: 260px;
		margin: 0;
		padding: 8px 0;
		list-style: none;
		background: #fff;
		border: 1px solid #e0e6ee;
		border-radius: 6px;
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
		z-index: 1000;

		/* デフォルトは閉じる */
		opacity: 0;
		visibility: hidden;
		transform: translateY(-4px);
		transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;

		li { margin: 0; }

		a {
			display: block;
			padding: 10px 16px;
			text-decoration: none;
			color: var(--color-text, #1f2937);
			border-bottom: 1px solid #f0f3f7;
			transition: background 0.15s;
		}
		li:last-child a { border-bottom: 0; }
		a:hover,
		a:focus { background: var(--color-accent-soft, #e8f3fc); outline: none; }
	}
	/* マウスオーバー／フォーカス／クリックで開く */
	.quote-dropdown:hover .quote-dropdown-menu,
	.quote-dropdown:focus-within .quote-dropdown-menu,
	.quote-dropdown.is-open .quote-dropdown-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.quote-name {
		display: block;
		font-size: 14px;
		font-weight: bold;
		color: var(--color-primary, #1c70c5);
		line-height: 1.4;

		.fa-angle-right { margin-left: 6px; font-size: 11px; color: var(--color-accent, #3897dc); }
	}
	.quote-desc {
		display: block;
		font-size: 11px;
		color: #6b7785;
		margin-top: 2px;
		line-height: 1.4;
	}

	/* ----- モバイル（768px 以下）-----
	   電話番号とボタンを縦積み・中央寄せにして横はみ出しを解消し、
	   見積りドロップダウンはトグルではなく全幅の .header-utility を基準にした
	   全幅パネルにすることで、開閉どちらでも画面外へはみ出さないようにする。 */
	@media (max-width: 768px) {
		.header-utility {
			position: relative;       /* ドロップダウンメニューの位置基準にする */
			flex-direction: column;
			gap: 12px;
			width: 100%;
		}
		.header-tel { text-align: center; }
		.header-btns { justify-content: center; flex-wrap: wrap; }

		.quote-dropdown { position: static; }   /* 位置基準を .header-utility へ移す */
		.quote-dropdown-menu {
			top: calc(100% + 6px);
			left: 0;
			right: 0;
			min-width: 0;             /* 固定幅(260px)を解除し、ヘッダー全幅に収める */
		}
		.quote-dropdown-toggle { padding: 6px 10px; font-size: 12px; }
	}

	.header-main {
		padding: 0;
		background: #f7f9fc;
		border-top: 1px solid #e4ebf3;
		border-bottom: 1px solid #e4ebf3;

		/* グローバルナビは ≤1024px で非表示。中身が空になる帯を出さない */
		@media (max-width: 1024px) { display: none; }
	}

	/* ----- グローバルナビ ----- */
	.global-nav {
		flex: 1;

		@media (max-width: 1024px) { display: none; }

		ul {
			display: flex;
			justify-content: space-between;
			list-style: none;
			padding: 0;
			margin: 0;
			flex-wrap: wrap;
		}
		li {
			flex: 1;
			text-align: center;
			border-right: 1px solid #e4ebf3;

			&:last-child { border-right: none; }
		}
		a,
		.nav-dropdown-toggle {
			display: block;
			width: 100%;
			padding: 12px 8px;
			text-decoration: none;
			color: #333;
			font-size: 13px;
			font-weight: bold;
			white-space: nowrap;
			position: relative;
			transition: color 0.25s ease, background-color 0.25s ease;

			&::after {
				content: '';
				position: absolute;
				left: 50%;
				bottom: 0;
				width: 0;
				height: 2px;
				background-color: var(--color-primary);
				transition: width 0.3s ease, left 0.3s ease;
			}
			&:hover {
				color: var(--color-primary);
				background-color: rgba(242, 78, 0, 0.06);

				&::after { width: 100%; left: 0; }
			}
		}

		/* ----- 取り扱い商品ドロップダウン ----- */
		.nav-dropdown { position: relative; }
		.nav-dropdown-toggle {
			background: transparent;
			border: 0;
			cursor: pointer;
			font-family: inherit;
			display: inline-flex;
			align-items: center;
			justify-content: center;
			gap: 6px;
		}
		.nav-dropdown-caret {
			font-size: 10px;
			color: #888;
			transition: transform 0.2s ease, color 0.2s ease;
		}
		.nav-dropdown:hover .nav-dropdown-caret,
		.nav-dropdown.is-open .nav-dropdown-caret {
			transform: rotate(180deg);
			color: var(--color-primary);
		}
		.nav-dropdown.is-open .nav-dropdown-toggle,
		.nav-dropdown:hover .nav-dropdown-toggle {
			color: var(--color-primary);

			&::after { width: 100%; left: 0; }
		}

		.nav-dropdown-menu {
			position: absolute;
			top: 100%;
			left: 0;
			min-width: 280px;
			background: #fff;
			border: 1px solid #e4ebf3;
			border-radius: 10px;
			box-shadow: 0 12px 32px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.04);
			z-index: 1000;
			padding: 6px;

			/* 閉じ状態 */
			opacity: 0;
			visibility: hidden;
			transform: translateY(-6px);
			transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;

			ul {
				display: block;
				list-style: none;
				padding: 0;
				margin: 0;
				flex-wrap: nowrap;
			}
			li {
				flex: none;
				text-align: left;
				border-right: 0;
			}
			a {
				display: flex;
				flex-direction: column;
				gap: 2px;
				padding: 10px 14px;
				border-radius: 6px;
				color: var(--color-text, #1f2937);
				font-weight: 600;
				white-space: normal;
				transition: background-color 0.15s ease, color 0.15s ease;

				&::after { content: none; }
				&:hover, &:focus {
					background: var(--color-accent-soft, #f4f7fb);
					color: var(--color-primary);
					outline: none;
				}
			}
		}
		.nav-dropdown:hover .nav-dropdown-menu,
		.nav-dropdown:focus-within .nav-dropdown-menu,
		.nav-dropdown.is-open .nav-dropdown-menu {
			opacity: 1;
			visibility: visible;
			transform: translateY(0);
		}

		.nav-dropdown-name {
			font-size: 13px;
			line-height: 1.4;
			color: inherit;
		}
		.nav-dropdown-desc {
			font-size: 11px;
			font-weight: 400;
			color: #6b7785;
			line-height: 1.5;
		}
	}

	/* ==========================================================================
	   Site Footer（4列メニュー + 関連サイト + コピーライト）
	   ========================================================================== */
	.site-footer {
		background: #002b6b;
		color: #e5e9f3;
		font-size: 14px;

		a { color: #fff; text-decoration: none; }
	}

	/* 4列メニュー */
	.site-footer-menu {
		padding: 48px 0 24px;
		border-bottom: 1px solid rgba(255, 255, 255, .12);

		.site-footer-menu-grid {
			display: grid;
			grid-template-columns: repeat(4, 1fr);
			gap: 32px;
			text-align: left;
		}
		@media (max-width: 900px) {
			.site-footer-menu-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
		}
		@media (max-width: 480px) {
			.site-footer-menu-grid { grid-template-columns: 1fr; gap: 20px; }
		}

		.site-footer-col-heading {
			margin: 0 0 14px;
			padding-bottom: 8px;
			font-size: 14px;
			font-weight: 700;
			letter-spacing: .03em;
			border-bottom: 2px solid rgba(255, 255, 255, .25);
			color: #fff;
		}
		.site-footer-col-list {
			list-style: none;
			padding: 0;
			margin: 0;

			li { margin: 0; padding: 6px 0; }
			a {
				display: inline-flex;
				align-items: center;
				font-size: 13px;
				line-height: 1.5;
				color: #cfd5e6;
				transition: color .15s ease;

				&::before {
					content: '›';
					margin-right: 6px;
					color: rgba(255, 255, 255, .35);
				}
				&:hover { color: #fff; text-decoration: underline; }
			}
		}
	}

	/* 関連サイトカードグリッド */
	.site-footer-siblings {
		padding: 28px 0;
		border-bottom: 1px solid rgba(255, 255, 255, .12);

		.site-footer-siblings-list {
			list-style: none;
			padding: 0;
			margin: 0;
			display: grid;
			grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
			gap: 12px;
		}
		.site-footer-sibling-item {
			a {
				display: flex;
				flex-direction: column;
				align-items: center;
				gap: 6px;
				padding: 10px 6px;
				background: rgba(255, 255, 255, .06);
				border-radius: 6px;
				transition: background .15s ease, transform .15s ease;
				font-size: 12px;
				color: #fff;
				text-align: center;

				&:hover {
					background: rgba(255, 255, 255, .12);
					transform: translateY(-2px);
					text-decoration: none;
				}
				img {
					width: 56px;
					height: 56px;
					object-fit: contain;
					border-radius: 4px;
					background: rgba(255, 255, 255, .9);
				}
			}
			.site-footer-sibling-label { font-weight: 600; }
		}
	}

	/* コピーライト */
	.site-footer-copyright {
		padding: 16px 0;
		text-align: center;
		font-size: 12px;
		color: #aab3cc;

		p { margin: 0; }
	}

	/* 戻る (legacy support) — 念のため既存クラスも残す */
	.site-info { font-size: 13px; text-align: center; }
	.footer-navigation ul {
		display: flex;
		justify-content: center;
		gap: 20px;
		list-style: none;
		padding: 0;
		margin-top: 15px;
	}

	/* ==========================================================================
	   ページトップへ戻るボタン（右下固定）
	   ========================================================================== */
	.site-page-top {
		position: fixed;
		right: 16px;
		bottom: 16px;
		z-index: 60;
		width: 44px;
		height: 44px;
		border-radius: 50%;
		border: 0;
		background: var(--jamble-color-accent, #f24e00);
		color: #fff;
		font-size: 20px;
		line-height: 1;
		cursor: pointer;
		opacity: 0;
		transform: translateY(8px);
		transition: opacity .2s ease, transform .2s ease, background .15s ease;
		box-shadow: 0 4px 12px rgba(0, 0, 0, .25);

		&.is-visible {
			opacity: 1;
			transform: translateY(0);
		}
		&:hover { background: #d63f00; }
		i { pointer-events: none; }
	}
	@media (max-width: 600px) {
		.site-page-top {
			right: 12px;
			bottom: calc(72px + env(safe-area-inset-bottom)); /* モバイル sticky CTA と重ならないように */
		}
	}

}
