/* Final, late-loading colour layer. Component geometry remains owned by style.css. */
@media (prefers-color-scheme: dark) {
	html:not([data-color-scheme]) {
		--cl-canvas: #12100f;
		--cl-surface: #1c1917;
		--cl-surface-raised: #26211e;
		--cl-ink: #f8f3ef;
		--cl-muted: #c0b4ac;
		--cl-line: #403832;
		--cl-control-line: #5a4d45;
		--cl-accent-soft: #3c2517;
		color-scheme: dark;
	}
}

html[data-color-scheme="dark"] {
	--cl-canvas: #12100f;
	--cl-surface: #1c1917;
	--cl-surface-raised: #26211e;
	--cl-ink: #f8f3ef;
	--cl-muted: #c0b4ac;
	--cl-line: #403832;
	--cl-control-line: #5a4d45;
	--cl-accent-soft: #3c2517;
	color-scheme: dark;
}

html[data-color-scheme="dark"] body,
html[data-color-scheme="dark"] .wp-site-blocks,
html[data-color-scheme="dark"] main,
html[data-color-scheme="dark"] .cl-ai-page {
	background-color: var(--cl-canvas) !important;
	color: var(--cl-ink);
}

html[data-color-scheme="dark"] :is(h1,h2,h3,h4,h5,h6,strong,legend,summary,.wp-block-post-title,.wp-block-heading) { color: var(--cl-ink); }
html[data-color-scheme="dark"] :is(p,li,small,label,.wp-block-post-excerpt,.cl-muted) { color: var(--cl-muted); }
html[data-color-scheme="dark"] a:not(.wp-element-button):not(.cl-button):not(.cl-ai-button) { text-decoration-color: rgba(249,115,22,.65); }

html[data-color-scheme="dark"] :is(
	.cl-audience-card,.cl-path-card,.cl-native-card,.cl-school-card,.cl-trust-panel,
	.cl-network-post,.cl-core-pillar-grid>article,.cl-core-sprint-grid>article,
	.cl-builder-phase-grid>article,.cl-builder-result-grid>article,.cl-builder-method__grid>article,
	.cl-career-card,.cl-career-filters,.cl-search-empty,.cl-article-sidebar>*,
	.cl-editorial-card,.cl-community-card,.cl-community-submissions,.cl-contact-form,
	.cl-profile-body aside,.cl-ai-process article,.cl-ai-report,.cl-ai-plans article:not(.cl-ai-plan--featured),
	.cl-ai-safety article,.cl-ai-demo-card,.cl-ai-dialog,.cl-ai-launch
) {
	background: var(--cl-surface) !important;
	border-color: var(--cl-line) !important;
	color: var(--cl-ink) !important;
}

html[data-color-scheme="dark"] :is(input,select,textarea,.cl-rich-editor,.cl-rich-editor__canvas,.cl-rich-editor__toolbar,.cl-search-command) {
	background: var(--cl-surface-raised) !important;
	border-color: var(--cl-control-line) !important;
	color: var(--cl-ink) !important;
}
html[data-color-scheme="dark"] :is(input,textarea)::placeholder,
html[data-color-scheme="dark"] .cl-rich-editor__canvas:empty::before { color: #aa9d95 !important; opacity: 1; }

html[data-color-scheme="dark"] :is(.cl-ai-launch-band,.cl-ai-hero,.cl-ai-section,.cl-ai-report__summary) {
	background-color: var(--cl-canvas) !important;
	background-image: none !important;
}
html[data-color-scheme="dark"] :is(.cl-ai-launch__copy>p:not(.cl-ai-kicker),.cl-ai-hero__lead,.cl-ai-heading>p:not(.cl-eyebrow),.cl-ai-process p,.cl-ai-safety p,.cl-ai-faq details p,.cl-ai-plans li,.cl-ai-plan-note,.cl-ai-report__summary p,.cl-ai-demo-card__signals span) { color: var(--cl-muted) !important; }
html[data-color-scheme="dark"] :is(.cl-ai-button--ghost,.cl-ai-link,.cl-ai-price-lockup b) { color: var(--cl-ink) !important; }
html[data-color-scheme="dark"] .cl-ai-launch__proof span,
html[data-color-scheme="dark"] .cl-ai-demo-card__follow { background: var(--cl-surface-raised); border-color: var(--cl-line); color: var(--cl-muted); }
html[data-color-scheme="dark"] .cl-ai-report__ring::before { background: var(--cl-surface); }
html[data-color-scheme="dark"] .cl-ai-report__metrics article { border-color: var(--cl-line); }
html[data-color-scheme="dark"] .cl-ai-report__metrics article>span { background: #4c423c; }

html[data-color-scheme="dark"] .cl-profile-page { background: var(--cl-canvas); color: var(--cl-ink); }
html[data-color-scheme="dark"] .cl-profile-book { background: var(--cl-surface); color: var(--cl-ink); }
html[data-color-scheme="dark"] .cl-profile-book p { color: var(--cl-muted); }
html[data-color-scheme="dark"] .cl-theme-toggle__track { box-shadow: inset 0 1px 2px rgba(255,255,255,.08), 0 8px 22px rgba(0,0,0,.35); }

/* Explicitly chosen light/dark hero surfaces retain their intentional contrast. */
html[data-color-scheme="dark"] :is(.cl-search-hero--focused,.cl-article-hero,.cl-ai-section--dark,.cl-ai-final,.cl-profile-hero,.cl-site-footer) :is(h1,h2,h3,strong) { color: #fff; }

@media (prefers-contrast: more) {
	html[data-color-scheme="dark"] { --cl-muted: #ddd4ce; --cl-line: #71645c; --cl-control-line: #8c7c72; }
}
