/**
 * Global base styles. Keep this file small (budget: 20 KB unminified).
 * Colours, fonts and spacing come from theme.json as CSS custom properties:
 *   --wp--preset--color--{slug},
 *   --wp--preset--font-size--{slug},
 *   --wp--preset--spacing--{10..60}, --wp--custom--*.
 * Block-specific CSS lives with each block and only loads where
 * the block is used.
 */

/* ---------- Reset (light) ---------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-padding-top: var(--emtrer-sticky-offset, 0);
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	overflow-wrap: break-word;
}

img,
svg,
video,
iframe {
	max-width: 100%;
	height: auto;
}

/* Zero specificity (:where), so the icon helper below and any block can
   change it. */
:where(img, svg, video) {
	display: block;
}

input,
button,
textarea,
select {
	font: inherit;
}

:where(h1, h2, h3, h4, h5, h6) {
	text-wrap: balance;
	margin-block: 0 0.5em;
}

:where(p) {
	text-wrap: pretty;
}

/* ---------- Layout ---------- */
.site-main {
	flex: 1 0 auto;
}

/* Centred container for theme templates (header, footer, archives). */
.container {
	width: min(100% - 2 * var(--wp--preset--spacing--30), var(--wp--style--global--wide-size, 78rem));
	margin-inline: auto;
}

.container--narrow {
	width: min(100% - 2 * var(--wp--preset--spacing--30), var(--wp--style--global--content-size, 48rem));
}

.section {
	padding-block: var(--wp--preset--spacing--50);
}

.section--surface {
	background: var(--wp--preset--color--surface);
}

/* ---------- Accessibility ---------- */

/* Visible keyboard focus everywhere (WCAG 2.4.7 / 2.4.11). */
:focus-visible {
	outline: var(--wp--custom--focus--width) solid var(--wp--custom--focus--color);
	outline-offset: var(--wp--custom--focus--offset);
}

:focus:not(:focus-visible) {
	outline: none;
}

/* WordPress core class: hidden visually, available to screen readers. */
.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute;
	width: 1px;
	white-space: nowrap;
	overflow-wrap: normal !important;
}

.skip-link {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1000;
	padding: 0.75rem 1.25rem;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	font-weight: 600;
	text-decoration: none;
	transform: translateY(-120%);
}

.skip-link:focus {
	transform: none;
	clip-path: none;
	width: auto;
	height: auto;
	margin: 0;
}

/* Minimum tap/click size for controls (WCAG 2.5.8 asks 24px; we use 44px). */
:where(button, .wp-element-button, .wp-block-button__link, input[type="submit"], select) {
	min-height: var(--wp--custom--tap-target);
	cursor: pointer;
}

.wp-element-button,
.wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	transition: background-color var(--wp--custom--transition), color var(--wp--custom--transition);
}

/* Outline button style (registered by core). */
.is-style-outline > .wp-block-button__link {
	border: 2px solid currentcolor;
	background: transparent;
	color: var(--wp--preset--color--primary);
}

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

/* ---------- Icons ---------- */

/* Zero specificity (:where), so any block's own rule for an icon wins
   whatever order the stylesheets load in. */
:where(.emtrer-icon) {
	display: inline-block;
	width: 1.25em;
	height: 1.25em;
	flex: none;
	vertical-align: middle;
}

/* ---------- Content ---------- */
.wp-block-image figcaption,
.wp-element-caption {
	margin-top: 0.5em;
}

table {
	border-collapse: collapse;
	width: 100%;
}

:where(th, td) {
	border: 1px solid var(--wp--preset--color--border);
	padding: 0.5rem 0.75rem;
	text-align: start;
}

/* ==========================================================================
   Site header and navigation (mobile first; desktop from 64em)
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: color-mix(in srgb, var(--wp--preset--color--base) 88%, transparent);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.site-header__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
	padding-block: var(--wp--preset--spacing--20);
}

.site-branding {
	margin-inline-end: auto;
}

.site-branding img {
	width: auto;
	max-height: 3.5rem;
}

.site-title {
	display: inline-flex;
	align-items: center;
	min-height: var(--wp--custom--tap-target);
	font-family: var(--wp--preset--font-family--heading);
	font-size: 1.7rem;
	font-weight: 800;
	letter-spacing: -0.05em;
	text-transform: lowercase;
	color: inherit;
	text-decoration: none;
}

/* The logo's full stop drops in once per page and hops on hover. */
.site-title__dot {
	width: 0.38em;
	height: 0.38em;
	margin: 0.42em 0 0 0.08em;
	border-radius: 50%;
	background: var(--wp--preset--color--accent);
	transform-origin: 50% 100%;
}

@media (prefers-reduced-motion: no-preference) {

	.site-header .site-title__dot {
		animation: emtrer-dot-drop 1s cubic-bezier(0.3, 0.8, 0.4, 1) 0.4s both;
	}

	.site-title:is(:hover, :focus-visible) .site-title__dot {
		animation: emtrer-dot-hop 0.62s cubic-bezier(0.3, 0.8, 0.4, 1) both;
	}
}

