/* ============================================================
   pleaple · design tokens
   Moss palette (brand) layered under the semantic --color-* API.
   Generic scale tokens (space / radius / shadow / motion / z /
   components) are kept stable so app.css needs no changes.
   ============================================================ */


/* --- Moss brand palette ------------------------------------- */
:root {
  --pl-ink:   #0f0f12;
  --pl-bone:  #f4f1ea;
  --pl-paper: #faf8f3;

  --pl-moss-on-dark:           oklch(0.70 0.10 150);
  --pl-moss-on-light:          oklch(0.48 0.09 150);
  --pl-moss-on-dark-fallback:  #6aa178;
  --pl-moss-on-light-fallback: #3f6d4f;

  --pl-moss-soft-dark:  oklch(0.70 0.10 150 / 0.25);
  --pl-moss-soft-light: oklch(0.48 0.09 150 / 0.20);

  --pl-faint-on-light: rgba(15, 15, 18, 0.10);
  --pl-faint-on-dark:  rgba(244, 241, 234, 0.10);
  --pl-mute-on-light:  rgba(15, 15, 18, 0.55);
  --pl-mute-on-dark:   rgba(244, 241, 234, 0.55);

  --pl-font-display:   'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --pl-font-editorial: 'Newsreader', Georgia, serif;
  --pl-font-mono:      'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --pl-tracking-display: -0.035em;
  --pl-tracking-mono:     0.22em;
}

/* Lightmode (default) */
:root {
  --pl-bg:          var(--pl-bone);
  --pl-fg:          var(--pl-ink);
  --pl-surface:     var(--pl-paper);
  --pl-accent:      var(--pl-moss-on-light);
  --pl-accent-soft: var(--pl-moss-soft-light);
  --pl-faint:       var(--pl-faint-on-light);
  --pl-mute:        var(--pl-mute-on-light);
}

/* Darkmode — driven exclusively by the explicit data-theme attribute.
   app.js handles OS-preference fallback at init, then removes the
   attribute for light. Relying on @media (prefers-color-scheme) here
   would override the user's explicit "light" choice on dark-OS. */
[data-theme="dark"], :root[data-theme="dark"] {
  --pl-bg:          var(--pl-ink);
  --pl-fg:          var(--pl-bone);
  --pl-surface:     color-mix(in oklch, var(--pl-ink) 88%, var(--pl-bone));
  --pl-accent:      var(--pl-moss-on-dark);
  --pl-accent-soft: var(--pl-moss-soft-dark);
  --pl-faint:       var(--pl-faint-on-dark);
  --pl-mute:        var(--pl-mute-on-dark);
}


/* --- Generic scale tokens (unchanged from prior system) ----- */
:root {
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 1.75rem;
  --space-8: 2rem;
  --space-9: 2.25rem;
  --space-10: 2.5rem;
  --space-11: 2.75rem;
  --space-12: 3rem;
  --space-14: 3.5rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-28: 7rem;
  --space-32: 8rem;
  --space-0-5: 0.125rem;
  --space-1-5: 0.375rem;
  --space-2-5: 0.625rem;
  --space-3-5: 0.875rem;

  --radius-none: 0;
  --radius-sm:   0.125rem;
  --radius-md:   0.375rem;
  --radius-lg:   0.5rem;
  --radius-xl:   0.75rem;
  --radius-2xl:  1rem;
  --radius-3xl:  1.5rem;
  --radius-full: 9999px;

  --shadow-none: none;
  --shadow-sm:   0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md:   0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.10);
  --shadow-lg:   0 10px 15px -3px rgb(0 0 0 / 0.10), 0 4px 6px -4px rgb(0 0 0 / 0.10);
  --shadow-xl:   0 20px 25px -5px rgb(0 0 0 / 0.10), 0 8px 10px -6px rgb(0 0 0 / 0.10);

  --motion-duration-instant: 0ms;
  --motion-duration-fast:    150ms;
  --motion-duration-default: 200ms;
  --motion-duration-slow:    300ms;
  --motion-duration-slower:  500ms;
  --motion-easing-linear:    cubic-bezier(0, 0, 1, 1);
  --motion-easing-out:       cubic-bezier(0, 0, 0.2, 1);
  --motion-easing-in:        cubic-bezier(0.4, 0, 1, 1);
  --motion-easing-in-out:    cubic-bezier(0.4, 0, 0.2, 1);
  --motion-easing-spring:    cubic-bezier(0.5, 1.5, 0.5, 1);

  --z-base:     0;
  --z-dropdown: 10;
  --z-sticky:   20;
  --z-overlay:  30;
  --z-modal:    40;
  --z-popover:  50;
  --z-tooltip:  60;
  --z-toast:    70;

  --font-weight-normal:   400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  --font-size-xs:   0.75rem;
  --font-size-sm:   0.875rem;
  --font-size-base: 1rem;
  --font-size-lg:   1.125rem;
  --font-size-xl:   1.25rem;
  --font-size-2xl:  1.5rem;
  --font-size-3xl:  1.875rem;
  --font-size-4xl:  2.25rem;
  --font-size-5xl:  3rem;
  --font-size-6xl:  3.75rem;
}


/* --- Semantic --color-* aliases → moss tokens --------------- */
/* Lets the existing 1,400-line app.css stay on its semantic API
   while the brand shifts. Everything theme-aware because the
   moss --pl-* tokens already switch on data-theme. */
:root {
  --color-background:            var(--pl-bg);
  --color-foreground:            var(--pl-fg);
  --color-card:                  var(--pl-surface);
  --color-card-foreground:       var(--pl-fg);
  --color-popover:               var(--pl-surface);
  --color-popover-foreground:    var(--pl-fg);

  --color-primary:               var(--pl-accent);
  --color-primary-foreground:    var(--pl-bg);
  --color-secondary:             var(--pl-faint);
  --color-secondary-foreground:  var(--pl-fg);
  --color-muted:                 var(--pl-faint);
  --color-muted-foreground:      var(--pl-mute);
  --color-accent:                var(--pl-accent-soft);
  --color-accent-foreground:     var(--pl-fg);

  --color-destructive:           oklch(0.55 0.18 25);
  --color-destructive-foreground:var(--pl-bg);

  --color-border:                var(--pl-faint);
  --color-input:                 var(--pl-faint);
  --color-ring:                  var(--pl-accent);
}


/* --- Reduced-motion safety ---------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-duration-fast:    0ms;
    --motion-duration-default: 0ms;
    --motion-duration-slow:    0ms;
    --motion-easing-out:       cubic-bezier(0, 0, 1, 1);
    --motion-easing-in:        cubic-bezier(0, 0, 1, 1);
    --motion-easing-in-out:    cubic-bezier(0, 0, 1, 1);
  }
}
