/*
 * type_compass_header.css
 * ヘッダー専用スタイル：ハンバーガーメニュー（モバイル）、通知ドロップダウン。
 * 基礎トークンは style.css の :root 変数を参照する。
 */

/* ---------- ヘッダー全体のレイアウト ----------
 * 配置をこのファイル内で完結させる（以前は .tc-flex-between が tc-ui-kit.css 側のみの
 * 定義で、ナビも inline style で固定されていたため、折り返し・モバイル非表示が効かず
 * メニューが1文字ずつ折り返して崩れていた）。
 * デスクトップ：1段目＝ロゴ／右上ユーティリティ、2段目＝メインナビ（折り返さず整列）。
 */
.tc-header__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"brand utils"
		"nav   nav";
	align-items: center;
	column-gap: var(--tc-space-2);
	padding-block: var(--tc-space-2);
}
.tc-header__brand {
	grid-area: brand;
	display: flex;
	align-items: center;
	gap: 0.6em;
	color: var(--tc-color-white);
	white-space: nowrap;
}
.tc-header__nav-desktop {
	grid-area: nav;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 var(--tc-space-3);
	margin-top: 0.25rem;
}
.tc-header__link {
	color: var(--tc-color-navy-300);
	font-size: var(--tc-fs-sm);
	white-space: nowrap;
	padding-block: 0.5em;
}
.tc-header__link:hover { color: var(--tc-color-white); }

.tc-header__utils {
	grid-area: utils;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--tc-space-2);
}
.tc-header__burger-wrap {
	grid-area: utils;
	display: none;
	align-items: center;
	justify-content: flex-end;
}

/* ---------- ドロップダウン（言語切替・ユーザーメニュー） ---------- */
.tc-header__dropdown { position: relative; }
.tc-header__dropdown-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.4em 0.5em;
	border: none;
	border-radius: var(--tc-radius-sm);
	background: transparent;
	color: var(--tc-color-navy-300);
	font: inherit;
	font-size: var(--tc-fs-sm);
	white-space: nowrap;
	cursor: pointer;
}
.tc-header__dropdown-btn:hover { background: rgba(255,255,255,0.08); }
.tc-header__user-btn { color: var(--tc-color-white); }
.tc-header__user-name {
	max-width: 14em;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tc-header__dropdown-panel {
	position: absolute;
	right: 0;
	top: calc(100% + 8px);
	min-width: 140px;
	padding: 0.4em;
	background: var(--tc-color-white);
	border-radius: var(--tc-radius-sm);
	box-shadow: var(--tc-shadow-md);
	display: none;
	z-index: var(--tc-z-header);
}
.tc-header__dropdown--user .tc-header__dropdown-panel { min-width: 180px; }
.tc-header__dropdown-panel.is-open { display: block; }
.tc-header__dropdown-item {
	display: block;
	padding: 0.5em 0.6em;
	border-radius: 4px;
	font-size: var(--tc-fs-sm);
	color: var(--tc-color-gray-800);
	white-space: nowrap;
}
.tc-header__dropdown-item:hover { background: var(--tc-color-gray-050); }
.tc-header__dropdown-item.is-current { font-weight: 700; }
.tc-header__dropdown-item--danger { color: var(--tc-color-danger); }
.tc-header__dropdown-role {
	margin: 0 0 0.4em;
	padding: 0.2em 0.6em;
	font-size: var(--tc-fs-xs);
	color: var(--tc-color-gray-400);
}

/* ---------- メインナビ：目的別グループ（ドロップダウン） ---------- */
.tc-header__group-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.45em;
	padding: 0.5em 0.2em;
	border: none;
	background: transparent;
	color: var(--tc-color-navy-300);
	font: inherit;
	font-size: var(--tc-fs-sm);
	white-space: nowrap;
	cursor: pointer;
	box-shadow: inset 0 -2px 0 transparent;
}
.tc-header__group-btn:hover,
.tc-header__group-btn[aria-expanded="true"] { color: var(--tc-color-white); }
.tc-header__group-btn.is-current {
	color: var(--tc-color-white);
	box-shadow: inset 0 -2px 0 var(--tc-color-purple-300);
}
.tc-header__caret {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	opacity: 0.7;
	transition: transform var(--tc-duration-fast) var(--tc-ease);
}
[aria-expanded="true"] > .tc-header__caret { transform: rotate(180deg); }
.tc-header__dropdown-panel--left { left: 0; right: auto; min-width: 230px; }
.tc-header__dropdown-heading {
	margin: 0.5em 0 0.2em;
	padding: 0.5em 0.6em 0.2em;
	border-top: 1px solid var(--tc-color-gray-100);
	font-size: var(--tc-fs-xs);
	font-weight: 700;
	color: var(--tc-color-gray-400);
}
.tc-header__dropdown-item.is-current {
	background: var(--tc-color-gray-050);
	font-weight: 700;
}
.tc-header__dropdown-btn:focus-visible,
.tc-header__group-btn:focus-visible,
.tc-header__dropdown-item:focus-visible {
	outline: 2px solid var(--tc-color-purple-300);
	outline-offset: 2px;
}

