/* Themes. Load after tokens.css. js/theme.js sets <html data-theme="..."> before paint.
   warm (default, no override) is the Figma look; white, dark and ocean remap tokens only.
   Order: shared, white, ocean, dark, then the switcher component. */

/* Shared: colour transition when switching (theme.js adds .theme-switching for one frame window) */
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after {
  transition: background-color var(--dur-slow) var(--ease), border-color var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease) !important;
}

/* Clean white: neutral greys, black buttons, no warm tints */
:root[data-theme="white"] {
  --amber-600: #262626;
  --amber-800: #404040;
  --amber-950: #0a0a0a;
  --orange-400: #737373;
  --orange-500: #171717;
  --orange-700: #262626;
  --orange-900: #404040;
  --stone-50: #fafafa;
  --stone-100: #f5f5f5;
  --stone-300: #d4d4d4;
  --peach-100: #f5f5f5;
  --cream-100: #f5f5f5;
  --sage-100: #f5f5f5;
  --apricot-100: #f5f5f5;
  --sand-100: #f5f5f5;
  --mint-100: #f0f0f0;

  --btn-dark: #0a0a0a;
  --accent: #171717;
  --footer-bg: #0a0a0a;
  --footer-accent: #ffffff;
  --pricing-accent: #171717;
  --pricing-chip: #f0f0f0;
  --pricing-switch-border: rgb(0 0 0 / 0.12);
  --features-dot: #171717;
  --hero-grad-top: rgb(0 0 0 / 0.04);
  --hero-grad-mid: rgb(0 0 0 / 0.02);
  --btn-emboss-ring: #525252;
  --btn-emboss-glow: rgb(0 0 0 / 0.5);
  --tint-brown-10: rgb(0 0 0 / 0.08);
  --focus-ring: rgb(0 0 0 / 0.12);
  --callout-bg: #f5f5f5;
}
:root[data-theme="white"] .s-cta { --cta-bg: #f5f5f5; }
:root[data-theme="white"] .s-case-study { --cs-shade: #171717; }
:root[data-theme="white"] .s-agents { --agents-tile-hover: #f5f5f5; }
:root[data-theme="white"] .s-workflow { --wf-tray: #f0f0f0; }
:root[data-theme="white"] .s-showcase__glow { opacity: 0.25; filter: blur(40px) grayscale(1); }

/* Ocean: navy and blue in place of brown and orange */
:root[data-theme="ocean"] {
  --amber-600: #2563eb;
  --amber-800: #1e40af;
  --amber-950: #0b1b3f;
  --orange-400: #60a5fa;
  --orange-500: #2563eb;
  --orange-700: #1d4ed8;
  --orange-900: #1e3a8a;
  --yellow-400: #22d3ee;
  --yellow-500: #06b6d4;
  --yellow-600: #0891b2;
  --stone-50: #f8fafc;
  --stone-100: #f1f5f9;
  --stone-300: #cbd5e1;
  --peach-100: #dbeafe;
  --cream-100: #e0f2fe;
  --sage-100: #e0f7f4;
  --apricot-100: #e0e7ff;
  --sand-100: #e8effa;
  --mint-100: #d5f5f6;

  --text-strong: #0b1b3f;
  --text-medium: rgb(11 27 63 / 0.72);
  --text-low: rgb(11 27 63 / 0.6);
  --base-medium: #f1f5f9;
  --base-low: #e2e8f0;

  --btn-dark: #0b1b3f;
  --accent: #2563eb;
  --footer-bg: #0b1b3f;
  --footer-accent: #bfdbfe;
  --pricing-accent: #2563eb;
  --pricing-chip: #e2e8f0;
  --pricing-switch-border: rgb(11 27 63 / 0.15);
  --features-dot: #0b1b3f;
  --hero-grad-top: rgb(37 99 235 / 0.14);
  --hero-grad-mid: rgb(6 182 212 / 0.1);
  --btn-emboss-ring: #6b85b8;
  --btn-emboss-glow: rgb(37 64 120 / 0.7);
  --tint-brown-10: rgb(11 27 63 / 0.1);
  --focus-ring: rgb(37 99 235 / 0.2);
  --callout-bg: #eef2f8;
}
:root[data-theme="ocean"] .s-cta { --cta-bg: #e8effa; }
:root[data-theme="ocean"] .s-case-study { --cs-shade: #102a5c; }
:root[data-theme="ocean"] .s-agents { --agents-tile-hover: #eaf1fd; }
:root[data-theme="ocean"] .s-workflow { --wf-tray: #e8edf5; }
:root[data-theme="ocean"] .s-showcase__glow { filter: blur(40px) hue-rotate(185deg); }

/* Dark: warm near-black surfaces, light text, orange accent kept */
:root[data-theme="dark"] {
  color-scheme: dark;
  --amber-600: #f08a1c;
  --amber-800: #f5a35a;
  --amber-950: #1c1410;
  --orange-700: #ff8a3d;
  --orange-900: #ffb27a;
  --stone-50: #1a1715;
  --stone-100: #1f1b18;
  --stone-300: #3a3430;
  --neutral-900: #f5f5f4;
  --peach-100: #2a1d14;
  --cream-100: #24211a;
  --sage-100: #1a2419;
  --apricot-100: #2a2014;
  --sand-100: #221d17;
  --mint-100: #15291f;

  --text-strong: #fafaf9;
  --text-medium: rgb(255 255 255 / 0.74);
  --text-low: rgb(255 255 255 / 0.58);
  --text-weak: #57534e;
  --text-brand: var(--emerald-300);

  --base-high: #0f0d0c;
  --base-medium: #191614;
  --base-low: #26221f;
  --base-negative: #fafaf9;

  --border-strong: #57534e;
  --border-thin: rgb(255 255 255 / 0.1);
  --border-solid: #fafaf9;

  --black-4: rgb(255 255 255 / 0.04);
  --black-5: rgb(255 255 255 / 0.06);
  --black-6: rgb(255 255 255 / 0.07);
  --black-10: rgb(255 255 255 / 0.1);
  --black-20: rgb(255 255 255 / 0.2);
  --black-60: rgb(255 255 255 / 0.6);
  --black-90: rgb(255 255 255 / 0.9);

  --btn-dark: #c2410c;
  --accent: var(--orange-500);
  --footer-bg: #17110d;
  --pricing-chip: #26221f;
  --pricing-line: #2e2925;
  --pricing-switch-border: rgb(255 255 255 / 0.12);
  --features-dot: #f5a35a;
  --hero-grad-top: rgb(255 113 0 / 0.12);
  --hero-grad-mid: rgb(153 255 0 / 0.04);
  --btn-emboss-ring: #f08a5d;
  --btn-emboss-glow: rgb(255 120 60 / 0.35);
  --btn-soft-ring: rgb(255 255 255 / 0.18);
  --btn-soft-inner: rgb(255 255 255 / 0.06);
  --tint-brown-10: rgb(255 255 255 / 0.08);
  --focus-ring: rgb(255 137 4 / 0.25);
  --callout-bg: #1f1b18;
  --status-progress: #0f3b2c;
  --status-progress-text: #a4f4cf;
  --status-rejected: #3f1215;
  --status-rejected-text: #ffc9c9;
  --docs-header-bg: #161311;
  --code-bg: #050404;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-md: 0 8px 24px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 24px 56px rgb(0 0 0 / 0.55);
  --shadow-nav: 0 12px 12px rgb(0 0 0 / 0.3);
  --shadow-nav-scrolled: 0 12px 24px rgb(0 0 0 / 0.5);
}
:root[data-theme="dark"] .s-cta { --cta-bg: #1f1a15; }
:root[data-theme="dark"] .s-case-study { --cs-bg: #1c1410; --cs-shade: #2a1a10; }
:root[data-theme="dark"] .s-agents { --agents-tile-hover: #241a12; --agents-border-hover: rgb(255 255 255 / 0.25); }
:root[data-theme="dark"] .s-workflow { --wf-tray: #1f1b18; --wf-divider: #2e2925; }
:root[data-theme="dark"] .s-showcase__glow { opacity: 0.55; }
/* Dark: hardcoded black text in section mockups */
:root[data-theme="dark"] .s-features { --f-tag: #173d27; }
:root[data-theme="dark"] :is(.s-workflow__label, .s-workflow__gate-input span, .s-workflow__chat-code) { color: var(--text-strong); }
:root[data-theme="dark"] .s-workflow__gate-input { color: var(--amber-800); }
:root[data-theme="dark"] .s-workflow__chat-footer { color: var(--text-medium); }
:root[data-theme="dark"] .s-workflow__chat-mic { background: var(--text-strong); }
:root[data-theme="dark"] .s-workflow__icon { background: var(--base-low); }
/* Monochrome client and partner logos are black artwork: flip them to white */
:root[data-theme="dark"] .s-logos__logo { filter: invert(1) brightness(1.6); }

/* Dark: product mockups stay light, like screenshots of the app */
:root[data-theme="dark"] :is(.s-showcase__window, .s-cta__mock) {
  color-scheme: light;
  --stone-50: #fafaf9;
  --stone-100: #f5f5f4;
  --text-strong: #0a0a0a;
  --text-medium: rgb(0 0 0 / 0.7);
  --text-low: rgb(0 0 0 / 0.6);
  --base-high: #ffffff;
  --base-medium: #f5f5f5;
  --base-low: #e5e5e5;
  --border-thin: rgb(0 0 0 / 0.1);
  --black-4: rgb(0 0 0 / 0.04);
  --black-5: rgb(0 0 0 / 0.05);
  --black-6: rgb(0 0 0 / 0.06);
  --black-10: rgb(0 0 0 / 0.1);
  --black-60: rgb(0 0 0 / 0.6);
  --black-90: rgb(0 0 0 / 0.9);
  --amber-950: #461901;
  --amber-800: #973c00;
  --cta-mock-bg: #f5f5f4;
  --cta-mock-line: rgb(0 0 0 / 0.1);
  color: var(--text-medium);
}
:root[data-theme="dark"] :is(.s-showcase__window, .s-cta__mock) :is(h1, h2, h3, h4, h5, h6) { color: var(--text-strong); }

/* Theme switcher: rendered by js/theme.js into every [data-theme-switcher] */
.theme-switcher {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  border: 1px solid var(--border-thin); border-radius: var(--radius-pill);
  background: var(--base-high);
}
.theme-switcher__btn {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  color: var(--text-low);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.theme-switcher__btn:hover { color: var(--text-strong); background: var(--black-5); }
.theme-switcher__btn[aria-pressed="true"] { color: var(--text-strong); background: var(--black-10); }
.theme-switcher__swatch {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--sw); box-shadow: inset 0 0 0 1px rgb(127 127 127 / 0.45);
}
/* Fallback when a page has no mount point: fixed pill, bottom left */
.theme-switcher--floating {
  position: fixed; left: var(--space-4); bottom: var(--space-4); z-index: 90;
  box-shadow: var(--shadow-md);
}
/* Phones: the floating fallback collapses to the active swatch and opens on tap */
@media (max-width: 767px) {
  .theme-switcher--floating { left: var(--space-3); bottom: var(--space-3); opacity: 0.9; }
  .theme-switcher--floating:not(:focus-within):not(:hover) .theme-switcher__btn:not([aria-pressed="true"]) { display: none; }
}
