/*
 * Semantic status classes and motion rules.
 *
 * `src/ui/status-color.js` decides which of these a value gets; this file is only the
 * appearance. Keeping the decision in JS (and unit-tested) means the meaning of a colour
 * is asserted, not just styled.
 *
 * Motion budget: 100–150ms, transform/opacity/colour only, and nothing on the order path
 * ever waits for an animation to finish.
 */

:root {
  --dur-fast: 100ms;
  --dur-normal: 150ms;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --transition-color: color var(--dur-fast) var(--ease-out),
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out);
}

.is-profit,
.is-buy {
  color: var(--green);
}

.is-loss,
.is-sell {
  color: var(--orange);
}

.is-flat {
  color: var(--ink-muted);
}

.is-warn {
  color: var(--orange-300);
}

.is-danger {
  color: var(--orange-hot);
}

/* Filled variants, for buttons and badges rather than numbers. */
.bg-profit,
.bg-buy {
  background: var(--green);
  color: var(--ink-inverse);
}

.bg-loss,
.bg-sell {
  background: var(--orange);
  color: var(--ink-inverse);
}

.bg-danger {
  background: var(--orange-hot);
  color: var(--ink-inverse);
}

/* Interactive elements transition colour only — never size or position. */
button,
a,
.interactive {
  transition: var(--transition-color);
}

button:focus-visible,
a:focus-visible,
.interactive:focus-visible {
  outline: var(--border-2) solid var(--green);
  outline-offset: 2px;
}

/*
 * Reduced motion: the desk keeps updating at full speed, it just stops animating. The
 * numbers are the information; the movement is only emphasis.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/*
 * Theme crossfade. Only surface and text colours transition — a 150ms fade on the whole
 * page would drag the price cells with it, and a price that fades between values is a
 * price you cannot read at speed.
 */
html,
body,
.app-header,
.app-footer,
.block,
.block__bar {
  transition:
    background-color var(--dur-normal) var(--ease-out),
    border-color var(--dur-normal) var(--ease-out),
    color var(--dur-normal) var(--ease-out);
}

/* Numbers never fade: they must be legible in every frame of the switch. */
.price,
.pnl,
.tnum,
.num {
  transition: none;
}

/*
 * Toast severities. Only warn and error take a colour: a stack where every toast is
 * coloured is one where colour has stopped carrying the severity it was added for.
 */
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-2, 0.5rem);
  cursor: pointer;
}

.toast--warn {
  border-color: var(--orange);
}

.toast--error {
  border-color: var(--orange);
  box-shadow: 0 0 8px color-mix(in srgb, var(--orange) 40%, transparent);
}

.toast--success {
  border-color: var(--green);
}

.toast__count {
  margin-left: auto;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* A paused toast says so, so the trader knows why it has not gone. */
.toast.is-paused {
  border-style: dashed;
}

/* A silenced desk says so in the header. Orange rather than hidden: the one thing worse
   than a noisy desk is a quiet one nobody meant to silence. */
.icon-btn.is-silenced {
  color: var(--orange);
}

/*
 * The playback badge.
 *
 * Orange and always in the header, never inside the block being replayed: a warning that
 * only shows where you are already looking is a warning for somebody who did not need it.
 */
.badge--playback {
  padding-inline: var(--sp-1);
  border: 1px solid var(--orange);
  border-radius: var(--radius-1);
  color: var(--orange);
  font-weight: 700;
  letter-spacing: 0.12em;
}
