/**
 * Base styles that theme.json cannot express: transitions and the reduced-motion rule.
 *
 * Kept small on purpose; block-specific styles live in assets/css/blocks/.
 *
 * @package DeWittePrins\Theme
 * @since   0.1.0
 */

/*
 * Fallback while Raleway loads: Arial scaled to the width of Raleway 400 (measured on Dutch running
 * text) and given Raleway's vertical metrics, so lines neither wrap differently nor change height
 * when the web font swaps in.
 */
@font-face {
	font-family: "Raleway fallback";
	src: local("Arial");
	ascent-override: 90.21%;
	descent-override: 22.46%;
	line-gap-override: 0%;
	size-adjust: 104.2%;
}

/* A long word in a heading breaks at a large text setting instead of running out of the screen. */
:where(h1, h2, h3, h4, h5, h6) {
	overflow-wrap: break-word;
}

/* Buttons fill with the accent colour on hover or tap, with a short transition. */
.wp-element-button,
.wp-block-button__link {
	transition:
		background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		border-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

/*
 * Site header: a low bar of 52px on the plane colour, like the footer; the brand on the left, the
 * account, cart and menu icons on the right, each with a 44px tap area. On wide screens the bar
 * grows a little and holds the menu as tiles (assets/css/blocks/core-navigation.css).
 */
.wp-block-template-part:has(> .site-header) {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: var(--wp--custom--layer--header);
	transition: transform var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

/*
 * Hidden while reading down (assets/js/header-on-scroll.js). The visible state has no transform at all,
 * because any transform would trap the fixed menu overlay inside the header.
 */
.wp-block-template-part.is-header-hidden {
	transform: translateY(calc(-100% - var(--wp-admin--admin-bar--height, 0px)));
}

/*
 * An open menu always wins: no transform and no transition, also not halfway a slide back in, so the
 * overlay covers the screen instead of a strip the height of the header.
 */
.wp-block-template-part.wp-block-template-part:has(.is-menu-open) {
	transform: none;
	transition: none;
}

/*
 * Up to 600px WordPress lets the admin bar scroll away with the page (position: absolute), while the
 * height variable still says 46px. The header then sticks to the very top, not below an empty strip.
 */
@media screen and (max-width: 600px) {

	.wp-block-template-part:has(> .site-header) {
		top: 0;
	}

	.wp-block-template-part.is-header-hidden {
		transform: translateY(-100%);
	}
}

.site-header__bar {
	gap: 0;
	min-height: 3.25rem;
}

.site-header__bar > :first-child {
	margin-right: auto;
}

.brand-mark__link {
	display: block;
	line-height: 0;
}

.brand-mark__image {
	display: block;
	width: auto;
	max-width: 100%;
	height: 1.75rem;
}

/*
 * The sunrise of Tineke van Urk is taller than wide words: the arc and the road need height,
 * so the name stays readable.
 */
.brand-mark--tineke-van-urk .brand-mark__image {
	height: 3rem;
}

.site-header .wc-block-customer-account__link,
.site-header .wc-block-mini-cart__button {
	display: grid;
	place-items: center;
	min-width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	color: var(--wp--custom--color--on-plane);
}

/*
 * The count on the cart: the light button colour of the plane, so it stands out on the bar. WooCommerce
 * writes its own colours inline from a script, so only !important wins.
 */
.site-header .wc-block-mini-cart__badge {
	background-color: var(--wp--preset--color--plane-button) !important;
	color: var(--wp--custom--color--plane-deep) !important;
}

/*
 * Focus on the bar in the colour of its text: the accent would vanish on the plane. The panels of the
 * submenus and the cart drawer are light, so there the accent stays.
 */
.site-header .site-header__bar :focus-visible {
	outline-color: var(--wp--custom--color--on-plane);
}

.site-header .site-header__bar :is(.wp-block-navigation__submenu-container, .wc-block-mini-cart__drawer) :focus-visible {
	outline-color: var(--wp--preset--color--accent);
}

/* The cart drawer opens from inside the header: it takes the text colour of the page, not of the plane. */
.site-header .wc-block-mini-cart__drawer {
	color: var(--wp--preset--color--contrast);
}

@media (min-width: 60rem) {

	.site-header__bar {
		gap: var(--wp--preset--spacing--20);
		min-height: 4.25rem;
	}

	.brand-mark__image {
		height: 2.125rem;
	}

	.brand-mark--tineke-van-urk .brand-mark__image {
		height: 4rem;
	}
}

/*
 * Search in the wide bar: a magnifier that unfolds a field next to it. A stopgap until the design of
 * search unfolding over the bar is done. On a phone, and when the menu is behind the menu button
 * (.is-crowded), the field sits at the top of the menu overlay.
 */
.site-header__search.site-header__search {
	display: none;
}

@media (min-width: 60rem) {

	.site-header:not(.is-crowded) .site-header__search.site-header__search {
		display: block;
		position: relative;
		order: 1;
		margin: 0 0 0 0.625rem;
		padding-inline-start: 0.5rem;
	}

	/* A short line in the bar parts the fixed icons from the menu (board "Menu breed"). */
	.site-header:not(.is-crowded) .site-header__search.site-header__search::before {
		content: "";
		position: absolute;
		inset-block-start: 50%;
		inset-inline-start: 0;
		block-size: 1.375rem;
		border-inline-start: 1px solid color-mix(in srgb, var(--wp--custom--color--on-plane) 32%, transparent);
		transform: translateY(-50%);
	}

	/* The icons in the order of the board: search, cart, account. */
	.site-header:not(.is-crowded) .wp-block-woocommerce-mini-cart {
		order: 2;
	}

	.site-header:not(.is-crowded) .wp-block-woocommerce-customer-account {
		order: 3;
	}

	/* The field unfolds over the menu items, so the bar never reflows. */
	.site-header:not(.is-crowded) .site-header__search .wp-block-search__inside-wrapper {
		position: relative;
		align-items: center;
	}

	.site-header:not(.is-crowded) .site-header__search .wp-block-search__input {
		position: absolute;
		inset-block-start: 50%;
		inset-inline-end: 100%;
		z-index: 1;
		box-sizing: border-box;
		block-size: 2.75rem;
		transform: translateY(-50%);
		inline-size: 18rem;
		min-block-size: 2.75rem;
		padding-inline: 0.75rem;
		border: 1.5px solid var(--wp--custom--color--line-strong);
		border-radius: var(--wp--preset--border-radius--medium);
		background-color: var(--wp--preset--color--surface);
		color: var(--wp--preset--color--contrast);
	}

	.site-header:not(.is-crowded) .site-header__search .wp-block-search__input:focus {
		border-color: var(--wp--preset--color--accent);
		outline: 3px solid transparent; /* Shows as the focus ring in forced colours, where box-shadow is dropped. */
		box-shadow: 0 0 0 3px var(--wp--custom--color--ring);
	}

	.site-header:not(.is-crowded) .site-header__search.wp-block-search__searchfield-hidden .wp-block-search__input {
		visibility: hidden;
		inline-size: 0;
		padding: 0;
		border-width: 0;
	}

	.site-header:not(.is-crowded) .site-header__search .wp-block-search__button {
		display: grid;
		place-items: center;
		min-inline-size: 2.75rem;
		block-size: 2.75rem;
		margin: 0 0 0 0.25rem;
		padding: 0;
		border: 0;
		border-radius: var(--wp--preset--border-radius--small);
		background: none;
		color: var(--wp--custom--color--on-plane);
	}

	.site-header:not(.is-crowded) .site-header__search .wp-block-search__button svg {
		inline-size: 1.5rem;
		block-size: 1.5rem;
		fill: currentColor;
	}
}

/*
 * The icons in the bar (search, account, cart) are tiles like the menu items: same corners, and on
 * hover the same lift (core-navigation.css). Only for a real pointer.
 */
.site-header .wc-block-customer-account__link,
.site-header .wc-block-mini-cart__button,
.site-header .site-header__search .wp-block-search__button {
	border-radius: var(--wp--preset--border-radius--small);
	transition:
		background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		box-shadow var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

@media (min-width: 60rem) and (hover: hover) {

	.site-header .wc-block-customer-account__link:hover,
	.site-header .wc-block-mini-cart__button.wc-block-mini-cart__button:hover,
	.site-header:not(.is-crowded) .site-header__search .wp-block-search__button:hover {
		background-color: var(--wp--custom--color--submenu);
		box-shadow: 0 0.25rem 0.875rem rgba(0, 0, 0, 0.14);
		color: var(--wp--custom--color--submenu-text);
	}
}

/* Quiet header (checkout, landing pages): the brand and one link back, nothing else. */
.site-header__back {
	margin: 0;
}

.site-header__back a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	color: var(--wp--custom--color--on-plane);
	font-weight: 600;
}

/*
 * Back to top: a round button in the page space above the footer. It gives that space a task and
 * keeps the footer visibly apart from the band above it.
 */
.back-to-top {
	margin-block: var(--wp--preset--spacing--60);
	text-align: center;
}

.back-to-top__link {
	display: inline-grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 1px solid var(--wp--custom--color--rim);
	border-radius: 50%;
	background-color: var(--wp--preset--color--tint);
	color: var(--wp--preset--color--accent);
	transition:
		background-color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing),
		color var(--wp--custom--motion--duration) var(--wp--custom--motion--easing);
}

.back-to-top__link:hover,
.back-to-top__link:focus-visible {
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--custom--color--on-accent);
}

