/**
 * FarPress front-end adjustments.
 *
 * Color overrides apply only when a visitor's saved choice differs from the
 * site default, so Site Editor customizations of the active style stay intact.
 *
 * Light tokens match theme.json. Dark tokens match styles/dark.json.
 * The dark background also matches farpress_dark_background_color().
 */

html[data-color-site="light"][data-color-mode="dark"] {
	color-scheme: dark;
	background-color: #141311;
	color: #f3efe7;
	--wp--preset--color--background: #141311;
	--wp--preset--color--surface: #1e1c19;
	--wp--preset--color--foreground: #f3efe7;
	--wp--preset--color--muted: #b7b0a4;
	--wp--preset--color--primary: #8fd4b0;
	--wp--preset--color--primary-contrast: #141311;
	--wp--preset--color--accent: #e3a078;
	--wp--preset--color--border: #3a3632;
}

html[data-color-site="dark"][data-color-mode="light"] {
	color-scheme: light;
	background-color: #f6f3ee;
	color: #1a1916;
	--wp--preset--color--background: #f6f3ee;
	--wp--preset--color--surface: #fffcf8;
	--wp--preset--color--foreground: #1a1916;
	--wp--preset--color--muted: #514c46;
	--wp--preset--color--primary: #14573c;
	--wp--preset--color--primary-contrast: #f6f3ee;
	--wp--preset--color--accent: #9a3412;
	--wp--preset--color--border: #e4ddd2;
}

html[data-color-site="light"][data-color-mode="dark"] body,
html[data-color-site="dark"][data-color-mode="light"] body {
	background-color: var(--wp--preset--color--background);
	color: var(--wp--preset--color--foreground);
}

::selection {
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary-contrast);
}

a:where(:not(.wp-element-button)) {
	text-underline-offset: 0.18em;
}

a:focus-visible,
button:focus-visible,
.wp-element-button:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}

.farpress-header-bar {
	align-items: center;
}

.farpress-color-toggle {
	display: inline-flex;
	align-items: center;
	align-self: center;
	margin: 0;
	padding: 0.35rem 0.8rem;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--foreground);
	font: inherit;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.2;
	white-space: nowrap;
	cursor: pointer;
}

.farpress-color-toggle:hover {
	border-color: var(--wp--preset--color--primary);
}

.farpress-color-toggle__when-dark {
	display: none;
}

html[data-color-mode="dark"] .farpress-color-toggle__when-light {
	display: none;
}

html[data-color-mode="dark"] .farpress-color-toggle__when-dark {
	display: inline;
}

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