/* ==========================================================================
   VII Breaths — base, layout, components
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
ul,
ol {
	margin: 0;
}

ul[class],
ol[class] {
	list-style: none;
	padding: 0;
}

img {
	max-width: 100%;
	height: auto;
	display: block;
}

button {
	font: inherit;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

/* --- Base ----------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
	-webkit-text-size-adjust: 100%;
	/* Anchored sections stop below the sticky header, never under it.
	   main.js keeps --vii-header-offset in step with the header's real
	   height; the token is the fallback before the script runs. */
	scroll-padding-top: calc(var(--vii-header-offset, var(--vii-header-h)) + var(--vii-space-s));
}

body {
	background-color: var(--vii-kraft);
	color: var(--vii-on-kraft);
	font-family: var(--vii-font-body);
	font-size: var(--vii-step-0);
	line-height: var(--vii-leading-body);
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

h1,
h2,
h3 {
	font-family: var(--vii-font-display);
	font-weight: var(--vii-weight-display);
	line-height: var(--vii-leading-tight);
	letter-spacing: 0.004em;
	text-wrap: balance;
}

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
	outline: 2px solid var(--vii-red);
	outline-offset: 3px;
}

::selection {
	background: var(--vii-red);
	color: var(--vii-kraft);
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 999;
	background: var(--vii-red);
	color: #fff;
	padding: var(--vii-space-2xs) var(--vii-space-s);
}

.skip-link:focus {
	left: var(--vii-space-s);
	top: var(--vii-space-s);
}

/* --- Grain: the kraft board this is all printed on ------------------------ */

.grain {
	position: fixed;
	inset: 0;
	z-index: 9999;
	pointer-events: none;
	opacity: 0.12;
	mix-blend-mode: multiply;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Washi: the bone ground is paper ---------------------------------------
   Kraft stays board and ink stays ink — only the lifted panels take the
   fibre. Layers are multiplied so the ground darkens a touch rather than
   picking up a cast; contrast against --vii-on-kraft improves slightly. --- */

.is-ground-bone {
	background-image: var(--vii-washi-fibres), var(--vii-washi-tone);
	background-size: 420px 420px, 900px 900px;
	background-position: 0 0, 0 0;
	background-blend-mode: multiply, multiply;
}

/* The form fields sit on the same paper. */
.split__form input[type="text"],
.split__form input[type="email"],
.split__form input[type="tel"],
.split__form textarea,
.split__form select {
	background-image: var(--vii-washi-fibres);
	background-size: 420px 420px;
	background-blend-mode: multiply;
}

/* --- Layout --------------------------------------------------------------- */

.wrap {
	width: min(100% - (var(--vii-gutter) * 2), var(--vii-wrap));
	margin-inline: auto;
}

.section {
	position: relative;
	padding-block: var(--vii-space-2xl);
	background-color: var(--vii-bg);
	color: var(--vii-text);
}

/* Narrow sections keep the page's left rail and shorten their measure instead
   of centring, so every band starts on the same line down the page. */
.section--narrow .wrap > * {
	max-width: var(--vii-wrap-narrow);
}

/* Anchored sections stop below the sticky header, not behind it. */
.section[id],
.page-hero[id],
.media-band[id] {
	scroll-margin-top: calc(var(--vii-header-offset, var(--vii-header-h)) + var(--vii-space-s));
}

.section__head {
	max-width: var(--vii-wrap-narrow);
	margin-bottom: var(--vii-space-xl);
}

/* The editorial grid every band shares: a fixed left rail carrying the eyebrow
   and a short note, the content in the wide column beside it. One line down the
   page for every section head, so the page stops reading as a single ragged
   column with dead space on the right. */
.band {
	display: grid;
	gap: var(--vii-space-m) var(--vii-space-xl);
	grid-template-columns: 1fr;
	align-items: start;
}

@media (min-width: 62rem) {
	.band {
		gap: var(--vii-space-l) var(--vii-space-xl);
		grid-template-columns: var(--vii-rail) minmax(0, 1fr);
	}

	.band__rail {
		position: sticky;
		top: calc(var(--vii-header-h) + 3.6rem);
	}
}

.band__rail .eyebrow {
	margin-bottom: var(--vii-space-xs);
}

.band__rail-note {
	font-size: var(--vii-step--1);
	color: var(--vii-text-soft);
	max-width: 22ch;
}

.section__title {
	font-size: var(--vii-step-3);
	font-weight: var(--vii-weight-display-loud);
	margin-bottom: var(--vii-space-m);
	max-width: 18ch;
}

/* Titles that sit in a band body, under a rail — a step down from a page's
   one loud line. */
.section__title--small {
	font-size: var(--vii-step-2);
	font-weight: var(--vii-weight-display);
	max-width: 24ch;
}

/* The breath mark: a short red rule that opens a section. */
.eyebrow {
	display: flex;
	align-items: center;
	gap: var(--vii-space-s);
	font-family: var(--vii-font-body);
	font-size: var(--vii-step--1);
	font-weight: 600;
	letter-spacing: var(--vii-tracking-wide);
	text-transform: uppercase;
	color: var(--vii-accent-text);
	margin-bottom: var(--vii-space-m);
}

.eyebrow::before {
	content: "";
	flex: 0 0 auto;
	width: 2.5rem;
	height: 2px;
	background: var(--vii-accent);
}

.prose {
	color: var(--vii-text-soft);
	max-width: 60ch;
}

.prose > * + * {
	margin-top: var(--vii-space-m);
}

.prose h2,
.prose h3 {
	color: var(--vii-text);
	margin-top: var(--vii-space-l);
}

.prose a {
	color: var(--vii-accent-text);
}

.prose strong {
	font-weight: 600;
	color: var(--vii-text);
}

/* --- Buttons and links ----------------------------------------------------- */

.button {
	display: inline-block;
	margin-top: var(--vii-space-m);
	padding: 0.95em 2em;
	background: var(--vii-red);
	color: #fff;
	font-family: var(--vii-font-body);
	font-size: var(--vii-step--1);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	border-radius: var(--vii-radius);
	transition: background 240ms var(--vii-ease), transform 240ms var(--vii-ease);
}

.button:hover {
	background: var(--vii-red-hot);
	transform: translate(2px, -2px);
}

.button--ghost {
	background: transparent;
	color: var(--vii-text);
	box-shadow: inset 0 0 0 2px currentColor;
}

.button--ghost:hover {
	background: var(--vii-text);
	color: var(--vii-bg);
}

.button--light {
	background: var(--vii-kraft);
	color: var(--vii-ink);
}

.button--light:hover {
	background: #fff;
	color: var(--vii-ink);
}

.button--small {
	margin-top: 0;
	padding: 0.6em 1.2em;
}

.link-underline {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--vii-rule);
	transition: text-decoration-color 240ms var(--vii-ease);
}

