/*
 * DonpiNotify design tokens.
 * The single source of truth for color, space, type, radius, shadow, motion.
 * Components NEVER hardcode a hex value. They read these variables.
 * Palette: Terracotta & Clay. Light on :root, dark on [data-theme="dark"],
 * with a prefers-color-scheme fallback so first paint matches the OS.
 */

:root {
  /* Type families */
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Type scale */
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --lh-tight: 1.2;
  --lh-body: 1.6;

  /* Spacing scale (4pt rhythm) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-full: 999px;

  /* Motion */
  --t-fast: 120ms;
  --t: 200ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Layout */
  --container: 60rem;
  --z-bar: 40;
  --z-toast: 1000;

  /* ---- Light theme (default) ---- */
  --bg: #faf4ec;
  --surface: #f3e9db;
  --surface-2: #ece0cf;
  --text: #2e2a26;
  --text-muted: #6b5f52;
  --border: #e2d4c2;
  --border-strong: #d4c0a6;

  --primary: #b85c38;        /* brand accent: dots, active, borders */
  --primary-strong: #a34e2e; /* button base, AA with on-primary */
  --primary-stronger: #8f4226;
  --on-primary: #fff8f2;
  --accent: #d98e5a;
  --primary-tint: rgba(184, 92, 56, 0.1);
  --ring: rgba(184, 92, 56, 0.45);

  --success: #6e7a4f;
  --success-text: #54603a;
  --success-tint: rgba(110, 122, 79, 0.16);
  --danger: #b23a2e;
  --danger-text: #9a2f25;
  --danger-tint: rgba(178, 58, 46, 0.12);
  --neutral-text: #8a5a33;
  --neutral-tint: rgba(184, 92, 56, 0.12);

  --shadow-sm: 0 1px 2px rgba(74, 47, 30, 0.06), 0 1px 3px rgba(74, 47, 30, 0.08);
  --shadow-md: 0 4px 14px rgba(74, 47, 30, 0.1);
  --shadow-lg: 0 12px 32px rgba(74, 47, 30, 0.16);

  color-scheme: light;
}

/* Dark via OS preference, only until an explicit choice is stored */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1b18;
    --surface: #2a2420;
    --surface-2: #332b25;
    --text: #ede3d6;
    --text-muted: #b6a593;
    --border: #3c332c;
    --border-strong: #4a3f36;

    --primary: #d9774a;
    --primary-strong: #d9774a;
    --primary-stronger: #e2895e;
    --on-primary: #211a16;
    --accent: #c98a5e;
    --primary-tint: rgba(217, 119, 74, 0.16);
    --ring: rgba(217, 119, 74, 0.5);

    --success: #9daa77;
    --success-text: #b9c58f;
    --success-tint: rgba(157, 170, 119, 0.16);
    --danger: #e07a6b;
    --danger-text: #f0a99d;
    --danger-tint: rgba(224, 122, 107, 0.16);
    --neutral-text: #e0b48c;
    --neutral-tint: rgba(217, 119, 74, 0.16);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.34);
    --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

/* Dark via explicit toggle */
:root[data-theme="dark"] {
  --bg: #1f1b18;
  --surface: #2a2420;
  --surface-2: #332b25;
  --text: #ede3d6;
  --text-muted: #b6a593;
  --border: #3c332c;
  --border-strong: #4a3f36;

  --primary: #d9774a;
  --primary-strong: #d9774a;
  --primary-stronger: #e2895e;
  --on-primary: #211a16;
  --accent: #c98a5e;
  --primary-tint: rgba(217, 119, 74, 0.16);
  --ring: rgba(217, 119, 74, 0.5);

  --success: #9daa77;
  --success-text: #b9c58f;
  --success-tint: rgba(157, 170, 119, 0.16);
  --danger: #e07a6b;
  --danger-text: #f0a99d;
  --danger-tint: rgba(224, 122, 107, 0.16);
  --neutral-text: #e0b48c;
  --neutral-tint: rgba(217, 119, 74, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px rgba(0, 0, 0, 0.34);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}
