/* Redwood dark — the one place the dark exception lives.
 *
 * Redwood publishes no dark palette, and the style guide says not to invent
 * one: inverting a warm neutral ramp by hand produces muddy results. This file
 * invents nothing. Every value below is a step already in redwood-tokens.css,
 * or an alpha of one, reassigned at the semantic layer. The ramps themselves
 * are untouched, so a component stylesheet that reads --rw-text-primary and
 * --rw-bg-content needs no knowledge that this file exists.
 *
 * Load order: oracle-sans.css, redwood-tokens.css, this file, then component
 * styles. Tokens define what this reassigns, and this reassigns what components
 * consume. A page that loads it out of order renders every value as its CSS
 * initial default.
 *
 * Three states, not two:
 *
 *   system     no data-theme attribute on the root, so prefers-color-scheme is
 *              the only signal. The media block is guarded against an explicit
 *              light choice, so a toggle set to light wins over the system.
 *   dark       data-theme="dark", set by the viewer.
 *   clinical   data-theme="clinical", for a surface that is dark for a clinical
 *              reason rather than a viewer preference — a reading room, a wall
 *              board, a bench display. Same values as dark, and it holds them
 *              when the operating system is light.
 *
 * --rw-bg-app is the page ground behind the cards. It sits one step outside the
 * semantic set on purpose: cards are --rw-bg-content, and a page painted the
 * same color as its cards reads as one undivided sheet. Its light value is here
 * rather than in redwood-tokens.css because that file carries only values read
 * out of Oracle's JET reference theme, and this one is not among them.
 *
 * The focus ring is Redwood's one deliberate inversion. On a light ground it is
 * near-black so it stays visible on brand-colored surfaces; on a near-black
 * ground it is near-white for the same reason. The rule is the contrast.
 *
 * When the Redwood team publishes dark tokens, load theirs and delete this.
 * Nothing else has to change.
 *
 * (c) Oracle. Internal brand asset — see NOTICE. */

:root {
  --rw-bg-app: var(--rw-neutral-20);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rw-bg-app: var(--rw-neutral-190);
    --rw-bg-content: var(--rw-neutral-180);
    --rw-bg-subtle: var(--rw-neutral-170);
    --rw-bg-muted: var(--rw-neutral-160);
    --rw-bg-hover: rgba(251, 249, 248, .08);
    --rw-bg-active: rgba(251, 249, 248, .16);
    --rw-bg-selected: var(--rw-brand-160);

    --rw-text-primary: var(--rw-neutral-10);
    --rw-text-secondary: rgba(251, 249, 248, .70);
    --rw-text-disabled: rgba(251, 249, 248, .40);
    --rw-text-brand: var(--rw-brand-70);
    --rw-text-danger: var(--rw-danger-70);
    --rw-text-warning: var(--rw-warning-60);
    --rw-text-success: var(--rw-success-60);

    --rw-divider: rgba(251, 249, 248, .14);
    --rw-border-enabled: rgba(251, 249, 248, .45);
    --rw-border-selected: var(--rw-brand-80);
    --rw-focus-ring: var(--rw-neutral-0);
    --rw-field-border-focus: var(--rw-brand-80);
    color-scheme: dark;
  }
}

/* The stamped states repeat the values so an explicit choice wins in both
   directions: a viewer on a light system who asks for dark gets it, and a
   clinical surface keeps it whatever the system says. */
:root[data-theme="dark"],
:root[data-theme="clinical"] {
  --rw-bg-app: var(--rw-neutral-190);
  --rw-bg-content: var(--rw-neutral-180);
  --rw-bg-subtle: var(--rw-neutral-170);
  --rw-bg-muted: var(--rw-neutral-160);
  --rw-bg-hover: rgba(251, 249, 248, .08);
  --rw-bg-active: rgba(251, 249, 248, .16);
  --rw-bg-selected: var(--rw-brand-160);

  --rw-text-primary: var(--rw-neutral-10);
  --rw-text-secondary: rgba(251, 249, 248, .70);
  --rw-text-disabled: rgba(251, 249, 248, .40);
  --rw-text-brand: var(--rw-brand-70);
  --rw-text-danger: var(--rw-danger-70);
  --rw-text-warning: var(--rw-warning-60);
  --rw-text-success: var(--rw-success-60);

  --rw-divider: rgba(251, 249, 248, .14);
  --rw-border-enabled: rgba(251, 249, 248, .45);
  --rw-border-selected: var(--rw-brand-80);
  --rw-focus-ring: var(--rw-neutral-0);
  --rw-field-border-focus: var(--rw-brand-80);
  color-scheme: dark;
}
