/**
 * Steuber Theme: what theme.json cannot express.
 *
 * Only preset (--wp--preset--*) and custom (--wp--custom--*) properties from
 * theme.json are used, so every style variation restyles this file too.
 */

/* Focus ring: keyboard focus on links, buttons, navigation and form fields. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
.wp-element-button:focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--focus);
	outline-offset: var(--wp--custom--focus--offset);
}

/* On dark backgrounds the ring switches to the on-dark colour. */
:is(
	.has-primary-background-color,
	.has-primary-hover-background-color,
	.has-ink-background-color,
	.has-link-background-color
) :is(a, button, input, select, textarea, summary, [tabindex], .wp-element-button):focus-visible {
	outline-color: var(--wp--preset--color--on-dark);
}

/* On mid-tone accent backgrounds the ring switches to ink. */
:is(
	.has-accent-background-color,
	.has-highlight-background-color,
	.has-highlight-hover-background-color
) :is(a, button, input, select, textarea, summary, [tabindex], .wp-element-button):focus-visible {
	outline-color: var(--wp--preset--color--ink);
}

/* Buttons: smooth colour changes. */
.wp-element-button,
.wp-block-button__link {
	transition:
		background-color var(--wp--custom--transition),
		border-color var(--wp--custom--transition),
		color var(--wp--custom--transition);
}

@media (prefers-reduced-motion: reduce) {

	.wp-element-button,
	.wp-block-button__link {
		transition: none;
	}
}

/* Button style "With icon": a bag icon drawn in the text colour. */
.wp-block-button.is-style-with-icon .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--2);
}

.wp-block-button.is-style-with-icon .wp-block-button__link::before {
	content: "";
	flex: none;
	width: var(--wp--custom--icon--size);
	height: var(--wp--custom--icon--size);
	background-color: currentcolor;
	mask: url(../icons/bag.svg) center / contain no-repeat;
}

/*
 * Hover states of the button styles.
 * Rest colours live in theme.json (styles.blocks.core/button.variations). Hover
 * cannot: pseudo-classes are not supported on block style variations, and core
 * prints its own outline variation after any element hover. The colours stay
 * semantic presets, so every style variation still recolours them.
 */
.wp-block-button:is(.is-style-secondary, .is-style-with-icon) .wp-block-button__link:hover {
	background-color: var(--wp--preset--color--primary-hover);
	color: var(--wp--preset--color--on-dark);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	border-color: var(--wp--preset--color--primary);
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--on-dark);
}

.wp-block-button.is-style-ghost-light .wp-block-button__link:hover {
	border-color: var(--wp--preset--color--on-dark);
	background-color: var(--wp--preset--color--on-dark);
	color: var(--wp--preset--color--primary);
}

/*
 * Button style "Outline": core gives it its own em-based padding. Keep it the
 * same size as the other buttons, also inside a "Small buttons" group.
 */
.wp-block-button.is-style-outline > .wp-block-button__link {
	padding: var(--wp--custom--button--padding-block) var(--wp--custom--button--padding-inline);
}

.wp-block-buttons.is-style-small > .wp-block-button.is-style-outline > .wp-block-button__link {
	padding: var(--wp--custom--button--small--padding-block) var(--wp--custom--button--small--padding-inline);
}

/*
 * Button style "Outline" on mid-tone accent backgrounds: primary text does not
 * reach 4.5:1 there in every palette, so the outline switches to ink.
 */
:is(
	.has-accent-background-color,
	.has-highlight-background-color
) .wp-block-button.is-style-outline .wp-block-button__link:not(.has-text-color, :hover) {
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ink);
}

/*
 * Template parts sit directly below each other: the header, main content and
 * footer bands carry their own spacing.
 */
.wp-site-blocks > * + * {
	margin-block-start: 0;
}

/* Top bar: contact links in the on-dark colour, without underline. */
.site-topbar a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--on-dark);
	font-weight: 600;
	text-decoration: none;
}

.site-topbar a:where(:not(.wp-element-button)):hover {
	text-decoration: underline;
}

/* The contact links stay on the right when the slogan is hidden. */
.site-topbar .alignwide > :last-child {
	margin-left: auto;
}

/*
 * WooCommerce mini-cart in the top bar: a compact icon in the bar's link
 * colour, with the item count as a small highlight badge.
 */
.site-topbar .wc-block-mini-cart__button {
	padding: var(--wp--preset--spacing--1);
	color: var(--wp--preset--color--on-dark);
}