/*
 * Header on the plane colour, footer a step deeper. The brand mark uses its dark colour set there, its text in
 * warm white and its separating strokes in the plane colour, like the dark version of the logo.
 */
.site-header .brand-mark,
.site-footer .brand-mark {
	--wp--preset--color--contrast: var(--wp--custom--color--on-plane);
	--wp--preset--color--base: var(--wp--preset--color--plane);
	color-scheme: dark;
}

/* The footer lies a step deeper than the plane (board "Menu breed"), so its strokes take that colour. */
.site-footer .brand-mark {
	--wp--preset--color--base: var(--wp--custom--color--footer);
}

.site-footer .brand-mark__image {
	height: 2.125rem;
}

.site-footer .brand-mark--tineke-van-urk .brand-mark__image {
	height: 4.5rem;
}

.site-footer__main {
	row-gap: var(--wp--preset--spacing--50);
}

.site-footer__menu .wp-block-navigation__container {
	gap: 0;
}

.site-footer__menu .wp-block-navigation-item__content {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
}

/*
 * Footer menu in the language of the wide header bar, mirrored: pointing gives the whole item a green
 * tile, and a submenu opens upward as a panel joined to that tile, because below the footer there is no
 * page left to show it. The padding of the tiles is taken back by the container, so the text stays aligned.
 */
