/*
 * Primitive tokens: the raw palette and scales. Only the token files
 * (primitives, semantic, themes) may reference these; components use
 * semantic tokens instead.
 */
@layer tokens {
  :root {
    --brand-hue: 51;      /* saddle brown, like old book leather */

    /*
     * The app's palette is two hand-picked ramps rather than one gray ramp
     * inverted for dark mode: cream paper, and brown ink. Each mode picks
     * its own steps from them (see semantic.css).
     */
    --paper-50:  oklch(98.2% 0.013 71);   /* page */
    --paper-200: oklch(93.2% 0.03  74);   /* text on ink */
    --paper-300: oklch(89%   0.02  72);   /* rules on paper */
    --paper-400: oklch(78.6% 0.064 75);   /* tan: quiet text on ink */
    --ink-400:   oklch(39.9% 0.045 46);   /* quiet text on paper, rules on ink */
    --ink-800:   oklch(23.4% 0.036 42);   /* text on paper, surfaces on ink */
    --ink-900:   oklch(19.7% 0.013 56);   /* the page at night */

    --brand-400: oklch(63.4% 0.155 var(--brand-hue));   /* chocolate */
    --brand-600: oklch(47.1% 0.112 var(--brand-hue));   /* saddle brown */

    --slate-500: oklch(59.3% 0.031 248);   /* the slate of a book's endpapers */

    --green-700: oklch(39.1% 0.095 135);   /* forest green */

    --red-400: oklch(74.4% 0.128 29);   /* soft coral */
    --red-600: oklch(40% 0.164 29);     /* dark red */

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;

    /*
     * Type scale: a modular scale, each step the ratio times the one below.
     * The app keeps the perfect fourth (1.333) its original design used, at
     * every width. Change the ratio to change every step. Body text stays
     * at 1rem so it always follows the user's font size.
     */
    --type-ratio: 1.333;
    --text-sm:   calc(1rem / var(--type-ratio));                /* step -1: 12px */
    --text-base: 1rem;                                          /* step 0 */
    --text-lg:   calc(1rem * var(--type-ratio));                /* step 1: 21.3px */
    --text-xl:   calc(1rem * pow(var(--type-ratio), 2));        /* step 2: 28.4px */
    --text-2xl:  calc(1rem * pow(var(--type-ratio), 3));        /* step 3: 37.9px */

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 999px;

    --shadow-sm: 0 1px 3px oklch(0% 0 0 / 0.12);
    --shadow-md: 0 4px 8px oklch(0% 0 0 / 0.12);
    --shadow-lg: 0 10px 24px oklch(0% 0 0 / 0.18);

    --duration-fast: 120ms;
    --duration-base: 200ms;
  }
}
