/**
 * BootHack Compatibility — third-party plugin dark mode provision.
 *
 * Framework-agnostic overrides for installed plugins. Depends on
 * dark-mode-surfaces.css tokens (--bh-dark-*). Add new plugin blocks here,
 * not in canonical module stylesheets.
 *
 * @package BootHack
 */

/* --- BootHack Shortcodes [pullquote] (.boothack-pullquote) ---------------- */

@media (prefers-color-scheme: dark) {

	html:not([data-theme=light]) .bh-singular-content .entry-content .boothack-pullquote,
	html:not([data-theme=light]) .bh-site-content .entry-content .boothack-pullquote {
		color: var(--bh-dark-text-muted);
		border-left-color: var(--bh-dark-border-strong);
		background-color: var(--bh-dark-surface-raised);
		border-right-color: var(--bh-dark-border) !important;
		border-top-color: var(--bh-dark-border) !important;
		border-bottom-color: var(--bh-dark-border) !important;
	}
}

html[data-theme=dark] .bh-singular-content .entry-content .boothack-pullquote,
html[data-theme=dark] .bh-site-content .entry-content .boothack-pullquote {
	color: var(--bh-dark-text-muted);
	border-left-color: var(--bh-dark-border-strong);
	background-color: var(--bh-dark-surface-raised);
	border-right-color: var(--bh-dark-border) !important;
	border-top-color: var(--bh-dark-border) !important;
	border-bottom-color: var(--bh-dark-border) !important;
}

/* --- Footnotes plugin (markcheret) — reference panel table cells ---------- */

@media (prefers-color-scheme: dark) {

	html:not([data-theme=light]) .bh-singular-content .footnotes_reference_container table :is(th, td),
	html:not([data-theme=light]) .bh-site-content .footnotes_reference_container table :is(th, td) {
		color: var(--bh-dark-text);
		border-color: var(--bh-dark-border);
		background-color: transparent !important;
	}
}

html[data-theme=dark] .bh-singular-content .footnotes_reference_container table :is(th, td),
html[data-theme=dark] .bh-site-content .footnotes_reference_container table :is(th, td) {
	color: var(--bh-dark-text);
	border-color: var(--bh-dark-border);
	background-color: transparent !important;
}

/*
 * Easy Table of Contents plugin — dark mode surfaces and link parity.
 *
 * Plugin stylesheet + adapter bridges ship light grey panels (#F9F9F9) and #444
 * link locks. Remap to BootHack dark tokens in prose, sidebar widgets, and
 * sticky containers (framework-agnostic).
 */
@media (prefers-color-scheme: dark) {

	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	):not(.ez-toc-black):not(.ez-toc-transparent):not(.ez-toc-sticky-black):not(.ez-toc-sticky-transparent) {
		background-color: var(--bh-dark-surface-raised) !important;
		border-color: var(--bh-dark-border) !important;
		-webkit-box-shadow: var(--bh-dark-shadow) !important;
		box-shadow: var(--bh-dark-shadow) !important;
		color: var(--bh-dark-text);
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container.ez-toc-black,
		#ez-toc-sticky-container.ez-toc-sticky-black
	) {
		background-color: var(--bh-dark-canvas) !important;
		border-color: var(--bh-dark-border-strong) !important;
		color: var(--bh-dark-text);
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container.ez-toc-transparent,
		#ez-toc-sticky-container.ez-toc-sticky-transparent
	) {
		background: transparent !important;
		border-color: var(--bh-dark-border) !important;
		color: var(--bh-dark-text);
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	) nav {
		color: inherit;
		background: transparent !important;
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	) :is(.ez-toc-title, p.ez-toc-title, p.ez-toc-sticky-title) {
		color: var(--bh-dark-text) !important;
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	) :is(
		a.ez-toc-link,
		a.ez-toc-toggle,
		nav a,
		ul.ez-toc-list a,
		ul.ez-toc-sticky-list a
	),
	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	) :is(
		a.ez-toc-link,
		a.ez-toc-toggle,
		nav a,
		ul.ez-toc-list a,
		ul.ez-toc-sticky-list a
	):visited {
		color: var(--bh-dark-text-muted) !important;
		text-decoration-color: color-mix(in srgb, var(--bh-dark-text-muted) 35%, transparent) !important;
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	) :is(
		a.ez-toc-link,
		a.ez-toc-toggle,
		nav a,
		ul.ez-toc-list a,
		ul.ez-toc-sticky-list a
	):is(:hover, :focus, :focus-visible) {
		color: var(--bh-content-link-color, var(--bh-dark-link)) !important;
		text-decoration-color: var(--bh-content-link-color, var(--bh-dark-link)) !important;
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container.ez-toc-black,
		#ez-toc-sticky-container.ez-toc-sticky-black
	) :is(
		a.ez-toc-link,
		a.ez-toc-toggle,
		nav a,
		ul.ez-toc-list a,
		ul.ez-toc-sticky-list a,
		.ez-toc-title,
		p.ez-toc-title,
		p.ez-toc-sticky-title
	) {
		color: var(--bh-dark-text) !important;
	}

	html:not([data-theme=light]) :is(
		#ez-toc-container,
		.ez-toc-widget-container,
		#ez-toc-sticky-container,
		.ez-toc-sticky-widget-container
	) :is(ul.ez-toc-list li.active, ul.ez-toc-sticky-list li.active) {
		background-color: color-mix(in srgb, var(--bh-dark-surface-raised) 75%, var(--bh-dark-link) 25%) !important;
	}

	html:not([data-theme=light]) #ez-toc-container :is(.ez-toc-toggle label, .ez-toc-js-icon-con, label.cssicon),
	html:not([data-theme=light]) #ez-toc-sticky-container :is(.ez-toc-toggle label, .ez-toc-js-icon-con, label.cssicon) {
		border-color: var(--bh-dark-border-strong) !important;
		color: var(--bh-dark-text-muted) !important;
	}
}