@keyframes emtrer-dot-drop {

	0% {
		transform: translateY(-2.4em);
		opacity: 0;
	}

	15% {
		opacity: 1;
	}

	48%,
	80% {
		transform: scale(1.3, 0.7);
	}

	64% {
		transform: translateY(-0.6em) scale(0.9, 1.14);
	}

	100% {
		transform: none;
	}
}

@keyframes emtrer-dot-hop {

	18%,
	78% {
		transform: scale(1.24, 0.74);
	}

	50% {
		transform: translateY(-0.85em) scale(0.88, 1.16);
	}
}

.header-actions {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--20);
}

.header-phone {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	min-height: var(--wp--custom--tap-target);
	font-weight: 700;
	color: var(--wp--preset--color--primary);
	text-decoration: none;
	white-space: nowrap;
}

.header-phone:hover {
	text-decoration: underline;
}

/* On phones the number lives in the call bar; keep just the icon here. */
@media (max-width: 47.99em) {

	.header-phone span {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}

	.header-phone {
		justify-content: center;
		min-width: var(--wp--custom--tap-target);
	}

	.header-cta {
		display: none;
	}
}

.menu-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	order: 3;
	padding: 0 1rem;
	border: 1.5px solid currentcolor;
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
}

.menu-toggle__close,
.menu-toggle[aria-expanded="true"] .menu-toggle__open {
	display: none;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__close {
	display: inline;
}

.header-actions {
	order: 2;
}

.primary-nav {
	order: 4;
	flex-basis: 100%;
}

.primary-nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.primary-nav a {
	display: flex;
	align-items: center;
	min-height: var(--wp--custom--tap-target);
	padding: 0.5rem 0.75rem;
	color: var(--wp--preset--color--contrast);
	font-weight: 600;
	text-decoration: none;
}

.primary-nav a {
	font-weight: 500;
}

.primary-nav a:hover,
.primary-nav [aria-current="page"],
.primary-nav .current-menu-ancestor > a {
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.35em;
}

.primary-nav li {
	position: relative;
}

.submenu-toggle {
	position: absolute;
	top: 0;
	right: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--wp--custom--tap-target);
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
}

.submenu-toggle .emtrer-icon {
	transition: transform var(--wp--custom--transition);
}

.submenu-toggle[aria-expanded="true"] .emtrer-icon {
	transform: rotate(180deg);
}

/* Mobile: the menu is a panel under the header row, submenus are accordions. */
@media (max-width: 63.99em) {

	.js .primary-nav {
		display: none;
	}

	.js .primary-nav.is-open {
		display: block;
		max-height: calc(100vh - 5rem);
		overflow-y: auto;
		border-top: 1px solid var(--wp--preset--color--border);
	}

	.primary-nav li {
		border-bottom: 1px solid var(--wp--preset--color--border);
	}

	.primary-nav .menu-item-has-children > a {
		padding-inline-end: calc(var(--wp--custom--tap-target) + 0.5rem);
	}

	.primary-nav .sub-menu {
		padding-inline-start: 1rem;
	}

	.primary-nav .sub-menu li:last-child {
		border-bottom: 0;
	}

	.js .primary-nav .sub-menu {
		display: none;
	}

	.js .submenu-toggle[aria-expanded="true"] + .sub-menu {
		display: block;
	}

	html:not(.js) .menu-toggle,
	html:not(.js) .submenu-toggle {
		display: none;
	}
}

/* Desktop: horizontal bar with dropdowns. */
@media (min-width: 64em) {

	.menu-toggle {
		display: none;
	}

	.primary-nav {
		order: 0;
		flex-basis: auto;
	}

	.header-actions {
		order: 1;
	}

	.primary-nav__menu {
		display: flex;
		flex-wrap: wrap;
		align-items: center;
	}

	/* Top level: link and its toggle sit side by side. */
	.primary-nav__menu > li {
		display: flex;
		align-items: center;
	}

	.primary-nav__menu > .menu-item-has-children > a {
		padding-inline-end: 0.125rem;
	}

	.primary-nav__menu > li > .submenu-toggle {
		position: static;
		width: 1.75rem;
	}

	.primary-nav .sub-menu {
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 10;
		display: none;
		min-width: 15rem;
		padding: 0.5rem 0;
		background: var(--wp--preset--color--base);
		border: 1px solid var(--wp--preset--color--border);
		border-radius: var(--wp--custom--radius--medium);
		box-shadow: var(--wp--preset--shadow--card);
	}

	.primary-nav .sub-menu .sub-menu {
		top: 0;
		left: 100%;
	}

	.primary-nav .sub-menu a {
		padding-inline: 1rem;
		font-weight: 400;
	}

	.primary-nav .sub-menu .submenu-toggle {
		transform: rotate(-90deg);
	}

	.submenu-toggle[aria-expanded="true"] + .sub-menu,
	html:not(.js) .primary-nav li:hover > .sub-menu,
	html:not(.js) .primary-nav li:focus-within > .sub-menu {
		display: block;
	}
}

