/* Палитры поверх светлой и тёмной темы шаблонов (№24–25, 1.54). Переопределяются только цвета;
   остальные переменные наследуются от data-theme. Контраст проверяет tests/theme_contrast.test.cjs. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

:root[data-theme="light"][data-palette="sepia"] {
    --bg: #f2ece1; --surface: #fbf8f2; --surface-2: #f2ece1; --surface-3: #e8dfcf;
    --border: #e2d8c6; --border-strong: #cbbda5;
    --text: #2b2620; --text-2: #4a4239; --muted: #675d4f; --muted-2: #8a7f6e;
    --accent: #8c4610; --accent-2: #6f370c; --on-accent: #ffffff; --danger: #a3271b;
    --badge-grey-bg: #ece4d6; --badge-grey-fg: #4a4239;
    --code-bg: #ece4d6; --pre-bg: #f6f1e8; --quote-bg: #f6f1e8;
    --dot-todo: #a89b86; --bar: #a0561a;
}
:root[data-theme="dark"][data-palette="midnight"] {
    --bg: #0a0f1d; --surface: #111a2e; --surface-2: #0d1425; --surface-3: #1a2540;
    --border: #22304d; --border-strong: #33466e;
    --text: #e6ebf5; --text-2: #c3cbdb; --muted: #95a1b8; --muted-2: #6f7b93;
    --accent: #7cb0ff; --accent-2: #a1c6ff; --on-accent: #0a0f1d; --danger: #ff8f86;
    --badge-grey-bg: #1a2540; --badge-grey-fg: #c3cbdb;
    --badge-amber-bg: #2e2a1a; --badge-red-bg: #3a1c22;
    --code-bg: #1a2540; --pre-bg: #0d1425; --quote-bg: #0f1830; --bar: #7cb0ff;
}
:root[data-theme="light"][data-palette="contrast"] {
    --bg: #ffffff; --surface: #ffffff; --surface-2: #f0f0f0; --surface-3: #e2e2e2;
    --border: #595959; --border-strong: #000000;
    --text: #000000; --text-2: #111111; --muted: #333333; --muted-2: #4d4d4d;
    --accent: #0030b8; --accent-2: #00208a; --on-accent: #ffffff; --danger: #8f0000;
    --badge-grey-bg: #e2e2e2; --badge-grey-fg: #000000;
    --badge-amber-bg: #fff0c2; --badge-amber-fg: #5c3800;
    --badge-red-bg: #ffe0e0; --badge-red-fg: #8f0000;
    --dot-todo: #333333; --dot-done: #006b24;
    --code-bg: #ececec; --pre-bg: #f5f5f5; --quote-bg: #f5f5f5; --bar: #0030b8;
}
:root[data-theme="dark"][data-palette="contrast"] {
    --bg: #000000; --surface: #000000; --surface-2: #121212; --surface-3: #1f1f1f;
    --border: #a6a6a6; --border-strong: #ffffff;
    --text: #ffffff; --text-2: #f2f2f2; --muted: #d6d6d6; --muted-2: #bdbdbd;
    --accent: #8cbcff; --accent-2: #b3d3ff; --on-accent: #000000; --danger: #ff9e94;
    --badge-grey-bg: #1f1f1f; --badge-grey-fg: #ffffff;
    --badge-amber-bg: #2a2000; --badge-amber-fg: #ffd66b;
    --badge-red-bg: #2a0000; --badge-red-fg: #ff9e94;
    --dot-todo: #d6d6d6; --dot-done: #5cf08f;
    --code-bg: #1f1f1f; --pre-bg: #121212; --quote-bg: #121212; --bar: #8cbcff;
}
/* В контрастных темах рамки карточек и полей заметнее */
:root[data-palette="contrast"] .task, :root[data-palette="contrast"] .row, :root[data-palette="contrast"] input,
:root[data-palette="contrast"] select, :root[data-palette="contrast"] textarea { border-color: var(--border-strong); }
:root[data-palette="contrast"] :is(.md, p, li, .hint) a { text-decoration: underline; }
:root[data-palette="contrast"] :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Цвет доски (№26): полоса над шапкой, точка у названия и в переключателе; яркость под схему */
:root[data-board-color] { --board-stripe: hsl(var(--board-hue) 62% 44%); }
:root[data-board-color][data-theme="dark"] { --board-stripe: hsl(var(--board-hue) 62% 64%); }
:root[data-board-color][data-palette="contrast"][data-theme="light"] { --board-stripe: hsl(var(--board-hue) 80% 32%); }
:root[data-board-color][data-palette="contrast"][data-theme="dark"] { --board-stripe: hsl(var(--board-hue) 85% 72%); }
:root[data-board-color] .header { box-shadow: inset 0 3px 0 var(--board-stripe); }
:root[data-board-color] #boardTitle::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--board-stripe); vertical-align: middle; }
.board-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; background: hsl(var(--dot-hue) 62% 44%); }
:root[data-theme="dark"] .board-dot { background: hsl(var(--dot-hue) 62% 64%); }
.color-field { border: 0; padding: 0; min-width: 0; }
.color-field legend { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.color-choices { display: flex; flex-wrap: wrap; gap: 10px; }
.color-choice { position: relative; display: inline-flex; cursor: pointer; }
.color-choice input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.color-choice span { display: block; width: 26px; height: 26px; border-radius: 50%; background: hsl(var(--hue) 62% 44%); border: 1px solid var(--border-strong); }
:root[data-theme="dark"] .color-choice span { background: hsl(var(--hue) 62% 64%); }
.color-choice.color-none span { background: linear-gradient(135deg, transparent 45%, var(--muted) 45%, var(--muted) 55%, transparent 55%), var(--surface); }
.color-choice input:checked + span { outline: 2px solid var(--text); outline-offset: 2px; }
.color-choice input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Компактные карточки (№28): номер, название и срок, меньше отступов; список задач не меняется */
:root[data-density="compact"] .tasks { gap: 6px; }
:root[data-density="compact"] .task { padding: 7px 10px; gap: 4px; }
:root[data-density="compact"] .task .task-checklist-bar { display: none; }
:root[data-density="compact"] .task .task-meta > :not(.deadline) { display: none; }
:root[data-density="compact"] .task .task-meta:not(:has(.deadline)) { display: none; }

/* Меньше анимации: выбор в меню темы или системная настройка */
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
