/* Night (dark) mode for the whole site. It is on when <html data-theme="dark">: set before the page
   paints by the small script lib/theme.js puts in <head> (the reader's saved choice, else their
   system setting), and switched with the moon/sun button in the header (site/assets/theme.js).
   The Salient theme hard-codes its colours (black #000/#0a0a0a on #f7f7f7 and white), so this file
   overrides them element by element. */
html[data-theme="dark"] {
  color-scheme: dark;
  --dk-bg: #111111;
  --dk-surface: #1b1b1b;
  --dk-surface-2: #262626;
  --dk-text: #ececec;
  --dk-muted: #a8a8a8;
  --dk-line: #303030;
  --nectar-bg-color: #111111;
  --nectar-accent-color: #ececec;
  /* the captcha and form messages (site/assets/forms.css) */
  --cs-color-primary: #ececec;
  --cs-color-site-background: #111111;
  --cs-color-contrast-100: #1b1b1b;
  --cs-color-contrast-200: #303030;
  --cs-color-contrast-300: #3a3a3a;
  --cs-color-contrast-600: #a8a8a8;
}

/* page and text */
html[data-theme="dark"] body,
html[data-theme="dark"] .ocm-effect-wrap,
html[data-theme="dark"] #ajax-content-wrap,
html[data-theme="dark"] .container-wrap,
html[data-theme="dark"] .container-wrap .main-content,
html[data-theme="dark"] .body-border-top,
html[data-theme="dark"] .body-border-right,
html[data-theme="dark"] .body-border-bottom,
html[data-theme="dark"] .body-border-left { background-color: var(--dk-bg) !important; }
html[data-theme="dark"] body,
html[data-theme="dark"] .container-wrap,
html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] label,
html[data-theme="dark"] blockquote,
html[data-theme="dark"] figcaption,
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
html[data-theme="dark"] h4, html[data-theme="dark"] h5, html[data-theme="dark"] h6,
html[data-theme="dark"] .entry-title,
html[data-theme="dark"] .post-heading, html[data-theme="dark"] .post-heading a,
html[data-theme="dark"] .nectar-split-heading,
html[data-theme="dark"] .meta-author-name, html[data-theme="dark"] .meta-date,
html[data-theme="dark"] .nectar-responsive-text,
html[data-theme="dark"] .wpb_text_column { color: var(--dk-text); }
html[data-theme="dark"] a { color: var(--dk-text); }
html[data-theme="dark"] [style^="color: #0a0a0a"],
html[data-theme="dark"] [style^="color:#0a0a0a"],
html[data-theme="dark"] [style*="; color:#000000"],
html[data-theme="dark"] [style*="; color: #000000"],
html[data-theme="dark"] [style^="color: #000000"],
html[data-theme="dark"] [style^="color:#000000"] { color: var(--dk-text) !important; }
html[data-theme="dark"] .content-inner a { text-decoration-color: var(--dk-muted); }
html[data-theme="dark"] hr, html[data-theme="dark"] .divider-border { border-color: var(--dk-line) !important; background-color: var(--dk-line); }

/* header bar */
html[data-theme="dark"] #header-outer,
html[data-theme="dark"] #header-outer #top,
html[data-theme="dark"] #header-outer.transparent #top { background-color: var(--dk-surface) !important; }
html[data-theme="dark"] #header-outer { box-shadow: 0 0 0 1px var(--dk-line) !important; }
html[data-theme="dark"] #header-outer #top nav > ul > li > a,
html[data-theme="dark"] #header-outer .menu-title-text,
html[data-theme="dark"] #header-outer .icon-salient-search,
html[data-theme="dark"] #header-outer .nectar-icon { color: var(--dk-text) !important; }
/* the grey pill behind the current / hovered menu item */
html[data-theme="dark"] #header-outer .menu-title-text::before { background-color: var(--dk-surface-2) !important; }
html[data-theme="dark"] #header-outer .lines,
html[data-theme="dark"] #header-outer .lines::before,
html[data-theme="dark"] #header-outer .lines::after { background-color: var(--dk-text) !important; }
html[data-theme="dark"] #logo img { filter: invert(1) hue-rotate(180deg); }
html[data-theme="dark"] #header-outer .sf-menu ul,
html[data-theme="dark"] #header-outer .sf-menu ul li a { background-color: var(--dk-surface) !important; color: var(--dk-text) !important; }

/* search overlay and the phone menu */
html[data-theme="dark"] #search-outer,
html[data-theme="dark"] #search-outer #search,
html[data-theme="dark"] #search-outer .bg-overlay { background-color: var(--dk-surface) !important; }
html[data-theme="dark"] #search-outer input[type=text],
html[data-theme="dark"] #search-outer #search span { color: var(--dk-text) !important; }

