/*
 * Nomon Theme — base stylesheet, loaded on the frontend and inside the editor iframe.
 *
 * Tailwind handles reset and utilities; this file owns only what utilities can't express.
 * Responsibilities and the cascade smoke-test: docs/styling.md.
 */

/* Up front so layer order doesn't depend on when Blockstudio's inline style loads. Holds
 * only while Blockstudio emits layered utilities — smoke-test in docs/styling.md. */
@layer theme, base, components, utilities;

/* Unlayered on purpose: wrapping this ties with preflight's `body { line-height: inherit }`. */
body {
	font-size: var(--wp--preset--font-size--regular);
	line-height: 1.5;
	color: var(--wp--preset--color--muted);
}

/* WP's `size-full` marker collides with Tailwind's utility of that name; unlayered on
 * purpose so it beats the layered utility. See docs/styling.md. */
.wp-block-image.size-full {
	height: auto;
}

@layer base {
	body p { margin-block: 1.5rem; }
	body figure { margin-block: 3rem; }

	body :is(h1, h2, h3, h4, h5, h6) { font-weight: 600; color: var(--wp--preset--color--ink); }

	body h1 { font-size: var(--wp--preset--font-size--heading-1); line-height: 1.1;  margin-block: 3rem 1.5rem; }
	body h2 { font-size: var(--wp--preset--font-size--heading-2); line-height: 1.15; margin-block: 3rem 1.5rem; }
	body h3 { font-size: var(--wp--preset--font-size--heading-3); line-height: 1.2;  margin-block: 2rem 1.5rem; }
	body h4 { font-size: var(--wp--preset--font-size--heading-4); line-height: 1.25; margin-block: 2rem 1.5rem; }
	body h5 { font-size: var(--wp--preset--font-size--heading-5); line-height: 1.3;  margin-block: 1.5rem 1.5rem; }
	body h6 { font-size: var(--wp--preset--font-size--heading-6); line-height: 1.4;  margin-block: 1.5rem 1.5rem; }

	/* Stacked headings: any heading directly following another collapses its top margin. */
	body :is(h1, h2, h3, h4, h5, h6) + :is(h1, h2, h3, h4, h5, h6) { margin-top: 0; }

	/* core/list block: restore bullets/numbers and indent that Tailwind preflight zeroes. */
	.wp-block-list { margin-block: 1.5rem; padding-inline-start: 1.5em; }
	.wp-block-list:where(ul) { list-style: disc; }
	.wp-block-list:where(ol) { list-style: decimal; }
	.wp-block-list :where(li > *) { margin-block: 0.5rem; }
	.wp-block-list :where(li > :first-child) { margin-top: 0; }
	.wp-block-list :where(li > :last-child)  { margin-bottom: 0; }

	:is(.site-content, .editor-styles-wrapper) :where(p, li, td, th, figcaption) a {
		color: var(--wp--preset--color--ink);
		font-weight: 600;
		text-decoration: underline;
		text-decoration-thickness: 1.5px;
		text-underline-offset: 0.2em;
		transition: color 150ms, text-decoration-color 150ms;
	}
	:is(.site-content, .editor-styles-wrapper) :where(p, li, td, th, figcaption) a:hover {
		color: var(--wp--preset--color--accent-text);
		text-decoration-color: currentColor;
	}

	/* First/last reset: heading at top of a section, paragraph at end, don't push the container. */
	body :is(h1, h2, h3, h4, h5, h6):first-child { margin-top: 0; }
	body p:last-child { margin-bottom: 0; }
}

/* Prose cap; descendant selector so prose inside a nested group is capped too (docs/styling.md).
 * `!important` matches WP's own constrained-layout centring, which this overrides. */
.wp-block-group :is(p, h1, h2, h3, h4, h5, h6, ul, ol),
.site-content > :is(p, h1, h2, h3, h4, h5, h6, ul, ol) {
	max-width: 750px;
	margin-inline-start: 0 !important;
}

/* Auto-bleed, mirroring native `.alignfull`; `!important` matches WP's own margin rule.
 * `.nomon-bleed` opts a block in without a background (docs/blocks.md). */
.has-global-padding > .wp-block-group.has-background,
.has-global-padding > .nomon-bleed {
	max-width: none;
	margin-left: calc(var(--wp--style--root--padding-left) * -1) !important;
	margin-right: calc(var(--wp--style--root--padding-right) * -1) !important;
	padding-left: var(--wp--style--root--padding-left);
	padding-right: var(--wp--style--root--padding-right);
}

