/* Shared semantic colours. Load after component styles; no layout overrides. */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --danger: #ff9ca8;
  --suite-danger: #ff9ca8;
  --shadow-soft: 0 10px 30px rgb(0 0 0 / 18%);
}
html[data-theme="light"] {
  color-scheme: light;
  --danger: #b4233b;
  --suite-danger: #b4233b;
  --bg: #d5e0eb;
  --bg-soft: #cbd8e5;
  --surface: #e6eef5;
  --surface-2: #dce6ef;
  --line: #b5c5d4;
  --line-strong: #93a8ba;
  --text-muted: #496579;
  --shadow-soft: 0 2px 5px rgb(22 52 78 / 3%), 0 8px 20px rgb(22 52 78 / 5%);

  /* Distinct page, card and inset surfaces across all tool families. */
  --suite-bg: var(--bg);
  --suite-panel: var(--surface);
  --suite-panel-soft: var(--surface-2);
  --suite-border: var(--line);
  --suite-border-strong: var(--line-strong);
  --suite-muted: var(--text-muted);
  --suite-shadow: var(--shadow-soft);
  --media-panel: var(--surface);
  --media-soft: var(--surface-2);
  --media-line: var(--line);
  --media-line-strong: var(--line-strong);
  --media-muted: var(--text-muted);
  --media-shadow: var(--shadow-soft);
  --r-bg: var(--bg);
  --r-bg-2: var(--bg-soft);
  --r-surface: var(--surface);
  --r-surface-2: var(--surface-2);
  --r-glass: #e6eef5;
  --r-line: var(--line);
  --r-line-strong: var(--line-strong);
  --r-muted: var(--text-muted);
}

/* Only UI surfaces: image pixels, document pages and selection colours retain
   their own styles. No geometry, visibility or processing behaviour changes. */
html[data-theme="light"] body {
  background: var(--bg);
}

html[data-theme="light"] .tool-card,
html[data-theme="light"] .workflow-step,
html[data-theme="light"] .why-card {
  /* Earlier landing rules mark translucent card fills important. */
  background: var(--surface) !important;
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .workspace-card,
html[data-theme="light"] .legal-content,
html[data-theme="light"] .legal-summary,
html[data-theme="light"] .reader-welcome-card,
html[data-theme="light"] .about-reader-card,
html[data-theme="light"] .about-flow-grid article {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .contributors-page .contributor-card:not(.contributor-top-card) {
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

html[data-theme="light"] .tool-category-chip:not(.is-active):not([aria-selected="true"]),
html[data-theme="light"] .tools-more-btn {
  background: var(--surface);
  border-color: var(--line-strong);
}

html[data-theme="light"] .form-upload-card,
html[data-theme="light"] .form-preset-info,
html[data-theme="light"] .form-requirement-grid > article,
html[data-theme="light"] .form-review-check,
html[data-theme="light"] .form-result-card,
html[data-theme="light"] .pdfc-review-flow,
html[data-theme="light"] .pdfc-final-review,
html[data-theme="light"] .pdfc-pdf-ready,
html[data-theme="light"] .pdf-mode-chooser,
html[data-theme="light"] .image-to-text-language-clean {
  background: var(--surface-2);
  border-color: var(--line);
}

html[data-theme="light"] .field input[type="number"],
html[data-theme="light"] .field select,
html[data-theme="light"] .form-edit-grid input,
html[data-theme="light"] .form-edit-grid select,
html[data-theme="light"] #form-preset-search,
html[data-theme="light"] #form-custom-source-url {
  background: var(--surface);
  border-color: var(--line-strong);
}

html[data-theme="light"] .field input:focus,
html[data-theme="light"] .field select:focus,
html[data-theme="light"] .form-edit-grid input:focus,
html[data-theme="light"] .form-edit-grid select:focus,
html[data-theme="light"] #form-preset-search:focus,
html[data-theme="light"] #form-custom-source-url:focus {
  border-color: var(--primary);
}

html[data-theme="light"] .tool-help-popover,
html[data-theme="light"] .suite-help-popover,
html[data-theme="light"] .reader-popover {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: 0 4px 12px rgb(22 52 78 / 6%), 0 18px 44px rgb(22 52 78 / 12%);
}

html[data-theme="light"] .po-footer {
  --pf-bg: #cbd8e5;
  --pf-card: #e6eef5;
  --pf-line: #b5c5d4;
}

/* Muted light palette: tint the large surfaces instead of outlining them more. */
html[data-theme="light"] .site-header,
html[data-theme="light"] .site-header.scrolled,
html[data-theme="light"] .workspace-header.site-header,
html[data-theme="light"] .workspace-header.site-header.scrolled {
  background: var(--surface) !important;
  border-color: var(--line);
  box-shadow: 0 3px 12px rgb(22 52 78 / 5%) !important;
}
html[data-theme="light"] #mobile-menu {
  background: var(--surface);
}
html[data-theme="light"] .hero {
  background:
    radial-gradient(circle at 80% 24%, rgb(89 75 210 / 7%), transparent 35%),
    radial-gradient(circle at 14% 72%, rgb(6 124 156 / 7%), transparent 34%),
    linear-gradient(135deg, #dbe6ef, #d0ddeb 55%, #dcddef);
}
html[data-theme="light"] body.contributors-page {
  --recognition-surface: var(--surface);
  --recognition-tint: var(--surface-2);
}
