/**
 * Fix for contrast/black background issues in Twenty Twenty-Four theme
 */

/* Override the contrast color variable to a lighter shade */
:root {
    --wp--preset--color--contrast: #333333 !important; /* Changed from #111111 */
    --wp--preset--color--contrast-2: #666666 !important; /* Changed from #636363 */
    --wp--preset--color--contrast-3: #999999 !important; /* Changed from #A4A4A4 */
}

/* Fix specific contrast background classes */
.has-contrast-background-color {
    background-color: #f5f5f5 !important; /* Light gray instead of near-black */
    color: #333333 !important;
}

.has-contrast-2-background-color {
    background-color: #eeeeee !important;
    color: #333333 !important;
}

.has-contrast-3-background-color {
    background-color: #e8e8e8 !important;
    color: #333333 !important;
}

/* Fix buttons that use contrast color */
.wp-element-button,
.wp-block-button__link {
    background-color: #2e7d32 !important; /* Green instead of black */
    color: white !important;
}

.wp-element-button:hover,
.wp-block-button__link:hover {
    background-color: #1b5e20 !important;
    color: white !important;
}

/* Fix any blocks using contrast as background */
[style*="background-color:var(--wp--preset--color--contrast)"] {
    background-color: #f5f5f5 !important;
    color: #333333 !important;
}

/* Ensure entry content doesn't have black backgrounds */
.entry-content .wp-block-group,
.entry-content .wp-block-columns,
.entry-content .wp-block-column,
.entry-content > div[class*="wp-block"] {
    background-color: transparent !important;
}

/* Remove black backgrounds from any block patterns */
.entry-content [class*="has-black-background"],
.entry-content [class*="has-contrast-background"],
.entry-content [style*="background-color:#111111"],
.entry-content [style*="background-color:#000000"],
.entry-content [style*="background-color:rgb(0,0,0)"],
.entry-content [style*="background-color:rgba(0,0,0"] {
    background-color: transparent !important;
}

/* Fix spacer blocks that might appear black */
.wp-block-spacer {
    background-color: transparent !important;
    clear: both;
}

/* Ensure proper backgrounds for the single post template */
.single-post-article .entry-content {
    background-color: transparent;
}

.single-post-article .entry-content-inner {
    background-color: transparent;
}

/* Fix any pattern blocks that might have dark backgrounds */
.wp-block-pattern,
[class*="wp-block-pattern"] {
    background-color: transparent !important;
}

/* Ensure gallery blocks don't have black backgrounds */
.wp-block-gallery {
    background-color: transparent !important;
}

/* Fix cover blocks that might be too dark */
.wp-block-cover {
    background-color: transparent !important;
}

.wp-block-cover__background {
    opacity: 0.5 !important;
}

/* Remove any inline styles causing issues */
[style*="background-color"] {
    background-color: inherit !important;
}

/* Specific fix for entry content area */
main .entry-content > * {
    background-color: transparent !important;
}

/* Override theme patterns that use dark backgrounds */
.is-style-dark,
[class*="is-style-dark"] {
    background-color: transparent !important;
    color: #333333 !important;
}

/* Ensure text remains readable */
body,
.entry-content,
.entry-content p,
.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
    color: #333333 !important;
}

/* Fix empty paragraphs that might show as black blocks */
.entry-content p:empty {
    display: none !important;
}

/* Debug mode - uncomment to see which blocks have backgrounds */
/*
.wp-block-group,
.wp-block-columns,
.wp-block-column,
[class*="wp-block"] {
    outline: 2px solid red !important;
}
*/