/*
 * Gutenberg color guard.
 * Ensures block-selected WordPress colors win in frontend and editor.
 * Scoped to content/editor areas and loaded late. Only Gutenberg color classes use !important,
 * matching WordPress core behaviour for palette classes.
 */
:root {
    --wp--preset--color--dark-green: #184D47;
    --wp--preset--color--lime-green: #A3D900;
    --wp--preset--color--anthracite: #2E3338;
    --wp--preset--color--white: #FFFFFF;
    --wp--preset--color--primary: #2563EB;
    --wp--preset--color--accent: #14B8A6;
    --wp--preset--color--heading: #0F172A;
    /* Do not register a palette slug named "text": it collides with Gutenberg .has-text-color. */
    --mc-block-default-text: #172033;
    --wp--preset--color--mc-background: #F7F8FB;
    --wp--preset--color--mc-surface: #FFFFFF;
    --wp--preset--color--mca-dark-green: #184D47;
    --wp--preset--color--mca-lime: #A3D900;
    --wp--preset--color--mca-lime-green: #A3D900;
    --wp--preset--color--mca-anthracite: #2E3338;
}

/* Direct Gutenberg text color classes. */
body .mc-entry-content .has-dark-green-color,
body .mc-entry-content .has-mca-dark-green-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-dark-green-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-dark-green-color,
.editor-styles-wrapper .has-dark-green-color,
.editor-styles-wrapper .has-mca-dark-green-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-dark-green-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-dark-green-color {
    color: #184D47 !important;
}

body .mc-entry-content .has-lime-green-color,
body .mc-entry-content .has-mca-lime-color,
body .mc-entry-content .has-mca-lime-green-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-lime-green-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-lime-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-lime-green-color,
.editor-styles-wrapper .has-lime-green-color,
.editor-styles-wrapper .has-mca-lime-color,
.editor-styles-wrapper .has-mca-lime-green-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-lime-green-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-lime-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-lime-green-color {
    color: #A3D900 !important;
}

body .mc-entry-content .has-anthracite-color,
body .mc-entry-content .has-mca-anthracite-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-anthracite-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-anthracite-color,
.editor-styles-wrapper .has-anthracite-color,
.editor-styles-wrapper .has-mca-anthracite-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-anthracite-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-mca-anthracite-color {
    color: #2E3338 !important;
}

body .mc-entry-content .has-white-color,
body .mc-entry-content :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-white-color,
.editor-styles-wrapper .has-white-color,
.editor-styles-wrapper :where(.wp-block-heading, h1, h2, h3, h4, h5, h6).has-white-color {
    color: #FFFFFF !important;
}

