/*
 * Embedonix dark colour scheme. Loaded after every other stylesheet; every rule is
 * under html[data-theme="dark"], so the light pages are untouched.
 * The first block restates the parent theme's colour variables. html[data-theme]
 * outranks :root, so a parent theme update that regenerates its own colours
 * cannot change this scheme.
 */
html[data-theme="dark"] {
	color-scheme: dark;
	--theme-palette-color-1: #5b9bff;
	--theme-palette-color-2: #4a8bff;
	--theme-palette-color-3: #b4c2d3;
	--theme-palette-color-4: #eef3f9;
	--theme-palette-color-5: #2c3b50;
	--theme-palette-color-6: #17212e;
	--theme-palette-color-7: #0e1621;
	--theme-palette-color-8: #131d2b;
	--theme-text-color: #b4c2d3;
	--theme-headings-color: #eef3f9;
	--theme-border-color: #2c3b50;
	--theme-link-initial-color: #7db0ff;
	--theme-link-hover-color: #a9ccff;
	--theme-selection-text-color: #ffffff;
	--theme-selection-background-color: #2f6fe0;
	--theme-form-field-border-initial-color: #3a4d66;
	--theme-form-field-border-focus-color: #7db0ff;
	--theme-form-selection-field-initial-color: #3a4d66;
	--theme-form-selection-field-active-color: #3b82f6;
	--theme-button-text-initial-color: #ffffff;
	--theme-button-text-hover-color: #ffffff;
	--theme-button-background-initial-color: #1f62dd;
	--theme-button-background-hover-color: #174fb8;
	--theme-icon-color: #b4c2d3;
	--theme-box-shadow: none;
}

html[data-theme="dark"] body {
	background-color: #0e1621;
	color: #b4c2d3;
}