.site-topbar .wc-block-mini-cart__icon {
	width: var(--wp--custom--topbar--cart-icon-size);
	height: var(--wp--custom--topbar--cart-icon-size);
}

.site-topbar .wc-block-mini-cart__badge {
	background-color: var(--wp--preset--color--highlight);
	color: var(--wp--preset--color--ink);
}

/* Header. */
.site-header {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

/*
 * Fallback for the sticky header (class "steuber-sticky") where Steuber Block
 * Logic Pro does not make the block sticky itself: the template part wrapper
 * steps aside so the header sticks to the page, and the top bar scrolls away.
 */
.wp-site-blocks > .wp-block-template-part:has(> .steuber-sticky:not(.glp-sticky)) {
	display: contents;
}

.steuber-sticky:not(.glp-sticky) {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0);
	z-index: 99;
}

.site-header__brand {
	flex-shrink: 0;
}

.site-header .wp-block-site-logo img {
	max-height: var(--wp--custom--header--logo-height);
	width: auto;
}

/*
 * Sticky header with Steuber Block Logic Pro, once scrolled past its effects
 * offset: a smaller logo makes the bar more compact.
 */
.site-header .wp-block-site-logo img {
	transition: max-height var(--wp--custom--transition);
}

.site-header.glp-sticky--effects .wp-block-site-logo img {
	max-height: var(--wp--custom--header--logo-height-compact);
}

@media (prefers-reduced-motion: reduce) {

	.site-header .wp-block-site-logo img {
		transition: none;
	}
}

/* Header buttons keep their label on one line. */
.site-header .wp-block-button__link {
	white-space: nowrap;
}

/* Main menu: the current page and hover get an accent underline. */
.site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content {
	padding-block: var(--wp--preset--spacing--2);
	border-bottom: var(--wp--custom--nav--indicator) solid transparent;
	text-decoration: none;
}

.site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__content:is(:hover, [aria-current="page"]) {
	border-bottom-color: var(--wp--preset--color--accent-strong);
}

/* Overlay menu: items start at the left, whatever the desktop alignment. */
.site-header .wp-block-navigation__responsive-container.is-menu-open,
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	--navigation-layout-justification-setting: flex-start;
	--navigation-layout-justify: flex-start;
}

/* Overlay menu: the current page is underlined there too. */
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content[aria-current="page"] {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--accent-strong);
	text-decoration-thickness: var(--wp--custom--nav--indicator);
	text-underline-offset: 0.35em;
}

/* Menu button: a square outlined button. */
.wp-block-navigation__responsive-container-open {
	justify-content: center;
	align-items: center;
	width: var(--wp--custom--header--menu-button-size);
	height: var(--wp--custom--header--menu-button-size);
	border: 2px solid currentcolor;
	border-radius: var(--wp--custom--radius--md);
	background-color: var(--wp--preset--color--surface);
}

/*
 * Navigation styles "Menu button below 900px" and "Menu button below 1240px":
 * core switches to the menu button below 600px; these styles keep it up to
 * the tablet breakpoint, or up to laptop width for long menus.
 */
@media (min-width: 600px) and (max-width: 899.98px) {

	.wp-block-navigation.is-style-collapse-tablet .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.wp-block-navigation.is-style-collapse-tablet .wp-block-navigation__responsive-container:not(.hidden-by-default, .is-menu-open) {
		display: none;
	}
}

@media (min-width: 600px) and (max-width: 1239.98px) {

	.wp-block-navigation.is-style-collapse-laptop .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}

	.wp-block-navigation.is-style-collapse-laptop .wp-block-navigation__responsive-container:not(.hidden-by-default, .is-menu-open) {
		display: none;
	}

	.site-header__actions .wp-block-navigation.is-style-collapse-laptop {
		order: 1;
	}
}

/* Header menu items keep their label on one line. */
.site-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation-item__label {
	white-space: nowrap;
}

/* Footer. */
.site-footer a:where(:not(.wp-element-button)) {
	color: var(--wp--preset--color--on-dark);
	text-decoration: none;
}

.site-footer a:where(:not(.wp-element-button)):hover {
	text-decoration: underline;
}

.site-footer__logo .wp-block-site-logo img {
	max-height: var(--wp--custom--footer--logo-height);
	width: auto;
}

.site-footer__bottom {
	border-top: 1px solid var(--wp--custom--color--line-on-dark);
}

/* Narrow phones: actions may wrap below the logo, never off-screen. */
@media (max-width: 599.98px) {

	.site-header .alignwide {
		flex-wrap: wrap;
	}
}