.site-footer__menu .wp-block-navigation__container.wp-block-navigation__container {
	margin-inline: -0.5rem;
}

.site-footer__menu .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	padding-inline: 0.5rem;
}

.site-footer__menu .wp-block-navigation__container > .has-child > .wp-block-navigation-item__content {
	padding-inline-end: 0.25rem;
}

/* Room to the edge of the tile in the margin: core sizes the button at 0.6em including its padding. */
.site-footer__menu .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-icon {
	margin: 0 0.5rem 0 0;
	padding: 0;
}

.site-footer__menu .wp-block-navigation__container > .wp-block-navigation-item:is(:hover, :focus-within) {
	border-radius: var(--wp--preset--border-radius--small);
	background-color: var(--wp--custom--color--submenu);
	color: var(--wp--custom--color--submenu-text);
}

.site-footer__menu .wp-block-navigation__container > .has-child:is(:hover, :focus-within) {
	border-radius: 0 0 var(--wp--preset--border-radius--small) var(--wp--preset--border-radius--small);
}

.site-footer__menu .wp-block-navigation__container > .wp-block-navigation-item:is(:hover, :focus-within) > .wp-block-navigation-item__content.wp-block-navigation-item__content {
	color: var(--wp--custom--color--submenu-text);
}

.site-footer__menu .wp-block-navigation__container > .has-child > .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
	top: auto;
	bottom: 100%;
	left: 0;
	padding: 0.375rem;
	border: 0;
	border-radius: var(--wp--preset--border-radius--medium) var(--wp--preset--border-radius--medium) var(--wp--preset--border-radius--medium) 0;
	background-color: var(--wp--custom--color--submenu);
	box-shadow: 0 -0.75rem 1.5rem rgba(0, 0, 0, 0.12);
	color: var(--wp--custom--color--submenu-text);
}

