/*
 * APMly design tokens. Canonical source: packages/apmly-theme/tokens.css.
 * Each UI ships a copy made by scripts/apmly/sync-theme.sh; edit this file,
 * then run the script. See packages/apmly-theme/README.md for usage rules.
 *
 * Light is the default. theme-init.js stamps data-theme="light|dark" on
 * <html> from the saved choice or the OS preference before first paint.
 */
:root {
  color-scheme: light;

  /* Type */
  --apmly-font-sans:
    Geist, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --apmly-font-serif: Newsreader, 'Iowan Old Style', Georgia, serif;
  --apmly-font-mono:
    'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* Surfaces */
  --apmly-site: #fafafa;
  --apmly-surface: #ffffff;
  --apmly-surface-muted: #f5f5f5;
  --apmly-surface-sunken: #f0f0f0;
  --apmly-sidebar: #fafafa;
  --apmly-overlay: rgba(10, 10, 10, 0.32);
  --apmly-dots: rgba(10, 10, 10, 0.09);

  /* Ink */
  --apmly-ink: #0a0a0a;
  --apmly-ink-secondary: #404040;
  --apmly-ink-muted: #737373;
  --apmly-ink-subtle: #a3a3a3;

  /* Lines */
  --apmly-border: #e5e5e5;
  --apmly-border-strong: #d4d4d4;
  --apmly-ring: #a1a1a1;
  --apmly-focus-ring: 0 0 0 3px rgba(161, 161, 161, 0.35);

  /* Actions */
  --apmly-primary: #171717;
  --apmly-primary-hover: #2e2e2e;
  --apmly-primary-ink: #fafafa;

  /* Inverse band (dark CTA sections, code blocks on marketing pages) */
  --apmly-inverse: #0a0a0a;
  --apmly-inverse-surface: #171717;
  --apmly-inverse-ink: #fafafa;
  --apmly-inverse-muted: #a1a1a1;
  --apmly-inverse-border: rgba(255, 255, 255, 0.1);

  /* Status: the dot/fill color, a text-safe ink, and a soft background */
  --apmly-success: #0ca30c;
  --apmly-success-ink: #006300;
  --apmly-success-soft: #effaef;
  --apmly-warning: #fab219;
  --apmly-warning-ink: #8a5300;
  --apmly-warning-soft: #fff8e8;
  --apmly-danger: #d03b3b;
  --apmly-danger-ink: #b42323;
  --apmly-danger-soft: #fdf1f1;
  --apmly-info: #2a78d6;
  --apmly-info-ink: #1c5cab;
  --apmly-info-soft: #eff5fd;

  /* Elevation: a hairline ring plus a soft drop, never a heavy border */
  --apmly-shadow-surface:
    0 0 0 1px rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.06),
    0 2px 4px 0 rgba(0, 0, 0, 0.04);
  --apmly-shadow-surface-hover:
    0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08),
    0 2px 4px 0 rgba(0, 0, 0, 0.06);
  --apmly-shadow-raised:
    0 0 0 1px rgba(0, 0, 0, 0.06), 0 8px 24px -6px rgba(0, 0, 0, 0.12);
  --apmly-shadow-overlay:
    0 0 0 1px rgba(0, 0, 0, 0.06), 0 24px 64px -16px rgba(0, 0, 0, 0.2);

  /* Shape */
  --apmly-radius-xs: 6px;
  --apmly-radius-sm: 8px;
  --apmly-radius-md: 10px;
  --apmly-radius-lg: 12px;
  --apmly-radius-xl: 16px;
  --apmly-radius-2xl: 24px;
  --apmly-radius-pill: 999px;

  /* Motion */
  --apmly-ease: cubic-bezier(0.2, 0, 0, 1);
  --apmly-duration: 150ms;

  /* Charts. Categorical order validated (scripts/validate_palette.js) on
     #ffffff: worst adjacent CVD dE 9.1, normal-vision dE 19.6. Slots 3, 4
     and 5 are under 3:1 on white, so charts keep legends and a table view.
     Status colors are reserved for state and never used as a series. */
  --chart-s1: #2a78d6;
  --chart-s2: #eb6834;
  --chart-s3: #1baf7a;
  --chart-s4: #eda100;
  --chart-s5: #e87ba4;
  --chart-s6: #008300;
  --chart-s7: #4a3aa7;
  --chart-muted: #a3a3a3;
  --chart-good: #0ca30c;
  --chart-warn: #fab219;
  --chart-error: #d03b3b;
  --chart-p50: #86b6ef;
  --chart-p95: #3987e5;
  --chart-p99: #1c5cab;
  --chart-grid: #ededed;
  --chart-axis: #d4d4d4;
  --chart-label: #737373;
}

