/* Design tokens + base reset — Compute palette: parchment + ink + electric blue */
:root,
[data-theme='light'] {
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.4rem + 2.5vw, 3.25rem);
  --text-3xl: clamp(2.5rem, 1.4rem + 4vw, 4.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Compute palette: parchment + deep ink + electric cobalt */
  --color-bg: #f6f4ee;
  --color-surface: #fbfaf4;
  --color-surface-2: #ffffff;
  --color-surface-offset: #ece8db;
  --color-divider: #ddd6c2;
  --color-border: #ccc4ab;

  --color-text: #15161a;
  --color-text-muted: #5b5d66;
  --color-text-faint: #989aa3;
  --color-text-inverse: #f6f4ee;

  --color-primary: #1f4ed8;        /* cobalt blue */
  --color-primary-hover: #1a3fb0;
  --color-primary-active: #143087;
  --color-primary-highlight: #d8e0f5;

  /* Chart series colors */
  --color-compute: #1f4ed8;        /* compute / blue */
  --color-energy: #c9582b;         /* industrial / terracotta */
  --color-cost: #15803d;           /* falling cost / green */
  --color-warn: #b8860b;           /* projection / amber */

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  --shadow-sm: 0 1px 2px oklch(0.2 0.02 250 / 0.08);
  --shadow-md: 0 6px 18px oklch(0.2 0.02 250 / 0.08);
  --shadow-lg: 0 18px 40px oklch(0.2 0.02 250 / 0.12);

  --content-narrow: 640px;
  --content-default: 980px;
  --content-wide: 1240px;

  --font-display: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

[data-theme='dark'] {
  --color-bg: #0c0e14;
  --color-surface: #131620;
  --color-surface-2: #1a1d28;
  --color-surface-offset: #181b25;
  --color-divider: #232734;
  --color-border: #353a4a;

  --color-text: #e6e7ea;
  --color-text-muted: #8a8d99;
  --color-text-faint: #565a66;
  --color-text-inverse: #0c0e14;

  --color-primary: #6c8eff;
  --color-primary-hover: #8da6ff;
  --color-primary-active: #a8bcff;
  --color-primary-highlight: #1c2745;

  --color-compute: #6c8eff;
  --color-energy: #e08157;
  --color-cost: #4ade80;
  --color-warn: #e8b134;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-md: 0 6px 20px oklch(0 0 0 / 0.4);
  --shadow-lg: 0 18px 40px oklch(0 0 0 / 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg: #0c0e14;
    --color-surface: #131620;
    --color-surface-2: #1a1d28;
    --color-surface-offset: #181b25;
    --color-divider: #232734;
    --color-border: #353a4a;
    --color-text: #e6e7ea;
    --color-text-muted: #8a8d99;
    --color-text-faint: #565a66;
    --color-primary: #6c8eff;
    --color-primary-highlight: #1c2745;
    --color-compute: #6c8eff;
    --color-energy: #e08157;
    --color-cost: #4ade80;
    --color-warn: #e8b134;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}
body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}
img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
input, button, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.1; font-family: var(--font-display); font-weight: 400; }
p { text-wrap: pretty; max-width: 68ch; }
button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }
::selection { background: var(--color-primary-highlight); color: var(--color-text); }
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
a, button, [role='button'], input {
  transition: color var(--transition-interactive), background var(--transition-interactive),
    border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}
