/* Shared header control and the default dark-mode exceptions.
   The Ledger stylesheet is active only in the owner's selected light mode. */
html:not([data-cf-theme="light"]) { color-scheme: dark; }
html[data-cf-theme="light"] { color-scheme: light; }

body:not(.session-demo) .cf-theme-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 1px;
  align-items: center;
  justify-content: center;
  min-width: 102px;
  min-height: 44px;
  padding: 4px 8px;
  border: 1px solid #D9D2C3;
  border-radius: 6px;
  background: transparent;
  color: #F6F3EC;
  font: 600 13px/1.3 "IBM Plex Sans", "Inter", system-ui, sans-serif;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  order: 3;
}
body:not(.session-demo) .cf-theme-toggle[aria-pressed="true"] { background: rgba(246,243,236,.1); }
body:not(.session-demo) .cf-theme-toggle:focus-visible { outline: 2px solid #F6F3EC !important; outline-offset: 3px !important; }
body:not(.session-demo) .cf-theme-toggle:disabled { cursor: default; }
body:not(.session-demo) :is(.header-inner, .cfw-home-header-inner, .offer-header-inner, .cw-nav-inner, .journey-header-inner, .brand-nav-inner, .design-nav-inner, .legal-nav)>:is(nav, .nav, .cfw-home-nav, .offer-nav, .cw-nav-links, .journey-nav, .brand-links, .design-links, .legal-nav-links) { order: 2; }
body:not(.session-demo) :is(.nav-toggle, .cfw-home-nav-toggle, .journey-nav-toggle, .brand-menu, .design-menu) { order: 4; }
/* These two legacy headers use a pale surface independently of page mode. */
body:is(.branding-page, .design-page) :is(.brand-nav, .design-nav, .brand-links, .design-links) { background: #14212B !important; border-color: #D9D2C3 !important; }
body:is(.branding-page, .design-page) :is(.brand-links, .design-links) a { color: #D9D2C3 !important; }
body:is(.branding-page, .design-page) :is(.brand-menu, .design-menu) { background: transparent !important; color: #F6F3EC !important; border-color: #D9D2C3 !important; }
body:is(.branding-page, .design-page) :is(.brand-nav, .design-nav) a:is(.brand-btn, .design-btn) { background: transparent !important; color: #F6F3EC !important; border-color: #D9D2C3 !important; }
body:is(.branding-page, .design-page) :is(.brand-nav, .design-nav) :is(a, button):focus-visible { outline: 2px solid #F6F3EC !important; outline-offset: 3px !important; }
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-footer { background: #14212B !important; color: #D9D2C3 !important; border-color: #3d596a !important; }
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-footer :is(a, .footer-name, .footer-note) { color: #D9D2C3 !important; }
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-footer a:focus-visible { outline: 2px solid #F6F3EC !important; outline-offset: 3px !important; }
body:is(.branding-page, .design-page) :is(.brand-home, .design-home) img { filter: brightness(0) invert(1); }
html:not([data-cf-theme="light"]) body:is(.branding-page, .design-page) :is(.brand-footer, .design-footer) { background: #14212B !important; color: #D9D2C3 !important; border-color: #3d596a !important; }
html:not([data-cf-theme="light"]) body:is(.branding-page, .design-page) :is(.brand-footer, .design-footer) :is(a, p, span, small, strong, .brand-footer-note, .design-footer-note) { color: #D9D2C3 !important; }
html:not([data-cf-theme="light"]) body:is(.branding-page, .design-page) :is(.brand-footer, .design-footer) img { filter: brightness(0) invert(1); }
html:not([data-cf-theme="light"]) body:is(.branding-page, .design-page) :is(.brand-footer, .design-footer) :is(a, button):focus-visible { outline: 2px solid #F6F3EC !important; outline-offset: 3px !important; }
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-qualify-card li,
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-form-card .site-lead-field label { color: #C0D0DA !important; }
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-live-demo-foot { background: #08151f !important; color: #C0D0DA !important; }
html:not([data-cf-theme="light"]) body.custom-workspaces-page .cw-live-demo-foot p { color: #C0D0DA !important; }
html:not([data-cf-theme="light"]) body:is(.execution-page, .learn-page) main a.btn.ghost { color: #C0D0DA !important; border-color: #3d596a !important; background: transparent !important; }
body:is(.execution-page, .learn-page) .site-footer .footer-note { color: #D9D2C3 !important; }
html:not([data-cf-theme="light"]) body.cfw-review-page .cfw-review-main .campaign-offer-cta>a { color: #FFFFFF !important; background: #2F6B4F !important; border-color: #2F6B4F !important; border-radius: 6px; min-height: 44px; text-decoration: none; }
html:not([data-cf-theme="light"]) body.cfw-review-page .cfw-review-main .campaign-offer-cta>a :is(span, strong, b) { color: #FFFFFF !important; }
html:not([data-cf-theme="light"]) body.clearframe-home .concept-hero-owner .concept-owner-note { color: #C0D0DA !important; }

/* The explicit mint profit line remains readable on the existing dark hero. */
html:not([data-cf-theme="light"]) body.clearframe-home #hero-title .cf-profit-line {
  color: #69E4C8 !important;
  background: none !important;
  background-clip: border-box !important;
  -webkit-background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
  text-shadow: none !important;
  filter: none !important;
}

/* Legal pages start with light CSS in production; normalize their dark mode
   without changing content, source layout, or the existing public navigation. */
html:not([data-cf-theme="light"]) body:has(.legal-card) {
  --page: #04090c;
  --surface: #08151f;
  --ink: #eef7f9;
  --text: #e0f0f3;
  --muted: #a8bdc9;
  --line: #3d596a;
  --accent: #69E4C8;
  background: #04090c;
  color: #e0f0f3;
}
html:not([data-cf-theme="light"]) body:has(.legal-card) :is(.legal-header, .legal-footer) { background: #04090c; color: #e0f0f3; }
html:not([data-cf-theme="light"]) body:has(.legal-card) .legal-card { background: #08151f; border-color: #3d596a; }
html:not([data-cf-theme="light"]) body:has(.legal-card) .legal-note { background: #10232b; color: #e0f0f3; border-color: #69E4C8; }
html:not([data-cf-theme="light"]) body:has(.legal-card) main a { color: #69E4C8; }

/* Slightly heavier light typography; retain every existing size and line break. */
html[data-cf-theme="light"] body:not(.session-demo) { font-weight: 500; }
html[data-cf-theme="light"] body:not(.session-demo) :is(p, li, dd, blockquote, figcaption, input, textarea, select, small) { font-weight: 500 !important; }
html[data-cf-theme="light"] body:not(.session-demo) :is(label, dt, .section-kicker, .concept-hero-eyebrow, .cfw-review-kicker, nav a, .cf-theme-toggle) { font-weight: 600 !important; }
html[data-cf-theme="light"] body:not(.session-demo) :is(h1, h2, h3, h4, strong, b, .btn, .offer-button, .process-contact-primary, .cf-web-cta, .help-primary-link, .cf-cmd-free-primary, .cf-utility-cta, .contact-action) { font-weight: 700 !important; }

@media (max-width: 900px) {
  body:is(.branding-page, .design-page) .cfw-review-main>.cfw-review-hero:first-child { padding-top: 81px !important; }
  body:not(.session-demo) :is(.header-inner, .cfw-home-header-inner, .journey-header-inner, .brand-nav-inner, .design-nav-inner) { gap: 10px; }
  body:not(.session-demo) :is(.header-inner, .cfw-home-header-inner, .journey-header-inner, .brand-nav-inner, .design-nav-inner)>:is(.brand, .concept-brand, .cfw-home-brand, .journey-brand, .brand-home, .design-home) { flex: 1 1 auto; min-width: 0; }
  body:not(.session-demo) :is(.header-inner, .cfw-home-header-inner, .journey-header-inner, .brand-nav-inner, .design-nav-inner)>:is(.brand, .concept-brand, .cfw-home-brand, .journey-brand, .brand-home, .design-home) img { max-width: 100%; }
  body:not(.session-demo) .cf-theme-toggle { order: 2; padding-inline: 8px; min-width: 96px; }
  body:not(.session-demo) :is(.nav-toggle, .cfw-home-nav-toggle, .journey-nav-toggle, .brand-menu, .design-menu) { order: 3; flex-shrink: 0; }
  body:not(.session-demo) :is(.header-inner, .cfw-home-header-inner, .journey-header-inner, .brand-nav-inner, .design-nav-inner)>:is(nav, .nav, .cfw-home-nav, .journey-nav, .brand-links, .design-links) { order: 4; }
}
@media (max-width: 600px) {
  body:not(.session-demo) :is(.offer-header-inner, .cw-nav-inner) { flex-wrap: wrap; gap: 10px 14px; }
  body:not(.session-demo) :is(.offer-header-inner, .cw-nav-inner)>:is(.offer-brand, .cw-brand) { flex: 1 1 auto; min-width: 0; }
  body:not(.session-demo) :is(.offer-header-inner, .cw-nav-inner)>:is(.offer-nav, .cw-nav-links) { order: 4; flex-basis: 100%; width: 100%; display: flex; flex-wrap: wrap; justify-content: flex-start; }
  body:not(.session-demo) .cw-nav-links .btn { display: inline-flex; }
}
@media (max-width: 360px) {
  body.custom-workspaces-page .cw-nav-inner { column-gap: 10px; }
  body.custom-workspaces-page .cw-nav-inner>.cw-brand { gap: 8px; max-width: calc(100% - 106px); }
  body.custom-workspaces-page .cw-nav-inner>.cw-brand img { width: 32px; height: 32px; }
  body.custom-workspaces-page .cw-nav-inner>.cw-brand span { font-size: 13px; font-weight: 600; }
}

/* Explicit mode label and active state remain correct before deferred scripts run. */
html body:not(.session-demo) button.cf-theme-toggle .cf-theme-toggle-label { display: block; font-size: 11px; line-height: 1.2; font-weight: 600; letter-spacing: 0; color: #F6F3EC !important; }
html body:not(.session-demo) button.cf-theme-toggle .cf-theme-toggle-state { display: block; font-size: 13px; line-height: 1.2; font-weight: 700; letter-spacing: 0; color: #F6F3EC !important; }
html:not([data-cf-theme="light"]) button.cf-theme-toggle [data-cf-theme-state="light"],
html[data-cf-theme="light"] button.cf-theme-toggle [data-cf-theme-state="dark"] { display: none !important; }