/* archive header (category, tag, author, search) */
html[data-theme="dark"] .page-header-no-bg.color-bg { background: linear-gradient(180deg, var(--dk-surface) 0%, var(--dk-bg) 100%) !important; color: var(--dk-text) !important; }
html[data-theme="dark"] body:has(.page-header-no-bg.color-bg) .ocm-effect-wrap { background: linear-gradient(var(--dk-surface), var(--dk-surface)) 0 0 / 100% 240px no-repeat, var(--dk-bg) !important; }
/* the post count next to an archive heading: Salient draws its circle with ::before */
/* (a faint circle of the text colour, as in light mode, with the number in the text colour) */
html[data-theme="dark"] .nectar-archive-tax-count { background-color: transparent !important; color: var(--dk-text) !important; }
html[data-theme="dark"] .nectar-archive-tax-count::before { background-color: var(--dk-text) !important; opacity: .16 !important; }

/* light page sections become dark */
html[data-theme="dark"] .row-bg.using-bg-color[style*="#ffffff"],
html[data-theme="dark"] .row-bg.using-bg-color[style*="#fff;"],
html[data-theme="dark"] .row-bg.using-bg-color[style*="#f7f7f7"],
html[data-theme="dark"] [style*="background-color:#ffffff"],
html[data-theme="dark"] [style*="background-color: #ffffff"],
html[data-theme="dark"] [style*="background-color:#f7f7f7"] { background-color: var(--dk-surface) !important; }

/* category labels: black pills become light pills */
html[data-theme="dark"] .meta-category a.style-button,
html[data-theme="dark"] .meta-category a[class*="style-button"],
html[data-theme="dark"] .nectar-post-grid-item .meta-category a { background-color: var(--dk-text) !important; color: var(--dk-bg) !important; }
html[data-theme="dark"] .meta-category a.style-button::before { background-color: var(--dk-text) !important; }

/* scrolling "Thought Leadership" text: the outlined row */
html[data-theme="dark"] .nectar-scrolling-text,
html[data-theme="dark"] .nectar-scrolling-text h2 { color: var(--dk-text) !important; -webkit-text-stroke-color: var(--dk-text) !important; }

/* inline icons drawn in black */
html[data-theme="dark"] svg [stroke="#000"], html[data-theme="dark"] svg [stroke="#000000"] { stroke: var(--dk-text); }
html[data-theme="dark"] svg [fill="#000"], html[data-theme="dark"] svg [fill="#000000"] { fill: var(--dk-text); }

/* buttons and form fields */
html[data-theme="dark"] .nectar-button:not(.see-through),
html[data-theme="dark"] button.wpforms-submit,
html[data-theme="dark"] .wpforms-container .wpforms-submit,
html[data-theme="dark"] input[type=submit] { background-color: var(--dk-text) !important; color: var(--dk-bg) !important; border-color: var(--dk-text) !important; }
html[data-theme="dark"] input[type=text], html[data-theme="dark"] input[type=email], html[data-theme="dark"] input[type=search],
html[data-theme="dark"] input[type=url], html[data-theme="dark"] input[type=tel], html[data-theme="dark"] textarea, html[data-theme="dark"] select,
html[data-theme="dark"] .wpforms-container .wpforms-field input, html[data-theme="dark"] .wpforms-form .wpforms-field-container,
html[data-theme="dark"] .wpforms-container .wpforms-form { background-color: var(--dk-surface) !important; color: var(--dk-text) !important; border-color: var(--dk-line) !important; }
html[data-theme="dark"] ::placeholder { color: var(--dk-muted) !important; }

/* article pages */
html[data-theme="dark"] .content-inner blockquote { border-color: var(--dk-text); }
html[data-theme="dark"] .content-inner table td, html[data-theme="dark"] .content-inner table th { border-color: var(--dk-line) !important; }
html[data-theme="dark"] .wp-block-separator { border-color: var(--dk-line) !important; }
html[data-theme="dark"] .nectar-social, html[data-theme="dark"] .nectar-social a { color: var(--dk-text) !important; border-color: var(--dk-line) !important; }

