/* Shared website palette, drawn from the app icon's indigo, blue and cyan. */
:root {
  color-scheme: dark;
  --bg: #0b1224;
  --surface: #121e36;
  --surface2: #1b2a47;
  --panel: var(--surface);
  --line: #2c3e61;
  --text: #f3f6ff;
  --muted: #b0bed6;
  --dim: #91a1bd;
  --accent: #94b8ff;
  --mint: var(--accent);
  --blue: #73caff;
  --orange: #f6bd87;
  --red: #f29a94;
  --brand-indigo: #5663b3;
  --brand-blue: #347bc4;
  --brand-cyan: #159bd4;
  --brand-gradient: linear-gradient(125deg, var(--brand-indigo), #326cba 54%, #137cae);
  --brand-gradient-hover: linear-gradient(125deg, #4e5aa5, #2b62ae 54%, #0b709f);
  --brand-border: #728bd2;
  --brand-shadow: 0 8px 24px #347bc42e;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 38%, var(--line));
  --footer-bg: #0a1020;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7ff;
  --surface: #fff;
  --surface2: #edf1fb;
  --line: #d6ddf0;
  --text: #182340;
  --muted: #53627e;
  --dim: #64728b;
  --accent: #425fb1;
  --blue: #126c9b;
  --orange: #a96829;
  --red: #bc4c55;
  --footer-bg: #edf1fb;
}

body { accent-color: var(--accent); }
::selection { background: var(--brand-indigo); color: #fff; }
[data-theme] .topbar { background: color-mix(in srgb, var(--bg) 92%, transparent); }
[data-theme] .site-footer { background: var(--footer-bg); }
.brand-logo { background: var(--brand-indigo); }
.brand-mark { background: var(--brand-gradient); color: #fff; }
.skip-link:focus { background: var(--brand-indigo); color: #fff; }
.notice-dot { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
.main-nav a.active { color: var(--accent); }
[data-theme="light"] .main-nav a.active { color: var(--accent); }

/* Primary actions share one readable gradient in both themes. */
.primary-button,
.light-button,
.pricing-subscribe:not(:disabled):not(.pricing-subscribe-free),
.update-list a.release-download-button {
  border-color: var(--brand-border);
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: var(--brand-shadow);
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.primary-button:hover,
.light-button:hover,
.pricing-subscribe:not(:disabled):not(.pricing-subscribe-free):hover,
.update-list a.release-download-button:hover {
  border-color: var(--accent);
  background: var(--brand-gradient-hover);
  color: #fff;
  box-shadow: 0 10px 28px #347bc440;
}
.download-toggle { background: #137cae; border-color: var(--brand-border); border-left-color: #ffffff40; }
.download-toggle:hover { background: #0b709f; }
.pricing-subscribe-free { background: transparent; border-color: var(--accent-line); color: var(--accent); }
.pricing-subscribe-free:hover { background: var(--accent-soft); color: var(--accent); }
.primary-button:focus-visible,
.light-button:focus-visible,
.download-toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

/* Replace the former green tints on navigation, cards and callouts. */
[data-theme] .doc-card.featured,
[data-theme] .feature-card.featured,
[data-theme] .subscribe-box {
  background: linear-gradient(130deg, var(--accent-soft), var(--surface));
  border-color: var(--accent-line);
}
.update-preview { background: var(--accent-soft) !important; border-color: var(--accent-line) !important; }
[data-theme] .feature-card-mark,
[data-theme] .docs-sidebar .selected,
[data-theme] .feature-category-filters button.selected,
[data-theme] .feature-category-filters button:hover { background: var(--accent-soft); color: var(--accent); }
[data-theme] .source-feature-card:hover,
[data-theme] .feature-card:hover,
[data-theme] .feature-card:focus-visible,
[data-theme] .task-directory-card:hover,
[data-theme] .task-directory-card:focus-visible { background: var(--surface2); }
[data-theme] .feature-card-objects i,
[data-theme] .feature-object-tags li { background: var(--surface2); }
[data-theme] .feature-workflow-stage { background: var(--surface2); border-color: var(--line); color: var(--text); }
.home-safety { background: radial-gradient(circle at 88% 50%, var(--accent-soft), transparent 45%); }
[data-theme] .trial-strip { background: var(--brand-gradient); color: #fff; }
.trial-strip .light-button { background: #fff; color: #354f9b; border-color: #fff; }
.trial-strip .light-button:hover { background: #edf1fb; color: #293f83; border-color: #edf1fb; }

[data-theme] .global-search { background: var(--surface); border-color: var(--line); }
[data-theme] .global-search label,
[data-theme] .subscribe-box input { background: var(--bg); border-color: var(--line); }
[data-theme] .doc-card small,
[data-theme] .doc-meta b,
[data-theme] .markdown-body { color: var(--muted); }
[data-theme] .markdown-body code { background: var(--surface2); border-color: var(--line); color: var(--blue); }
[data-theme] .markdown-body pre { background: var(--surface); border-color: var(--line); color: var(--text); }
[data-theme] .markdown-body pre code { background: transparent; border: 0; color: inherit; }
[data-theme] .markdown-body blockquote { background: var(--accent-soft); color: var(--muted); }

/* Frame product images with the website palette. */
[data-theme] .hm-shot,
[data-theme] .hm-workspace-gallery,
[data-theme] .real-product-shot,
[data-theme] .showcase-figure,
[data-theme] .markdown-body figure { background: var(--surface); border-color: var(--line); }
[data-theme] .hm-workspace-gallery { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); }
[data-theme] .hm-workspace-gallery .hm-workspace-shot + .hm-workspace-shot { border-color: var(--line); }
[data-theme] .hm-shot figcaption,
[data-theme] .real-product-shot figcaption,
[data-theme] .real-product-shot.guide-figure figcaption,
[data-theme] .showcase-figure figcaption,
[data-theme] .markdown-body figcaption { background: var(--surface); border-color: var(--line); color: var(--muted); }
[data-theme] .showcase-figure figcaption span:first-child { color: var(--text); }
.showcase-dots button { border-color: var(--dim); }
.site-image-viewer button:hover,
.image-viewer-actions a:hover { border-color: #94b8ff; background: #233659; color: #c5d8ff; }
.site-image-viewer button:focus-visible,
.site-image-viewer a:focus-visible,
.site-image-viewer [tabindex="0"]:focus-visible,
.site-image-viewer .viewer-list > .viewer-active { outline-color: #94b8ff; }

[data-theme] .admin-body { background: var(--bg); }
[data-theme] .admin-nav,
[data-theme] .admin-form section,
[data-theme] .collection-editor article { background: var(--surface); border-color: var(--line); }
[data-theme] .admin-nav > a.selected,
[data-theme] .admin-form > footer,
[data-theme] .save-state { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
[data-theme] .form-field input,
[data-theme] .form-field textarea { background: var(--bg); border-color: var(--line); }

/* One shared control stays outside the routed content on every page. */
.back-to-top {
  position: fixed;
  right: max(24px, calc(env(safe-area-inset-right) + 16px));
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 16px));
  z-index: 8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid var(--brand-border);
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 8px 26px #0b122433, var(--brand-shadow);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .2s, box-shadow .2s;
}
.back-to-top[hidden] { display: none; }
.back-to-top svg { width: 23px; height: 23px; }
.back-to-top:hover { background: var(--brand-gradient-hover); box-shadow: 0 10px 30px #347bc44d; }
.back-to-top:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
@media (hover: hover) {
  .back-to-top:hover { transform: translateY(-3px); }
}
@media (max-width: 680px) {
  .back-to-top {
    right: max(16px, calc(env(safe-area-inset-right) + 12px));
    bottom: max(16px, calc(env(safe-area-inset-bottom) + 12px));
    width: 46px;
    height: 46px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .back-to-top, .primary-button, .light-button, .pricing-subscribe,
  .update-list a.release-download-button { transition: none; }
  .back-to-top:hover { transform: none; }
}
