/* Business theme controls. Layout and typography remain shared by both themes. */

/* Texture belongs only to the canvas; cards, fields, tables and chrome stay solid. */
.main-workspace:not(.case-view-active),
.admin-scroll,
.fin-scroll,
.platform-case-detail__body {
  background-image: var(--workspace-background-image);
  background-size: var(--workspace-dot-spacing) var(--workspace-dot-spacing);
}

.workspace-theme-toggle:focus-visible {
  outline: 2px solid var(--color-brand-primary);
  outline-offset: 2px;
}

.workspace-theme-toggle[aria-checked="true"] {
  color: var(--color-info-text);
  background: var(--color-brand-soft);
}

.workspace-theme-icons {
  position: relative;
}

.workspace-theme-icons svg {
  position: absolute;
  inset: 0;
  transition: transform 240ms ease, opacity 180ms ease;
}

.workspace-theme-moon {
  opacity: 0;
  transform: rotate(-60deg) scale(0.5);
}

.workspace-theme-toggle[aria-checked="true"] .workspace-theme-sun {
  opacity: 0;
  transform: rotate(60deg) scale(0.5);
}

.workspace-theme-toggle[aria-checked="true"] .workspace-theme-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

:root.workspace-theme-switching::view-transition-old(root) {
  animation: workspace-theme-fade-out 180ms ease both;
}

:root.workspace-theme-switching::view-transition-new(root) {
  animation: workspace-theme-fade-in 180ms ease both;
}

@keyframes workspace-theme-fade-out { to { opacity: 0; } }
@keyframes workspace-theme-fade-in { from { opacity: 0; } }

/* These are document pages, not app surfaces. PDF/image pixels are never filtered. */
.declaration-preview,
.declaration-print,
.decl-boxmap-white,
.react-declaration-form-preview,
.case-decl-preview-doc {
  color-scheme: light;
  --color-text-primary: #0c1220;
  --color-text-secondary: #3b4557;
  --color-text-muted: #66708a;
  --color-surface: #ffffff;
  --color-surface-muted: #eef2f8;
  --color-border-light: rgba(12, 18, 32, 0.10);
  --color-border-strong: rgba(12, 18, 32, 0.17);
  --color-brand-primary: #1d4ed8;
  color: #0c1220;
}

/* Login keeps its independent preference, including native form controls. */
.site-login,
#invite-accept-root,
#password-reset-root,
#scop-viewport-notice {
  color-scheme: dark;
}

:root[data-theme="light"] .site-login,
:root[data-theme="light"] #invite-accept-root,
:root[data-theme="light"] #password-reset-root,
:root[data-theme="light"] #scop-viewport-notice {
  color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
  .workspace-theme-icons svg { transition: none; }
  :root.workspace-theme-switching::view-transition-old(root),
  :root.workspace-theme-switching::view-transition-new(root) { animation: none; }
}