/* ---------- ハンバーガーボタン（モバイルのみ表示） ---------- */
.tc-header__burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	border: none;
	background: transparent;
	cursor: pointer;
	padding: 0;
}
.tc-header__burger span {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--tc-color-white);
	border-radius: 2px;
	transition: transform var(--tc-duration-fast) var(--tc-ease), opacity var(--tc-duration-fast) var(--tc-ease);
	margin: 0 auto;
}
.tc-header__burger.is-active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.tc-header__burger.is-active span:nth-child(2) { opacity: 0; }
.tc-header__burger.is-active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- モバイルナビゲーションドロワー ---------- */
@media (max-width: 860px) {
	.tc-header__burger { display: flex; }

	.tc-header__nav-desktop,
	.tc-header__utils { display: none; }

	.tc-header__inner {
		grid-template-areas: "brand utils";
	}
	.tc-header__burger-wrap { display: flex; }

	/* ドロワー内：目的別グループのアコーディオン */
	.tc-header__acc-list { margin-top: var(--tc-space-3); }
	.tc-header__acc { border-bottom: 1px solid rgba(255,255,255,0.08); }
	.tc-header__acc-btn {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		padding: 0.9em 0.4em;
		border: none;
		background: transparent;
		color: var(--tc-color-white);
		font: inherit;
		font-size: var(--tc-fs-md);
		font-weight: 600;
		text-align: left;
		cursor: pointer;
	}
	.tc-header__acc-btn.is-current { color: var(--tc-color-purple-300); }
	.tc-header__acc-panel { display: none; padding: 0 0 0.6em 0.8em; }
	.tc-header__acc.is-open .tc-header__acc-panel { display: block; }
	.tc-header__acc.is-open .tc-header__caret { transform: rotate(180deg); }
	.tc-header__acc-heading {
		margin: 0.8em 0 0.2em;
		font-size: var(--tc-fs-xs);
		font-weight: 700;
		color: var(--tc-color-purple-300);
	}
	.tc-header__acc-item {
		display: block;
		padding: 0.7em 0.4em;
		color: var(--tc-color-navy-300);
		font-size: var(--tc-fs-sm);
	}
	.tc-header__acc-item:hover,
	.tc-header__acc-item.is-current { color: var(--tc-color-white); }
	.tc-header__acc-item.is-current { font-weight: 700; }

	/* ドロワー内の言語切替 */
	.tc-header__drawer-lang {
		margin-top: var(--tc-space-3);
		padding-top: var(--tc-space-2);
		border-top: 1px solid rgba(255,255,255,0.08);
	}
	.tc-header__drawer-lang-title {
		margin: 0 0 0.6em;
		font-size: var(--tc-fs-xs);
		color: var(--tc-color-purple-300);
		font-weight: 600;
	}
	.tc-header__drawer-lang-list { display: flex; flex-wrap: wrap; gap: 0.5em; }
	.tc-header__drawer-lang-item {
		padding: 0.45em 0.9em;
		border: 1px solid rgba(255,255,255,0.18);
		border-radius: var(--tc-radius-full);
		color: var(--tc-color-navy-300);
		font-size: var(--tc-fs-sm);
		white-space: nowrap;
	}
	.tc-header__drawer-lang-item.is-current {
		color: var(--tc-color-white);
		border-color: var(--tc-color-purple-300);
	}

	.tc-header__drawer {
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		width: min(84vw, 340px);
		background: var(--tc-color-navy-900);
		box-shadow: -8px 0 32px rgba(10, 22, 40, 0.35);
		z-index: var(--tc-z-modal);
		padding: var(--tc-space-4) var(--tc-space-3);
		transform: translateX(100%);
		transition: transform var(--tc-duration-slow) var(--tc-ease);
		overflow-y: auto;
	}
	.tc-header__drawer.is-open { transform: translateX(0); }

	.tc-header__drawer-backdrop {
		position: fixed;
		inset: 0;
		background: rgba(10, 22, 40, 0.5);
		z-index: calc(var(--tc-z-modal) - 1);
		opacity: 0;
		pointer-events: none;
		transition: opacity var(--tc-duration-slow) var(--tc-ease);
	}
	.tc-header__drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

	.tc-header__drawer-close {
		display: block;
		margin-left: auto;
		width: 36px;
		height: 36px;
		border: none;
		border-radius: 50%;
		background: rgba(255,255,255,0.08);
		color: var(--tc-color-white);
		font-size: 1.2rem;
	}

	.tc-header__drawer-list {
		list-style: none;
		margin: var(--tc-space-3) 0 0;
		padding: 0;
		display: flex;
		flex-direction: column;
		gap: var(--tc-space-1);
	}
	.tc-header__drawer-list a {
		display: block;
		padding: 0.85em 0.4em;
		color: var(--tc-color-navy-300);
		font-size: var(--tc-fs-md);
		border-bottom: 1px solid rgba(255,255,255,0.06);
	}
	.tc-header__drawer-list a:hover { color: var(--tc-color-white); }
}