/* Section rhythm is each section's own padding; `core/group` spacing controls
 * are off in `theme.json`, so the seam has to be zeroed here. */
.has-global-padding > .wp-block-group,
.wp-block-group.has-background {
	padding-block: var(--wp--preset--spacing--section);
}

/* Two white sections in a row share one seam, not two. "White" is any root
 * section without a background marker (docs/blocks.md). Unlayered on purpose:
 * it has to beat the blocks' own `py-section` utility. */
.has-global-padding
	> :is(:not(.has-background, .nomon-bleed, [class*="bg-"]), .bg-white)
	+ :is(:not(.has-background, .nomon-bleed, [class*="bg-"]), .bg-white) {
	padding-top: 0;
}

/* Top-level flow only — inside a Group the same gap is what spaces the prose. */
main.site-content > * {
	margin-block-start: 0;
}

/* Headings carry an explicit `ink` in the base layer, so inheritance alone leaves them unreadable. */
.wp-block-group.has-ink-background-color {
	color: var(--wp--preset--color--sand);
}

.wp-block-group.has-ink-background-color :is(h1, h2, h3, h4, h5, h6),
.wp-block-group.has-ink-background-color :where(p, li, td, th, figcaption) a {
	color: var(--wp--preset--color--white);
}
.wp-block-group.has-ink-background-color :where(p, li, td, th, figcaption) a:hover {
	color: var(--wp--preset--color--accent);
}

@layer base {
	html {
		scroll-behavior: smooth;
		scroll-padding-top: var(--scroll-offset, 2rem);
	}

	body {
		-webkit-font-smoothing: antialiased;
		-moz-osx-font-smoothing: grayscale;
	}

	/* Gutenberg can't hide these toolbar buttons, so cancel the effect instead. */
	:where(h1, h2, h3, h4, h5, h6) :is(strong, b, em, i) {
		font-weight: inherit;
		font-style: inherit;
	}

	/* Same reason as above; the editor iframe loads this file too, so preview matches. */
	:is(p, h1, h2, h3, h4, h5, h6):is(
		.has-text-align-left,
		.has-text-align-center,
		.has-text-align-right
	) {
		text-align: inherit;
	}

	/* `accent-text` clears 3:1 on all three page surfaces; the footer overrides
	 * to white, which does better on ink. */
	:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
		outline: 2px solid var(--wp--preset--color--accent-text);
		outline-offset: 2px;
	}

	.site-footer :where(a, button):focus-visible {
		outline-color: var(--wp--preset--color--white);
	}

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

	.skip-link:focus {
		clip-path: none;
		height: auto;
		margin: 0;
		overflow: auto;
		padding: 1rem;
		position: absolute;
		inset-block-start: 0;
		inset-inline-start: 0;
		width: auto;
		z-index: 100000;
		background: #000;
		color: #fff;
		text-decoration: underline;
	}

	/* WCAG 2.4.4: per-site CSS may restyle or hide the glyph, never the screen-reader text. */
	a.is-external-link::after,
	a.is-new-window::after {
		content: " ↗";
		display: inline-block;
		font-size: 0.85em;
		vertical-align: super;
		line-height: 1;
	}
	a.is-new-window::after {
		content: " ⧉";
	}
	a.is-external-link.is-new-window::after {
		content: " ⧉";
	}

	/* Hides the glyph in the footer, credit bar and primary nav only; the screen-reader text stays. */
	:is(.site-footer, .nomon_footer, .nav-primary) a.is-external-link::after,
	:is(.site-footer, .nomon_footer, .nav-primary) a.is-new-window::after,
	:is(.site-footer, .nomon_footer, .nav-primary) a.is-external-link.is-new-window::after {
		content: none;
	}
}

/* Pre-init Swiper layout, until the lazy-loaded vendor CSS lands (`docs/runtimes.md`). */
.swiper { overflow: hidden; }
.swiper-wrapper { display: flex; }
.swiper-slide { flex-shrink: 0; width: 100%; }

/* Editor-only: flattens Gutenberg's InnerBlocks wrapper chain, which breaks parent flex/grid.
 * Unlayered to outrank editor styles; descendant combinators because `useBlockProps` shifts a level. */
[data-type^="nomon/"] .block-editor-inner-blocks,
[data-type^="nomon/"] .block-editor-block-list__layout {
	display: contents;
}

/* Editor-only: a drag saves the box's computed `aspectRatio`, which the ratio dropdown
 * cannot display or clear (`docs/integrations.md`). Selector length beats the components
 * stylesheet's own `.has-show-handle` rule at (0,3,0). */
