/**
 * Theme Name:        Payback Nutrition
 * Theme URI:         https://www.paybacknutrition.com
 * Template:          chs-inc
 * Description:       Child theme of CHS Inc for the Payback Nutrition site.
 * Version:           1.0.12
 * Requires at least: 6.0
 * Requires PHP:      8.0
 * Author:            Creed Interactive
 * Author URI:        https://creedinteractive.com
 * License:           GPL-2.0-or-later
 * License URI:       https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain:       payback-nutrition
 * Domain Path:       /languages
 *
 * @package Payback_Nutrition
 */

/*
 * Child overrides only — minimal.
 * Design tokens belong in theme.json, not here.
 * Block-specific styles live in assets/css/blocks/*.css
 * Component styles live in assets/css/components/*.css
 *
 * The parent stylesheet is enqueued ahead of this file by functions.php.
 */

/* "primary" isn't in this theme's own color palette (it's aliased via
 * settings.custom.color instead), so WordPress doesn't auto-generate
 * has-primary-*-color CSS for it. These rules keep content saved with
 * backgroundColor/textColor "primary" working, pointed at the semantic token. */
.has-primary-background-color { background-color: var(--wp--custom--color--primary) !important; }
.has-primary-border-color { border-color: var(--wp--custom--color--primary) !important; }

/* Fix WordPress color class specificity issue */
/* Specific color classes must override the generic .has-text-color */
.has-payback-brown-color { color: var(--wp--preset--color--payback-brown) !important; }
.has-dark-brown-color { color: var(--wp--preset--color--dark-brown) !important; }
.has-rose-color { color: var(--wp--preset--color--rose) !important; }
.has-primary-color { color: var(--wp--custom--color--primary) !important; }
.has-haze-color { color: var(--wp--preset--color--haze) !important; }
.has-gray-color { color: var(--wp--preset--color--gray) !important; }
.has-dark-gray-color { color: var(--wp--preset--color--dark-gray) !important; }
.has-black-color { color: var(--wp--preset--color--black) !important; }
.has-white-color { color: var(--wp--preset--color--white) !important; }
.has-beef-color { color: var(--wp--preset--color--beef) !important; }
.has-dairy-color { color: var(--wp--preset--color--dairy) !important; }
.has-goat-color { color: var(--wp--preset--color--goat) !important; }
.has-poultry-color { color: var(--wp--preset--color--poultry) !important; }
.has-sheep-color { color: var(--wp--preset--color--sheep) !important; }
.has-swine-color { color: var(--wp--preset--color--swine) !important; }
.has-show-color { color: var(--wp--preset--color--show) !important; }
.has-specialty-color { color: var(--wp--preset--color--specialty) !important; }
.has-equine-color { color: var(--wp--preset--color--equine) !important; }
.has-organic-color { color: var(--wp--preset--color--organic) !important; }

/* Headings are dark brown site-wide (theme.json), which disappears on the
 * brown footer — let footer headings inherit the footer's white text. */
footer .site-footer .wp-block-heading { color: inherit; }

/* Links on species backgrounds use the same text color as the species
 * button of that color (the {species}-text tokens in theme.json), whatever
 * link color was picked in the editor — an editor-picked link color is often
 * another species color with too little contrast on the band. Rose is the
 * multi-species color. Buttons are left alone, and so are links inside a
 * nested block with a different background. */
.has-beef-background-color { --payback-species--link: var(--wp--custom--color--beef-text); }
.has-dairy-background-color { --payback-species--link: var(--wp--custom--color--dairy-text); }
.has-goat-background-color { --payback-species--link: var(--wp--custom--color--goat-text); }
.has-poultry-background-color { --payback-species--link: var(--wp--custom--color--poultry-text); }
.has-sheep-background-color { --payback-species--link: var(--wp--custom--color--sheep-text); }
.has-swine-background-color { --payback-species--link: var(--wp--custom--color--swine-text); }
.has-show-background-color { --payback-species--link: var(--wp--custom--color--show-text); }
.has-specialty-background-color { --payback-species--link: var(--wp--custom--color--specialty-text); }
.has-equine-background-color { --payback-species--link: var(--wp--custom--color--equine-text); }
.has-organic-background-color { --payback-species--link: var(--wp--custom--color--organic-text); }
.has-rose-background-color { --payback-species--link: var(--wp--custom--color--multi-species-text); }

:is(.has-beef-background-color, .has-dairy-background-color, .has-goat-background-color, .has-poultry-background-color, .has-sheep-background-color, .has-swine-background-color, .has-show-background-color, .has-specialty-background-color, .has-equine-background-color, .has-organic-background-color, .has-rose-background-color)
	a:not(.wp-block-button__link, .wp-element-button, .has-background:not(.has-beef-background-color, .has-dairy-background-color, .has-goat-background-color, .has-poultry-background-color, .has-sheep-background-color, .has-swine-background-color, .has-show-background-color, .has-specialty-background-color, .has-equine-background-color, .has-organic-background-color, .has-rose-background-color) a) {
	color: var(--payback-species--link);
	text-decoration: underline;
}

/* Outline and Link buttons have no fill, so on a species background their
 * brown text fails contrast on the dark colors. They take the same color as
 * links there, for text, border and the Link arrow, by re-pointing the two
 * tokens those styles read. Hover keeps its underline and arrow motion. */
:is(.has-beef-background-color, .has-dairy-background-color, .has-goat-background-color, .has-poultry-background-color, .has-sheep-background-color, .has-swine-background-color, .has-show-background-color, .has-specialty-background-color, .has-equine-background-color, .has-organic-background-color, .has-rose-background-color)
	.wp-block-button:is(.is-style-outline, .is-style-link) .wp-block-button__link:not(.has-background:not(.has-beef-background-color, .has-dairy-background-color, .has-goat-background-color, .has-poultry-background-color, .has-sheep-background-color, .has-swine-background-color, .has-show-background-color, .has-specialty-background-color, .has-equine-background-color, .has-organic-background-color, .has-rose-background-color) *) {
	--wp--custom--color--primary: var(--payback-species--link);
	--wp--custom--color--secondary: var(--payback-species--link);
}