/*
 * WooCommerce templates: their main area has no spacing of its own, and the
 * cart and checkout titles are capped narrower than the wide blocks below them.
 * (Templates that set their own padding keep it: inline styles win.) On the
 * single product page WooCommerce wraps main in an extra group.
 */
.woocommerce-page .wp-site-blocks > main,
.woocommerce-page .wp-site-blocks > .wp-block-group.product > main {
	padding-block: var(--wp--preset--spacing--8) var(--wp--preset--spacing--20);
}

:is(.woocommerce-cart, .woocommerce-checkout) .wp-block-post-title.alignwide {
	max-width: var(--wp--style--global--wide-size);
}

/*
 * Below the tablet breakpoint (900px): compact header, contact details in the
 * top bar reduced to the essentials, smaller small buttons.
 */
@media (max-width: 899.98px) {

	/*
	 * Fallback for responsive visibility without Steuber Block Logic: hidden
	 * on phones and tablets. With the plugin, its setting on the block decides.
	 */
	.no-block-logic .steuber-hide-mobile {
		display: none;
	}

	.site-topbar .alignwide {
		justify-content: center;
	}

	.site-topbar .alignwide > :last-child {
		margin-left: 0;
	}

	.site-header .wp-block-site-logo img {
		max-height: var(--wp--custom--header--logo-height-mobile);
	}

	/* With a logo, the site title only returns from tablet width. */
	.site-header__brand:has(.wp-block-site-logo img) .wp-block-site-title {
		display: none;
	}

	.site-header .alignwide,
	.site-header__actions,
	.site-header .wp-block-buttons {
		gap: var(--wp--preset--spacing--2);
	}

	/* The menu button sits after the action buttons, as in the design. */
	.site-header__actions .wp-block-navigation {
		order: 1;
	}

	:is(.wp-block-buttons.is-style-small, .wp-block-button.is-style-small) .wp-block-button__link {
		padding-inline: var(--wp--preset--spacing--3);
		font-size: var(--wp--preset--font-size--body-sm);
	}
}

/*
 * Sections and block styles used by the patterns.
 */

/* Paragraph style "Badge": as wide as its text. */
.is-style-badge {
	width: fit-content;
}

/* Breadcrumbs on dark bands: links in the on-dark colour, without underline. */
:is(
	.has-primary-background-color,
	.has-primary-hover-background-color,
	.has-ink-background-color
) .wp-block-breadcrumbs a {
	color: var(--wp--preset--color--on-dark);
	text-decoration: none;
}

:is(
	.has-primary-background-color,
	.has-primary-hover-background-color,
	.has-ink-background-color
) .wp-block-breadcrumbs a:hover {
	text-decoration: underline;
}

/* Group styles "Card", "Panel" and "Panel with accent edge". */
.wp-block-group:is(.is-style-card, .is-style-panel, .is-style-panel-accent) {
	overflow: hidden;
}

.wp-block-group.is-style-card {
	transition:
		box-shadow var(--wp--custom--transition),
		transform var(--wp--custom--transition);
}

.wp-block-group.is-style-card:hover {
	box-shadow: var(--wp--custom--shadow--card-hover);
	transform: translateY(var(--wp--custom--card--lift));
}

.wp-block-group.is-style-panel-accent {
	border-top: var(--wp--custom--card--accent-width) solid var(--wp--preset--color--accent);
}

@media (prefers-reduced-motion: reduce) {

	.wp-block-group.is-style-card {
		transition: none;
	}

	.wp-block-group.is-style-card:hover {
		transform: none;
	}
}

/*
 * Group style "Numbered steps": every direct child gets its number in a
 * diamond above it.
 */
.wp-block-group.is-style-numbered {
	counter-reset: steuber-step;
}

.wp-block-group.is-style-numbered > * {
	position: relative;
	padding-top: var(--wp--preset--spacing--12);
	counter-increment: steuber-step;
}

.wp-block-group.is-style-numbered > *::before {
	content: counter(steuber-step);
	position: absolute;
	top: 0;
	left: 0;
	display: grid;
	place-items: center;
	width: var(--wp--custom--step--size);
	height: var(--wp--custom--step--size);
	background-color: var(--wp--preset--color--highlight);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--custom--step--font-size);
	font-weight: 800;
	line-height: 1;
	clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

/* Image styles "Accent bar" and "Corner accent". */
.wp-block-image:is(.is-style-accent-bar, .is-style-corner-accent) {
	position: relative;
	overflow: hidden;
}

.wp-block-image:is(.is-style-accent-bar, .is-style-corner-accent) img {
	display: block;
	width: 100%;
}

