/* Worldrig's restrained tint extends the bundled Borozdov palette.
   Translucency belongs to navigation and tool surfaces; writing and card content stay opaque. */
body.theme-dark.wb-shell {
  /* The inherited palette's names on Midnight Prism (D-184, tokens.css): a near-black canvas, panels a step lighter,
     white text, steel for the main action and ice for focus and the current thing. */
  --canvas: var(--wl-bg);
  --inset: var(--wl-inset);
  --surface: var(--wl-surface);
  --hover: var(--wl-raised);
  --zebra: color-mix(in srgb, var(--wl-inset) 50%, var(--wl-surface));
  --hairline: var(--wl-line);
  --strong: var(--wl-line-strong);
  --slate: var(--wl-text-2);
  --tertiary: var(--wl-text-3);
  --soft: var(--wl-highlight);
  --ink: var(--wl-text);
  --focus-ring: color-mix(in srgb, var(--wl-selection) 30%, transparent);
  --scrim: color-mix(in srgb, var(--wl-bg) 70%, transparent);
  --wb-accent: var(--wl-accent);
  /* The roles (base-theme.css names them): steel fills, ice marks focus and what is chosen, signals are signals. */
  --interactive-accent: var(--wl-accent);
  --interactive-accent-hover: color-mix(in srgb, var(--wl-accent) 80%, var(--wl-text));
  --color-accent: var(--wl-accent);
  --color-accent-1: var(--wl-accent);
  --color-accent-2: var(--wl-highlight);
  --text-accent: var(--wl-selection);
  --text-accent-hover: var(--wl-text);
  --text-on-accent: var(--wl-on-accent);
  --text-on-accent-inverted: var(--wl-on-accent);
  --text-error: var(--wl-danger);
  --text-success: var(--wl-success);
  --text-warning: var(--wl-warning);
  --text-highlight-bg: color-mix(in srgb, var(--wl-warning) 22%, transparent);
  --background-modifier-border-focus: var(--wl-selection);
  --background-modifier-error: var(--wl-danger);
  --background-modifier-error-hover: color-mix(in srgb, var(--wl-danger) 82%, var(--wl-text));
  --background-modifier-success: color-mix(in srgb, var(--wl-success) 14%, transparent);
  /* The inherited shell's controls (the legacy window): a quiet line instead of its drop shadows. */
  --input-shadow: inset 0 0 0 1px var(--wl-line);
  --input-shadow-hover: inset 0 0 0 1px var(--wl-line-strong);
  /* Tags in writing: a soft ice pill, as in the kit's writing (shell/src/styles/prose.css). Quotes: a quiet bar. */
  --tag-color: var(--wl-selection);
  --tag-color-hover: var(--wl-selection);
  --tag-background: var(--wl-selection-soft);
  --tag-background-hover: color-mix(in srgb, var(--wl-selection) 22%, transparent);
  --tag-border-color: transparent;
  --tag-border-color-hover: transparent;
  --tag-radius: var(--r-pill);
  --blockquote-border-color: var(--wl-line-strong);
  --blockquote-color: var(--wl-text-2);
  --wl-glass: color-mix(in srgb, var(--wl-inset) 85%, transparent);
  --wl-glass-border: var(--wl-glass-line);
  --wl-stage-image: none;
}
/* The named colours the pages use for tags, marks and changes (the own window has no inherited shell to give them). */
body.wl-own.wb-shell {
  --color-red: #f0535b; --color-orange: #eb9a48; --color-yellow: #e2d670; --color-green: #4fcf78;
  --color-cyan: #58d8d6; --color-blue: #3d8bff; --color-purple: #ab8aff; --color-pink: #f39acb;
}
body.theme-light.wb-shell {
  --canvas: #f5f7f9;
  --inset: #edf1f4;
  --surface: #fff;
  --hover: #e9eff3;
  --zebra: #f0f4f7;
  --hairline: #d7e0e7;
  --strong: #778896;
  --slate: #647482;
  --tertiary: #748391;
  --soft: #334657;
  --ink: #17222d;
  --wb-accent: #3d6886;
  --wl-glass: rgb(255 255 255 / 84%);
  --wl-glass-border: rgb(34 71 97 / 10%);
  --wl-stage-image: radial-gradient(ellipse at 58% 0%, rgb(82 136 172 / 8%), transparent 48%);
}
/* Selected text: an ice tint under white text. A highlight (==text==): a warm tint under the text's own colour. */
body.theme-dark.wb-shell ::selection { background: color-mix(in srgb, var(--wl-selection) 30%, transparent); color: var(--wl-text); }
body.theme-dark.wb-shell .markdown-rendered mark { background-color: var(--text-highlight-bg); }
body.theme-dark.wb-shell :is(.markdown-rendered mark, .markdown-rendered mark .internal-link, .cm-s-obsidian span.cm-highlight:not(.obsidian-search-match-highlight), .search-result-file-matched-text, .community-item .suggestion-highlight) { color: inherit; }
body.wb-shell .wb-project-bar,
body.wb-shell .workspace-tab-header-container,
body.wb-shell .wt-header,
body.wb-shell .wt-workbench-footer,
body.wb-shell .wt-field-rail,
body.wb-shell .wt-inspector,
body.wb-shell .wt-orbis-panel {
  background: var(--wl-glass);
  backdrop-filter: blur(var(--wl-glass-blur)) saturate(1.08);
  -webkit-backdrop-filter: blur(var(--wl-glass-blur)) saturate(1.08);
}
/* Blur would make the ribbon a containing block and displace its native sidebar toggle. */
body.wb-shell .workspace-ribbon.mod-left { background: var(--background-secondary); backdrop-filter: none; -webkit-backdrop-filter: none; }
body.wb-shell .wt-preview-stage,
body.wb-shell .wt-designer-body .wt-preview-stage { background-color: var(--background-primary-alt); background-image: var(--wl-stage-image); }
body.wb-shell .wt-designer-body .wt-preview-stage {
  background-image: radial-gradient(var(--background-modifier-border) .7px,transparent .7px), var(--wl-stage-image);
  background-size: 20px 20px, auto;
}
body.wb-shell .wb-map-breadcrumbs,
body.wb-shell .wt-layout-config {
  background: var(--wl-glass);
  border-color: var(--wl-glass-border);
  backdrop-filter: blur(var(--wl-glass-blur)) saturate(1.08);
  -webkit-backdrop-filter: blur(var(--wl-glass-blur)) saturate(1.08);
  box-shadow: var(--wl-elev-pop);
}
body.wb-shell .wt-workbench-footer { border-top-color: var(--wl-glass-border); }
body.wb-shell .wt-header { border-bottom-color: var(--wl-glass-border); }
/* Less transparency asked for: every glass surface turns solid inset (DESIGN-SYSTEM.md, section 17). */
@media (prefers-reduced-transparency: reduce) {
  body.theme-dark.wb-shell { --wl-glass: var(--wl-inset); --wl-glass-fill: var(--wl-inset); }
  body.wb-shell .wb-project-bar,
  body.wb-shell .workspace-tab-header-container,
  body.wb-shell .workspace-ribbon.mod-left,
  body.wb-shell .wt-header,
  body.wb-shell .wt-workbench-footer,
  body.wb-shell .wt-field-rail,
  body.wb-shell .wt-inspector,
  body.wb-shell .wt-orbis-panel,
  body.wb-shell .wb-map-breadcrumbs,
  body.wb-shell .wt-layout-config,
  body.wb-shell :is(.wl-glass-panel, .wl-glass) { background: var(--wl-inset); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* Buttons (DESIGN-SYSTEM.md, section 7), at the control radius: the main action is filled steel with dark text, a
   destructive confirm (Discard, Delete) is filled rose, the rest are dark with a quiet line. */
body.wb-shell button.mod-cta { background: var(--interactive-accent); color: var(--text-on-accent); border-radius: var(--r-md); box-shadow: none; font-weight: 500; }
body.wb-shell button.mod-cta:hover { background: var(--interactive-accent-hover); color: var(--text-on-accent); }
body.wb-shell button.mod-warning { background: var(--text-error); color: var(--background-primary); border-radius: var(--r-md); box-shadow: none; font-weight: 500; }
body.wb-shell button.mod-warning:hover { background: color-mix(in srgb, var(--text-error) 88%, var(--background-primary)); color: var(--background-primary); }
body.wb-shell .wt-surface .wt-actions button:not(.mod-cta):not(.wt-text-button),
body.wb-shell .wt-collection-toolbar .wt-segment button,
body.wb-shell .wb-modal .wt-actions button:not(.mod-cta):not(.wt-text-button) { border-radius: var(--r-md); border: 1px solid var(--background-modifier-border); background: color-mix(in srgb, var(--wl-text) 3%, transparent); box-shadow: none; }
body.wb-shell .wt-surface .wt-actions button:not(.mod-cta):not(.wt-text-button):hover { border-color: var(--background-modifier-border-hover); background: color-mix(in srgb, var(--wl-text) 8%, transparent); }
body.wb-shell button { transition: background-color var(--wl-quick) var(--wl-ease), color var(--wl-quick) var(--wl-ease), border-color var(--wl-quick) var(--wl-ease); }

/* The map canvas's colours (shell/src/styles/canvas.css) arrive as "r, g, b": the six named ones and an item's own
   (shell/src/canvas/node.ts), and the map reads them back that way (maps/map-features.js). Here they become colours. */
body.wb-shell .wl-canvas :is(.canvas-node, .canvas-edges g) { --canvas-paint: rgb(var(--canvas-tint)); }
body.wb-shell .wl-canvas .canvas-color-picker-item { --swatch: rgb(var(--canvas-plain)); }
body.wb-shell .wl-canvas .canvas-color-picker-item.mod-canvas-color-1 { --swatch: rgb(var(--canvas-color-1)); }
body.wb-shell .wl-canvas .canvas-color-picker-item.mod-canvas-color-2 { --swatch: rgb(var(--canvas-color-2)); }
body.wb-shell .wl-canvas .canvas-color-picker-item.mod-canvas-color-3 { --swatch: rgb(var(--canvas-color-3)); }
body.wb-shell .wl-canvas .canvas-color-picker-item.mod-canvas-color-4 { --swatch: rgb(var(--canvas-color-4)); }
body.wb-shell .wl-canvas .canvas-color-picker-item.mod-canvas-color-5 { --swatch: rgb(var(--canvas-color-5)); }
body.wb-shell .wl-canvas .canvas-color-picker-item.mod-canvas-color-6 { --swatch: rgb(var(--canvas-color-6)); }
