/**
 * Lbayk shared UI tokens (--lb-ui-*). Hand-written; lbayk-tokens.css stays the
 * generated brand source and is only read from here, never edited.
 * Light values live in :root. Dark values are in theme-preference.css under
 * html[data-theme="dark"]. Contrast (checked): text-muted 6.2:1 on surface,
 * every status -fg on its -bg >= 5.0:1, line-strong >= 3:1 on surface.
 * Usage notes: see the Lbayk UI layer usage doc (lbayk-ui.css header).
 */
:root {
  /* Space: 4px grid. */
  --lb-ui-space-1: 0.25rem;
  --lb-ui-space-2: 0.5rem;
  --lb-ui-space-3: 0.75rem;
  --lb-ui-space-4: 1rem;
  --lb-ui-space-5: 1.25rem;
  --lb-ui-space-6: 1.5rem;
  --lb-ui-space-7: 2rem;
  --lb-ui-space-8: 2.5rem;
  --lb-ui-space-9: 3rem;
  --lb-ui-gutter: 1rem;
  --lb-ui-page-max: 72rem;

  /* Shape. */
  --lb-ui-radius-sm: 8px;
  --lb-ui-radius-control: 12px;
  --lb-ui-radius-card: 20px;
  --lb-ui-radius-pill: 999px;

  /* Size. */
  --lb-ui-target: 44px;
  --lb-ui-control-h: 48px;

  /* Type: nothing below 13px. */
  --lb-ui-text-xs: 0.8125rem;
  --lb-ui-text-sm: 0.875rem;
  --lb-ui-text-md: 1rem;
  --lb-ui-text-lg: 1.125rem;
  --lb-ui-text-xl: 1.375rem;
  --lb-ui-text-2xl: clamp(1.625rem, 1.3rem + 1.4vw, 2.125rem);
  --lb-ui-weight-medium: 500;
  --lb-ui-weight-strong: 700;
  --lb-ui-leading-tight: 1.3;
  --lb-ui-leading-body: 1.6;

  /* Motion and layers. */
  --lb-ui-dur: 160ms;
  --lb-ui-ease: cubic-bezier(0.2, 0, 0, 1);
  /* Above the floating accessibility / chat buttons (z-index 90) and the old modal. */
  --lb-ui-z-toast: 100010;

  /* Brand colour roles (follow the generated --lbayk-* values, incl. dark overrides). */
  --lb-ui-ink: var(--lbayk-ink);
  --lb-ui-text: var(--lbayk-ink);
  --lb-ui-text-muted: var(--lbayk-muted);
  --lb-ui-canvas: var(--lbayk-canvas);
  --lb-ui-surface: #fff;
  --lb-ui-surface-raised: #f4f7f7;
  --lb-ui-line: #dce5e8;
  --lb-ui-line-strong: #6d7c84;
  --lb-ui-accent: var(--lbayk-primary);
  --lb-ui-accent-hover: var(--lbayk-primary-dark);
  --lb-ui-accent-contrast: #fff;
  --lb-ui-accent-soft: #e7f2f0;
  --lb-ui-coral: var(--lbayk-coral);
  --lb-ui-accent-text: var(--lbayk-primary-dark);
  --lb-ui-danger-solid: var(--lbayk-error);
  --lb-ui-danger-solid-fg: #fff;
  --lb-ui-danger-solid-hover: #912018;
  --lb-ui-focus: var(--lbayk-focus);
  --lb-ui-focus-halo: rgb(23 92 211 / 0.25);
  --lb-ui-edge-shadow: rgb(22 43 58 / 0.18);

  /* Elevation. */
  --lb-ui-shadow-1: 0 1px 2px rgb(22 43 58 / 0.06), 0 1px 3px rgb(22 43 58 / 0.08);
  --lb-ui-shadow-2: 0 4px 10px rgb(22 43 58 / 0.08), 0 2px 4px rgb(22 43 58 / 0.06);
  --lb-ui-shadow-3: 0 12px 32px rgb(22 43 58 / 0.18), 0 2px 6px rgb(22 43 58 / 0.1);

  /* Status roles. Static values first, derived from --lbayk-* where color-mix exists. */
  --lb-ui-success-fg: var(--lbayk-success);
  --lb-ui-success-bg: #e8f1ed;
  --lb-ui-success-line: #9cc9b3;
  --lb-ui-warning-fg: var(--lbayk-warning);
  --lb-ui-warning-bg: #f3ede6;
  --lb-ui-warning-line: #dcb98f;
  --lb-ui-error-fg: var(--lbayk-error);
  --lb-ui-error-bg: #f8e9e8;
  --lb-ui-error-line: #e4a49e;
  --lb-ui-info-fg: var(--lbayk-pending);
  --lb-ui-info-bg: #e8effb;
  --lb-ui-info-line: #a5bff0;
  --lb-ui-neutral-fg: var(--lbayk-muted);
  --lb-ui-neutral-bg: #eeeff0;
  --lb-ui-neutral-line: #c5ccd0;
}

@supports (color: color-mix(in srgb, red 10%, white)) {
  :root {
    --lb-ui-success-bg: color-mix(in srgb, var(--lb-ui-success-fg) 10%, var(--lb-ui-surface));
    --lb-ui-success-line: color-mix(in srgb, var(--lb-ui-success-fg) 40%, var(--lb-ui-surface));
    --lb-ui-warning-bg: color-mix(in srgb, var(--lb-ui-warning-fg) 10%, var(--lb-ui-surface));
    --lb-ui-warning-line: color-mix(in srgb, var(--lb-ui-warning-fg) 40%, var(--lb-ui-surface));
    --lb-ui-error-bg: color-mix(in srgb, var(--lb-ui-error-fg) 10%, var(--lb-ui-surface));
    --lb-ui-error-line: color-mix(in srgb, var(--lb-ui-error-fg) 40%, var(--lb-ui-surface));
    --lb-ui-info-bg: color-mix(in srgb, var(--lb-ui-info-fg) 10%, var(--lb-ui-surface));
    --lb-ui-info-line: color-mix(in srgb, var(--lb-ui-info-fg) 40%, var(--lb-ui-surface));
    --lb-ui-neutral-bg: color-mix(in srgb, var(--lb-ui-neutral-fg) 10%, var(--lb-ui-surface));
    --lb-ui-neutral-line: color-mix(in srgb, var(--lb-ui-neutral-fg) 40%, var(--lb-ui-surface));
    --lb-ui-accent-soft: color-mix(in srgb, var(--lb-ui-accent) 10%, var(--lb-ui-surface));
  }
}

@media (min-width: 48em) {
  :root { --lb-ui-gutter: 1.5rem; }
}

/* F22: the legacy --so-stone hint grey (#9B9689, 2.8:1) is reused for table
   headers, hints and meta text across the theme. One AA value fixes all of
   them (6.8:1 on white, 6.4:1 on #F8F9FA). Dark mode re-declares it. */
:root { --so-stone: #5f5b52; }
