/*
 * Canadensys light theme (Phase 2, option D: follows the OS on first visit,
 * header toggle remembers the visitor's choice).
 *
 * Approved code exception (Nate, docs/phase2-plan.md; scope recorded in
 * CLAUDE.md): this is the only file where colours are written as hex, and
 * only inside the two marked blocks below (the light palette and the
 * always-dark restore). Everything else uses var(--gcid-cds-*).
 *
 * The theme is set by the inline head script in functions.php, which puts
 * data-theme="light" or "dark" on <html> before first paint.
 */

/*
 * HEX BLOCK 1: the light palette.
 * Limitation: a Divi global colour holds one value, and Divi only prints the
 * colour variables a page uses, so the light values can't live in Divi. Every
 * cds-* variable is re-pointed here (the full list, printed or not), plus
 * Divi's theme-level variables that come from hex-only theme options
 * (heading, body, link and accent colour).
 * Values: docs/design-system.md section 1 (light theme), with the decision
 * brief's fixes (hovers, offwhite/ink swap, gold, field border).
 * Borders: the v6.5 prototype values (pixel plan RC-3, 2026-11-13). They are decorative (cards, bands, ghost pills, the toggle ring); form fields use cds-field-border, which keeps 3:1 (WCAG 1.4.11).
 */
html[data-theme="light"] {
	--gcid-cds-bg: #F0EEE6;
	--gcid-cds-surface: #FBFAF5;
	--gcid-cds-card: #FBFAF5;
	--gcid-cds-card-alt: #F0EEE6;
	--gcid-cds-field: #FFFFFF;
	--gcid-cds-field-border: #857F70;
	--gcid-cds-border: #E3DECF;
	--gcid-cds-border-2: #DFDACB;
	--gcid-cds-text: #211F1A;
	--gcid-cds-body: #4A473F;
	--gcid-cds-lead: #4A473F; /* overview lead: dark #D9D9DC (prototype); light keeps the readable body colour (the prototype's light lead is a bug), pixel plan chunk 04 */
	--gcid-cds-muted: #6F6B5E;
	--gcid-cds-accent: #2E3B96;
	--gcid-cds-accent-hover: #26317F;
	--gcid-cds-accent-btn: #2E3B96;
	--cds-accent-btn-light: #2E3B96; /* the light accent button colour, kept out of the always-dark restore (pixel plan chunk 04, HOME-N13) */
	--gcid-cds-accent-btn-hover: #26317F;
	--gcid-cds-gold: #7E6110;
	--gcid-cds-offwhite: #211F1A;
	--gcid-cds-ink: #F5F3EC;
	--gcid-cds-white: #FFFFFF;
	--gcid-cds-logo-red: #E8102D;
	color-scheme: light;
}

/*
 * HEX BLOCK 2: always-dark restore.
 * Limitation: sections on photographs (heroes, the Home careers banner, the
 * News and Contact starfield bands) keep light text on a dark overlay in both
 * themes. Their overlays are Divi opacity variants, which render as baked hex
 * and stay dark, so the text inside must get the dark values back. A var()
 * alias can't do this (it would resolve to the overridden light value), so
 * the dark palette is repeated here. Applied with the cds-always-dark class
 * (section or module CSS Class field), listed in docs/light-mode-retrofit.md.
 */
html[data-theme="light"] .cds-always-dark {
	--gcid-cds-bg: #0B0C0E;
	--gcid-cds-surface: #131417;
	--gcid-cds-card: #15161A;
	--gcid-cds-card-alt: #101114;
	--gcid-cds-field: #17181C;
	--gcid-cds-field-border: #6B6C72;
	--gcid-cds-border: #26272B;
	--gcid-cds-border-2: #2A2B30;
	--gcid-cds-text: #F0F0F0;
	--gcid-cds-body: #C6C6C9;
	--gcid-cds-muted: #97979C;
	--gcid-cds-accent: #7D8DEB;
	--gcid-cds-accent-hover: #9AA7F2;
	--gcid-cds-accent-btn: #3F51C0;
	--gcid-cds-accent-btn-hover: #4A5CD0;
	--gcid-cds-gold: #D8A03A;
	--gcid-cds-offwhite: #F5F3EC;
	--gcid-cds-ink: #211F1A;
	--gcid-cds-white: #FFFFFF;
	color-scheme: dark;
}

/* ---- No hex below this line. ---- */

/*
 * Divi's theme-level colours (et_divi header_color, font_color, link_color,
 * accent_color) are hex-only options printed as --gcid-heading-color and
 * friends. Point them at the cds variables so they follow the theme, and so
 * the always-dark restore reaches them too (they're re-declared on the class,
 * where the cds variables hold the dark values).
 */
