/* @carbonid1/tailwind-config/dashboard
 *
 * Dashboard theme — for data-dense UIs (CoI Calculator, admin panels,
 * production-chain visualizers). Visual register: neutral-cool surfaces
 * with subtle elevation (high-information UIs benefit from low-noise
 * chrome that lets data take focus).
 *
 * Same elevation contract as reader.css — see that file for the full table.
 * Surfaces here are neutral (chroma 0 in light, ~hue 260 in dark) instead
 * of warm paper, but the layering rules (background < card; surface-inset
 * recessed into card; popover floats with shadow) are identical.
 *
 * Consumer responsibilities:
 *   - Optionally import tw-animate-css for animate utilities.
 *   - Toggle dark mode by adding the `dark` class to a root ancestor.
 */

@import 'tailwindcss';

/* Scan design-system components so consumers pick up classes used inside
 * Button/Kbd/etc. — Tailwind v4 skips node_modules by default. Point at the
 * shipped `dist/` (the only source that lands in installed `node_modules`),
 * not `src/` which isn't in the published `files`. */
@source '../dist/**/*.js';

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-overlay: var(--overlay);
  --color-surface-inset: var(--surface-inset);
  --shadow-card: var(--card-shadow);
  --shadow-popover: var(--popover-shadow);
  --inset-shadow-surface: var(--surface-inset-shadow);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary-hover: var(--primary-hover);
  --color-primary-muted: var(--primary-muted);
  --color-primary-border: var(--primary-border);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-highlight: var(--highlight);
  --color-highlight-foreground: var(--highlight-foreground);
  --color-highlight-muted: var(--highlight-muted);
  --color-attention: var(--attention);
  --color-attention-foreground: var(--attention-foreground);
  --color-attention-muted: var(--attention-muted);
  --color-attention-border: var(--attention-border);
  --color-success: var(--success);
  --color-success-foreground: var(--success-foreground);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-input-border: var(--input-border);
  --color-ring: var(--ring);
  /* Font families. Override a role by setting its `--font-*-custom` variable;
   * each falls back to a system stack. */
  --font-sans: var(
    --font-sans-custom,
    ui-sans-serif,
    system-ui,
    sans-serif,
    'Apple Color Emoji',
    'Segoe UI Emoji',
    'Segoe UI Symbol',
    'Noto Color Emoji'
  );
  --font-serif: var(
    --font-serif-custom,
    ui-serif,
    Georgia,
    Cambria,
    'Times New Roman',
    Times,
    serif
  );
  --font-mono: var(
    --font-mono-custom,
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    'Liberation Mono',
    'Courier New',
    monospace
  );
  --radius: 0.625rem;
  --animate-buffer-pulse: buffer-pulse 3s ease-in-out infinite;
  --animate-ring-spin: ring-spin 5s linear infinite;
  --animate-ring-drift: ring-spin 24s linear infinite;
}