.wp-block-image:is(.is-style-accent-bar, .is-style-corner-accent)::after {
	content: "";
	position: absolute;
	bottom: 0;
	pointer-events: none;
}

.wp-block-image.is-style-accent-bar::after {
	left: 0;
	width: var(--wp--custom--image--bar-width);
	height: var(--wp--custom--image--bar-height);
	background-color: var(--wp--preset--color--accent);
}

.wp-block-image.is-style-corner-accent::after {
	right: 0;
	width: var(--wp--custom--image--corner-size);
	height: var(--wp--custom--image--corner-size);
	background-color: var(--wp--preset--color--highlight);
	clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

/* A free-standing image with an accent gets large rounded corners. */
.wp-block-image:is(.is-style-accent-bar, .is-style-corner-accent) {
	border-radius: var(--wp--custom--radius--lg);
}

.wp-block-group:is(.is-style-card, .is-style-panel, .is-style-panel-accent) > .wp-block-image {
	border-radius: 0;
}

/* The placeholder image of the patterns: a soft plane until a photo is set. */
.wp-block-image img[src$="/assets/images/placeholder.svg"] {
	background-color: var(--wp--preset--color--accent-soft);
}

/* List styles "Diamonds" and "Diamonds in a row". */
.wp-block-list:is(.is-style-diamonds, .is-style-diamonds-row) {
	display: grid;
	gap: var(--wp--preset--spacing--3);
	padding-left: 0;
	list-style: none;
}

.wp-block-list:is(.is-style-diamonds, .is-style-diamonds-row) > li {
	display: flex;
	gap: var(--wp--preset--spacing--3);
	align-items: baseline;
	font-weight: 500;
}

.wp-block-list:is(.is-style-diamonds, .is-style-diamonds-row) > li::before {
	content: "";
	flex: none;
	width: var(--wp--custom--diamond--size-small);
	height: var(--wp--custom--diamond--size-small);
	background-color: var(--wp--preset--color--accent);
	transform: var(--wp--custom--diamond--transform);
}

/* In a row: two columns, one row from tablet width, colours in turn. */
.wp-block-list.is-style-diamonds-row {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--4) var(--wp--preset--spacing--6);
}

.wp-block-list.is-style-diamonds-row > li {
	align-items: center;
	color: var(--wp--preset--color--primary);
	font-size: var(--wp--custom--list--row-font-size);
	font-weight: 600;
	line-height: 1.3;
}

.wp-block-list.is-style-diamonds-row > li::before {
	width: var(--wp--custom--diamond--size);
	height: var(--wp--custom--diamond--size);
}

.wp-block-list.is-style-diamonds-row > li:nth-child(4n + 1)::before {
	background-color: var(--wp--preset--color--highlight);
}

.wp-block-list.is-style-diamonds-row > li:nth-child(4n + 3)::before {
	background-color: var(--wp--preset--color--link);
}

.wp-block-list.is-style-diamonds-row > li:nth-child(4n + 4)::before {
	background-color: var(--wp--preset--color--primary);
}

@media (min-width: 900px) {

	.wp-block-list.is-style-diamonds-row {
		grid-template-columns: none;
		grid-auto-columns: minmax(0, 1fr);
		grid-auto-flow: column;
	}
}

/*
 * Forms of the Contact Form 7 plugin: labels above full-width fields. The
 * field border is ink-muted, not line: a field needs 3:1 against the page.
 * Give the submit tag the class "wp-element-button" to make it a theme button.
 */
.wpcf7-form p {
	margin-block: 0 var(--wp--preset--spacing--4);
}

.wpcf7-form label {
	display: block;
	font-weight: 600;
}

.wpcf7-form :is(input:not([type="submit"], [type="checkbox"], [type="radio"], [type="file"]), textarea, select) {
	display: block;
	box-sizing: border-box;
	width: 100%;
	margin-top: var(--wp--preset--spacing--1);
	padding: var(--wp--preset--spacing--3);
	border: 1px solid var(--wp--preset--color--ink-muted);
	border-radius: var(--wp--custom--radius--sm);
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font: inherit;
	font-weight: 400;
}

.wpcf7-form .wpcf7-submit {
	cursor: pointer;
}

/*
 * Embedded frames in the content (class "steuber-embed" on the iframe, for
 * example a map): full width, no border, rounded corners.
 */
.steuber-embed {
	display: block;
	width: 100%;
	border: 0;
	border-radius: var(--wp--custom--radius--md);
}