@media (min-width: 861px) {
	.tc-header__drawer,
	.tc-header__drawer-backdrop,
	.tc-header__drawer-close,
	.tc-header__drawer-lang,
	.tc-header__acc-list,
	.tc-header__burger-wrap { display: none; }
}

/* ---------- 通知ベル ---------- */
.tc-header__notify {
	position: relative;
	display: inline-flex;
}
.tc-header__notify-btn {
	position: relative;
	width: 38px;
	height: 38px;
	border: none;
	border-radius: 50%;
	background: rgba(255,255,255,0.06);
	color: var(--tc-color-white);
	font-size: 1.1rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background var(--tc-duration-fast) var(--tc-ease);
}
.tc-header__notify-btn:hover { background: rgba(255,255,255,0.14); }

.tc-header__notify-badge {
	position: absolute;
	top: 2px;
	right: 2px;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: var(--tc-radius-full);
	background: var(--tc-color-danger);
	color: var(--tc-color-white);
	font-size: 10px;
	line-height: 16px;
	text-align: center;
	font-weight: 700;
}

.tc-header__notify-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: 300px;
	max-width: 82vw;
	background: var(--tc-color-white);
	border-radius: var(--tc-radius-md);
	box-shadow: var(--tc-shadow-lg);
	padding: var(--tc-space-2);
	display: none;
	z-index: var(--tc-z-header);
}
.tc-header__notify-panel.is-open { display: block; animation: tc-fade-in var(--tc-duration-base) var(--tc-ease); }

.tc-header__notify-item {
	display: block;
	padding: 0.7em 0.6em;
	border-radius: var(--tc-radius-sm);
	font-size: var(--tc-fs-sm);
	color: var(--tc-color-gray-800);
}
.tc-header__notify-item:hover { background: var(--tc-color-gray-050); }
.tc-header__notify-item + .tc-header__notify-item { border-top: 1px solid var(--tc-color-gray-100); }
.tc-header__notify-item time { display: block; font-size: var(--tc-fs-xs); color: var(--tc-color-gray-400); margin-top: 0.2em; }
.tc-header__notify-empty { padding: var(--tc-space-3); text-align: center; font-size: var(--tc-fs-sm); color: var(--tc-color-gray-400); }

/* ---------- スクロール時のヘッダー圧縮 ---------- */
.tc-header { transition: box-shadow var(--tc-duration-base) var(--tc-ease); }
.tc-header.is-scrolled { box-shadow: 0 4px 20px rgba(10, 22, 40, 0.25); }

/* ---------- ロゴ画像（丸いマーク部分の差し替え） ----------
   管理画面「カスタマイズ > サイト基本情報 > ロゴ」、または
   assets/images/brand/logo-header.(svg|png|webp) の画像を表示する。
   高さを固定し、横幅は画像の縦横比に合わせる（極端に横長な画像は幅で制限）。 */
.tc-header__logo-img {
	display: block;
	height: 32px;
	width: auto;
	max-width: 120px;
	object-fit: contain;
	flex: 0 0 auto;
}
