/*
 * The dock: the mark, the menu and one action, fixed at the top of every page.
 * On the homepage the hero carries the mark itself, so the dock's mark only
 * steps in once the hero has left.
 *
 * Diensten and Werk open a submenu: on pointer and on focus without script,
 * by their toggle with nav.js (see klauw-dock__item.is-open). On a narrow
 * screen the row of links makes way for the Menu button, which opens the
 * whole menu as a dialog; without script the row simply stays.
 *
 * The panels are ink with cream type, whatever register the page is in: the
 * dock is ink too, and a menu that changed colour while scrolling would read
 * as a different menu.
 */

.klauw-dock {
	position: fixed;
	inset: var(--wp-admin--admin-bar--height, 0px) 0 auto 0;
	z-index: 30;
	box-sizing: border-box;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem var(--k-edge);
	pointer-events: none;
}

.klauw-dock > *,
.klauw-dock__nav > * {
	margin: 0;
	pointer-events: auto;
}

.klauw-dock .wp-block-klauw-logo {
	flex: none;
	padding: 0.5rem 0.55rem;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--cream);

	--klauw-logo-size: 1.9rem;
}

/* The mark in the dock is simply there: the pop-in of the logo block (with its own body:not() rule) is for the hero. */
body:not(.editor-styles-wrapper) .klauw-dock .wp-block-klauw-logo rect {
	animation: none;
}

body.home .klauw-dock .wp-block-klauw-logo {
	transform: translateY(-190%);
	transition: transform 0.24s steps(4, end);
}

html.is-past-hero body.home .klauw-dock .wp-block-klauw-logo,
body.home .klauw-dock .wp-block-klauw-logo:focus-within {
	transform: none;
}

.klauw-dock__nav {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: 0.375rem;
	margin-inline-start: auto;
	pointer-events: none;
}

.klauw-dock__links {
	display: flex;
	gap: 0.375rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.klauw-dock__item {
	position: relative;
	display: flex;
	gap: 1px;
}

/* The tabs: ink blocks with a mono label, and the toggle that belongs to a tab directly against it. */
.klauw-dock__links > li > a,
.klauw-dock__toggle,
.klauw-dock__menu,
.klauw-menu__close {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 2.875rem;
	margin: 0;
	padding: 0 0.95rem;
	border: 0;
	border-radius: 0;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--cream);
	cursor: pointer;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.6875rem;
	letter-spacing: var(--k-label-spacing);
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

/* Where you are, and where you point: a line in the accent under the word. */
.klauw-dock__links > li > a:is(:hover, :focus-visible, [aria-current]),
.klauw-dock__toggle:is(:hover, :focus-visible, [aria-expanded="true"]),
.klauw-dock__menu:is(:hover, :focus-visible) {
	box-shadow: inset 0 -3px 0 0 var(--wp--preset--color--ember);
}

.klauw-dock__toggle {
	justify-content: center;
	inline-size: 2.25rem;
	padding: 0;
}

/* A chevron from the block grid; it turns over while its submenu is open. */
.klauw-dock__toggle::before {
	content: "";
	inline-size: 0.625rem;
	block-size: 0.375rem;
	background: currentColor;
	-webkit-mask: var(--k-chevron) center / contain no-repeat;
	mask: var(--k-chevron) center / contain no-repeat;
}

.klauw-dock__toggle[aria-expanded="true"]::before {
	transform: scaleY(-1);
}

.klauw-dock .klauw-dock__cta {
	display: inline-flex;
	align-items: center;
	box-sizing: border-box;
	min-height: 2.875rem;
	padding: 0 1.14rem 0 1.3rem;
	white-space: nowrap;
}

.klauw-dock .klauw-dock__cta[aria-current] {
	background: var(--wp--preset--color--cream);
	box-shadow: inset 0 -3px 0 0 var(--wp--preset--color--ember), inset 0 0 0 2px var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ink);
}

:root {
	/* A chevron, a cross and three bars, each drawn on the block grid. */
	--k-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 3'%3E%3Cpath d='M0 0h1v1H0zM4 0h1v1H4zM1 1h1v1H1zM3 1h1v1H3zM2 2h1v1H2z'/%3E%3C/svg%3E");
	--k-cross: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 5'%3E%3Cpath d='M0 0h1v1H0zM4 0h1v1H4zM1 1h1v1H1zM3 1h1v1H3zM2 2h1v1H2zM1 3h1v1H1zM3 3h1v1H3zM0 4h1v1H0zM4 4h1v1H4z'/%3E%3C/svg%3E");
	--k-bars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 5'%3E%3Cpath d='M0 0h6v1H0zM0 2h6v1H0zM0 4h6v1H0z'/%3E%3C/svg%3E");
}

/*
 * The submenu: an ink panel under its tab. It steps open from the top, the
 * way the paper edges are cut. No shadow and no rounding: the panel is set
 * apart by being ink on the page, like the tabs.
 */
.klauw-dock__sub {
	position: absolute;
	inset: calc(100% + 0.375rem) auto auto 0;
	z-index: 1;
	display: none;
	box-sizing: border-box;
	inline-size: max-content;
	min-inline-size: 18rem;
	max-inline-size: min(24rem, calc(100vw - 2rem));
	padding-block-start: 0.5rem;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--cream);
}