/* Header and footer */
html[data-theme="dark"] .ct-header [data-row*="middle"],
html[data-theme="dark"] .ct-header [data-row] {
	background-color: #131d2b;
	border-color: #25354a;
}
html[data-theme="dark"] .ct-header .site-title a,
html[data-theme="dark"] .ct-header .site-title { color: #eef3f9; }
html[data-theme="dark"] .ct-header .site-description { color: #9fb0c4; }
html[data-theme="dark"] .ct-footer,
html[data-theme="dark"] .ct-footer [data-row] {
	background-color: #0a111a;
	color: #b4c2d3;
	border-color: #25354a;
}
html[data-theme="dark"] .ct-footer a { color: #b4c2d3; }
html[data-theme="dark"] .ct-footer a:hover { color: #ffffff; }

/* Logo: the dark-background version of the vector mark (same geometry, alt text kept) */
html[data-theme="dark"] img.embedonix-brand-logo {
	content: url("brand/embedonix-logo-dark.svg");
}

/* Toggle button */
.embedonix-theme-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0 6px 0 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: var(--theme-text-color, #3a4f66);
	cursor: pointer;
	flex: 0 0 auto;
}
.embedonix-theme-toggle:hover { background: rgba(127, 140, 160, 0.16); }
.embedonix-theme-toggle:focus-visible { outline: 3px solid #2872fa; outline-offset: 2px; }
.embedonix-theme-toggle svg { display: block; }
.embedonix-theme-toggle__sun { display: none !important; }
html[data-theme="dark"] .embedonix-theme-toggle__sun { display: block !important; }
html[data-theme="dark"] .embedonix-theme-toggle__moon { display: none !important; }
html[data-theme="dark"] .embedonix-theme-toggle { color: #eef3f9; }
html[data-theme="dark"] .embedonix-theme-toggle:focus-visible { outline-color: #7db0ff; }
.embedonix-theme-toggle--floating {
	position: fixed;
	right: 16px;
	bottom: 16px;
	z-index: 9999;
	background: var(--theme-palette-color-8, #fff);
	border-color: var(--theme-border-color, #ccc);
}

/* Home hero and discovery footer */
html[data-theme="dark"] .embedonix-home-hero__inner {
	background: #131d2b;
	border-color: #2c3b50;
	box-shadow: none;
}
html[data-theme="dark"] .embedonix-home-hero,
html[data-theme="dark"] .embedonix-home-hero h1,
html[data-theme="dark"] .embedonix-home-hero__author { color: #eef3f9; }
html[data-theme="dark"] .embedonix-home-hero p { color: #b4c2d3; }
html[data-theme="dark"] .embedonix-home-hero__eyebrow,
html[data-theme="dark"] .embedonix-home-hero__author-text span,
html[data-theme="dark"] .embedonix-home-hero__author strong + * { color: #7db0ff; }
html[data-theme="dark"] .embedonix-home-hero__author {
	background: #0e1621;
	border-color: #2c3b50;
}
html[data-theme="dark"] .embedonix-home-hero__author-bio { color: #b4c2d3; }
html[data-theme="dark"] .embedonix-discovery-footer {
	background: #0a111a;
	border-top-color: #25354a;
}
html[data-theme="dark"] .embedonix-discovery-footer,
html[data-theme="dark"] .embedonix-discovery-footer p { color: #9fb0c4; }
html[data-theme="dark"] .embedonix-discovery-footer h2,
html[data-theme="dark"] .embedonix-discovery-footer h3,
html[data-theme="dark"] .embedonix-discovery-footer strong { color: #eef3f9; }

/* Cookie bar and settings dialog (inline styles from the plugin need !important) */
html[data-theme="dark"] #cookie-law-info-bar {
	background-color: #131d2b !important;
	color: #d5dfeb !important;
	border-top: 1px solid #2c3b50;
}
html[data-theme="dark"] #cookie-law-info-bar a:not(.cli-plugin-button) { color: #7db0ff !important; }
/* Reject keeps the same blue fill as in the light scheme, so it is never less prominent than Accept. */
html[data-theme="dark"] #cookie-law-info-bar .cookie_action_close_header_reject {
	background: #1f62dd !important;
	color: #fff !important;
}
html[data-theme="dark"] #cookie-law-info-bar .cli-plugin-main-button.cli_settings_button,
html[data-theme="dark"] #cookie-law-info-bar a.medium.cli-plugin-button.cli-plugin-main-button:not(#cookie_action_close_header):not(#wt-cli-accept-all-btn):not(.cookie_action_close_header_reject) {
	background-color: #2c3b50 !important;
	color: #eef3f9 !important;
}
html[data-theme="dark"] .cli-modal .cli-modal-content,
html[data-theme="dark"] .cli-modal .cli-tab-content,
html[data-theme="dark"] .cli-modal-dialog { background-color: #131d2b !important; color: #d5dfeb; }
html[data-theme="dark"] .cli-modal .cli-tab-header { background-color: #1b2738 !important; }
html[data-theme="dark"] .cli-modal .cli-tab-header a,
html[data-theme="dark"] .cli-modal .cli-privacy-overview p,
html[data-theme="dark"] .cli-modal .cli-tab-content p,
html[data-theme="dark"] .cli-modal .cli-tab-content,
html[data-theme="dark"] .cli-modal h4,
html[data-theme="dark"] .cli-modal .cli-privacy-content-text,
html[data-theme="dark"] .cli-modal .cli-privacy-content-text * { color: #d5dfeb !important; }
html[data-theme="dark"] .cli-modal .cli-tab-container,
html[data-theme="dark"] .cli-modal .cli-tab-section { border-color: #2c3b50 !important; }
html[data-theme="dark"] .cli-modal .cli-tab-footer { background: #131d2b !important; }
html[data-theme="dark"] .cli-modal-close svg { fill: #d5dfeb; }
html[data-theme="dark"] .cookielawinfo-table th { background: #2c3b50 !important; color: #fff !important; }
html[data-theme="dark"] .cookielawinfo-table td { background: #131d2b !important; color: #d5dfeb !important; border-color: #2c3b50 !important; }

/* Inline-styled diagrams inside articles keep their own light palette as a card.
   Text that carries no colour of its own gets a dark ink so it stays readable. */
html[data-theme="dark"] .entry-content [style*="d8e0e8"] {
	color: #24384a;
	color-scheme: light;
}
html[data-theme="dark"] .entry-content [style*="d8e0e8"] :is(h1, h2, h3, h4, h5, h6, p, li, span, div, th, td, strong, b, em, a) {
	color: inherit;
}

/* Syntax highlighter (Urvanov, Eclipse theme) */
html[data-theme="dark"] .crayon-theme-eclipse {
	border-color: #2c3b50 !important;
	background: #0b1320 !important;
}
html[data-theme="dark"] .crayon-theme-eclipse .crayon-table .crayon-nums {
	background: #0b1320 !important;
	color: #6f849b !important;
	border-right-color: #2c3b50 !important;
}
html[data-theme="dark"] .crayon-theme-eclipse .crayon-line { background: transparent !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-striped-line { background: #0f1a2a !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-striped-num { background: #0f1a2a !important; color: #6f849b !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-marked-line,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-marked-line.crayon-striped-line { background: #2a2a12 !important; border-color: #6b6620 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-marked-num,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-marked-num.crayon-striped-num { background: #1b2738 !important; color: #b4c2d3 !important; border-color: #1b2738 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-toolbar { background: #17212e !important; border-bottom-color: #2c3b50 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-title { color: #d5dfeb !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-language { color: #8fa2b8 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-button { background-color: #2c3b50 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-info { background: #26230f !important; color: #d9d27a !important; border-bottom-color: #6b6620 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-p,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-ta,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-i,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-e,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-v,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-o,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-sy,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-n,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-f { color: #dbe5f0 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-c { color: #7fb685 !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-s { color: #f0a87c !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-cn { color: #86c5ff !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-k,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-st,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-r,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-t,
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-m { color: #d7a0ff !important; }
html[data-theme="dark"] .crayon-theme-eclipse .crayon-pre .crayon-h { color: #7db0ff !important; }
html[data-theme="dark"] .crayon-theme-eclipse-inline { background: #17212e !important; border-color: #2c3b50 !important; }

/* Inline code and plain blocks */
html[data-theme="dark"] .entry-content :not(pre) > code {
	background: #17212e;
	color: #d5dfeb;
}
html[data-theme="dark"] .entry-content pre {
	background: #0b1320;
	color: #dbe5f0;
	border-color: #2c3b50;
}

/* Buttons: the accent colour above is bright for text, so fills are set explicitly */
html[data-theme="dark"] .wp-block-button__link,
html[data-theme="dark"] .wp-element-button,
html[data-theme="dark"] button.submit,
html[data-theme="dark"] .embedonix-home-hero__button {
	background-color: #1f62dd;
	border-color: #1f62dd;
	color: #fff;
}
html[data-theme="dark"] .wp-block-button__link:hover,
html[data-theme="dark"] .wp-element-button:hover,
html[data-theme="dark"] button.submit:hover { background-color: #174fb8; border-color: #174fb8; color: #fff; }
html[data-theme="dark"] .wp-block-button.is-style-outline .wp-block-button__link,
html[data-theme="dark"] .embedonix-home-hero__button--secondary {
	background: transparent;
	border-color: #5b9bff;
	color: #8dbbff;
}
html[data-theme="dark"] .embedonix-home-hero__author h2,
html[data-theme="dark"] .embedonix-home-hero__author-name { color: #eef3f9; }
html[data-theme="dark"] .embedonix-discovery-footer__wordmark { color: #eef3f9; }
html[data-theme="dark"] .embedonix-part-nav__status { color: #9fb0c4; }

/* Legacy inline colours in article bodies */
html[data-theme="dark"] .entry-content :is([style*="#eef4f8"], [style*="#dff5eb"], [style*="#e6f2fb"], [style*="#f7fafc"], [style*="#fff0d8"], [style*="#fff8e8"], [style*="#fff7ed"], [style*="#ffffff"]) {
	color: #24384a;
}
html[data-theme="dark"] .entry-content [style*="#fff7ed"] :is(p, li, strong, b, em, span, a, h2, h3, h4) { color: inherit; }
html[data-theme="dark"] .entry-content [style*="#fff7ed"] a { text-decoration: underline; }
html[data-theme="dark"] .entry-content [style*="color: #000000"],
html[data-theme="dark"] .entry-content [style*="color:#000"] { color: inherit !important; }
html[data-theme="dark"] .entry-content [style*="52616f"] { color: #9fb0c4 !important; }
html[data-theme="dark"] .entry-content [style*="d8e0e8"] [style*="52616f"] { color: #52616f !important; }
html[data-theme="dark"] .entry-content [style*="42545c"] { color: #9fb0c4 !important; }

/* Article listing pages set their own page, header and footer backgrounds */
html[data-theme="dark"] body.embedonix-enhancement-article-listing { background: #0e1621; }
html[data-theme="dark"] body.embedonix-enhancement-article-listing #header [data-row] { background: #131d2b; }
html[data-theme="dark"] body.embedonix-enhancement-article-listing footer,
html[data-theme="dark"] body.embedonix-enhancement-article-listing .embedonix-discovery-footer { background: #0a111a; }

/* Social icons whose brand colour is black or near black */
html[data-theme="dark"] .ct-header-socials a[data-network="github"],
html[data-theme="dark"] .ct-header-socials a[data-network="twitter"],
html[data-theme="dark"] .ct-footer .ct-socials a[data-network="github"],
html[data-theme="dark"] .ct-footer .ct-socials a[data-network="twitter"] { --official-color: #e6edf3 !important; }

/* Phone header: logo, title, toggle, search and menu share one row. The toggle
   added a 40px button, so the row is tightened to keep the title clear of it. */
@media (max-width: 689px) {
	#header [data-device="mobile"] [data-column="end"] [data-items] { gap: 4px; }
	#header [data-device="mobile"] [data-column="end"] [data-items] > * { margin-left: 0; margin-right: 0; }
	#header [data-device="mobile"] .embedonix-theme-toggle { width: 36px; height: 40px; }
	#header [data-device="mobile"] .site-title-container { margin-left: 12px; }
	[data-header*="type-1"] .ct-header [data-device="mobile"] [data-id="logo"] .site-title { --theme-font-size: 22px; }
}
@media (max-width: 374px) {
	[data-header*="type-1"] .ct-header [data-device="mobile"] [data-id="logo"] .site-title { --theme-font-size: 18px; }
}
@media (max-width: 359px) {
	[data-header*="type-1"] .ct-header [data-device="mobile"] [data-id="logo"] .site-title { --theme-font-size: 17px; }
	[data-header*="type-1"] .ct-header [data-device="mobile"] [data-id="logo"] .site-logo-container { --logo-max-height: 34px; }
	#header [data-device="mobile"] .site-title-container { margin-left: 8px; }
	#header [data-device="mobile"] [data-id="search"] { width: 40px; }
}

/* Compact archive (/archive/) and listing chips */
html[data-theme="dark"] .embedonix-compact-archive__eyebrow,
html[data-theme="dark"] .embedonix-compact-archive__list time { color: #9fb0c4; }
html[data-theme="dark"] .embedonix-compact-archive__header p:last-child { color: #b4c2d3; }
html[data-theme="dark"] .embedonix-compact-archive__filters {
	border-color: #2c3b50;
	background: #131d2b;
}
html[data-theme="dark"] .embedonix-compact-archive__filters label { color: #d5dfeb; }
html[data-theme="dark"] .embedonix-compact-archive__filters select {
	border-color: #4a5d76;
	background-color: #0e1621;
	color: #eef3f9;
}
html[data-theme="dark"] .embedonix-compact-archive__filters select:disabled { color: #8fa2b8; background: #17212e; }
html[data-theme="dark"] .embedonix-compact-archive__list,
html[data-theme="dark"] .embedonix-compact-archive__list li { border-color: #25354a; }
html[data-theme="dark"] .embedonix-compact-archive__empty { background: #131d2b; border-left-color: #8fa2b8; }
html[data-theme="dark"] .embedonix-compact-archive :focus-visible { outline-color: #7db0ff; }
html[data-theme="dark"] .embedonix-archive-chips__chip { border-color: #3a4d66; }
html[data-theme="dark"] .embedonix-archive-chips__chip--active { border-color: #4fb39a; background: rgba(79, 179, 154, 0.14); }

/* Footer details, ad label, back-to-top */
html[data-theme="dark"] .embedonix-discovery-footer__tagline,
html[data-theme="dark"] .embedonix-discovery-footer__heading { color: #9fb0c4; }
html[data-theme="dark"] .embedonix-ad__label { color: #8293a8; }
html[data-theme="dark"] .ct-back-to-top {
	background-color: #1f62dd;
	color: #fff;
	--theme-icon-color: #fff;
}

/* Forms: borders, error text and required marks readable on the dark surface */
html[data-theme="dark"] :is(.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea, .fluentform .ff-el-form-control, .search-form input[type="search"]) {
	border-color: #4a5d76;
	background-color: #0e1621;
	color: #eef3f9;
}
html[data-theme="dark"] ::placeholder { color: #8293a8; }
html[data-theme="dark"] .fluentform .ff-el-is-error .text-danger,
html[data-theme="dark"] .comment-form .required,
html[data-theme="dark"] .fluentform .ff-el-is-required.asterisk-right label::after { color: #ff8a80; }

/* Consulting page bio card on phones */
html[data-theme="dark"] body.embedonix-enhancement-consulting-page .embedonix-mobile-card--bio {
	border-color: #2c3b50;
	background: #131d2b;
}
html[data-theme="dark"] body.embedonix-enhancement-consulting-page .embedonix-mobile-card--bio * { color: #b4c2d3; }

/* Article part navigation */
html[data-theme="dark"] .embedonix-part-nav__link--prev {
	border-color: #5b9bff;
	color: #8dbbff;
}
html[data-theme="dark"] .embedonix-part-nav__link--prev:hover,
html[data-theme="dark"] .embedonix-part-nav__link--prev:focus {
	background: rgba(91, 155, 255, 0.12);
	border-color: #8dbbff;
	color: #cfe0ff;
}

/* Figure zoom viewer keeps a white plate behind diagrams */
html[data-theme="dark"] .embedonix-figure-zoom__pane img { background: #fff; }
