/*
 * Keeps pages built under the old Neve theme readable, and moves their palette colors to the new palette.
 *
 * Older pages chose many colors by NAME from Neve's palette ("Site Background", "Dark Background"…). WordPress saves
 * that as a class such as has-nv-site-bg-color. Neve supplied the CSS for those classes; without it, white headings on
 * dark banners turn dark and banner overlays vanish. This file supplies them again, pointed at the new palette.
 *
 * It also brings older pages closer to the new design without editing them:
 *   - the full-width banner at the top of a page becomes a rounded teal card, like the new page header;
 *   - the few navy colors and the blue gradient that were typed in by hand become teal.
 * Pages rebuilt from the new patterns don't use these (their header is the Hero block, colors come from the palette).
 *
 * Delete this file (and its two lines in functions.php) once every page has been rebuilt from the new patterns.
 */

:root {
	--wp--preset--color--nv-site-bg: var(--wp--preset--color--white);
	--wp--preset--color--nv-text-dark-bg: var(--wp--preset--color--white);
	--wp--preset--color--nv-light-bg: var(--wp--preset--color--mist-50);
	--wp--preset--color--nv-dark-bg: var(--wp--preset--color--teal-900);
	--wp--preset--color--nv-text-color: var(--wp--preset--color--ink);
	--wp--preset--color--neve-text-color: var(--wp--preset--color--ink);
	--wp--preset--color--neve-link-color: var(--wp--preset--color--teal-900);
	--wp--preset--color--neve-link-hover-color: var(--wp--preset--color--teal-600);
	--wp--preset--color--nv-primary-accent: var(--wp--preset--color--teal-600);
	--wp--preset--color--nv-secondary-accent: var(--wp--preset--color--teal-900);
	--wp--preset--color--nv-c-1: var(--wp--preset--color--sage-500);
	--wp--preset--color--nv-c-2: var(--wp--preset--color--yellow-400);
}

/* Text colors. !important matches how WordPress writes palette classes, so block-level settings still win as before. */
.has-nv-site-bg-color { color: var(--wp--preset--color--nv-site-bg) !important; }
.has-nv-text-dark-bg-color { color: var(--wp--preset--color--nv-text-dark-bg) !important; }
.has-nv-light-bg-color { color: var(--wp--preset--color--nv-light-bg) !important; }
.has-nv-dark-bg-color { color: var(--wp--preset--color--nv-dark-bg) !important; }
.has-nv-text-color-color { color: var(--wp--preset--color--nv-text-color) !important; }
.has-neve-text-color-color { color: var(--wp--preset--color--neve-text-color) !important; }
.has-neve-link-color-color { color: var(--wp--preset--color--neve-link-color) !important; }
.has-neve-link-hover-color-color { color: var(--wp--preset--color--neve-link-hover-color) !important; }
.has-nv-primary-accent-color { color: var(--wp--preset--color--nv-primary-accent) !important; }
.has-nv-secondary-accent-color { color: var(--wp--preset--color--nv-secondary-accent) !important; }
.has-nv-c-1-color { color: var(--wp--preset--color--nv-c-1) !important; }
.has-nv-c-2-color { color: var(--wp--preset--color--nv-c-2) !important; }

/* Background colors (also used for Cover block overlays). */
.has-nv-site-bg-background-color { background-color: var(--wp--preset--color--nv-site-bg) !important; }
.has-nv-text-dark-bg-background-color { background-color: var(--wp--preset--color--nv-text-dark-bg) !important; }
.has-nv-light-bg-background-color { background-color: var(--wp--preset--color--nv-light-bg) !important; }
.has-nv-dark-bg-background-color { background-color: var(--wp--preset--color--nv-dark-bg) !important; }
.has-nv-text-color-background-color { background-color: var(--wp--preset--color--nv-text-color) !important; }
.has-neve-text-color-background-color { background-color: var(--wp--preset--color--neve-text-color) !important; }
.has-neve-link-color-background-color { background-color: var(--wp--preset--color--neve-link-color) !important; }
.has-neve-link-hover-color-background-color { background-color: var(--wp--preset--color--neve-link-hover-color) !important; }
.has-nv-primary-accent-background-color { background-color: var(--wp--preset--color--nv-primary-accent) !important; }
.has-nv-secondary-accent-background-color { background-color: var(--wp--preset--color--nv-secondary-accent) !important; }
.has-nv-c-1-background-color { background-color: var(--wp--preset--color--nv-c-1) !important; }
.has-nv-c-2-background-color { background-color: var(--wp--preset--color--nv-c-2) !important; }