/*
 * The width only while the panel is open: core keeps a closed panel at width 0, and a closed panel
 * with a minimum width makes the page scroll sideways on a phone, where the menu is a column.
 */
.site-footer__menu .wp-block-navigation__container > .has-child:is(:hover, :focus-within) > .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container,
.site-footer__menu .wp-block-navigation__container > .has-child > [aria-expanded="true"] ~ .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
	min-width: 14rem;
}

/* Near the right edge the panel hangs to the left of its tile (assets/js/submenu-in-view.js). */
.site-footer__menu .wp-block-navigation__container > .has-child.is-submenu-flipped > .wp-block-navigation__submenu-container.wp-block-navigation__submenu-container {
	right: 0;
	left: auto;
	border-radius: var(--wp--preset--border-radius--medium) var(--wp--preset--border-radius--medium) 0 var(--wp--preset--border-radius--medium);
}

.site-footer__menu .wp-block-navigation__submenu-container .wp-block-navigation-item__content.wp-block-navigation-item__content {
	min-height: 2.5rem;
	padding: 0.5rem 0.75rem;
	border-radius: var(--wp--preset--border-radius--small);
	color: var(--wp--custom--color--submenu-text);
}

/* As on the header bar: pointing shifts the link in with a line, the page you are on is bold with the accent line. */
.site-footer__menu .wp-block-navigation__submenu-container .wp-block-navigation-item__content.wp-block-navigation-item__content:is(:hover, :focus-visible) {
	padding-inline-start: 1.25rem;
	color: var(--wp--custom--color--submenu-pointed);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.3em;
}

.site-footer__menu .wp-block-navigation-item__content[aria-current="page"] {
	font-weight: 700;
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent);
	text-decoration-thickness: 2px;
	text-underline-offset: 0.35em;
}

.site-footer .site-footer__line.site-footer__line {
	width: 100%;
	max-width: none;
	height: 0;
	border: 0;
	border-top: 1px solid rgba(245, 241, 234, 0.22);
	background: none;
}

.site-footer__legal {
	margin: 0;
	color: var(--wp--custom--color--footer-link);
}

.site-footer--quiet .site-footer__legal {
	color: inherit;
}

/* The footer menu is a list on the phone and one calm row from 40rem. */
@media (min-width: 40rem) {

	.site-footer__menu .wp-block-navigation__container {
		flex-direction: row;
		flex-wrap: wrap;
		column-gap: var(--wp--preset--spacing--50);
	}
}

/* Kicker: the small capitals line above a title, in the liver colour. Used on terms and paragraphs. */
.is-kicker {
	margin: 0;
	color: var(--wp--preset--color--kicker);
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 700;
	letter-spacing: 0.12em;
	line-height: 1.4;
	text-transform: uppercase;
}

.is-kicker a {
	color: inherit;
	text-decoration: none;
}

.is-kicker a:hover {
	text-decoration: underline;
}

/* What the visitor sets in the system always wins: no motion means no effects. */
@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

/* A kicker with a small dot in front, as on the call card. */
.is-kicker.has-dot {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.is-kicker.has-dot::before {
	content: "";
	flex: none;
	width: 0.375rem;
	height: 0.375rem;
	border-radius: 50%;
	background-color: currentColor;
}
