/*
 * Layout: page frame, skip link, prototype notice, header and navigation.
 */
.tz-container {
	width: 100%;
	max-width: calc(var(--tz-wide) + 2 * var(--tz-gutter));
	margin-inline: auto;
	padding-inline: var(--tz-gutter);
}

/* Keep the footer at the bottom of short pages. */
body {
	display: flex;
	flex-direction: column;
	min-height: 100svh;
}

.tz-main {
	display: block;
	flex: 1 0 auto;
}

.tz-main:focus {
	outline: none;
}

.tz-skip-link {
	position: absolute;
	top: var(--tz-space-2xs);
	left: var(--tz-space-2xs);
	z-index: 100;
	padding: var(--tz-space-xs) var(--tz-space-s);
	background: var(--tz-text);
	color: var(--tz-bg);
	font-weight: 700;
	text-decoration: none;
	transform: translateY(-200%);
}

.tz-skip-link:focus {
	transform: none;
}

/* The curtain as a thin rule — the site's signature. */
.tz-maku-rule {
	height: 4px;
	background: var(--tz-maku);
}

.tz-maku-rule--short {
	width: 6rem;
}

/* Prototype notice */
.tz-proto {
	background: var(--tz-stage-bg);
	color: var(--tz-stage-text);
	--tz-focus: var(--tz-stage-text);
}

.tz-proto__text {
	max-width: calc(var(--tz-wide) + 2 * var(--tz-gutter));
	margin-inline: auto;
	padding: 0.5rem var(--tz-gutter);
	font-size: var(--tz-step--1);
	line-height: 1.5;
}

.tz-proto__text::before {
	content: "";
	display: inline-block;
	width: 1.5rem;
	height: 0.5rem;
	margin-inline-end: 0.625rem;
	background: linear-gradient(90deg, var(--tz-maku-black) 0 33.3%, var(--tz-maku-kaki) 33.3% 66.6%, var(--tz-maku-moegi) 66.6%);
	outline: 1px solid var(--tz-stage-line);
	vertical-align: 0.05em;
}

/* Header */
.tz-header {
	position: sticky;
	top: 0;
	z-index: 50;
	border-bottom: 1px solid var(--tz-line);
	background: var(--tz-bg);
}

/* Logged-in visitors: sit below the fixed admin toolbar (it scrolls away below 600px). */
.admin-bar .tz-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar .tz-header {
		top: 0;
	}
}

.tz-header::before {
	content: "";
	display: block;
	height: 4px;
	background: var(--tz-maku);
}

/*
 * Phones and tablets: a wrapping row, so with enlarged text (browser font size, text zoom)
 * the Book link and Menu button move to a second line instead of off the screen (review
 * A11Y-3). The grid areas take over from the desktop breakpoint.
 */
.tz-header__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	column-gap: var(--tz-space-2xs);
	max-width: calc(var(--tz-wide) + 2 * var(--tz-gutter));
	min-height: var(--tz-header-h);
	margin-inline: auto;
	padding-inline: var(--tz-gutter);
}

.tz-brand {
	grid-area: brand;
	display: inline-flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 0.5rem;
	margin-inline-end: auto;
	padding-block: 0.25rem;
	color: var(--tz-text);
	text-decoration: none;
}

.tz-brand__name,
.tz-brand__kanji {
	white-space: nowrap;
}

.tz-brand__name {
	font-family: var(--tz-font-display);
	font-size: 1.25rem;
	font-weight: 800;
	letter-spacing: 0.02em;
}

.tz-brand__kanji {
	color: var(--tz-text-muted);
	font-family: var(--tz-font-display);
	font-size: 0.8125rem;
	font-weight: 500;
	letter-spacing: 0.12em;
}

.tz-header__book {
	grid-area: book;
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding: 0.375rem 0.875rem;
	border-radius: var(--tz-radius);
	background: var(--tz-action-bg);
	color: var(--tz-action-text);
	font-size: var(--tz-step--1);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
}

.tz-header__book:hover {
	background: var(--tz-action-bg-hover);
}

.tz-header__book-long {
	display: none;
}

.tz-nav-toggle {
	grid-area: toggle;
	display: none;
	align-items: center;
	gap: 0.375rem;
	min-height: 2.75rem;
	padding: 0.375rem 0.25rem 0.375rem 0.5rem;
	border: 0;
	background: none;
	color: var(--tz-text);
	font: inherit;
	font-size: var(--tz-step--1);
	font-weight: 500;
	cursor: pointer;
}

/* Three bars in the curtain's colours. */
.tz-nav-toggle__bars {
	display: grid;
	gap: 4px;
	width: 1.25rem;
}

.tz-nav-toggle__bars span {
	height: 2px;
	background: var(--tz-text);
	transition: transform var(--tz-duration) var(--tz-ease), opacity var(--tz-duration) var(--tz-ease);
}