.link-underline:hover {
	text-decoration-color: var(--vii-accent);
}

.link-arrow {
	display: inline-block;
	margin-top: var(--vii-space-s);
	font-size: var(--vii-step--1);
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--vii-accent-text);
}

/* The arrow rides on the last word, so it can never wrap onto a line of its
   own. margin, not a leading space: a space inside an inline-block is dropped. */
.link-arrow__end {
	white-space: nowrap;
}

.link-arrow__end::after {
	content: "\2192";
	display: inline-block;
	margin-left: 0.4em;
	transition: transform 240ms var(--vii-ease);
}

.link-arrow:hover .link-arrow__end::after {
	transform: translateX(5px);
}

/* --- Header: a black spine across the top --------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: var(--vii-ink);
	color: var(--vii-kraft);
	border-bottom: 2px solid var(--vii-red);
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--vii-space-m);
	min-height: var(--vii-header-h);
}

.site-brand {
	display: flex;
	align-items: center;
	gap: var(--vii-space-2xs);
	text-decoration: none;
	padding-block: 0.7rem;
}

.site-brand__logo {
	height: clamp(1.8rem, 1.4rem + 1.4vw, 2.6rem);
	width: auto;
}

.site-brand__mark {
	font-family: var(--vii-font-display);
	font-size: var(--vii-step-1);
	letter-spacing: 0.1em;
	color: var(--vii-red-soft);
}

.site-brand__word {
	font-family: var(--vii-font-display);
	font-size: var(--vii-step-1);
	letter-spacing: 0.02em;
}

.site-nav {
	display: flex;
	align-items: center;
	gap: var(--vii-space-l);
}

.site-nav__list {
	display: flex;
	align-items: center;
	gap: var(--vii-space-l);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav a {
	font-size: var(--vii-step--1);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	position: relative;
}

.site-nav__list a::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -0.45em;
	width: 100%;
	height: 2px;
	background: var(--vii-red-hot);
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 260ms var(--vii-ease);
}

.site-nav__list a:hover::after,
.site-nav__list .current-menu-item > a::after {
	transform: scaleX(1);
	transform-origin: left;
}

.nav-toggle {
	display: none;
	width: 2.75rem;
	height: 2.75rem;
	position: relative;
}

.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
	position: absolute;
	left: 50%;
	width: 24px;
	height: 2px;
	background: var(--vii-kraft);
	transform: translateX(-50%);
	transition: transform 260ms var(--vii-ease), opacity 180ms linear;
}

.nav-toggle__bar {
	top: 50%;
	translate: 0 -50%;
}

.nav-toggle__bar::before,
.nav-toggle__bar::after {
	content: "";
	left: 0;
	transform: none;
}

.nav-toggle__bar::before {
	top: -8px;
}

.nav-toggle__bar::after {
	top: 8px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar {
	background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar::before {
	transform: translateY(8px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar::after {
	transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 52rem) {
	.nav-toggle {
		display: block;
	}

	.site-nav {
		position: fixed;
		inset: calc(var(--vii-header-offset, var(--vii-header-h)) + 2px) 0 0 0;
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
		padding: var(--vii-space-s) var(--vii-gutter) var(--vii-space-xl);
		background: var(--vii-ink);
		border-bottom: 2px solid var(--vii-red);
		/* Pinned to the bottom of the screen by the inset above: an auto-height
		   panel let the page show through under it. A long menu scrolls inside. */
		overflow-y: auto;
		overscroll-behavior: contain;
		transform: translateY(-110%);
		visibility: hidden;
		transition: transform 320ms var(--vii-ease), visibility 320ms;
	}

	.site-nav.is-open {
		transform: translateY(0);
		visibility: visible;
	}

	.site-nav__list {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
		gap: 0;
	}

	.site-nav__list li {
		border-bottom: 1px solid rgba(216, 198, 153, 0.18);
	}

	/* Whole row is the tap target, comfortably over 44px. */
	.site-nav a {
		display: block;
		padding-block: 0.5em;
		font-family: var(--vii-font-display);
		font-size: var(--vii-step-2);
		font-weight: var(--vii-weight-display);
		text-transform: none;
		letter-spacing: 0.01em;
	}

	/* The underline sweep is a pointer affordance — a tap gets colour instead. */
	.site-nav__list a::after {
		display: none;
	}

	.site-nav__list a:active,
	.site-nav__list .current-menu-item > a {
		color: var(--vii-red-soft);
	}

	.site-nav .button {
		width: 100%;
		margin-top: var(--vii-space-l);
		text-align: center;
	}
}