[data-type="core/image"] .components-resizable-box__container.has-show-handle .components-resizable-box__handle {
	display: none;
}

/* Editor-only: makes the post title read as page metadata, not the first H1. No negative
 * inline margin needed — `useRootPaddingAwareAlignments` leaves body itself unpadded. */
/* WP core's editor styles add a top padding to the iframe body; zero it. */
body {
	padding-top: 0;
}

.edit-post-visual-editor__post-title-wrapper {
	background-color: #f0f0f0;
	color: #1e1e1e;
	margin-block-start: 0 !important;
	margin-block-end: 3rem;
	padding-inline: var(--wp--style--root--padding-left, clamp(1rem, 9.4vw - 1.3rem, 10rem));
}

.edit-post-visual-editor__post-title-wrapper .editor-post-title {
	color: inherit;
	margin: 0 auto;
	max-width: var(--wp--style--global--content-size, 1600px);
	padding-block: 3rem;
}

.edit-post-visual-editor__post-title-wrapper .editor-post-title::before {
	content: "Sivun otsikko";
	display: block;
	color: #666;
	font-size: 0.875rem;
	font-weight: 500;
	margin-block-end: 0.75rem;
}

.edit-post-visual-editor__post-title-wrapper .editor-post-title [data-rich-text-placeholder]::after {
	color: #666;
	opacity: 1;
}

/* Navigation — adapted from air-light; markup contract and runtime in docs/runtimes.md. */

:root {
	/* Must stay numeric: JS reads it via getComputedStyle for matchMedia. Sized for the
	 * four-item nav as drawn; air-light's 1029 fits three. */
	--breakpoint-nav: 1099px;

	--hamburger-color: var(--wp--preset--color--white);
	--hamburger-color-active: var(--wp--preset--color--white);
	--hamburger-width: 2rem;
	--hamburger-layer-height: 2px;

	/* Desktop dropdowns: a white panel with the link list and an optional button group. */
	--color-main-level: var(--wp--preset--color--ink);
	--color-hover-main-level: var(--wp--preset--color--ink);
	--color-current: var(--wp--preset--color--ink);
	--typography-size-main-level: 1.125rem;
	--typography-weight-main-level: 600;
	--padding-main-level-vertical: 0.375rem;
	--gap-main-level-horizontal: 1.875rem;
	--gap-between-dropdown-toggle: 0.625rem;
	--dropdown-toggle-size: 1.125rem;

	--color-sub-menu: var(--wp--preset--color--ink);
	--color-hover-sub-menu: var(--wp--preset--color--ink);
	--color-background-sub-menu: var(--wp--preset--color--white);
	--typography-size-sub-menu: 1.125rem;
	--typography-weight-sub-menu: 500;
	--padding-sub-menu-vertical: 1.5625rem;
	--padding-sub-menu-link-vertical: 0.5rem;
	--padding-sub-menu-link-horizontal: 1.875rem;
	--width-sub-menu: 15rem;
	--width-sub-menu-actions: 40rem;
	--width-sub-menu-max: 44rem;
	--gap-sub-menu-actions: 1.875rem;
	/* Lands the panel at the bottom edge of the 82px header band. */
	--gap-dropdown: 1.5rem;

	/* Mobile drawer — slides in from the left and pushes .site right by its width. */
	--width-navigation: 85vw;
	--color-background-menu-items: var(--wp--preset--color--white);
	--color-overlay-nav-mobile: rgb(0 0 0 / 0.5);
	--color-separator-nav-mobile: color-mix(in srgb, var(--wp--preset--color--ink) 10%, transparent);
	--color-main-level-menu-item-mobile: var(--wp--preset--color--ink);
	--color-main-level-menu-item-hover-focus-mobile: var(--wp--preset--color--ink);
	--color-sub-menu-mobile: color-mix(in srgb, var(--wp--preset--color--ink) 75%, transparent);
	--color-current-menu-item: var(--wp--preset--color--ink);
	--color-dropdown-toggle-mobile: var(--wp--preset--color--ink);
	--typography-size-main-level-mobile: 1.125rem;
	--typography-weight-main-level-mobile: 600;
	--padding-main-level-vertical-mobile: 1.125rem;
	--typography-size-sub-menu-mobile: 1rem;
	--typography-weight-sub-menu-mobile: 600;
	--margin-left-sub-menu: 0.625rem;
	--padding-sub-menu-vertical-mobile: 0.75rem;
	--padding-sub-menu-horizontal-mobile: var(--wp--style--root--padding-left, clamp(1rem, 9.4vw - 1.3rem, 10rem));
}