.tz-nav-toggle__bars span:nth-child(2) {
	background: var(--tz-accent);
}

.tz-nav-toggle__bars span:nth-child(3) {
	background: var(--tz-positive);
}

.tz-nav-toggle[aria-expanded="true"] .tz-nav-toggle__bars span:nth-child(1) {
	transform: translateY(6px) rotate(45deg);
}

.tz-nav-toggle[aria-expanded="true"] .tz-nav-toggle__bars span:nth-child(2) {
	opacity: 0;
}

.tz-nav-toggle[aria-expanded="true"] .tz-nav-toggle__bars span:nth-child(3) {
	transform: translateY(-6px) rotate(-45deg);
}

.tz-header__panel {
	grid-area: panel;
	flex-basis: 100%;
	padding-block: var(--tz-space-s) var(--tz-space-m);
}

.tz-js .tz-nav-toggle {
	display: inline-flex;
}

.tz-js .tz-header__panel:not(.is-open) {
	display: none;
}

/* The header is sticky, so an open menu scrolls inside itself on short screens. */
.tz-header__panel.is-open {
	max-height: calc(100svh - var(--tz-header-h) - 4px);
	overflow-y: auto;
	overscroll-behavior: contain;
}

.tz-nav__list,
.tz-lang__list,
.tz-footer__menu {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tz-nav__list li + li,
.tz-lang__list li + li,
.tz-footer__menu li + li {
	margin-top: 0;
}

.tz-nav__list a {
	display: block;
	padding-block: 0.625rem;
	border-bottom: 1px solid var(--tz-line);
	font-family: var(--tz-font-display);
	font-size: var(--tz-step-2);
	font-weight: 700;
	text-decoration: none;
}

.tz-nav__list a[aria-current="page"] {
	text-decoration: underline;
	text-decoration-color: var(--tz-link-underline);
	text-decoration-thickness: 2px;
}

.tz-lang--header {
	margin-top: var(--tz-space-m);
}

.tz-lang__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--tz-space-2xs);
}

/* 44px targets for the language switcher on phones (review UX-2); the desktop header is denser. */
.tz-lang__link {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding: 0.25rem 0.875rem;
	border: 1px solid var(--tz-line-strong);
	border-radius: var(--tz-radius);
	font-size: var(--tz-step--1);
	font-weight: 500;
	text-decoration: none;
}

.tz-lang__link[aria-current="true"] {
	border-color: var(--tz-text);
	background: var(--tz-text);
	color: var(--tz-bg);
}

/* Very narrow phones: the bars alone mark the menu; the label stays as its accessible name. */
@media (max-width: 22em) {
	.tz-nav-toggle__label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

@media (min-width: 30em) {
	.tz-header__bar {
		column-gap: var(--tz-space-xs);
	}

	.tz-brand__name {
		font-size: 1.375rem;
	}
}

/*
 * One-row desktop header. The brand, six menu items, the language switcher and the Book link
 * need about 1,120px with the web fonts and 1,220px with the fallback fonts (measured
 * 2026-09-28); below that they wrapped, making the header taller and shifting the page when
 * the web fonts arrived (review PERF-3). So the Menu button stays up to 80em (1280px).
 */
@media (min-width: 80em) {
	.tz-header__bar {
		display: grid;
		grid-template-columns: auto 1fr auto;
		grid-template-areas: "brand panel book";
		column-gap: var(--tz-space-m);
	}

	.tz-brand {
		flex-wrap: nowrap;
		margin-inline-end: 0;
	}

	.tz-js .tz-nav-toggle,
	.tz-nav-toggle {
		display: none;
	}

	.tz-js .tz-header__panel:not(.is-open),
	.tz-header__panel,
	.tz-header__panel.is-open {
		display: flex;
		max-height: none;
		overflow: visible;
		align-items: center;
		justify-content: flex-end;
		gap: var(--tz-space-m);
		padding: 0;
	}

	.tz-nav__list {
		display: flex;
		gap: var(--tz-space-s);
	}

	.tz-nav__list a {
		padding-block: 0.5rem;
		border: 0;
		font-family: var(--tz-font-body);
		font-size: var(--tz-step--1);
		font-weight: 500;
		white-space: nowrap;
	}

	.tz-lang--header .tz-lang__list {
		flex-wrap: nowrap;
	}

	.tz-nav__list a:hover {
		text-decoration: underline;
		text-decoration-color: var(--tz-link-underline);
	}

	.tz-lang--header {
		margin: 0;
	}

	.tz-lang--header .tz-lang__link {
		min-height: 2rem;
		padding-inline: 0.625rem;
		font-size: var(--tz-step--2);
	}

	.tz-header__book-short {
		display: none;
	}

	.tz-header__book-long {
		display: inline;
	}
}
