@layer reset, base, components, modules, utilities;

:root {
  /* Spacing */
  --block-space: 1rem;
  --block-space-quarter: calc(var(--block-space) / 4);
  --block-space-half: calc(var(--block-space) / 2);
  --block-space-3quarter: calc(var(--block-space) * 3 / 4);
  --block-space-1half: calc(var(--block-space) * 1.5);
  --block-space-double: calc(var(--block-space) * 2);

  /* Text */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";

  --text-x-small: 0.75rem;
  --text-small: clamp(0.8125rem, 0.25vw + 0.75rem, 0.9375rem);
  --text-normal: clamp(0.9375rem, 0.25vw + 0.875rem, 1.0625rem);
  --text-medium: clamp(1.0625rem, 0.25vw + 1rem, 1.1875rem);
  --text-large: clamp(1.1875rem, 0.25vw + 1.125rem, 1.3125rem);
  --text-x-large: clamp(1.3125rem, 0.25vw + 1.25rem, 1.4375rem);
  --text-xx-large: clamp(1.6875rem, 0.4vw + 1.5rem, 2rem);

  @media (max-width: 639px) {
    --text-small: clamp(0.875rem, 0.125vw + 0.84rem, 0.9375rem);
    --text-medium: clamp(1.125rem, 0.25vw + 1.0625rem, 1.1875rem);
  }

  --leading-tight: 1.1;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  --tracking-wide: 0.025em;
  --tracking-wider: 0.05em;

  /* Borders */
  --border: 1px solid var(--color-ink-light);
  --border-subtle: 1px solid var(--color-ink-lighter);
  --radius-full: 9999px;

  /* Components */
  --icon-size: 1rem;
  --icon-size-large: 1.25rem;
  --logo-size: 6rem;
  --logo-size-small: 4.5rem;

  /* Focus rings for keyboard navigation */
  --focus-ring-color: var(--color-ink-dark);
  --focus-ring-offset: 2px;
  --focus-ring-size: 2px;
  --focus-ring: var(--focus-ring-size) solid var(--focus-ring-color);

  /* Easing functions from https://easingwizard.com/ */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --main-width: 56rem;

  /* Z-index */
  --z-content: 10;
  --z-nav: 200;

  /* OKLCH colors: Fixed */
  --lch-black: 0% 0 0;
  --lch-white: 100% 0 0;

  /* OKLCH colors: Light mode */
  --lch-canvas: var(--lch-white);

  --lch-ink-darkest: 18% 0.04 260;
  --lch-ink-dark: 45% 0.01 274;
  --lch-ink-light: 93% 0.003 268;
  --lch-ink-lighter: 95% 0.003 268;
  --lch-ink-lightest: 97% 0.002 266;

  /* Blue (hue 260) is the Sako Labs identity */
  --lch-blue-dark: 35% 0.08 260;
  --lch-blue-medium: 43% 0.09 260;
  --lch-blue-lighter: 90% 0.04 260;
  --lch-blue-lightest: 96% 0.02 260;

  /* Colors: Named */
  --color-ink: oklch(var(--lch-ink-darkest));
  --color-ink-dark: oklch(var(--lch-ink-dark));
  --color-ink-light: oklch(var(--lch-ink-light));
  --color-ink-lighter: oklch(var(--lch-ink-lighter));
  --color-ink-lightest: oklch(var(--lch-ink-lightest));

  --color-blue-dark: oklch(var(--lch-blue-dark));
  --color-blue-medium: oklch(var(--lch-blue-medium));
  --color-blue-lighter: oklch(var(--lch-blue-lighter));
  --color-blue-lightest: oklch(var(--lch-blue-lightest));

  /* Colors: Abstractions */
  --color-canvas: oklch(var(--lch-canvas));
  --color-brand: var(--color-blue-dark);
  --color-selected: var(--color-blue-lighter);
}

/* Dark mode: only the --lch-* values change; every --color-* follows */
html[data-theme="dark"] {
  --lch-canvas: 15% 0.02 285;

  --lch-ink-darkest: 96% 0.01 260;
  --lch-ink-dark: 80% 0.009 260;
  --lch-ink-light: 26% 0.02 285;
  --lch-ink-lighter: 22% 0.02 285;
  --lch-ink-lightest: 18% 0.02 285;

  --lch-blue-dark: 65% 0.08 260;
  --lch-blue-medium: 55% 0.09 260;
  --lch-blue-lighter: 28% 0.04 260;
  --lch-blue-lightest: 22% 0.03 260;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --lch-canvas: 15% 0.02 285;

    --lch-ink-darkest: 96% 0.01 260;
    --lch-ink-dark: 80% 0.009 260;
    --lch-ink-light: 26% 0.02 285;
    --lch-ink-lighter: 22% 0.02 285;
    --lch-ink-lightest: 18% 0.02 285;

    --lch-blue-dark: 65% 0.08 260;
    --lch-blue-medium: 55% 0.09 260;
    --lch-blue-lighter: 28% 0.04 260;
    --lch-blue-lightest: 22% 0.03 260;
  }
}