/* ==========================================================================
   Breadcrumbs and page headers
   ========================================================================== */
.breadcrumbs {
	padding-block: var(--wp--preset--spacing--20) 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

.breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.breadcrumbs li + li::before {
	content: "/";
	margin-inline-end: 0.5rem;
	color: var(--wp--preset--color--border);
}

.entry-header {
	padding-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20);
}

.entry-title,
.archive-title {
	font-size: var(--wp--preset--font-size--xx-large);
}

.entry-meta {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
}

.entry-content {
	padding-block-end: var(--wp--preset--spacing--50);
}

/* Vertical rhythm between sections of a page. */
.entry-content > :where(h2) {
	margin-block-start: var(--wp--preset--spacing--50);
}

.entry-content > .alignfull:not(:first-child) {
	margin-block-start: var(--wp--preset--spacing--50);
}

.page-template-sections .entry-content > :first-child:not(.alignfull),
.page-template-landing .entry-content > :first-child:not(.alignfull) {
	margin-block-start: var(--wp--preset--spacing--40);
}

/* A full-width last section sits flush against the footer. */
.entry-content:has(> .alignfull:last-child) {
	padding-block-end: 0;
}

/* ==========================================================================
   Footer: dark panel with rounded top corners
   ========================================================================== */
.site-footer {
	position: relative;
	z-index: 1;
	border-radius: var(--wp--custom--radius--large) var(--wp--custom--radius--large) 0 0;
	overflow: hidden;
	background: var(--wp--preset--color--primary-dark);
	color: var(--wp--preset--color--on-primary);
	font-size: var(--wp--preset--font-size--small);
}

.site-footer a {
	color: inherit;
	text-decoration: none;
}

.site-footer a:hover {
	text-decoration: underline;
}

.site-footer__main {
	display: grid;
	gap: var(--wp--preset--spacing--40);
	padding-block: var(--wp--preset--spacing--50);
}

@media (min-width: 48em) {

	.site-footer__main {
		grid-template-columns: 1.6fr 1fr 1fr;
	}
}

.site-footer p {
	margin: 0.75rem 0 0;
	opacity: 0.75;
}

.site-footer__label {
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.site-footer__brand p {
	max-width: 22rem;
}

.footer-nav__menu,
.policy-nav__menu {
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

.footer-nav__menu a,
.policy-nav__menu a,
.site-footer__contact > a,
.back-to-top {
	display: inline-flex;
	align-items: center;
	min-height: var(--wp--custom--tap-target);
}

/* Big wordmark: phones only. */
.site-footer__wordmark {
	display: none;
	margin: 0;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 25.5vw;
	font-weight: 800;
	line-height: 0.74;
	letter-spacing: -0.07em;
	text-align: center;
	text-transform: lowercase;
	white-space: nowrap;
}

.site-footer .site-footer__wordmark {
	opacity: 1;
}

.site-footer__wordmark span {
	display: inline-block;
	width: 0.17em;
	height: 0.17em;
	margin-inline-start: 0.03em;
	border-radius: 50%;
	background: var(--wp--preset--color--accent);
}

@media (max-width: 47.99em) {

	.site-footer__wordmark {
		display: block;
		margin-block: 10px -0.03em;
	}
}

.site-footer__bottom {
	position: relative;
	padding-block: var(--wp--preset--spacing--20);
	border-top: 1px solid rgb(245 241 232 / 14%);
	background: inherit;
}

.site-footer__bottom .container {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--wp--preset--spacing--30);
	align-items: center;
	justify-content: space-between;
}

.site-footer__bottom .copyright {
	margin: 0;
}

.policy-nav__menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0 var(--wp--preset--spacing--30);
}

.site-footer :focus-visible {
	outline-color: var(--wp--preset--color--on-primary);
}

/* ==========================================================================
   Motion: reveal on scroll (see inc/motion.php). Only for visitors who have
   not asked for reduced motion; "is-pending" is added by assets/js/reveal.js.
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {

	/* Hiding is instant; only the reveal is animated. */
	.has-reveal:not(.is-pending) {
		transition: opacity 0.6s ease, transform 0.6s ease;
	}

	.has-reveal.is-pending {
		opacity: 0;
	}

	.has-reveal--up.is-pending {
		transform: translateY(1.5rem);
	}
}

/* ==========================================================================
   Blank page template: content centred on an otherwise empty screen.
   ========================================================================== */
.page-template-blank .site-main {
	display: grid;
	align-content: center;
	min-height: 100vh;
}

.page-template-blank .entry-content {
	padding-block: var(--wp--preset--spacing--50);
}

/* Full-width sections sit flush against each other. */
.entry-content > .alignfull + .alignfull {
	margin-block-start: 0;
}