/* Key takeaway and FAQs (site/assets/aeo.css) */
html[data-theme="dark"] .cxo-aeo-summary, html[data-theme="dark"] .cxo-aeo-faq { --cxd-ink: #ececec; --cxd-line: #303030; --cxd-line-strong: #4a4a4a; --cxd-muted: #b4b4b4; }
html[data-theme="dark"] .content-inner > .cxo-aeo-summary { background: var(--dk-surface); }
html[data-theme="dark"] .cxo-aeo-summary .cxo-aeo-label { color: var(--dk-bg); }
html[data-theme="dark"] .cxo-aeo-faq details[open] .cxo-aeo-icon::before,
html[data-theme="dark"] .cxo-aeo-faq details[open] .cxo-aeo-icon::after { background: var(--dk-bg); }

/* home page top section (site/assets/home.css): it is already dark; give it an edge on the dark page */
html[data-theme="dark"] .cxd-lead-feat { box-shadow: 0 0 0 1px var(--dk-line); }

/* the switch itself (light and dark) */
.cxd-theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin: 0; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer;
  transition: background-color .2s;
}
.cxd-theme-toggle:hover { background-color: rgba(0,0,0,.06); }
html[data-theme="dark"] .cxd-theme-toggle:hover { background-color: rgba(255,255,255,.1); }
.cxd-theme-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.cxd-theme-toggle svg { width: 20px; height: 20px; display: block; }
.cxd-theme-toggle .cxd-sun { display: none; }
html[data-theme="dark"] .cxd-theme-toggle .cxd-sun { display: block; }
html[data-theme="dark"] .cxd-theme-toggle .cxd-moon { display: none; }
#header-outer #cxd-theme-li { display: flex; align-items: center; }
#header-outer #cxd-theme-li > div { display: flex; align-items: center; }
/* phones: the button sits next to the search icon */
#header-outer .cxd-theme-mobile { display: none; }
@media (max-width: 999px) {
  #header-outer .cxd-theme-mobile { display: inline-flex; position: relative; z-index: 10; margin-right: 6px; vertical-align: middle; }
}
html { transition: none; }
html.cxd-theme-anim, html.cxd-theme-anim * { transition: background-color .25s ease, color .25s ease, border-color .25s ease !important; }
@media (prefers-reduced-motion: reduce) { html.cxd-theme-anim, html.cxd-theme-anim * { transition: none !important; } }

/* post grids drawn with dark text on the light page (cards with the title under the photo) */
html[data-theme="dark"] .nectar-post-grid[data-text-color="dark"] .content,
html[data-theme="dark"] .nectar-post-grid[data-text-color="dark"] .content :not(.meta-category):not(.meta-category *),
html[data-theme="dark"] .nectar-post-grid[data-text-color="dark"] .item-meta-extra,
html[data-theme="dark"] .nectar-post-grid[data-text-color="dark"] .item-meta-extra * { color: var(--dk-text) !important; }
html[data-theme="dark"] .nectar-post-grid[data-text-color="dark"] .meta-excerpt { color: var(--dk-muted) !important; }
/* the near-black sections (Leadership) get a lighter surface so they stand apart from the page */
html[data-theme="dark"] .row-bg.using-bg-color[style*="#0f0f0f"] { background-color: var(--dk-surface) !important; }
/* animated line icons (Lottie, e.g. the bell above the newsletter) are drawn in black */
html[data-theme="dark"] .nectar-lottie { filter: invert(1); }

/* the search icon (the theme colours it with a more specific rule) */
html[data-theme="dark"] body #header-outer #top #search-btn .icon-salient-search,
html[data-theme="dark"] body #header-outer #top #search-btn a,
html[data-theme="dark"] body #header-outer .mobile-search .nectar-icon,
html[data-theme="dark"] body #header-outer .mobile-search { color: var(--dk-text) !important; }
/* the search panel: typed text, placeholder, the "Hit enter…" hint and the close button */
html[data-theme="dark"] body #search-outer #search input#s,
html[data-theme="dark"] body #search-outer #search input[type=text] { color: var(--dk-text) !important; caret-color: var(--dk-text); border-color: var(--dk-line) !important; }
html[data-theme="dark"] body #search-outer #search input::placeholder { color: var(--dk-text) !important; opacity: .55; }
html[data-theme="dark"] body #search-outer #search span:not(.screen-reader-text):not(.close-wrap):not(.close-line) { color: var(--dk-muted) !important; }
html[data-theme="dark"] body #search-outer #close a,
html[data-theme="dark"] body #search-outer .close-wrap { color: var(--dk-text) !important; }
html[data-theme="dark"] body #search-outer .close-line { background-color: var(--dk-text) !important; }
/* the strip Salient slides in behind the header when the search panel opens (white by default;
   it showed as white corners at the panel's top edge) */
html[data-theme="dark"] #header-outer .bg-color-stripe { background-color: var(--dk-surface) !important; }