html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
):not(.ez-toc-black):not(.ez-toc-transparent):not(.ez-toc-sticky-black):not(.ez-toc-sticky-transparent) {
	background-color: var(--bh-dark-surface-raised) !important;
	border-color: var(--bh-dark-border) !important;
	-webkit-box-shadow: var(--bh-dark-shadow) !important;
	box-shadow: var(--bh-dark-shadow) !important;
	color: var(--bh-dark-text);
}

html[data-theme=dark] :is(
	#ez-toc-container.ez-toc-black,
	#ez-toc-sticky-container.ez-toc-sticky-black
) {
	background-color: var(--bh-dark-canvas) !important;
	border-color: var(--bh-dark-border-strong) !important;
	color: var(--bh-dark-text);
}

html[data-theme=dark] :is(
	#ez-toc-container.ez-toc-transparent,
	#ez-toc-sticky-container.ez-toc-sticky-transparent
) {
	background: transparent !important;
	border-color: var(--bh-dark-border) !important;
	color: var(--bh-dark-text);
}

html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
) nav {
	color: inherit;
	background: transparent !important;
}

html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
) :is(.ez-toc-title, p.ez-toc-title, p.ez-toc-sticky-title) {
	color: var(--bh-dark-text) !important;
}

html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
) :is(
	a.ez-toc-link,
	a.ez-toc-toggle,
	nav a,
	ul.ez-toc-list a,
	ul.ez-toc-sticky-list a
),
html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
) :is(
	a.ez-toc-link,
	a.ez-toc-toggle,
	nav a,
	ul.ez-toc-list a,
	ul.ez-toc-sticky-list a
):visited {
	color: var(--bh-dark-text-muted) !important;
	text-decoration-color: color-mix(in srgb, var(--bh-dark-text-muted) 35%, transparent) !important;
}

html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
) :is(
	a.ez-toc-link,
	a.ez-toc-toggle,
	nav a,
	ul.ez-toc-list a,
	ul.ez-toc-sticky-list a
):is(:hover, :focus, :focus-visible) {
	color: var(--bh-content-link-color, var(--bh-dark-link)) !important;
	text-decoration-color: var(--bh-content-link-color, var(--bh-dark-link)) !important;
}

html[data-theme=dark] :is(
	#ez-toc-container.ez-toc-black,
	#ez-toc-sticky-container.ez-toc-sticky-black
) :is(
	a.ez-toc-link,
	a.ez-toc-toggle,
	nav a,
	ul.ez-toc-list a,
	ul.ez-toc-sticky-list a,
	.ez-toc-title,
	p.ez-toc-title,
	p.ez-toc-sticky-title
) {
	color: var(--bh-dark-text) !important;
}

html[data-theme=dark] :is(
	#ez-toc-container,
	.ez-toc-widget-container,
	#ez-toc-sticky-container,
	.ez-toc-sticky-widget-container
) :is(ul.ez-toc-list li.active, ul.ez-toc-sticky-list li.active) {
	background-color: color-mix(in srgb, var(--bh-dark-surface-raised) 75%, var(--bh-dark-link) 25%) !important;
}

