/*
 * Base styles: the things theme.json cannot express.
 * Every color, size and space comes from a theme.json variable.
 */

:root {
	--hmx-focus-color: var(--wp--preset--color--text);
	--hmx-control-border: var(--wp--preset--color--text-muted);
}

/* Sections with the primary background need a light focus ring. */
.has-primary-background-color,
.has-secondary-background-color {
	--hmx-focus-color: var(--wp--preset--color--primary-contrast);
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* Focus. */

:focus-visible,
.wp-block-navigation .wp-block-navigation-item__content:focus-visible,
.wp-block-search__input:focus-visible,
.wp-element-button:focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--hmx-focus-color);
	outline-offset: var(--wp--custom--focus--offset);
}

/* Motion. */

a,
.wp-element-button {
	transition:
		color var(--wp--custom--transition),
		background-color var(--wp--custom--transition),
		border-color var(--wp--custom--transition);
}

@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;
	}
}

/* Layout. */

.wp-site-blocks > footer,
.wp-site-blocks > main {
	margin-block-start: 0;
}

.hmx-front > * {
	margin-block: 0;
}

/* Buttons. */

.wp-element-button,
.wp-block-button__link {
	align-items: center;
	box-sizing: border-box;
	cursor: pointer;
	display: inline-flex;
	justify-content: center;
	min-height: var(--wp--custom--target--min);
	text-align: center;
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background) {
	background-color: transparent;
	border: 1px solid var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary);
	padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
}

.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):hover,
.wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background):focus {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-contrast);
}

/* The button on the primary background swaps to an outline on hover. */
.hmx-cta__button > .wp-block-button__link {
	border-color: var(--wp--preset--color--primary-contrast);
}

.hmx-cta__button > .wp-block-button__link:hover,
.hmx-cta__button > .wp-block-button__link:focus {
	background-color: var(--wp--preset--color--primary) !important;
	border-color: var(--wp--preset--color--primary-contrast);
	color: var(--wp--preset--color--primary-contrast) !important;
}

/* Form controls. */

input:where([type="text"], [type="email"], [type="tel"], [type="url"], [type="password"], [type="search"], [type="number"]),
select,
textarea {
	background-color: var(--wp--preset--color--background);
	border: 1px solid var(--hmx-control-border);
	border-radius: var(--wp--custom--radius--sm);
	box-sizing: border-box;
	color: var(--wp--preset--color--text);
	font-family: inherit;
	font-size: var(--wp--preset--font-size--md);
	line-height: var(--wp--custom--line-height--snug);
	min-height: var(--wp--custom--target--min);
	padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--30);
}

::placeholder {
	color: var(--wp--preset--color--text-muted);
	opacity: 1;
}

.wp-block-search__inside-wrapper {
	gap: var(--wp--preset--spacing--20);
}

.wp-block-search__input {
	border-color: var(--hmx-control-border);
	border-radius: var(--wp--custom--radius--sm);
	min-width: 0;
}

.wp-block-search__button {
	margin-left: 0;
	min-width: var(--wp--custom--target--min);
}

.wp-block-search__button.has-icon {
	padding: var(--wp--preset--spacing--20);
}

/* Header. */

.hmx-header {
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding-block: var(--wp--preset--spacing--30);
}

.hmx-header__bar {
	align-items: center;
	gap: var(--wp--preset--spacing--30) var(--wp--preset--spacing--50);
}

.hmx-header__brand {
	gap: var(--wp--preset--spacing--30);
}

.hmx-header__nav {
	flex: 1 1 auto;
}

.hmx-header__search {
	flex: 0 1 18rem;
}

.hmx-header__actions {
	gap: var(--wp--preset--spacing--10);
}