/* Light mode tokens */
:root {
  --background: oklch(1 0 0);
  --foreground: oklch(0.145 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  /* Modal scrim behind dialogs. A neutral black dim, not a palette surface, so it reads the same
   * in reader and dashboard; heavier in dark mode to still separate the popup from an already-dark page. */
  --overlay: oklch(0 0 0 / 0.6);
  --surface-inset: oklch(0.965 0 0);
  --card-shadow: 0 1px 2px 0 oklch(0.2 0 0 / 0.06);
  --popover-shadow: 0 8px 24px -4px oklch(0.2 0 0 / 0.1), 0 4px 8px -2px oklch(0.2 0 0 / 0.06);
  --surface-inset-shadow: inset 0 1px 1px 0 oklch(0.2 0 0 / 0.04);
  --primary: oklch(0.546 0.245 262.881);
  --primary-foreground: oklch(1 0 0);
  /* Hover darkens the fill. An opacity modifier would lighten it toward the page and drop
   * the label under 4.5:1. */
  --primary-hover: oklch(0.488 0.243 264.376);
  --primary-muted: oklch(0.97 0.014 254);
  --primary-border: oklch(0.882 0.059 254);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  /* Clears 4.5:1 on every light surface, including surface-inset and muted fills. */
  --muted-foreground: oklch(0.53 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.58 0.22 27);
  /* Text shade of the destructive role, for error copy and labels on destructive tints.
   * `--destructive` tints darken with it, so it cannot carry text on them. */
  --destructive-foreground: oklch(0.46 0.17 27);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  /* Resting boundary for form controls (Button outline, inputs) — distinct from
   * decorative --border and the --input fill. Dark enough to clear WCAG 1.4.11
   * (3:1) against the surfaces controls sit on; the contrast test guards it. */
  --input-border: oklch(0.62 0 0);
  /* Neutral focus ring (border-ring + ring-ring/50 halo). Dark enough that the
   * solid border clears WCAG 1.4.11 (3:1 non-text) against the lightest surface
   * — the themes contrast test guards this floor. */
  --ring: oklch(0.6 0 0);
  --highlight: oklch(0.901 0.082 85.84);
  --highlight-foreground: oklch(0.344 0.06 58.6);
  --highlight-muted: oklch(0.962 0.042 95.28);
  --attention: oklch(0.769 0.188 70.08);
  --attention-foreground: oklch(0.473 0.137 46.2);
  --attention-muted: oklch(0.987 0.022 95.28);
  --attention-border: oklch(0.913 0.076 95.97);
  --success: oklch(0.62 0.19 149);
  --success-foreground: oklch(0.42 0.12 149);
}

/* Dark mode tokens */
.dark {
  --background: oklch(0.21 0.032 265);
  --foreground: oklch(0.967 0.003 265);
  --card: oklch(0.278 0.03 257);
  --card-foreground: oklch(0.967 0.003 265);
  --popover: oklch(0.278 0.03 257);
  --popover-foreground: oklch(0.967 0.003 265);
  --overlay: oklch(0 0 0 / 0.7);
  --surface-inset: oklch(0.225 0.028 261);
  --card-shadow: 0 1px 2px 0 oklch(0 0 0 / 0.2);
  --popover-shadow: 0 12px 32px -4px oklch(0 0 0 / 0.4), 0 4px 8px -2px oklch(0 0 0 / 0.2);
  /* Transparent, not `none`, so it doesn't wipe out a focus ring. See reader.css. */
  --surface-inset-shadow: 0 0 #0000;
  --primary: oklch(0.78 0.13 256);
  /* Dark primary is a light blue, so its label is dark: white text on it reads at ~2:1.
   * The contrast test holds the label to 4.5:1 on the fill. */
  --primary-foreground: oklch(0.21 0.032 265);
  --primary-hover: oklch(0.73 0.13 256);
  --primary-muted: oklch(0.282 0.091 267 / 0.2);
  --primary-border: oklch(0.393 0.155 264);
  --secondary: oklch(0.373 0.031 260);
  --secondary-foreground: oklch(0.967 0.003 265);
  --muted: oklch(0.373 0.031 260);
  --muted-foreground: oklch(0.714 0.019 261);
  --accent: oklch(0.446 0.026 257);
  --accent-foreground: oklch(0.967 0.003 265);
  --destructive: oklch(0.704 0.191 22.216);
  --destructive-foreground: oklch(0.82 0.1 22);
  --border: oklch(0.373 0.031 260 / 50%);
  --input: oklch(0.373 0.031 260 / 60%);
  --input-border: oklch(0.58 0.025 262);
  --ring: oklch(0.551 0.023 264);
  --highlight: oklch(0.55 0.07 268);
  --highlight-foreground: oklch(0.95 0.02 265);
  --highlight-muted: oklch(0.3 0.04 265);
  --attention: oklch(0.82 0.19 84);
  --attention-foreground: oklch(0.913 0.076 95.97);
  --attention-muted: oklch(0.414 0.112 45.9 / 0.2);
  --attention-border: oklch(0.555 0.163 49);
  --success: oklch(0.62 0.19 149);
  --success-foreground: oklch(0.82 0.1 149);
}

/* Global focus-visible ring for raw interactive elements. Primitives (Button,
 * etc.) override this with their own tuned focus styling. */
@layer base {
  button:focus-visible,
  [role='button']:focus-visible,
  a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 0.375rem;
  }
}

/* Keyframes referenced by the theme's --animate-* tokens */
@keyframes ring-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes buffer-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}
