*,
*::before,
*::after {
	box-sizing: border-box;
}

/* Follow the system colour mode; the colour roles in tokens.css are
   light-dark() pairs, and [data-theme] can force a mode. */
html {
	font-size: 100%;
	color-scheme: light dark;
}

/* A <picture> that only picks the colour-mode version of an image
   (sp_get_mode_picture()) takes no box, so the image lays out on its own. */
.sp-mode-picture {
	display: contents;
}

body {
	margin: 0;
	font-family: var(--sp-type-family-sans);
	font-size: var(--sp-type-size-body);
	line-height: var(--sp-type-line-height-body);
	color: var(--sp-color-text-primary);
	background: var(--sp-color-layer-canvas);
}

a {
	color: var(--sp-color-link-default);
	text-underline-offset: 0.15em;
	transition:
		color var(--sp-motion-duration-fast) var(--sp-motion-ease-standard),
		text-decoration-color var(--sp-motion-duration-fast) var(--sp-motion-ease-standard);
}

a:hover {
	color: var(--sp-color-link-hover);
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

svg {
	display: block;
}

.sp-icon {
	width: 1em;
	height: 1em;
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

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

button {
	color: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	margin-top: 0;
	margin-bottom: var(--uplift-space-2);
	font-family: var(--sp-type-family-heading);
	font-weight: var(--sp-type-weight-heading);
	color: var(--sp-color-text-heading);
	line-height: var(--sp-type-line-height-heading);
}

h1 {
	font-family: var(--sp-type-family-display);
	font-weight: var(--sp-type-weight-display);
	font-size: var(--sp-type-size-heading-1);
}

.has-display-font-size {
	font-family: var(--sp-type-family-display);
}

h2 {
	font-size: var(--sp-type-size-heading-2);
}

h3 {
	font-size: var(--sp-type-size-heading-3);
}

h4 {
	font-size: var(--sp-type-size-heading-4);
}

h5 {
	font-size: var(--sp-type-size-heading-5);
}

h6 {
	font-size: var(--sp-type-size-heading-6);
}

p {
	margin-top: 0;
}

input:not([type]),
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="url"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="month"],
input[type="week"],
input[type="time"],
textarea,
select {
	width: 100%;
	border: 1px solid var(--sp-color-border-subtle);
	border-radius: var(--uplift-radius-sm);
	padding: var(--uplift-space-2) var(--uplift-space-4);
	background: var(--sp-color-layer-input);
	color: var(--sp-color-text-primary);
	transition:
		background-color var(--sp-motion-duration-fast) var(--sp-motion-ease-standard),
		border-color var(--sp-motion-duration-fast) var(--sp-motion-ease-standard),
		box-shadow var(--sp-motion-duration-fast) var(--sp-motion-ease-standard);
}

input::placeholder,
textarea::placeholder {
	color: var(--sp-color-text-muted);
	opacity: 0.74;
}

input[type="checkbox"],
input[type="radio"] {
	accent-color: var(--sp-color-action-primary-bg);
}

input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not(:disabled):not([readonly]):hover,
textarea:not(:disabled):not([readonly]):hover,
select:not(:disabled):hover {
	border-color: var(--sp-color-border-strong);
	background: var(--sp-color-layer-2);
}

input[readonly],
textarea[readonly] {
	background: var(--sp-color-layer-1);
}

input:where(:user-invalid, [aria-invalid="true"]),
select:where(:user-invalid, [aria-invalid="true"]),
textarea:where(:user-invalid, [aria-invalid="true"]) {
	border-color: var(--sp-color-border-danger);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
	outline: var(--sp-state-focus-ring-width) solid var(--sp-state-focus-ring-color);
	outline-offset: var(--sp-state-focus-ring-offset);
}

input:focus,
select:focus,
textarea:focus {
	border-color: var(--sp-color-border-selected);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--sp-state-focus-ring-color) 24%, transparent);
}

input:where(:user-invalid, [aria-invalid="true"]):focus,
select:where(:user-invalid, [aria-invalid="true"]):focus,
textarea:where(:user-invalid, [aria-invalid="true"]):focus {
	border-color: var(--sp-color-border-danger);
	box-shadow: 0 0 0 3px var(--sp-color-status-danger-soft);
}

input[disabled],
textarea[disabled],
select[disabled],
button[disabled],
[aria-disabled="true"] {
	cursor: not-allowed;
	opacity: var(--sp-state-disabled-opacity);
}

