/* Layer order for every stylesheet. Each file wraps itself in one of these. */
@layer reset, base, components, utilities;

:root {
  /* Spacing */
  --inline-space: 1ch;
  --inline-space-half: 0.5ch;
  --inline-space-double: 2ch;
  --block-space: 1rem;
  --block-space-half: 0.5rem;
  --block-space-double: 2rem;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-x-small: 0.75rem;
  --text-small: 0.875rem;
  --text-normal: 1rem;
  --text-large: 1.25rem;
  --text-x-large: 1.75rem;
  --text-xx-large: 2.5rem;

  /* Shape */
  --radius: 0.5rem;
  --radius-large: 0.75rem;
  --header-height: 3.5rem;
  --content-width: 64rem;
  --shadow: 0 1px 2px oklch(0% 0 0 / 0.08), 0 4px 16px oklch(0% 0 0 / 0.06);

  /* Raw OKLCH colors (lightness chroma hue). Dark mode only redefines these. */
  --lch-canvas: 98% 0.006 85;
  --lch-surface: 100% 0 0;
  --lch-ink: 24% 0.02 250;
  --lch-ink-subtle: 50% 0.02 250;
  --lch-border: 90% 0.01 85;
  --lch-accent: 55% 0.13 155;   /* terrapin green */
  --lch-highlight: 72% 0.15 60; /* warm orange for headings */
  --lch-alert: 58% 0.19 27;

  /* Semantic colors */
  --color-canvas: oklch(var(--lch-canvas));
  --color-surface: oklch(var(--lch-surface));
  --color-ink: oklch(var(--lch-ink));
  --color-ink-subtle: oklch(var(--lch-ink-subtle));
  --color-border: oklch(var(--lch-border));
  --color-accent: oklch(var(--lch-accent));
  --color-highlight: oklch(var(--lch-highlight));
  --color-alert: oklch(var(--lch-alert));
  --color-hover: oklch(var(--lch-ink) / 0.06);

  @media (max-width: 639px) {
    --text-x-large: 1.5rem;
    --text-xx-large: 1.875rem;
  }
}

/* Dark: chosen explicitly, or following the system when no choice is stored. */
html[data-theme="dark"] {
  --lch-canvas: 18% 0.02 250;
  --lch-surface: 23% 0.02 250;
  --lch-ink: 93% 0.01 250;
  --lch-ink-subtle: 70% 0.02 250;
  --lch-border: 32% 0.02 250;
  --lch-accent: 70% 0.13 155;
  --lch-highlight: 78% 0.12 55;
  --lch-alert: 70% 0.16 27;
  color-scheme: dark;
}

html[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --lch-canvas: 18% 0.02 250;
    --lch-surface: 23% 0.02 250;
    --lch-ink: 93% 0.01 250;
    --lch-ink-subtle: 70% 0.02 250;
    --lch-border: 32% 0.02 250;
    --lch-accent: 70% 0.13 155;
    --lch-highlight: 78% 0.12 55;
    --lch-alert: 70% 0.16 27;
  }
}