/* Border colors. */
.has-nv-site-bg-border-color { border-color: var(--wp--preset--color--nv-site-bg) !important; }
.has-nv-light-bg-border-color { border-color: var(--wp--preset--color--nv-light-bg) !important; }
.has-nv-dark-bg-border-color { border-color: var(--wp--preset--color--nv-dark-bg) !important; }
.has-neve-text-color-border-color { border-color: var(--wp--preset--color--neve-text-color) !important; }
.has-neve-link-color-border-color { border-color: var(--wp--preset--color--neve-link-color) !important; }
.has-neve-link-hover-color-border-color { border-color: var(--wp--preset--color--neve-link-hover-color) !important; }


/*
 * Top banner of an older page → rounded teal card, matching the new page header (Hero block, class is-page).
 * Older pages all start with a full-width Cover block holding the title, an image or video and a blue overlay.
 * The Cover block stays editable: its image or video can still be replaced in the editor.
 * !important wins over the inline sizes and margins WordPress saved on each Cover block.
 */
:where(.wp-block-post-content) > .wp-block-cover:first-child {
	box-sizing: border-box;
	width: auto !important;
	max-width: var(--wp--style--global--wide-size) !important;
	min-height: 22.5rem !important;
	margin: var(--wp--preset--spacing--40) auto 0 !important;
	padding: var(--wp--preset--spacing--70);
	border-radius: var(--wp--custom--radius--lg);
	overflow: hidden;
}

:where(.wp-block-post-content) > .wp-block-cover:first-child > .wp-block-cover__background {
	background: linear-gradient(
		90deg,
		var(--wp--preset--color--ink),
		var(--wp--preset--color--teal-900) 55%,
		color-mix(in srgb, var(--wp--preset--color--teal-900) 45%, transparent)
	) !important;
	opacity: 0.85 !important;
}

:where(.wp-block-post-content) > .wp-block-cover:first-child h1 {
	font-size: var(--solid-page-h1);
	line-height: 1.05;
}

/* Tablets and phones: evenly dark, as on the new page header. */
@media (max-width: 1024px) {
	:where(.wp-block-post-content) > .wp-block-cover:first-child > .wp-block-cover__background {
		background: linear-gradient(180deg, var(--wp--preset--color--ink), var(--wp--preset--color--teal-900)) !important;
	}
}

@media (max-width: 600px) {
	:where(.wp-block-post-content) > .wp-block-cover:first-child {
		min-height: 20rem !important;
		padding: var(--wp--preset--spacing--60) var(--wp--preset--spacing--40);
	}
}

/*
 * Hand-typed colors on older pages → the new palette. These are the only ones the live pages use (checked Nov 2026):
 * three navies and one blue gradient. Matched on the style attribute WordPress saved on the block.
 */
[style*="rgb(4,53,81)"],
[style*="rgb(4, 53, 81)"] {
	background: linear-gradient(135deg, var(--wp--preset--color--teal-900) 15%, var(--wp--preset--color--teal-600) 100%) !important;
}

[style*="background-color:#054a65" i],
[style*="background-color: #054a65" i],
[style*="background-color:#004b6a" i],
[style*="background-color: #004b6a" i],
[style*="background-color:#043551" i],
[style*="background-color: #043551" i] {
	background-color: var(--wp--preset--color--teal-900) !important;
}
