/*
 * Nyappu Header — global navigation and skip link.
 * Spec: docs/navigation-design-brief.md. Selectors stay under .nyappu-header / .nyappu-skip-link.
 * One compact sticky row, page background with a thin rule. No fixed clone, search, shadow or pill UI.
 */

/* Skip link: off-screen until focused, then shown at the top-left. */
.nyappu-skip-link {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 1000;
	padding: 10px 16px;
	border: 1px solid #2f6b63;
	background: #faf8f4;
	color: #2a2724;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.5;
	text-decoration: none;
	transform: translateY(calc(-100% - 16px));
}
.nyappu-skip-link:focus {
	transform: none;
	outline: 2px solid #2f6b63;
	outline-offset: 2px;
}

.nyappu-ui.nyappu-header {
	position: relative;
	background: var(--ny-color-bg);
	border-bottom: var(--ny-border-width) solid var(--ny-color-border);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.5;
}

.nyappu-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	column-gap: 4px;
	max-width: calc(var(--ny-container-wide) + 2 * var(--ny-gutter-mobile));
	min-height: 56px;
	margin: 0 auto;
	padding: 0 var(--ny-gutter-mobile);
}

.nyappu-header__brand {
	display: flex;
	align-items: center;
	/* Fixes the row height so opening the menu does not shift the brand row. */
	min-height: 56px;
	margin-right: auto;
}
.nyappu-header .c-headLogo {
	margin: 0;
	padding: 0;
	font-size: 20px;
	font-weight: var(--ny-weight-strong);
	line-height: 1;
	/* Text wordmark (docs/visual-direction.md §7): open tracking, proportional kana. */
	letter-spacing: var(--ny-tracking-wordmark);
	font-feature-settings: "palt" 1;
}
.nyappu-header .c-headLogo__link {
	display: inline-flex;
	align-items: center;
	min-height: var(--ny-tap-target);
	color: var(--ny-color-text);
	/* SWELL sizes the text logo in vw; keep one brand size per breakpoint. */
	font-size: inherit;
	text-decoration: none;
}

.nyappu-header__explore {
	display: inline-flex;
	align-items: center;
	min-height: var(--ny-tap-target);
	padding: 0 8px;
	color: var(--ny-color-link);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
.nyappu-header__explore:hover {
	color: var(--ny-color-link-hover);
	text-decoration: underline;
	text-underline-offset: .2em;
}

.nyappu-header__toggle {
	display: inline-flex;
	align-items: center;
	/* Same width for 「メニュー」 and 「閉じる」 so the explore link does not move on toggle. */
	min-width: 68px;
	min-height: var(--ny-tap-target);
	justify-content: flex-end;
	margin: 0 -4px 0 0;
	padding: 0 4px 0 8px;
	border: 0;
	background: transparent;
	color: #57514c;
	font: inherit;
	font-size: 14px;
	font-weight: 400;
	letter-spacing: .02em;
	white-space: nowrap;
	cursor: pointer;
}
.nyappu-header__toggle[hidden] { display: none; }
/* 「閉じる」 is a secondary action: quieter than the brand and the links it reveals. */
.nyappu-header__toggle[aria-expanded="true"] { color: var(--ny-color-text-muted); }

/*
 * Mobile menu: pushes the page down below the header row.
 * Hierarchy comes from type and spacing; the header's own bottom rule is the only line.
 */
.nyappu-header__menu {
	flex-basis: 100%;
	padding: 0 0 16px;
}
.nyappu-header__menu[hidden] { display: none; }
.nyappu-header__menu ul {
	margin: 0;
	padding: 0;
	list-style: none;
}
.nyappu-header__menu li { margin: 0; }
.nyappu-header__primary a {
	display: flex;
	align-items: center;
	min-height: 48px;
	color: var(--ny-color-text);
	font-size: 16px;
	font-weight: 600;
	letter-spacing: .02em;
	text-decoration: none;
}
.nyappu-header__utility {
	display: flex;
	flex-wrap: wrap;
	column-gap: 24px;
	margin-top: 8px;
}
.nyappu-header__utility a {
	display: inline-flex;
	align-items: center;
	min-height: var(--ny-tap-target);
	color: var(--ny-color-text-muted);
	font-size: 15px;
	font-weight: 400;
	text-decoration: none;
}
.nyappu-header__menu a:hover {
	text-decoration: underline;
	text-underline-offset: .3em;
}

/*
 * M4 (GAP-029, docs/visual-direction-v2.md §5): the push-down menu opens and closes in 200ms, no bounce.
 * Applies only when the JS-driven toggle is present (toggle not [hidden]) and html.js-motion is set, so without JS
 * or with reduced motion the menu is simply shown / hidden as before. max-height is the one allowed layout property.
 * hidden is still toggled by nyappu-header.js; .is-open drives the transition in between.
 */
html.js-motion .nyappu-header__toggle:not([hidden]) + .nyappu-header__menu {
	max-height: 0;
	padding-bottom: 0;
	overflow: hidden;
	opacity: 0;
	transition:
		max-height var(--ny-motion-dur-ui) var(--ny-motion-ease),
		opacity var(--ny-motion-dur-ui) var(--ny-motion-ease);
}
html.js-motion .nyappu-header__toggle:not([hidden]) + .nyappu-header__menu.is-open {
	max-height: 480px; /* above the tallest mobile menu (3 primary + 2 utility links) */
	opacity: 1;
}
html.js-motion .nyappu-header__toggle:not([hidden]) + .nyappu-header__menu .nyappu-header__utility { padding-bottom: 16px; }
/* Current page keeps its level in the hierarchy: aria-current carries the state, the page H1 and breadcrumb show location. */

@media (min-width: 768px) {
	.nyappu-header__inner {
		min-height: 64px;
		column-gap: 8px;
	}
	.nyappu-header__brand { min-height: 64px; }
	.nyappu-header .c-headLogo { font-size: 22px; }
	.nyappu-header__toggle { display: none; }
	.nyappu-header__menu,
	.nyappu-header__menu[hidden],
	html.js-motion .nyappu-header__toggle:not([hidden]) + .nyappu-header__menu {
		display: block;
		flex-basis: auto;
		padding: 0;
		border: 0;
		max-height: none;
		overflow: visible;
		opacity: 1;
		transition: none;
	}
	html.js-motion .nyappu-header__toggle:not([hidden]) + .nyappu-header__menu .nyappu-header__utility { padding-bottom: 0; }
	.nyappu-header__primary { display: flex; }
	.nyappu-header__primary a {
		min-height: var(--ny-tap-target);
		padding: 0 8px;
		font-size: 15px;
		font-weight: 400;
		letter-spacing: 0;
	}
	/* Utility links live in the Footer on desktop. */
	.nyappu-header__utility { display: none; }
}