html[data-theme="light"],
html[data-theme="light"] .cds-always-dark {
	--gcid-heading-color: var(--gcid-cds-text);
	--gcid-body-color: var(--gcid-cds-body);
	--gcid-link-color: var(--gcid-cds-accent);
	--gcid-primary-color: var(--gcid-cds-accent);
}

/*
 * Page background. Limitation: the theme mod background_color is hex-only and
 * prints body.custom-background { background-color: #0b0c0e }; Divi also uses
 * it on #main-content (as body:not(.et_pb_pagebuilder_layout) #main-content on
 * Theme Builder templates, hence the extra body in the selector). Follow cds-bg.
 */
html[data-theme="light"] body,
html[data-theme="light"] body.custom-background,
html[data-theme="light"] #page-container,
html[data-theme="light"] body #main-content {
	background-color: var(--gcid-cds-bg);
}

/*
 * Divi bakes the accent_color hex into a few legacy selectors that this build
 * shows: the mobile menu's top border and blockquote borders.
 */
html[data-theme="light"] .et_mobile_menu,
html[data-theme="light"] .nav li ul {
	border-color: var(--gcid-cds-accent);
}

html[data-theme="light"] blockquote {
	border-color: var(--gcid-cds-accent);
}

/*
 * .cds-intro-band (the intro band under a detail-page hero: a cds-card-alt to
 * cds-bg gradient). Limitation: Divi bakes gradient stops to hex even when
 * they are plain colour variables, so the dark gradient would stay in light
 * mode. Drop it there; the section's own cds-bg colour (a variable) shows.
 * In the light palette cds-card-alt and cds-bg are the same, so nothing is lost.
 * !important: Divi prints the section's gradient with !important.
 */
html[data-theme="light"] .cds-intro-band {
	background-image: none !important;
}

/*
 * Theme cross-fade (site motion D2, option b). Limitation: a colour change on
 * every element can't animate without a transition on every element, and a
 * permanent one would replace Divi's own hover transitions. So the rule only
 * applies while theme-toggle.js holds cds-theme-fading on <html> (1550ms, for a
 * 1.5s fade; 0.45s in v6.5, 1.5s at the client's request, 16 Nov 2026, D5). ::before and ::after are included so Divi's icon glyphs
 * (menu chevrons, social icons) fade with the text beside them. filter is included so the footer logo darkens with the page, as in the prototype (pixel plan chunk 02).
 * Wrapped in no-preference so reduced motion never gets it: light.css loads
 * after a11y.css, so its !important rule would otherwise win the tie.
 */
@media (prefers-reduced-motion: no-preference) {
	html.cds-theme-fading,
	html.cds-theme-fading *,
	html.cds-theme-fading *::before,
	html.cds-theme-fading *::after {
		transition: background-color 1.5s ease, color 1.5s ease, border-color 1.5s ease, fill 1.5s ease, stroke 1.5s ease, filter 1.5s ease !important;
	}
}

/*
 * Pixel fixes, chunk 04 (HOME-N13): in light mode the prototype's cream pills on
 * always-dark boxes (Home careers band, the closing CTA boxes) hover to the light
 * accent button colour, var(--accentBtn) = #2E3B96. The always-dark restore puts
 * the dark #3F51C0 back, so the pill hover reads the light value from a property
 * the restore doesn't redeclare.
 */
html[data-theme="light"] .cds-always-dark .et_pb_button.preset--group--divi-button--divi-button--h1c8vfa--2dc488da-0680-48d7-8cb0-86415065de81:hover {
	background-color: var(--cds-accent-btn-light) !important;
}

/*
 * Logo swap for job postings (client corrections 16 Nov 2026, D7): an img or Image module with
 * the class cds-logo-swap shows the client's navy logo in the light theme, as the footer does
 * (footer.css). The img keeps its alt text.
 */
html[data-theme="light"] img.cds-logo-swap[src*="logo-dark-bg.svg"],
html[data-theme="light"] .cds-logo-swap img[src*="logo-dark-bg.svg"] {
	content: url("images/logo-light-bg.svg");
}

/*
 * Subtle background gradient, light theme (client corrections 16 Nov 2026, D5): the layout.css glow
 * in the light theme's accent (#2E3B96) at 6%, so it reads as faint as the dark one.
 */
html[data-theme="light"] body #main-content .et_pb_section:not(.cds-always-dark):not(.cds-news-band):not(.cds-intro-band):not(.cds-moon-on):not(.et_pb_sticky_placeholder) {
	background-image: radial-gradient(ellipse 1000px 520px at 50% -10%, rgba(46, 59, 150, 0.06) 0%, rgba(46, 59, 150, 0) 62%);
}
