/* Targeted block contrast fixes.
 *
 * This file is loaded after the general block styles and mobile refinements.
 * It fixes high-risk Gutenberg contrast cases without changing the palette.
 */

:where(.wp-block-calendar) {
	color: var(--sc-color-text);
}

:where(.wp-block-calendar table) {
	background: color-mix(in srgb, var(--sc-color-surface) 88%, var(--sc-color-background));
	color: var(--sc-color-text);
}

:where(.wp-block-calendar caption) {
	color: var(--sc-color-text);
}

:where(.wp-block-calendar th) {
	background: color-mix(in srgb, var(--sc-color-surface) 92%, var(--sc-color-background));
	color: var(--sc-color-text);
}

:where(.wp-block-calendar td) {
	color: var(--sc-color-muted);
}

:where(.wp-block-calendar tbody a) {
	color: var(--sc-color-on-accent) !important;
	font-weight: 700;
}

:where(.wp-block-calendar .wp-calendar-nav a) {
	color: var(--sc-color-text);
}

:where(.wp-block-calendar .wp-calendar-nav a:hover, .wp-block-calendar .wp-calendar-nav a:focus-visible) {
	color: var(--sc-color-accent);
}

:where(.wp-block-table table) {
	background: color-mix(in srgb, var(--sc-color-surface) 90%, var(--sc-color-background));
	color: var(--sc-color-text);
}

:where(.wp-block-table th) {
	background: color-mix(in srgb, var(--sc-color-contrast) 92%, var(--sc-color-surface));
	color: var(--sc-color-on-contrast);
}

:where(.wp-block-table td) {
	background: transparent;
	color: var(--sc-color-text);
}

:where(.wp-block-table.is-style-stripes tbody tr:nth-child(odd) td) {
	background: color-mix(in srgb, var(--sc-color-surface) 74%, var(--sc-color-background));
	color: var(--sc-color-text);
}

:where(.wp-block-table.is-style-stripes tbody tr:nth-child(even) td) {
	background: color-mix(in srgb, var(--sc-color-surface) 54%, var(--sc-color-background));
	color: var(--sc-color-text);
}

:where(.wp-block-table tfoot td) {
	background: transparent;
	color: var(--sc-color-text);
}

:where(.wp-block-table figcaption) {
	color: var(--sc-color-muted);
}

:where(.has-text-color .wp-block-table table, .has-text-color .wp-block-calendar table) {
	color: inherit;
}

:where(.has-background .wp-block-table td, .has-background .wp-block-calendar td) {
	color: var(--sc-color-text);
}

:where(.has-background .wp-block-table th, .has-background .wp-block-calendar th) {
	color: var(--sc-color-on-contrast);
}
