/* doot design tokens (see docs/design-system.md).
   Light is the base; dark applies when the system is dark, unless the user forces
   light with <html data-theme="light">. data-theme="dark" forces dark.
   Every text/background pair used by the components passes WCAG AA (4.5:1). */
:root {
  color-scheme: light;

  /* surfaces */
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #ece9e1;
  --line: #e2dfd6;
  --track: #a29f94;
  --scrim: rgb(14 18 17 / 0.45);

  /* text */
  --text: #16201e;
  --dim: #556360;

  /* brand + states */
  --accent: #0f766e;
  --on-accent: #ffffff;
  --accent-soft: #d9f3ee;
  --mine: #cdf5ee;
  --on-mine: #0b2b27;
  --mine-dim: #2f5f58;
  --theirs: #ffffff;
  --on-danger: #ffffff;
  --on-attention: #ffffff;
  --danger: #b91c1c;
  --danger-soft: #fde8e8;
  --attention: #92400e;
  --attention-soft: #fdf0d3;
  --ok: #0f766e;

  /* elevation */
  --shadow-1: 0 1px 2px rgb(22 32 30 / 0.08);
  --shadow-2: 0 8px 28px rgb(22 32 30 / 0.16), 0 1px 3px rgb(22 32 30 / 0.1);

  /* type */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;
  --fs-3xl: 2.25rem;
  --lh-tight: 1.2;
  --lh: 1.45;

  /* space: 4px grid */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 48px;
  --s-10: 64px;

  /* shape */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-full: 999px;

  /* motion */
  --dur-fast: 120ms;
  --dur: 200ms;
  --dur-slow: 320ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* layout */
  --tap: 44px;
  --topbar-h: 56px;
  --tabbar-h: 56px;
  --rail-w: 68px;
  --list-w: 340px;
  --thread-max: 720px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  /* z-index scale */
  --z-bar: 10;
  --z-pop: 30;
  --z-scrim: 40;
  --z-sheet: 50;
  --z-toast: 60;

  /* avatars: white initials on these hues stay above 5:1 */
  --av-s: 45%;
  --av-l: 32%;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1211;
    --surface: #161b1a;
    --surface-2: #1e2524;
    --line: #2a3231;
    --track: #55615f;
    --scrim: rgb(0 0 0 / 0.6);
    --text: #ecf0ef;
    --dim: #97a3a0;
    --accent: #2dd4bf;
    --on-accent: #04201c;
    --accent-soft: #123a35;
    --mine: #0f4f48;
    --on-mine: #e8fffb;
    --mine-dim: #a9d8d1;
    --theirs: #1e2524;
    --on-danger: #2a0a0a;
    --on-attention: #231a02;
    --danger: #f87171;
    --danger-soft: #3b1a1a;
    --attention: #fbbf24;
    --attention-soft: #3a2d0c;
    --ok: #2dd4bf;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 10px 30px rgb(0 0 0 / 0.55), 0 0 0 1px rgb(255 255 255 / 0.04);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1211;
  --surface: #161b1a;
  --surface-2: #1e2524;
  --line: #2a3231;
  --track: #55615f;
  --scrim: rgb(0 0 0 / 0.6);
  --text: #ecf0ef;
  --dim: #97a3a0;
  --accent: #2dd4bf;
  --on-accent: #04201c;
  --accent-soft: #123a35;
  --mine: #0f4f48;
  --on-mine: #e8fffb;
  --mine-dim: #a9d8d1;
  --theirs: #1e2524;
  --on-danger: #2a0a0a;
  --on-attention: #231a02;
  --danger: #f87171;
  --danger-soft: #3b1a1a;
  --attention: #fbbf24;
  --attention-soft: #3a2d0c;
  --ok: #2dd4bf;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 10px 30px rgb(0 0 0 / 0.55), 0 0 0 1px rgb(255 255 255 / 0.04);
}
