/*
 * Tax Accountant Theme - Header v3 (Louvre Revamp, Sprint 4)
 *
 * Horizontal primary navigation inspired by Louvre.fr:
 *   - Logo left, menu right, gold CTA at the far right
 *   - Initially transparent on dark-hero pages; transitions to solid
 *     off-white with a 1px hairline rule when `.v3-header--solid` is set
 *   - Mobile: logo + CTA + hamburger; sheet overlay for menu
 *
 * All selectors are scoped under `.v3-header` / `.v3-site` so this file can
 * coexist with the v1 header styles. Enqueued alongside design-system-v3.css.
 *
 * @package Tax_Accountant
 * @version 3.4.0
 */

/* ========== Header shell ========== */
.v3-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--v3-z-overlay);
	width: 100%;
	box-sizing: border-box;
	transition:
		background-color var(--v3-dur-base) var(--v3-ease),
		border-color var(--v3-dur-base) var(--v3-ease),
		color var(--v3-dur-base) var(--v3-ease);
	border-bottom: 1px solid transparent;
	color: var(--v3-ink);
	font-family: var(--v3-font-sans);
}

.v3-header--transparent {
	background-color: rgba(26, 26, 26, 0);
	color: var(--v3-ink-inverse);
}

.v3-header--solid,
.v3-header.is-scrolled {
	background-color: var(--v3-bg);
	border-bottom-color: var(--v3-line);
	color: var(--v3-ink);
}

/* Body padding: when the header is not transparent at the start, push the content down
 * so the fixed header does not cover it. Transparent-start pages don't need this because
 * the hero is full-bleed and the header overlays it. */
body:not(.v3-has-transparent-header) .v3-content {
	padding-top: 84px;
}

@media (max-width: 767px) {
	body:not(.v3-has-transparent-header) .v3-content {
		padding-top: 68px;
	}
}

.v3-header__inner {
	width: 100%;
	max-width: var(--v3-container-max);
	margin: 0 auto;
	padding: 0 var(--v3-gutter);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--v3-space-5);
	height: 84px;
	box-sizing: border-box;
}

@media (max-width: 767px) {
	.v3-header__inner {
		height: 68px;
		gap: var(--v3-space-3);
	}
}

/* ========== Brand / wordmark ========== */
.v3-header__brand {
	flex: 0 0 auto;
}

.v3-header__brand-link {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}

.v3-header__wordmark {
	display: inline-flex;
	flex-direction: column;
	line-height: 1.1;
}

.v3-header__wordmark-jp {
	font-family: var(--v3-font-serif);
	font-weight: var(--v3-weight-bold);
	font-size: 20px;
	letter-spacing: 0.04em;
}

.v3-header__wordmark-en {
	font-family: var(--v3-font-sans);
	font-size: 10px;
	letter-spacing: var(--v3-ls-meta);
	text-transform: uppercase;
	margin-top: 2px;
	opacity: 0.78;
}

.v3-header--transparent .v3-header__wordmark-en {
	opacity: 0.9;
}

@media (max-width: 767px) {
	.v3-header__wordmark-jp { font-size: 16px; }
	.v3-header__wordmark-en { font-size: 9px; }
}

/* ========== Primary nav ========== */
.v3-header__nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: flex-end;
}

.v3-nav-menu {
	list-style: none;
	padding: 0;
	margin: 0;
	display: flex;
	align-items: center;
	gap: var(--v3-space-7);
}

.v3-nav-menu > li {
	position: relative;
}

.v3-nav-menu > li > a {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	color: inherit;
	text-decoration: none;
	padding: 8px 2px;
	transition: color var(--v3-dur-fast) var(--v3-ease);
	position: relative;
}

/* When no EN/JA splitters are used (WP menu w/o shortcodes), style link as uppercase mini label */
.v3-nav-menu > li > a:not(:has(.v3-nav__jp)) {
	font-size: 13px;
	letter-spacing: var(--v3-ls-meta);
	text-transform: uppercase;
	font-weight: var(--v3-weight-medium);
}

.v3-nav__jp {
	font-family: var(--v3-font-sans);
	font-size: 14px;
	font-weight: var(--v3-weight-medium);
	letter-spacing: 0.08em;
}

.v3-nav__en {
	font-family: var(--v3-font-sans);
	font-size: 10px;
	letter-spacing: var(--v3-ls-meta);
	text-transform: uppercase;
	opacity: 0.7;
}

.v3-nav-menu > li > a:hover,
.v3-nav-menu > li > a:focus-visible {
	color: var(--v3-gold);
}

.v3-nav-menu > li.current-menu-item > a,
.v3-nav-menu > li.current_page_item > a {
	color: var(--v3-gold);
}

/* Hide WP sub-menus on desktop (v1 primary menu compatibility) */
.v3-nav-menu .sub-menu {
	display: none;
}

/* ========== CTA ========== */
.v3-header__cta-wrap {
	flex: 0 0 auto;
	margin-left: var(--v3-space-5);
}

