/* Delve colour schemes. Loaded last on every Delve page.
   Light is the default; dark follows the OS (prefers-color-scheme) with no JavaScript,
   and theme.js only pins the root with data-theme="light|dark" when the visitor chose.
   Tokens use light-dark(), which follows the root's `color-scheme`, so the same
   declaration serves the OS-dark case and the forced-dark case. */
:root {
  color-scheme: light dark;
  --bg: light-dark(#fff, #161719);
  --bg-soft: light-dark(#f5f5f7, #222428);
  --surface: light-dark(#fff, #1e2023);
  --paper: light-dark(#1d1d1f, #f0f0f3);
  --ink: var(--paper);
  --paper-dim: light-dark(#65656c, #b0b1ba);
  --paper-faint: var(--paper-dim);
  --muted: var(--paper-dim);
  --rule: light-dark(#dedee4, #3c3f46);
  --line: var(--rule);
  --accent: light-dark(#235cc5, #91b7ff);
  --accent-deep: light-dark(#194da9, #b4cdff);
  --accent-faint: light-dark(#235cc526, #91b7ff2e);
  --warn: light-dark(#80570c, #e7b85a);
  --nav-surface: light-dark(#ffffffed, #161719ed);
  --border: light-dark(#ddd, #3c3f46);
  --text-secondary: light-dark(#626875, #b0b1ba);
  --nav-hairline: light-dark(#00000012, #ffffff1f);
  --control-hover: light-dark(#3d3d3f, #fff);
  --tint: light-dark(#edf3fc, #293951);
  --cta-bg: light-dark(#1d1d1f, #e1e5ed);
  --cta-ink: light-dark(#fff, #161719);

  /* Funnel (pricing, team) */
  --funnel-ink: var(--paper);
  --funnel-copy: var(--paper-dim);
  --funnel-muted: var(--paper-dim);
  --funnel-surface: var(--bg);
  --funnel-soft: light-dark(#f5f5f7, #1e2023);
  --funnel-line: var(--rule);
  --funnel-blue: var(--accent);
  --funnel-blue-hover: var(--accent-deep);

  --funnel-strong: light-dark(#424245, #d6d7de);
  --funnel-link-strong: light-dark(#005bb5, #b4cdff);
  --funnel-stale: light-dark(#955e0a, #e7b85a);
  --funnel-chip-ink: light-dark(#075fbc, #a9c8ff);
  --funnel-chip-bg: light-dark(#e7f2ff, #243a5c);
  --good: light-dark(#18864b, #5fd18f);
  --good-bright: light-dark(#20a15a, #5fd18f);
  --surface-2: light-dark(#f6f8fb, #26282d);
  --surface-3: light-dark(#f5f8fc, #1a1c1f);
  --nav-glass: light-dark(#ffffffd1, #161719d1);
  --nav-glass-strong: light-dark(#fffffff0, #161719f0);
  --card-glass: light-dark(#ffffffeb, #1e2023eb);
  --hairline: light-dark(#0000000e, #ffffff1a);
  --hairline-strong: light-dark(#00000029, #ffffff33);
  --hairline-lit: light-dark(#ffffff9e, #ffffff1a);

  /* Illustrated app window (team page) */
  --demo-window: light-dark(#ffffff, #1e2023);
  --demo-bar: light-dark(#f6f6f8, #26282d);
  --demo-panel: light-dark(#f9f9fb, #212327);
  --demo-canvas: light-dark(#e9ebee, #17181b);
  --demo-inset: light-dark(#eef0f3, #2c2f35);
  --demo-field: light-dark(#ffffff, #17181b);
  --demo-card: light-dark(#ffffff, #292c32);
  --demo-fill: light-dark(#0000000a, #ffffff0f);
  --demo-ink: light-dark(#1d1d1f, #f0f0f3);
  --demo-copy: light-dark(#65656a, #b0b1ba);
  --demo-faint: light-dark(#98989d, #8f919b);
  --demo-line: light-dark(#00000016, #ffffff1f);
  --demo-line-strong: light-dark(#00000029, #ffffff38);
  --demo-accent-soft: light-dark(#0071e31a, #91b7ff29);
  --demo-pop: light-dark(#fffffff7, #2a2c31f7);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Dark-only values that cannot be expressed with light-dark() (token fallbacks that differ
   per use, whole-rule swaps). The two blocks below are identical: one for an OS in dark
   mode, one for a visitor who forced dark. KEEP THEM IN SYNC. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --theme-surface: #1e2023;
    --theme-soft: #222428;
    --theme-inset: #30333a;
    --theme-label: #191c22ed;
    --theme-muted: #b0b1ba;
    --theme-faint: #8f919b;
    --theme-ink: #f0f0f3;
    --theme-line: #3c3f46;
    --theme-tint: #293951;
    --theme-accent: #91b7ff;
    --theme-bar: #5b8def;
    --sun-gap: var(--demo-map-bg);
    --sun-mark: #f0f0f3;
  }
  :root:not([data-theme="light"]) .app-preview .map-file {
    background: linear-gradient(145deg,color-mix(in srgb,var(--file-color),#b6d5ff 12%),color-mix(in srgb,var(--file-color),#111827 18%));
  }
  :root:not([data-theme="light"]) .theme-disc { transform: scale(1); }
  :root:not([data-theme="light"]) .theme-cutout { transform: translateX(-7px); }
  :root:not([data-theme="light"]) .theme-rays { opacity: 0; transform: rotate(45deg) scale(.6); }
}
:root[data-theme="dark"] {
  --theme-surface: #1e2023;
  --theme-soft: #222428;
  --theme-inset: #30333a;
  --theme-label: #191c22ed;
  --theme-muted: #b0b1ba;
  --theme-faint: #8f919b;
  --theme-ink: #f0f0f3;
  --theme-line: #3c3f46;
  --theme-tint: #293951;
  --theme-accent: #91b7ff;
  --theme-bar: #5b8def;
  --sun-gap: var(--demo-map-bg);
  --sun-mark: #f0f0f3;
}
:root[data-theme="dark"] .app-preview .map-file {
  background: linear-gradient(145deg,color-mix(in srgb,var(--file-color),#b6d5ff 12%),color-mix(in srgb,var(--file-color),#111827 18%));
}
:root[data-theme="dark"] .theme-disc { transform: scale(1); }
:root[data-theme="dark"] .theme-cutout { transform: translateX(-7px); }
:root[data-theme="dark"] .theme-rays { opacity: 0; transform: rotate(45deg) scale(.6); }

body.ent-page {
  --ent-card: var(--surface);
  --ent-good: light-dark(#18864b, #5fd18f);
  --ent-flat: light-dark(#86868b, #9a9ca6);
}
:root { --ref-banner-bg: light-dark(#e9f1fd, #1c2a44); }
body.delve-home .nav-links { margin-left: auto; }
.theme-control { display: flex; align-items: center; margin-left: -12px; }
.theme-control button {
  display: grid; place-items: center; width: 44px; height: 44px;
  padding: 12px; border: 0; border-radius: 50%; background: transparent;
  color: var(--paper); cursor: pointer; touch-action: manipulation;
}
.theme-control button:hover { background: var(--bg-soft); }
.theme-icon { overflow: visible; }
.theme-disc,.theme-rays { transform-origin: 12px 12px; }
.theme-disc { transform: scale(.65); }
.theme-cutout { transform: translateX(0); }
@media (prefers-reduced-motion: no-preference) {
  .theme-control button { transition: background-color 180ms ease, transform 180ms ease; }
  .theme-control button:active { transform: scale(.9); }
  .theme-disc { transition: transform 420ms cubic-bezier(.22,1,.36,1); }
  .theme-cutout { transition: transform 420ms cubic-bezier(.22,1,.36,1); }
  .theme-rays { transition: transform 420ms cubic-bezier(.22,1,.36,1), opacity 180ms ease; }
  ::view-transition-old(root),::view-transition-new(root) { animation-duration: 240ms; animation-timing-function: ease-in-out; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),::view-transition-new(root) { animation: none; }
}
@media (max-width:760px) {
  body.delve-home .nav-inner { gap: 10px; }
  .theme-control { margin-left: auto; }
}

/* Visually hidden (table captions etc.) */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
/* Focusable scroll regions that wrap data tables */
[role="region"][tabindex="0"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Reduced transparency: solid surfaces in place of blurred, translucent ones. */
@media (prefers-reduced-transparency: reduce) {
  body #nav,
  body #nav.scrolled,
  body .ref-banner,
  body.delve-page .product-proof,
  body.ent-page .ent-proof,
  body.delve-page .mobile-conversion-bar {
    background: var(--surface);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  body #nav, body #nav.scrolled { background: var(--bg); }
  body .nav-inner { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-transparency: reduce) and (max-width: 760px) {
  body .nav-links { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