.hamburger {
	display: block;
	width: var(--hamburger-width);
	height: var(--hamburger-layer-height);
	background-color: var(--hamburger-color);
	position: relative;
	transition: all 0.2s ease 0s;
	flex-shrink: 0;
}
.hamburger::before,
.hamburger::after {
	content: "";
	display: block;
	width: var(--hamburger-width);
	height: var(--hamburger-layer-height);
	background-color: var(--hamburger-color);
	position: absolute;
	transition: all 0.2s ease 0s;
}
.hamburger::before { top: -0.5625rem; }
.hamburger::after  { bottom: -0.5625rem; }

body:not(.js-nav-active) .nav-toggle .hamburger::after,
body:not(.js-nav-active) .nav-toggle:focus .hamburger::after { width: 80%; }
body:not(.js-nav-active) .nav-toggle:hover .hamburger::after { width: 100%; }

.js-nav-active .hamburger { background-color: transparent; }
.js-nav-active .hamburger::before,
.js-nav-active .hamburger::after {
	background-color: var(--hamburger-color-active);
	left: 0;
	top: 0;
}
.js-nav-active .hamburger::before { transform: rotate(-45deg); }
.js-nav-active .hamburger::after  { transform: rotate(45deg); }

.nav-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 4rem;
	height: 4rem;
	margin: 0;
	padding: 0;
	background: var(--wp--preset--color--ink);
	border: 0;
	border-radius: 0;
	cursor: pointer;
	position: relative;
	z-index: 99999;
}

body.js-nav-active { overflow: hidden; }

.nav-drawer-head { display: none; }

@media (max-width: 1099.98px) {
	.nav-primary .menu-items ul { display: none; }
	.nav-primary ul .sub-menu.toggled-on { display: block; }

	.nav-primary { align-self: center; }

	.site-header ul,
	.site-header li,
	.site-header a { position: relative; }

	.site { transition: transform 220ms cubic-bezier(0.19, 1, 0.22, 1); }

	/* The transformed .site becomes the drawer's containing block, so the drawer sits
	 * at -width inside it and lands on the viewport's left edge once .site is pushed. */
	.nav-primary .menu-items-wrapper {
		position: fixed;
		top: var(--wp-admin--admin-bar--height, 0px);
		left: calc(-1 * var(--width-navigation));
		width: var(--width-navigation);
		height: calc(100dvh - var(--wp-admin--admin-bar--height, 0px));
		background-color: var(--color-background-menu-items);
		transition: opacity 180ms ease-in-out;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		overflow: auto;
		padding-bottom: 7.5rem;
		backface-visibility: hidden;
		z-index: 5;
	}

	.nav-drawer-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1rem;
		min-height: 82px;
		padding-left: var(--padding-sub-menu-horizontal-mobile);
		padding-right: 0.5rem;
		color: var(--wp--preset--color--ink);
	}
	.nav-drawer-head .nav-logo { width: 200px; max-width: 100%; height: auto; }

	.nav-close {
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		width: 4rem;
		height: 4rem;
		margin: 0;
		padding: 0;
		background: transparent;
		border: 0;
		color: var(--wp--preset--color--ink);
		cursor: pointer;
	}
	.nav-close svg { width: 2rem; height: 2rem; }

	.nav-primary .menu-items { margin: 0; padding: 0; list-style: none; }
	.nav-primary .menu-item  { margin: 0; }

	.nav-primary .menu-item > a {
		display: block;
		padding-block: var(--padding-main-level-vertical-mobile);
		padding-inline: var(--padding-sub-menu-horizontal-mobile);
		border-top: 1px solid var(--color-separator-nav-mobile);
		color: var(--color-main-level-menu-item-mobile);
		font-size: var(--typography-size-main-level-mobile);
		font-weight: var(--typography-weight-main-level-mobile);
		text-decoration: none;
		position: relative;
		z-index: 0;
	}
	.nav-primary .menu-item > a:hover,
	.nav-primary .menu-item > a:focus { color: var(--color-main-level-menu-item-hover-focus-mobile); }
	.nav-primary .menu-item.current-menu-parent > a,
	.nav-primary .menu-item.current-menu-item > a { color: var(--color-current-menu-item); }

	.nav-primary .sub-menu { margin: 0; padding: 0; list-style: none; }
	.nav-primary .sub-menu .menu-item > a {
		color: var(--color-sub-menu-mobile);
		font-size: var(--typography-size-sub-menu-mobile);
		font-weight: var(--typography-weight-sub-menu-mobile);
		padding-block: var(--padding-sub-menu-vertical-mobile);
		padding-left: calc(var(--padding-sub-menu-horizontal-mobile) + var(--margin-left-sub-menu));
	}
	.nav-primary .sub-menu .sub-menu .menu-item > a {
		padding-left: calc(var(--padding-sub-menu-horizontal-mobile) + var(--margin-left-sub-menu) * 2);
	}
	.nav-primary .sub-menu-actions {
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 0.625rem;
		padding-block: var(--padding-sub-menu-vertical-mobile) 1.25rem;
		padding-left: calc(var(--padding-sub-menu-horizontal-mobile) + var(--margin-left-sub-menu));
		padding-right: var(--padding-sub-menu-horizontal-mobile);
	}

	.nav-primary .dropdown-toggle {
		position: absolute;
		top: 2px;
		right: 0;
		height: 100%;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		overflow: hidden;
		padding-block: var(--padding-sub-menu-vertical-mobile);
		padding-left: var(--padding-sub-menu-horizontal-mobile);
		padding-right: calc(var(--padding-sub-menu-horizontal-mobile) - calc(var(--dropdown-toggle-size) / 2));
		background: transparent;
		border: 0;
		color: var(--color-dropdown-toggle-mobile);
		cursor: pointer;
		z-index: 100;
	}
	.nav-primary .dropdown-toggle svg {
		width: var(--dropdown-toggle-size);
		height: var(--dropdown-toggle-size);
		transition: transform 150ms;
		pointer-events: none;
	}
	.nav-primary .dropdown-toggle.toggled-on svg { transform: rotate(180deg); }
	.nav-primary .sub-menu .dropdown-toggle { color: var(--color-sub-menu-mobile); }

	.js-nav-active .nav-primary .menu-items-wrapper {
		opacity: 1;
		visibility: visible;
		pointer-events: auto;
	}

	.js-nav-active .site {
		position: fixed;
		inset: 0;
		transform: translate3d(var(--width-navigation), 0, 0);
	}
	.js-nav-active .site::after {
		content: "";
		position: absolute;
		inset: 0;
		background: var(--color-overlay-nav-mobile);
		z-index: 4;
	}
}