html[data-theme=dark] #ez-toc-container :is(.ez-toc-toggle label, .ez-toc-js-icon-con, label.cssicon),
html[data-theme=dark] #ez-toc-sticky-container :is(.ez-toc-toggle label, .ez-toc-js-icon-con, label.cssicon) {
	border-color: var(--bh-dark-border-strong) !important;
	color: var(--bh-dark-text-muted) !important;
}

/*
 * Footnotes plugin (markcheret) tooltips — light-surface typography in dark mode.
 *
 * Yellow background comes from plugin head CSS; text must stay dark (#000), not
 * --bh-dark-text. inherit failed because the container still inherited prose
 * white. jQuery tips append to body; alternative tips stay in entry-content.
 */
@media (prefers-color-scheme: dark) {

	html:not([data-theme=light]) html body .footnote_tooltip,
	html:not([data-theme=light]) html body .footnote_tooltip *:not(.footnote_tooltip_continue),
	html:not([data-theme=light]) html body .bh-site-content .entry-content .footnote_tooltip,
	html:not([data-theme=light]) html body .bh-site-content .entry-content .footnote_tooltip *:not(.footnote_tooltip_continue),
	html:not([data-theme=light]) html body .bh-singular-content .entry-content .footnote_tooltip,
	html:not([data-theme=light]) html body .bh-singular-content .entry-content .footnote_tooltip *:not(.footnote_tooltip_continue),
	html:not([data-theme=light]) html body .bh-site-content .prose .footnote_tooltip,
	html:not([data-theme=light]) html body .bh-site-content .prose .footnote_tooltip *:not(.footnote_tooltip_continue),
	html:not([data-theme=light]) html body .bh-singular-content.prose .footnote_tooltip,
	html:not([data-theme=light]) html body .bh-singular-content.prose .footnote_tooltip *:not(.footnote_tooltip_continue) {
		color: #000 !important;
		text-decoration-color: currentColor !important;
	}

	html:not([data-theme=light]) html body .footnote_tooltip .footnote_tooltip_continue,
	html:not([data-theme=light]) html body .bh-site-content .entry-content .footnote_tooltip .footnote_tooltip_continue,
	html:not([data-theme=light]) html body .bh-singular-content .entry-content .footnote_tooltip .footnote_tooltip_continue {
		color: green !important;
	}

	html:not([data-theme=light]) .footnote_tooltip,
	html:not([data-theme=light]) .bh-site-content .entry-content .footnote_tooltip,
	html:not([data-theme=light]) .bh-singular-content .entry-content .footnote_tooltip {
		color-scheme: light;
	}
}

html[data-theme=dark] html body .footnote_tooltip,
html[data-theme=dark] html body .footnote_tooltip *:not(.footnote_tooltip_continue),
html[data-theme=dark] html body .bh-site-content .entry-content .footnote_tooltip,
html[data-theme=dark] html body .bh-site-content .entry-content .footnote_tooltip *:not(.footnote_tooltip_continue),
html[data-theme=dark] html body .bh-singular-content .entry-content .footnote_tooltip,
html[data-theme=dark] html body .bh-singular-content .entry-content .footnote_tooltip *:not(.footnote_tooltip_continue),
html[data-theme=dark] html body .bh-site-content .prose .footnote_tooltip,
html[data-theme=dark] html body .bh-site-content .prose .footnote_tooltip *:not(.footnote_tooltip_continue),
html[data-theme=dark] html body .bh-singular-content.prose .footnote_tooltip,
html[data-theme=dark] html body .bh-singular-content.prose .footnote_tooltip *:not(.footnote_tooltip_continue) {
	color: #000 !important;
	text-decoration-color: currentColor !important;
}

html[data-theme=dark] html body .footnote_tooltip .footnote_tooltip_continue,
html[data-theme=dark] html body .bh-site-content .entry-content .footnote_tooltip .footnote_tooltip_continue,
html[data-theme=dark] html body .bh-singular-content .entry-content .footnote_tooltip .footnote_tooltip_continue {
	color: green !important;
}

html[data-theme=dark] .footnote_tooltip,
html[data-theme=dark] .bh-site-content .entry-content .footnote_tooltip,
html[data-theme=dark] .bh-singular-content .entry-content .footnote_tooltip {
	color-scheme: light;
}