:root[data-theme='dark'] {
  color-scheme: dark;

  --apmly-site: #0a0a0a;
  --apmly-surface: #141414;
  --apmly-surface-muted: #1f1f1f;
  --apmly-surface-sunken: #191919;
  --apmly-sidebar: #0f0f0f;
  --apmly-overlay: rgba(0, 0, 0, 0.6);
  --apmly-dots: rgba(255, 255, 255, 0.08);

  --apmly-ink: #fafafa;
  --apmly-ink-secondary: #d4d4d4;
  --apmly-ink-muted: #a1a1a1;
  --apmly-ink-subtle: #737373;

  --apmly-border: #262626;
  --apmly-border-strong: #383838;
  --apmly-ring: #737373;
  --apmly-focus-ring: 0 0 0 3px rgba(161, 161, 161, 0.28);

  --apmly-primary: #ededed;
  --apmly-primary-hover: #d4d4d4;
  --apmly-primary-ink: #171717;

  --apmly-inverse: #fafafa;
  --apmly-inverse-surface: #f0f0f0;
  --apmly-inverse-ink: #0a0a0a;
  --apmly-inverse-muted: #525252;
  --apmly-inverse-border: rgba(0, 0, 0, 0.1);

  --apmly-success: #0ca30c;
  --apmly-success-ink: #4cd964;
  --apmly-success-soft: rgba(12, 163, 12, 0.12);
  --apmly-warning: #fab219;
  --apmly-warning-ink: #fab219;
  --apmly-warning-soft: rgba(250, 178, 25, 0.12);
  --apmly-danger: #e66767;
  --apmly-danger-ink: #f28b8b;
  --apmly-danger-soft: rgba(230, 103, 103, 0.12);
  --apmly-info: #3987e5;
  --apmly-info-ink: #86b6ef;
  --apmly-info-soft: rgba(57, 135, 229, 0.14);

  --apmly-shadow-surface:
    0 0 0 1px rgba(255, 255, 255, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --apmly-shadow-surface-hover:
    0 0 0 1px rgba(255, 255, 255, 0.12), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --apmly-shadow-raised:
    0 0 0 1px rgba(255, 255, 255, 0.1), 0 8px 24px -6px rgba(0, 0, 0, 0.6);
  --apmly-shadow-overlay:
    0 0 0 1px rgba(255, 255, 255, 0.1), 0 24px 64px -16px rgba(0, 0, 0, 0.7);

  /* Dark chart steps: same hues, validated on #141414 (all >= 3:1,
     worst adjacent CVD dE 8.4, normal-vision dE 19.3). */
  --chart-s1: #3987e5;
  --chart-s2: #d95926;
  --chart-s3: #199e70;
  --chart-s4: #c98500;
  --chart-s5: #d55181;
  --chart-s6: #008300;
  --chart-s7: #9085e9;
  --chart-muted: #6b6b6b;
  --chart-p50: #256abf;
  --chart-p95: #5598e7;
  --chart-p99: #9ec5f4;
  --chart-grid: #232323;
  --chart-axis: #383838;
  --chart-label: #a1a1a1;
}