@media (min-width: 1100px) {
	.nav-toggle { display: none; }

	.nav-primary { line-height: 0; padding-block: 0; }

	.nav-primary .menu-items {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		justify-content: flex-end;
		column-gap: var(--gap-main-level-horizontal);
		row-gap: 0.625rem;
		margin: 0;
		padding: 0;
		list-style: none;
		position: relative;
	}

	/* Top-level items are static so every panel anchors to the bar's right edge,
	 * not to whichever item happens to be open. */
	.nav-primary .menu-item { margin: 0; }
	.nav-primary .sub-menu .menu-item { position: relative; }

	.nav-primary .menu-item > a {
		display: inline-flex;
		align-items: center;
		color: var(--color-main-level);
		font-size: var(--typography-size-main-level);
		font-weight: var(--typography-weight-main-level);
		padding-block: var(--padding-main-level-vertical);
		white-space: nowrap;
		text-decoration: none;
	}
	/* Hover / current treatment is derived, not drawn. */
	.nav-primary .menu-item > a:hover,
	.nav-primary .menu-item > a:focus,
	.nav-primary .menu-item.current-menu-parent > a,
	.nav-primary .menu-item.current-menu-item > a {
		color: var(--color-hover-main-level);
		text-decoration: underline;
		text-decoration-thickness: 2px;
		text-decoration-color: var(--wp--preset--color--accent-text);
		text-underline-offset: 6px;
	}

	/* The outbound English link is de-emphasised in the design (node 2:139). */
	.nav-primary .menu-item-english > a { color: var(--wp--preset--color--muted); }

	.nav-primary .menu-item.menu-item-has-children {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--gap-between-dropdown-toggle);
	}

	/* Bridges the menu-item/submenu gap so hover survives the empty space; only present
	 * while hovered, so it doesn't capture clicks at rest. */
	.nav-primary .menu-item.menu-item-has-children::after {
		content: "";
		display: block;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		height: var(--gap-dropdown);
		visibility: hidden;
	}
	.nav-primary .menu-item.menu-item-has-children.hover-intent::after {
		visibility: visible;
		z-index: 100;
	}
	.nav-primary .sub-menu .menu-item-has-children::after { display: none; }

	.nav-primary .sub-menu {
		--color-current: var(--color-sub-menu);
		position: absolute;
		top: 100%;
		right: 0;
		display: grid;
		grid-template-columns: minmax(max-content, 1fr) auto;
		grid-template-rows: repeat(12, min-content) 1fr;
		width: max-content;
		min-width: var(--width-sub-menu);
		max-width: var(--width-sub-menu-max);
		margin: 0;
		margin-top: var(--gap-dropdown);
		padding: var(--padding-sub-menu-vertical) var(--padding-sub-menu-link-horizontal);
		list-style: none;
		background-color: var(--color-background-sub-menu);
		border: 1px solid var(--wp--preset--color--rule);
		border-radius: 25px;
		box-shadow: 0 24px 48px -24px rgb(27 25 23 / 0.3);
		opacity: 0;
		visibility: hidden;
		transition: all 0.2s cubic-bezier(0.19, 1, 0.22, 1);
		z-index: 9;
	}
	.nav-primary .sub-menu:has(.sub-menu-actions) { min-width: var(--width-sub-menu-actions); }
	.nav-primary .sub-menu > .menu-item { grid-column: 1; }
	/* Spans the explicit rows; the trailing 1fr row absorbs the height a taller
	 * button column would otherwise distribute between the links. */
	.nav-primary .sub-menu-actions {
		grid-column: 2;
		grid-row: 1 / -1;
		display: flex;
		flex-direction: column;
		align-items: flex-start;
		gap: 0.625rem;
		min-width: 18rem;
		margin-left: var(--gap-sub-menu-actions);
		padding-left: var(--gap-sub-menu-actions);
		border-left: 1px solid var(--wp--preset--color--rule);
	}
	.nav-primary .sub-menu .sub-menu {
		top: 0;
		right: auto;
		left: 100%;
		margin-top: calc(-1 * var(--padding-sub-menu-vertical));
	}

	.nav-primary .sub-menu .sub-menu.is-out-of-viewport { left: auto; right: 100%; }

	.nav-primary .sub-menu .menu-item > a {
		display: inline-flex;
		align-items: center;
		width: 100%;
		color: var(--color-sub-menu);
		font-size: var(--typography-size-sub-menu);
		font-weight: var(--typography-weight-sub-menu);
		line-height: 1.5;
		padding-block: var(--padding-sub-menu-link-vertical);
		text-decoration: none;
		white-space: nowrap;
	}
	.nav-primary .sub-menu .menu-item > a:hover,
	.nav-primary .sub-menu .menu-item > a:focus,
	.nav-primary .sub-menu .menu-item.current-menu-item > a {
		color: var(--color-hover-sub-menu);
		text-decoration: underline;
		text-decoration-thickness: 2px;
		text-decoration-color: var(--wp--preset--color--accent-text);
		text-underline-offset: 6px;
	}

	/* :hover for mouse, :focus-within for keyboard, .hover-intent (JS) to keep the menu
	 * open briefly after the cursor leaves and absorb stray movement. */
	.nav-primary .menu-item-has-children:hover > .sub-menu,
	.nav-primary .menu-item-has-children:focus-within > .sub-menu,
	.nav-primary .menu-item-has-children.hover-intent > .sub-menu {
		opacity: 1;
		visibility: visible;
		z-index: 12;
	}

	/* Escape must beat `:focus-within`; ties on specificity, wins on source order. */
	.nav-primary .menu-item-has-children.is-collapsed > .sub-menu {
		opacity: 0;
		visibility: hidden;
	}

	/* Dropdown toggle on desktop is decorative — pointer-events: none lets
	 * clicks fall through to the parent <a>. The svg is the visual cue. */
	.nav-primary .dropdown-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		padding: 0;
		background: transparent;
		border: 0;
		pointer-events: none;
	}
	.nav-primary .dropdown-toggle svg {
		width: var(--dropdown-toggle-size);
		height: var(--dropdown-toggle-size);
		transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
	}
	.nav-primary .menu-item-has-children.hover-intent > .dropdown-toggle svg {
		transform: rotateX(180deg);
	}
	.nav-primary .sub-menu .dropdown-toggle svg { transform: rotate(-90deg); }
	.nav-primary .sub-menu .hover-intent > .dropdown-toggle svg {
		transform: rotate(-90deg) rotateX(180deg);
	}
}

/* Damped rather than removed, so anything waiting on a transition still completes;
 * `!important` reaches Tailwind's utilities and the nav layer. */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

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