/* Existing theme.json palette slugs from earlier versions. */
body .mc-entry-content .has-primary-color,
.editor-styles-wrapper .has-primary-color { color: #2563EB !important; }
body .mc-entry-content .has-accent-color,
.editor-styles-wrapper .has-accent-color { color: #14B8A6 !important; }
body .mc-entry-content .has-heading-color,
.editor-styles-wrapper .has-heading-color { color: #0F172A !important; }

body .mc-entry-content .has-mc-background-color,
.editor-styles-wrapper .has-mc-background-color { color: #F7F8FB !important; }
body .mc-entry-content .has-mc-surface-color,
.editor-styles-wrapper .has-mc-surface-color { color: #FFFFFF !important; }
body .mc-entry-content .has-text-color.has-text-color.has-primary-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-primary-color { color: #2563EB !important; }
body .mc-entry-content .has-text-color.has-text-color.has-accent-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-accent-color { color: #14B8A6 !important; }
body .mc-entry-content .has-text-color.has-text-color.has-heading-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-heading-color { color: #0F172A !important; }
body .mc-entry-content .has-text-color.has-text-color.has-dark-green-color,
body .mc-entry-content .has-text-color.has-text-color.has-mca-dark-green-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-dark-green-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-mca-dark-green-color { color: #184D47 !important; }
body .mc-entry-content .has-text-color.has-text-color.has-lime-green-color,
body .mc-entry-content .has-text-color.has-text-color.has-mca-lime-color,
body .mc-entry-content .has-text-color.has-text-color.has-mca-lime-green-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-lime-green-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-mca-lime-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-mca-lime-green-color { color: #A3D900 !important; }
body .mc-entry-content .has-text-color.has-text-color.has-anthracite-color,
body .mc-entry-content .has-text-color.has-text-color.has-mca-anthracite-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-anthracite-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-mca-anthracite-color { color: #2E3338 !important; }
body .mc-entry-content .has-text-color.has-text-color.has-white-color,
.editor-styles-wrapper .has-text-color.has-text-color.has-white-color { color: #FFFFFF !important; }

/* Background classes. */
body .mc-entry-content .has-dark-green-background-color,
body .mc-entry-content .has-mca-dark-green-background-color,
.editor-styles-wrapper .has-dark-green-background-color,
.editor-styles-wrapper .has-mca-dark-green-background-color { background-color: #184D47 !important; }
body .mc-entry-content .has-lime-green-background-color,
body .mc-entry-content .has-mca-lime-background-color,
body .mc-entry-content .has-mca-lime-green-background-color,
.editor-styles-wrapper .has-lime-green-background-color,
.editor-styles-wrapper .has-mca-lime-background-color,
.editor-styles-wrapper .has-mca-lime-green-background-color { background-color: #A3D900 !important; }
body .mc-entry-content .has-anthracite-background-color,
body .mc-entry-content .has-mca-anthracite-background-color,
.editor-styles-wrapper .has-anthracite-background-color,
.editor-styles-wrapper .has-mca-anthracite-background-color { background-color: #2E3338 !important; }
body .mc-entry-content .has-white-background-color,
.editor-styles-wrapper .has-white-background-color { background-color: #FFFFFF !important; }
body .mc-entry-content .has-primary-background-color,
.editor-styles-wrapper .has-primary-background-color { background-color: #2563EB !important; }
body .mc-entry-content .has-accent-background-color,
.editor-styles-wrapper .has-accent-background-color { background-color: #14B8A6 !important; }
body .mc-entry-content .has-mc-background-background-color,
.editor-styles-wrapper .has-mc-background-background-color { background-color: #F7F8FB !important; }
body .mc-entry-content .has-mc-surface-background-color,
.editor-styles-wrapper .has-mc-surface-background-color { background-color: #FFFFFF !important; }

/* If a color is set on a parent block, inner heading/text blocks must inherit it unless they define their own color. */
body .mc-entry-content .has-text-color :where(p, li, span, strong, em, small, a, h1, h2, h3, h4, h5, h6, .wp-block-heading):not(.has-text-color):not(.has-inline-color),
body .mc-entry-content .has-inline-color :where(p, li, span, strong, em, small, a, h1, h2, h3, h4, h5, h6, .wp-block-heading):not(.has-text-color):not(.has-inline-color),
.editor-styles-wrapper .has-text-color :where(p, li, span, strong, em, small, a, h1, h2, h3, h4, h5, h6, .wp-block-heading):not(.has-text-color):not(.has-inline-color),
.editor-styles-wrapper .has-inline-color :where(p, li, span, strong, em, small, a, h1, h2, h3, h4, h5, h6, .wp-block-heading):not(.has-text-color):not(.has-inline-color) {
    color: inherit !important;
}

body .mc-entry-content .has-text-color a:not(.mc-button):not(.wp-block-button__link),
body .mc-entry-content .has-inline-color a:not(.mc-button):not(.wp-block-button__link),
.editor-styles-wrapper .has-text-color a:not(.mc-button):not(.wp-block-button__link),
.editor-styles-wrapper .has-inline-color a:not(.mc-button):not(.wp-block-button__link) {
    color: inherit !important;
}