/* --- Footer: the back of the sleeve --------------------------------------- */

.site-footer {
	padding-block: var(--vii-space-xl) var(--vii-space-m);
	background: var(--vii-ink-deep);
	color: var(--vii-on-ink);
	border-top: 2px solid var(--vii-red);
}

.site-footer__inner {
	display: grid;
	gap: var(--vii-space-l);
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	padding-bottom: var(--vii-space-xl);
	border-bottom: 1px solid rgba(216, 198, 153, 0.2);
}

.site-footer__logo {
	height: 3rem;
	width: auto;
	margin-bottom: var(--vii-space-s);
}

.site-footer__note {
	color: var(--vii-on-ink-soft);
	max-width: 28ch;
}

.site-footer__list,
.social-list,
.contact-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var(--vii-space-2xs);
}

.site-footer__list a,
.social-list a {
	font-size: var(--vii-step--1);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
}

.site-footer__list a:hover,
.social-list a:hover {
	color: var(--vii-red-soft);
}

.social-list {
	margin-top: var(--vii-space-s);
}

.site-footer__legal {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: baseline;
	gap: var(--vii-space-s);
	padding-top: var(--vii-space-m);
	font-size: var(--vii-step--1);
	color: var(--vii-on-ink-soft);
}

.site-footer__proverb {
	font-family: var(--vii-font-display);
	font-weight: 400; /* the CJK fallback face carries this line — no faux bold */
	font-size: var(--vii-step-1);
	color: var(--vii-on-ink);
}

/* --- The count-in: seven marks, the last one red -------------------------- */

.count-in {
	display: flex;
	align-items: flex-end;
	gap: 0.55rem;
	height: 2.25rem;
	margin-bottom: var(--vii-space-m);
}