input[disabled],
textarea[disabled],
select[disabled] {
	border-color: var(--sp-color-border-disabled);
	background: var(--sp-color-layer-disabled);
	color: var(--sp-color-text-disabled);
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		scroll-behavior: auto !important;
		transition-duration: 1ms !important;
		animation-duration: 1ms !important;
		animation-iteration-count: 1 !important;
	}
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.sp-skip-link:focus {
	top: 1rem;
	left: 1rem;
	z-index: var(--sp-z-skip-link);
	width: auto;
	height: auto;
	padding: 0.75rem 1rem;
	margin: 0;
	overflow: visible;
	clip: auto;
	white-space: normal;
	border-radius: var(--uplift-radius-sm);
	background: var(--sp-color-action-primary-bg);
	color: var(--sp-color-action-primary-text);
	font-weight: var(--sp-type-weight-semibold);
	text-decoration: none;
}

/*
 * Shared Site Search overlay (site-search plugin). Its palette is custom
 * properties with light defaults on :root; map them to the colour roles
 * (:root:root outranks the plugin's :root whatever the load order), then
 * cover the colours it hard-codes for a white panel. Light values are the
 * plugin's own, so light mode is unchanged.
 */
:root:root {
	--search-overlay-backdrop: var(--sp-color-layer-overlay);
	--search-overlay-panel-bg: var(--sp-color-layer-2);
	--search-overlay-shadow: var(--sp-component-search-overlay-shadow);
	--search-overlay-border: light-dark(rgb(9 26 47 / 0.08), var(--uplift-night-rule));
	--search-overlay-divider: light-dark(rgb(9 26 47 / 0.06), var(--uplift-night-rule));
	--search-overlay-text: var(--sp-color-text-heading);
	--search-overlay-muted: var(--sp-color-text-muted);
	--search-result-border: var(--sp-color-border-selected);
	--search-result-hover: light-dark(var(--uplift-light-blue-50), rgb(255 255 255 / 0.06));
	--search-result-focus: var(--sp-color-border-selected);
	--search-type-pill-bg: light-dark(rgb(9 26 47 / 0.06), rgb(255 255 255 / 0.08));
	--search-type-pill-text: var(--sp-color-text-primary);
	--font-family-primary: var(--sp-type-family-sans);
}

.search-overlay .search-overlay__input-wrapper,
.search-overlay .search-overlay__results {
	background: light-dark(rgb(255 255 255 / 0.95), var(--uplift-night-bg));
	box-shadow: inset 0 1px 2px light-dark(rgb(9 26 47 / 0.06), transparent);
}

.search-overlay .search-overlay__input-wrapper:focus-within {
	border-color: light-dark(rgb(9 26 47 / 0.28), rgb(255 255 255 / 0.28));
	box-shadow: 0 0 0 3px light-dark(rgb(9 26 47 / 0.12), rgb(255 255 255 / 0.1));
}

.search-overlay .search-overlay__close:hover,
.search-overlay .search-overlay__popular-link {
	background-color: light-dark(rgb(9 26 47 / 0.06), rgb(255 255 255 / 0.06));
}

.search-overlay .search-overlay__popular-link:hover,
.search-overlay .search-overlay__popular-link.is-active {
	background-color: light-dark(rgb(9 26 47 / 0.08), rgb(255 255 255 / 0.1));
}

.search-overlay .search-overlay__spinner {
	border-color: var(--sp-color-spinner-track);
	border-top-color: var(--sp-color-spinner-head);
}

.search-overlay .search-overlay__empty-post-thumbnail,
.search-overlay .search-result__thumbnail[data-placeholder="true"] {
	background: var(--sp-color-layer-thumbnail);
}

.search-overlay :is(.search-overlay__empty-content, .search-overlay__results-list) {
	scrollbar-color: light-dark(rgb(9 26 47 / 0.18), rgb(255 255 255 / 0.18)) transparent;
}

.search-overlay .search-result__metadata .atm-status.open::before {
	background: var(--sp-color-status-success);
	border-color: var(--sp-color-status-success-soft);
}

.search-overlay .search-result__metadata .atm-status.closed::before {
	background: var(--sp-color-status-danger);
	border-color: var(--sp-color-status-danger-soft);
}

/* Popular-link and placeholder icons are dark image files; filters aren't
   colours, so this follows the mode with selectors instead of light-dark(). */
[data-theme="dark"] .search-overlay__popular-link-icon img {
	filter: brightness(0) invert(1);
}

[data-theme="dark"] :is(.search-overlay__empty-post-thumbnail, .search-result__thumbnail)[data-placeholder="true"] img {
	filter: invert(1) hue-rotate(180deg);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .search-overlay__popular-link-icon img {
		filter: brightness(0) invert(1);
	}

	:root:not([data-theme="light"]) :is(.search-overlay__empty-post-thumbnail, .search-result__thumbnail)[data-placeholder="true"] img {
		filter: invert(1) hue-rotate(180deg);
	}
}