/* A bridge over the gap under the tab, so the pointer can reach the panel without it closing. */
.klauw-dock__sub::before {
	content: "";
	position: absolute;
	inset: -0.375rem 0 100% 0;
}

.klauw-dock__item.is-open > .klauw-dock__sub {
	display: block;
}

@media (min-width: 900px) {
	html:not(.klauw-js) .klauw-dock__item:is(:hover, :focus-within) > .klauw-dock__sub {
		display: block;
	}
}

/* The links of a submenu, on the desktop panel and in the dialog alike. */
.klauw-menu-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.klauw-menu-list a {
	display: grid;
	grid-template-columns: 1.75rem minmax(0, 1fr);
	align-items: center;
	gap: 0.85rem;
	padding: 0.5rem 1rem;
	color: inherit;
	font-family: var(--wp--preset--font-family--body);
	font-size: 1rem;
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1.25;
	text-decoration: none;
	text-transform: none;
}

.klauw-menu-list a:is(:hover, :focus-visible) {
	background: var(--reg-ink-card);
	box-shadow: inset 3px 0 0 0 var(--wp--preset--color--ember);
}

.klauw-menu-list a:focus-visible {
	outline-offset: -2px;
}

.klauw-menu-list a[aria-current] .klauw-menu-label {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--ember);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.25em;
}

/* A service's sign on the colour of its layer; a piece of work gets one block from the grid. */
.klauw-menu-sign {
	display: block;
	box-sizing: border-box;
	inline-size: 1.75rem;
	block-size: 1.75rem;
	padding: 0.3rem;
	background: var(--klauw-layer, var(--reg-ink-card));
	color: var(--klauw-layer-ink, var(--wp--preset--color--cream));
	line-height: 0;
}

.klauw-menu-sign svg {
	display: block;
	inline-size: 100%;
	block-size: auto;
	fill: currentColor;
}

/* The ink layer would vanish on the ink panel. */
.klauw-menu-sign.klauw-layer--wordpress {
	background: var(--reg-ink-card);
}

.klauw-menu-sign--dot {
	inline-size: 0.6rem;
	block-size: 0.6rem;
	margin-inline-start: 0.1rem;
	padding: 0;
	background: var(--wp--preset--color--ember);
}

.klauw-menu-label {
	min-width: 0;
}

.klauw-menu-note {
	display: block;
	margin-block-start: 0.15rem;
	color: var(--reg-ink-note);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.6875rem;
	font-weight: 400;
	letter-spacing: var(--k-label-spacing);
	text-transform: uppercase;
}

.klauw-menu-all {
	display: block;
	margin-block-start: 0.5rem;
	padding: 0.95rem 1rem;
	border-block-start: 1px solid var(--reg-ink-rule);
	color: inherit;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.6875rem;
	letter-spacing: var(--k-label-spacing);
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--ember);
	text-decoration-thickness: 1px;
	text-transform: uppercase;
	text-underline-offset: 0.45em;
}

.klauw-menu-all:is(:hover, :focus-visible) {
	background: var(--reg-ink-card);
	text-decoration-thickness: 2px;
}

.klauw-menu-all:focus-visible {
	outline-offset: -2px;
}

/* The Menu button: three bars and the word. It stays hidden until a narrow screen with script needs it. */
.klauw-dock__menu {
	display: none;
	gap: 0.65rem;
}

.klauw-dock__bars,
.klauw-menu__cross {
	flex: none;
	inline-size: 0.75rem;
	block-size: 0.625rem;
	background: currentColor;
	-webkit-mask: var(--k-bars) center / contain no-repeat;
	mask: var(--k-bars) center / contain no-repeat;
}

.klauw-menu__cross {
	block-size: 0.75rem;
	-webkit-mask-image: var(--k-cross);
	mask-image: var(--k-cross);
}

/*
 * The dialog: the whole menu on one ink plane over the page. Its bar repeats
 * the dock, with Sluit where Menu was, so the same tap opens and closes it.
 */
.klauw-menu {
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	inline-size: 100%;
	max-inline-size: none;
	block-size: 100%;
	max-block-size: none;
	margin: 0;
	padding: 0 0 2.5rem;
	border: 0;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--cream);
	overflow-y: auto;
	overscroll-behavior: contain;
	pointer-events: auto;
}

.klauw-menu:not([open]) {
	display: none;
}

.klauw-menu::backdrop {
	background: transparent;
}

html:has(.klauw-menu[open]) {
	overflow: hidden;
}

.klauw-menu__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.75rem var(--k-edge);
}

.klauw-menu__home {
	display: block;
	inline-size: 1.9rem;
	padding: 0.5rem 0.55rem;
	color: var(--wp--preset--color--cream);
	line-height: 0;
}

.klauw-menu__home svg {
	display: block;
	inline-size: 100%;
	block-size: auto;
	fill: currentColor;
}

.klauw-menu__close {
	gap: 0.65rem;
	background: var(--wp--preset--color--cream);
	color: var(--wp--preset--color--ink);
	box-shadow: inset 0 -3px 0 0 var(--wp--preset--color--ember);
}

