/*
 * header.css
 * 共通ヘッダー（fixed sticky）＋ ドロワーメニュー ＋ CONTACTドロップダウン
 *
 * デザインは mockups/index.html のヘッダーに準拠。
 * カラー・フォントは tokens.css の CSS変数経由。字間は最大3px・italic禁止。
 */

/* ページ内アンカーがヘッダーに隠れないように */
html {
	scroll-padding-top: var(--header-height);
}

/* fixed ヘッダー分のスペースを確保（フルブリードのヒーローを持つpage-front等は
   body にクラスを付けて上書きする想定） */
.site-main {
	padding-top: var(--header-height);
}

/* ===== ヘッダー本体 ===== */
.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--z-header);
	height: var(--header-height);
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: 0 40px;
	background: var(--header-bg);
	border-bottom: 1px solid var(--on-dark-line-soft);
	transition: box-shadow .3s ease;
}

.site-header.is-scrolled {
	box-shadow: 0 4px 30px rgba(0, 0, 0, .25);
}

/* ===== 左：メニューボタン ===== */
.h-menu-btn {
	justify-self: start;
	display: flex;
	align-items: center;
	gap: 12px;
	background: transparent;
	border: none;
	padding: 8px 0;
	color: var(--on-dark-text);
	font-family: var(--f-deco);
	font-size: 13px;
	font-weight: var(--fw-medium);
	letter-spacing: var(--ls-3);
	text-transform: uppercase;
	cursor: pointer;
	transition: color .25s;
}

.h-menu-btn:hover,
.h-menu-btn:focus-visible {
	color: var(--ink);
}

.h-menu-icon {
	position: relative;
	display: inline-block;
	width: 22px;
	height: 12px;
}

.h-menu-icon::before,
.h-menu-icon::after {
	content: '';
	position: absolute;
	left: 0;
	width: 100%;
	height: 1px;
	background: currentColor;
	transition: transform .3s ease;
}

.h-menu-icon::before {
	top: 2px;
}

.h-menu-icon::after {
	bottom: 2px;
}

/* メニュー展開時はアイコンを×に */
.h-menu-btn[aria-expanded="true"] .h-menu-icon::before {
	transform: translateY(3px) rotate(45deg);
}

.h-menu-btn[aria-expanded="true"] .h-menu-icon::after {
	transform: translateY(-3px) rotate(-45deg);
}

/* ===== 中央：ロゴ ===== */
.h-logo {
	position: relative;
	justify-self: center;
	display: flex;
	align-items: center;
	height: 100%;
	padding: 18px 0;
	text-decoration: none;
}

.h-logo .logo-base,
.h-logo .logo-hover {
	display: block;
	height: 56px;
	width: auto;
	transition: opacity .35s ease, transform .5s ease;
}

.h-logo .logo-hover {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%) scale(.92);
	opacity: 0;
}

.h-logo:hover .logo-base {
	opacity: 0;
	transform: scale(1.04);
}

.h-logo:hover .logo-hover {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* ===== 右：CONTACT ===== */
.h-actions {
	justify-self: end;
	display: flex;
}

.contact-dropdown {
	position: relative;
	display: inline-block;
}

.btn-contact {
	display: inline-block;
	padding: 11px 28px;
	white-space: nowrap;
	color: var(--white);
	background: transparent;
	border: 1px solid rgba(255, 255, 255, .4);
	font-family: var(--f-deco);
	font-size: 13px;
	font-weight: var(--fw-medium);
	letter-spacing: var(--ls-3);
	text-transform: uppercase;
	cursor: pointer;
	transition: background .25s, border-color .25s, color .25s;
}

.btn-contact:hover,
.btn-contact:focus-visible {
	background: var(--ink);
	border-color: var(--ink);
	color: var(--white);
}

.contact-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 240px;
	background: var(--paper);
	border: 1px solid var(--border-soft);
	box-shadow: 0 14px 36px rgba(0, 0, 0, .12);
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity .25s ease, transform .25s ease, visibility .25s;
	z-index: 1;
}