/* Centred under a wordmark hero. */
.count-in--center {
	justify-content: center;
	gap: 0.8rem;
	height: 2rem;
	margin-bottom: var(--vii-space-l);
}

.count-in__tick {
	width: 3px;
	height: 100%;
	background: var(--vii-text);
	opacity: 0.5;
	transform-origin: bottom;
	transform: scaleY(1);
}

.count-in__tick:nth-child(7) {
	background: var(--vii-accent);
	opacity: 1;
	width: 6px;
}

/* Counted in once on load, then it rests. Not a metronome. */
.js .count-in__tick {
	transform: scaleY(0);
	animation: vii-count 420ms var(--vii-ease) forwards;
}

.js .count-in__tick:nth-child(1) { animation-delay: 120ms; }
.js .count-in__tick:nth-child(2) { animation-delay: 220ms; }
.js .count-in__tick:nth-child(3) { animation-delay: 320ms; }
.js .count-in__tick:nth-child(4) { animation-delay: 420ms; }
.js .count-in__tick:nth-child(5) { animation-delay: 520ms; }
.js .count-in__tick:nth-child(6) { animation-delay: 620ms; }
.js .count-in__tick:nth-child(7) { animation-delay: 760ms; }

@keyframes vii-count {
	from { transform: scaleY(0); }
	to   { transform: scaleY(1); }
}

/* --- Reveal: two speeds, so lines land off each other --------------------- */

.js .reveal {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity var(--vii-duration) var(--vii-ease), transform var(--vii-duration) var(--vii-ease);
}

.js .reveal.is-visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.js .reveal {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.js .count-in__tick {
		animation: none;
		transform: scaleY(1) !important;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}

/* --- Prose pages (privacy policy etc.) ------------------------------------ */

/* The hero already ends in a rule, so the text can start closer to it. */
.page-hero + .section--narrow {
	padding-top: var(--vii-space-l);
}

.section--narrow .prose h2 {
	padding-top: var(--vii-space-m);
	border-top: 1px solid var(--vii-rule);
}

.section--narrow .prose h3 {
	font-family: var(--vii-font-body);
	font-size: var(--vii-step-0);
	font-weight: 600;
	letter-spacing: 0;
}

/* Lists are reset globally — give prose lists a short red rule as a marker. */
.section--narrow .prose ul {
	list-style: none;
	padding-left: 0;
}

.section--narrow .prose li {
	position: relative;
	padding-left: 1.5em;
}

.section--narrow .prose li + li {
	margin-top: var(--vii-space-2xs);
}

.section--narrow .prose li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.8em;
	width: 0.75em;
	height: 2px;
	background: var(--vii-accent);
}

.section--narrow .prose p,
.section--narrow .prose li {
	text-wrap: pretty;
}

.prose .policy-updated {
	font-size: var(--vii-step--1);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--vii-accent-text);
}

/* --- Footer proverb: English on hover / focus ------------------------------ */

.proverb {
	position: relative;
	cursor: help;
}

.proverb:focus-visible {
	outline: 2px solid var(--vii-accent);
	outline-offset: 4px;
}

.proverb__tr {
	position: absolute;
	bottom: calc(100% + 0.6rem);
	left: 50%;
	transform: translate(-50%, 4px);
	width: max-content;
	max-width: min(20rem, calc(100vw - 2rem));
	text-align: center;
	padding: 0.45em 0.8em;
	visibility: hidden;
	font-family: var(--vii-font-body);
	font-size: var(--vii-step--1);
	letter-spacing: 0.04em;
	background: var(--vii-kraft);
	color: var(--vii-ink);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--vii-duration) var(--vii-ease), transform var(--vii-duration) var(--vii-ease);
}

.proverb:hover .proverb__tr,
.proverb:focus .proverb__tr {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

/* Phones: where the proverb lands depends on how the footer row wraps, so
   the label opens in flow underneath it on tap instead of floating. */
@media (max-width: 34rem) {
	.proverb {
		display: inline-block;
	}

	.proverb__tr {
		position: static;
		display: block;
		transform: none;
		max-width: none;
		max-height: 0;
		padding-block: 0;
		overflow: hidden;
	}

	.proverb:hover .proverb__tr,
	.proverb:focus .proverb__tr {
		transform: none;
		max-height: 4em;
		padding-block: 0.45em;
		margin-top: 0.4rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.proverb__tr {
		transition: none;
	}
}