.klauw-menu__nav {
	margin-block-start: 1.25rem;
	padding-inline: var(--k-edge);
}

.klauw-menu__pages {
	margin: 0;
	padding: 0;
	list-style: none;
}

.klauw-menu__pages > li {
	border-block-start: 1px solid var(--reg-ink-rule);
}

.klauw-menu__pages > li:last-child {
	border-block-end: 1px solid var(--reg-ink-rule);
}

.klauw-menu__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.klauw-menu__row > a {
	display: flex;
	align-items: center;
	gap: 0.3em;
	padding-block: 0.7rem;
	color: inherit;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(2rem, 9.5vw, 3rem);
	font-weight: 800;
	letter-spacing: -0.04em;
	line-height: 1;
	text-decoration: none;
}

.klauw-menu__row > a:is(:hover, :focus-visible) {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--ember);
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.12em;
}

/* The page you are on, or above: one block from the grid in front of it. */
.klauw-menu__row > a[aria-current]::before {
	content: "";
	flex: none;
	inline-size: 0.3em;
	block-size: 0.3em;
	background: var(--wp--preset--color--ember);
}

/* Plus and minus, as on the questions. */
.klauw-menu__more {
	flex: none;
	display: grid;
	place-items: center;
	inline-size: 3rem;
	block-size: 3rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	cursor: pointer;
}

.klauw-menu__more::before {
	content: "";
	inline-size: 1rem;
	block-size: 1rem;
	background:
		linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
		linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
}

.klauw-menu__more[aria-expanded="true"]::before {
	background: linear-gradient(var(--wp--preset--color--ember), var(--wp--preset--color--ember)) center / 100% 2px no-repeat;
}

.klauw-menu__pages .klauw-menu-list {
	padding-block-end: 1rem;
}

.klauw-menu__pages .klauw-menu-list[hidden] {
	display: none;
}

.klauw-menu__pages .klauw-menu-list a {
	padding-inline: 0.5rem;
	margin-inline: -0.5rem;
	font-size: 1.0625rem;
}

.klauw-menu__reach {
	margin-block-start: 2.25rem;
	padding-inline: var(--k-edge);
}

.klauw-menu__reach > * {
	margin: 0;
}

.klauw-menu__reach ul {
	margin-block: 0.75rem 1.25rem;
	padding: 0;
	list-style: none;
}

.klauw-menu__reach li + li {
	margin-block-start: 0.35rem;
}

.klauw-menu__reach a {
	color: inherit;
	font-size: 1.25rem;
	font-weight: 500;
	text-decoration-color: var(--wp--preset--color--ember);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.25em;
}

.klauw-menu__label {
	color: var(--reg-ink-note);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--label);
	letter-spacing: var(--k-label-spacing);
	text-transform: uppercase;
}

/* Arrival: panels are cut open from the top, in steps. */
@media (prefers-reduced-motion: no-preference) {
	:root:not([data-klauw-motion="off"]) .klauw-dock__item.is-open > .klauw-dock__sub,
	:root:not([data-klauw-motion="off"]) .klauw-menu[open] {
		animation: klauw-nav-cut 0.2s steps(5, end);
	}
}

@keyframes klauw-nav-cut {
	from {
		clip-path: inset(0 0 100% 0);
	}

	to {
		clip-path: inset(0 0 0 0);
	}
}

/*
 * A narrow screen: the row of links gives way to the Menu button. Without
 * script there is no dialog, so the row stays and wraps.
 */
@media (max-width: 899.98px) {
	.klauw-js .klauw-dock__links {
		display: none;
	}

	.klauw-js .klauw-dock__menu {
		display: inline-flex;
	}

	html:not(.klauw-js) .klauw-dock__nav {
		flex-wrap: wrap;
		justify-content: flex-end;
	}

	html:not(.klauw-js) .klauw-dock__links {
		flex-wrap: wrap;
		justify-content: flex-end;
	}

	/* Without script a submenu has nowhere to unfold on a narrow screen: its page lists the same links. */
	html:not(.klauw-js) .klauw-dock__toggle {
		display: none;
	}
}

/*
 * A very narrow screen: everything closer together. WordPress sets the gap of
 * a row of blocks itself, in a rule that starts at :root, so these do too.
 */
@media (max-width: 520px) {
	:root .klauw-dock,
	:root .klauw-dock__nav,
	:root .klauw-dock__links {
		gap: 0.25rem;
	}

	:root .klauw-dock,
	.klauw-menu__bar {
		padding-inline: 1rem;
	}

	.klauw-dock__links > li > a,
	.klauw-dock__menu,
	.klauw-menu__close {
		padding-inline: 0.75rem;
		letter-spacing: 0.1em;
	}

	.klauw-dock .klauw-dock__cta {
		padding-inline: 0.75rem;
		letter-spacing: 0.1em;
	}

	.klauw-menu__nav,
	.klauw-menu__reach {
		padding-inline: 1rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	body.home .klauw-dock .wp-block-klauw-logo {
		transition: none;
	}
}