.contact-dropdown.is-open .contact-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.contact-menu-item {
	display: block;
	padding: 16px 22px;
	border-bottom: 1px solid var(--border-soft);
	color: var(--ink);
	font-family: var(--f-jp);
	font-size: var(--fs-body);
	font-weight: var(--fw-bold);
	letter-spacing: var(--ls-2);
	text-decoration: none;
	transition: background .2s, color .2s, padding-left .25s;
}

.contact-menu-item:last-child {
	border-bottom: none;
}

.contact-menu-item:hover,
.contact-menu-item:focus-visible {
	background: var(--brand-soft);
	color: var(--brand);
	padding-left: 28px;
}

/* ===== ドロワーメニュー ===== */
.h-drawer {
	position: fixed;
	top: var(--header-height);
	left: 0;
	right: 0;
	z-index: var(--z-drawer);
	max-height: 0;
	overflow: hidden;
	background: var(--header-bg);
	border-bottom: 1px solid var(--on-dark-line-soft);
	transition: max-height .5s cubic-bezier(.4, 0, .2, 1);
}

.h-drawer.is-open {
	max-height: 700px;
}

.h-drawer-inner {
	max-width: var(--container-max);
	margin: 0 auto;
	padding: 36px 40px 48px;
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px 60px;
}

.h-drawer a {
	display: block;
	padding: 14px 0;
	border-bottom: 1px solid var(--on-dark-line);
	color: var(--on-dark-text);
	text-decoration: none;
	transition: color .25s, padding .25s;
}

.h-drawer a:hover,
.h-drawer a:focus-visible {
	color: var(--ink);
	padding-left: 12px;
}

.h-drawer a .en {
	display: block;
	font-family: var(--f-display);
	font-size: clamp(18px, 1.6vw, 22px);
	font-weight: var(--fw-medium);
	letter-spacing: var(--ls-3);
	text-transform: uppercase;
}

.h-drawer a .ja {
	display: block;
	margin-top: 4px;
	color: var(--on-dark-text-mid);
	font-family: var(--f-jp);
	font-size: var(--fs-body);
	font-weight: var(--fw-medium);
	letter-spacing: var(--ls-2);
}

/* ===== レスポンシブ ===== */
@media (max-width: 1024px) {
	.site-header {
		padding: 0 24px;
	}
}

/* スマホ：ロゴを左寄せ（≡の右隣）＋拡大。CONTACTは右端のまま、間は伸びる余白で離す。
   グリッドを「≡(auto) ロゴ(auto) 余白(1fr)＝右端CONTACT」に再構成（PCの中央配置は不変）。 */
@media (max-width: 760px) {
	.site-header {
		grid-template-columns: auto auto 1fr;
		column-gap: 12px;
	}

	/* ロゴは自トラックの左端に置き、≡ のすぐ右隣でひとかたまりにする */
	.h-logo {
		justify-self: start;
	}

	/* ロゴを主役に。画面幅に応じて拡大しつつ上限50px（390pxで約47px）。
	   横長ロゴのため、狭い端末では自動縮小して CONTACT との干渉を防ぐ。 */
	.h-logo .logo-base,
	.h-logo .logo-hover {
		height: clamp(40px, 12vw, 50px);
	}
}

/* スマホ：MENUラベルを隠してアイコンのみ、ドロワーは1カラム */
@media (max-width: 700px) {
	.site-header {
		padding: 0 18px;
	}

	.h-menu-label {
		display: none;
	}

	.btn-contact {
		padding: 10px 18px;
		letter-spacing: var(--ls-2);
	}

	.h-drawer-inner {
		grid-template-columns: 1fr;
		padding: 28px 24px 36px;
		gap: 6px;
	}
}

@media (max-width: 430px) {
	.contact-menu {
		min-width: 200px;
	}
}