@media (max-width: 599px) {
	.hmx-header__brand {
		margin-inline-end: auto;
		order: 1;
	}

	/* The cart link takes the place of the actions in the checkout header. */
	.hmx-header__actions,
	.hmx-header__bar > .wp-block-woocommerce-cart-link {
		order: 2;
	}

	.hmx-header__nav {
		flex: 0 0 auto;
		order: 3;
	}

	.hmx-header__search {
		flex: 1 0 100%;
		order: 4;
	}
}

/* Navigation. */

.wp-block-navigation .wp-block-navigation-item__content {
	padding-block: var(--wp--preset--spacing--20);
}

.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
	align-items: center;
	display: flex;
	justify-content: center;
	min-height: var(--wp--custom--target--min);
	min-width: var(--wp--custom--target--min);
}

@media (min-width: 600px) {
	.wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: none;
	}
}

.wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--text);
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-size: var(--wp--preset--font-size--lg);
	min-height: var(--wp--custom--target--min);
}

/* Footer. */

.hmx-footer {
	border-top: 1px solid var(--wp--preset--color--border);
}

.hmx-footer__top {
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--60);
}

.hmx-footer__brand > * {
	margin-block: 0;
}

.hmx-footer__nav .wp-block-navigation__container {
	gap: var(--wp--preset--spacing--10) var(--wp--preset--spacing--50);
}

.hmx-footer__bottom {
	border-top: 1px solid var(--wp--preset--color--border);
	padding-top: var(--wp--preset--spacing--40);
}

.hmx-footer__bottom p {
	margin: 0;
}

/* Home page sections. */

.hmx-section-head {
	margin-bottom: var(--wp--preset--spacing--50);
}

.hmx-section-head > * {
	margin: 0;
}

.hmx-usp {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.hmx-usp__item > * {
	margin-block: 0 var(--wp--preset--spacing--20);
}

.hmx-category-card {
	position: relative;
}

.hmx-category-card > * {
	margin-block: 0 var(--wp--preset--spacing--20);
}

.hmx-category-card__media {
	aspect-ratio: 4 / 3;
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--md);
	margin-bottom: var(--wp--preset--spacing--30);
	overflow: hidden;
}

.hmx-category-card__media img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* The link covers the whole card, so the card is one large target. */
.hmx-category-card a {
	color: var(--wp--preset--color--text);
	text-decoration: none;
}

.hmx-category-card a::after {
	border-radius: var(--wp--custom--radius--md);
	content: "";
	inset: 0;
	position: absolute;
}

.hmx-category-card a:hover {
	text-decoration: underline;
}

.hmx-category-card a:focus-visible {
	outline: none;
}

.hmx-category-card a:focus-visible::after {
	outline: var(--wp--custom--focus--width) solid var(--hmx-focus-color);
	outline-offset: var(--wp--custom--focus--offset);
}

.hmx-testimonial .wp-block-quote {
	margin-inline: auto;
}

/* Posts list. */

.hmx-posts > li {
	border-bottom: 1px solid var(--wp--preset--color--border);
	padding-bottom: var(--wp--preset--spacing--50);
}

.hmx-posts > li > * {
	margin-block: 0 var(--wp--preset--spacing--20);
}

/* Pagination. */

.wp-block-query-pagination {
	gap: var(--wp--preset--spacing--20);
	margin-top: var(--wp--preset--spacing--60);
}

.wp-block-query-pagination-numbers {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--10);
}

.wp-block-query-pagination .page-numbers,
.wp-block-query-pagination-next,
.wp-block-query-pagination-previous {
	align-items: center;
	border-radius: var(--wp--custom--radius--sm);
	box-sizing: border-box;
	display: inline-flex;
	justify-content: center;
	min-height: var(--wp--custom--target--min);
	min-width: var(--wp--custom--target--min);
	padding-inline: var(--wp--preset--spacing--20);
	text-decoration: none;
}

.wp-block-query-pagination a:hover {
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--text);
}

.wp-block-query-pagination .page-numbers.current {
	background-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-contrast);
	font-weight: var(--wp--custom--font-weight--bold);
}
