/*
 * Дизайн-токены и темы. Тема задаётся атрибутом data-theme — на <html> для всего сайта
 * или на любом элементе (так карточки выбора темы показывают настоящие цвета).
 */

:root {
  --font-display: "Unbounded", "Onest", system-ui, sans-serif;
  --font-body: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --text-xs: 0.72rem;
  --text-sm: 0.84rem;
  --text-md: 1rem;
  --text-lg: 1.18rem;
  --text-xl: clamp(1.35rem, 1.1rem + 1.1vw, 1.75rem);
  --text-hero: clamp(1.5rem, 1rem + 2.6vw, 2.6rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --gutter: clamp(1rem, 0.4rem + 2.4vw, 2rem);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  --rail-width: 264px;
  --tabbar-height: 64px;
  --content-max: 1280px;

  --duration-fast: 140ms;
  --duration: 280ms;
  --duration-slow: 800ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  /* Шанс прохождения карты: от «вызов» до «почти точно» */
  --chance-0: #f87171;
  --chance-1: #fb923c;
  --chance-2: #facc15;
  --chance-3: #a3e635;
  --chance-4: #4ade80;
}

:root,
[data-theme="blue"] {
  color-scheme: dark;
  --bg: #0f172a;
  --bg-deep: #0b1120;
  --surface: #1e293b;
  --surface-2: #243449;
  --surface-3: #2c3f58;
  --line: rgb(255 255 255 / 8%);
  --line-strong: rgb(255 255 255 / 16%);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-ink: #06202f;
  --danger: #f87171;
  --good: #4ade80;
  --warn: #facc15;
  --shadow: 0 18px 50px -24px rgb(0 0 0 / 70%);
}

[data-theme="black"] {
  color-scheme: dark;
  --bg: #09090b;
  --bg-deep: #000000;
  --surface: #18181b;
  --surface-2: #232327;
  --surface-3: #2e2e33;
  --line: rgb(255 255 255 / 9%);
  --line-strong: rgb(255 255 255 / 18%);
  --text: #fafafa;
  --muted: #a1a1aa;
  --accent: #fafafa;
  --accent-ink: #09090b;
  --danger: #f87171;
  --good: #4ade80;
  --warn: #facc15;
  --shadow: 0 18px 50px -24px rgb(0 0 0 / 90%);
}

[data-theme="crimson"] {
  color-scheme: dark;
  --bg: #1a090d;
  --bg-deep: #120609;
  --surface: #2a0e14;
  --surface-2: #3a141c;
  --surface-3: #4a1a24;
  --line: rgb(255 255 255 / 8%);
  --line-strong: rgb(255 255 255 / 16%);
  --text: #fde8ec;
  --muted: #c69aa4;
  --accent: #fb7185;
  --accent-ink: #2a0e14;
  --danger: #fda4af;
  --good: #4ade80;
  --warn: #facc15;
  --shadow: 0 18px 50px -24px rgb(0 0 0 / 75%);
}

[data-theme="forest"] {
  color-scheme: dark;
  --bg: #0b1512;
  --bg-deep: #070f0c;
  --surface: #13221c;
  --surface-2: #1b3027;
  --surface-3: #244034;
  --line: rgb(255 255 255 / 8%);
  --line-strong: rgb(255 255 255 / 16%);
  --text: #e3f2ea;
  --muted: #8faa9c;
  --accent: #5edfa0;
  --accent-ink: #062014;
  --danger: #f87171;
  --good: #5edfa0;
  --warn: #facc15;
  --shadow: 0 18px 50px -24px rgb(0 0 0 / 75%);
}

[data-theme="violet"] {
  color-scheme: dark;
  --bg: #120f1f;
  --bg-deep: #0b0915;
  --surface: #1d1830;
  --surface-2: #292242;
  --surface-3: #352c55;
  --line: rgb(255 255 255 / 8%);
  --line-strong: rgb(255 255 255 / 16%);
  --text: #ece8fb;
  --muted: #a39bc4;
  --accent: #a78bfa;
  --accent-ink: #160f2e;
  --danger: #f87171;
  --good: #4ade80;
  --warn: #facc15;
  --shadow: 0 18px 50px -24px rgb(0 0 0 / 75%);
}

[data-theme="amber"] {
  color-scheme: dark;
  --bg: #17110a;
  --bg-deep: #0f0b06;
  --surface: #241a0f;
  --surface-2: #332516;
  --surface-3: #42301d;
  --line: rgb(255 255 255 / 8%);
  --line-strong: rgb(255 255 255 / 16%);
  --text: #f7ebda;
  --muted: #b8a283;
  --accent: #fbbf24;
  --accent-ink: #261a04;
  --danger: #f87171;
  --good: #4ade80;
  --warn: #fbbf24;
  --shadow: 0 18px 50px -24px rgb(0 0 0 / 75%);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f1f5f9;
  --bg-deep: #e7edf4;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --surface-3: #e2e8f0;
  --line: rgb(15 23 42 / 10%);
  --line-strong: rgb(15 23 42 / 20%);
  --text: #0f172a;
  --muted: #5b6b82;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --good: #15803d;
  --warn: #a16207;
  --shadow: 0 18px 40px -26px rgb(15 23 42 / 35%);
  --chance-0: #dc2626;
  --chance-1: #ea580c;
  --chance-2: #b45309;
  --chance-3: #4d7c0f;
  --chance-4: #15803d;
}

[data-theme="paper"] {
  color-scheme: light;
  --bg: #f6f1e7;
  --bg-deep: #ece4d5;
  --surface: #fffdf8;
  --surface-2: #f1eadc;
  --surface-3: #e5dccb;
  --line: rgb(42 33 24 / 11%);
  --line-strong: rgb(42 33 24 / 22%);
  --text: #2a2118;
  --muted: #76685a;
  --accent: #b45309;
  --accent-ink: #fffdf8;
  --danger: #b91c1c;
  --good: #15803d;
  --warn: #a16207;
  --shadow: 0 18px 40px -26px rgb(42 33 24 / 35%);
  --chance-0: #dc2626;
  --chance-1: #ea580c;
  --chance-2: #b45309;
  --chance-3: #4d7c0f;
  --chance-4: #15803d;
}

/* Производные цвета считаются от акцента темы */
:root,
[data-theme] {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 38%, transparent);
  --glow: color-mix(in srgb, var(--accent) 30%, transparent);
}