.v3-header__cta {
	min-height: 44px;
	padding: 10px var(--v3-space-5);
	font-size: 13px;
	font-weight: var(--v3-weight-medium);
	letter-spacing: 0.08em;
	display: inline-flex;
	align-items: center;
	gap: var(--v3-space-2);
}

.v3-header__cta-en {
	font-size: 10px;
	letter-spacing: var(--v3-ls-meta);
	text-transform: uppercase;
	opacity: 0.85;
}

/* ========== Hamburger ========== */
.v3-header__toggle {
	display: none;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	color: inherit;
	position: relative;
}

.v3-header__toggle-line {
	position: absolute;
	left: 10px;
	right: 10px;
	height: 1.5px;
	background-color: currentColor;
	transition: transform var(--v3-dur-fast) var(--v3-ease), opacity var(--v3-dur-fast) var(--v3-ease), top var(--v3-dur-fast) var(--v3-ease);
}

.v3-header__toggle-line:nth-child(1) { top: 15px; }
.v3-header__toggle-line:nth-child(2) { top: 21px; }
.v3-header__toggle-line:nth-child(3) { top: 27px; }

.v3-header__toggle[aria-expanded="true"] .v3-header__toggle-line:nth-child(1) {
	top: 21px;
	transform: rotate(45deg);
}
.v3-header__toggle[aria-expanded="true"] .v3-header__toggle-line:nth-child(2) {
	opacity: 0;
}
.v3-header__toggle[aria-expanded="true"] .v3-header__toggle-line:nth-child(3) {
	top: 21px;
	transform: rotate(-45deg);
}

/* ========== Mobile sheet ========== */
.v3-header__sheet {
	position: fixed;
	inset: 0;
	background-color: var(--v3-bg);
	color: var(--v3-ink);
	z-index: calc(var(--v3-z-overlay) - 1);
	overflow-y: auto;
	padding: 96px var(--v3-gutter) 48px;
	box-sizing: border-box;
}

.v3-header__sheet[hidden] { display: none; }

.v3-header__sheet-inner {
	max-width: 480px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
	gap: var(--v3-space-7);
	position: relative;
}

/* Explicit close button inside the sheet */
.v3-header__sheet-close {
	position: absolute;
	top: -64px;
	right: 0;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	width: 56px;
	height: 56px;
	padding: 0;
	border: 1px solid var(--v3-rule-color, rgba(26, 26, 26, 0.12));
	background: transparent;
	color: var(--v3-ink);
	cursor: pointer;
	border-radius: 50%;
	transition: background-color var(--v3-dur-fast) var(--v3-ease), border-color var(--v3-dur-fast) var(--v3-ease);
}

.v3-header__sheet-close:hover,
.v3-header__sheet-close:focus-visible {
	background-color: rgba(26, 26, 26, 0.04);
	border-color: var(--v3-ink);
}

.v3-header__sheet-close-ico {
	font-size: 24px;
	line-height: 1;
	font-weight: 300;
}

.v3-header__sheet-close-label {
	font-size: 9px;
	letter-spacing: 0.12em;
}

/* Force solid header colors when the mobile sheet is open
   so the hamburger-X icon stays visible against the off-white sheet bg. */
body.v3-sheet-open .v3-header {
	background-color: var(--v3-bg);
	color: var(--v3-ink);
	border-bottom: var(--v3-rule);
}

body.v3-sheet-open .v3-header__toggle,
body.v3-sheet-open .v3-header__wordmark-jp,
body.v3-sheet-open .v3-header__wordmark-en {
	color: var(--v3-ink);
}

.v3-nav-menu--mobile {
	flex-direction: column;
	align-items: stretch;
	gap: 0;
	border-top: var(--v3-rule);
}

.v3-nav-menu--mobile > li {
	border-bottom: var(--v3-rule);
}

.v3-nav-menu--mobile > li > a {
	flex-direction: row;
	justify-content: space-between;
	align-items: baseline;
	padding: var(--v3-space-5) 0;
	width: 100%;
}

.v3-nav-menu--mobile .v3-nav__jp {
	font-size: 18px;
}

.v3-nav-menu--mobile .v3-nav__en {
	font-size: 11px;
}

.v3-header__sheet-cta {
	width: 100%;
	text-align: center;
	justify-content: center;
}

/* ========== Responsive ========== */
@media (max-width: 1023px) {
	.v3-nav-menu { gap: var(--v3-space-5); }
	.v3-header__cta-wrap { margin-left: var(--v3-space-4); }
}

@media (max-width: 899px) {
	.v3-header__nav { display: none; }
	.v3-header__toggle { display: inline-flex; align-items: center; justify-content: center; }
}

@media (max-width: 479px) {
	.v3-header__cta-wrap { display: none; }
}

/* Accessibility: focus ring within header */
.v3-header a:focus-visible,
.v3-header button:focus-visible {
	outline: var(--v3-focus-ring);
	outline-offset: var(--v3-focus-offset);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.v3-header,
	.v3-nav-menu > li > a,
	.v3-header__toggle-line {
		transition: none;
	}
}

/* Skip link: reuse v1 styling (already defined) but ensure above v3 header */
.v3-site .skip-link:focus {
	z-index: calc(var(--v3-z-overlay) + 1);
}
