/* The site's complete screen palette. Add roles here, not one-off component colors.
   Three families share the same roles. Swatches use these exact theme definitions.
   Page/sheet separate the reading surface; muted text, rules, and error feedback
   have different jobs. Buttons, ornaments, success, and focus reuse existing inks. */
:root {
  --radius: 8px;
  --radius-track: 999px;
  --paper-page: #f5f0e6;
  --paper-sheet: #fffcf5;
  --paper-ink: #29394a;
  --paper-muted: #68645d;
  --paper-line: #dcd3c6;
  --paper-accent: #87563e;
  --paper-accent-soft: #efe2d5;
  --light-error: #9a474b;
  --light-error-soft: #fae9e6;

  --rose-page: #f1ebed;
  --rose-sheet: #fcf8f6;
  --rose-ink: #493444;
  --rose-muted: #695e67;
  --rose-line: #ddcfd4;
  --rose-accent: #834f65;
  --rose-accent-soft: #ead9e1;

  --night-page: #202839;
  --night-sheet: #293246;
  --night-ink: #eee9e1;
  --night-muted: #bbb7c2;
  --night-line: #475064;
  --night-accent: #dec1d2;
  --night-accent-soft: #493b51;
  --night-error: #f2b9ad;
  --night-error-soft: #563b43;

  --shade: #000;
  --overlay: color-mix(in srgb, var(--shade) 38%, transparent);
  --shadow-color: color-mix(in srgb, var(--shade) 13%, transparent);
  --shadow-deep: color-mix(in srgb, var(--shade) 20%, transparent);
  --shadow-sheet: color-mix(in srgb, var(--shade) 3%, transparent);
  --shadow: 0 10px 36px var(--shadow-sheet);
}

:root, [data-theme=paper], .theme-swatch.paper {
  color-scheme: light;
  --page: var(--paper-page);
  --sheet: var(--paper-sheet);
  --ink: var(--paper-ink);
  --muted: var(--paper-muted);
  --line: var(--paper-line);
  --accent: var(--paper-accent);
  --accent-soft: var(--paper-accent-soft);
  --error: var(--light-error);
  --error-soft: var(--light-error-soft);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath d='m5 6 3 3 3-3' stroke='%2368645d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme=rose], .theme-swatch.rose {
  color-scheme: light;
  --page: var(--rose-page);
  --sheet: var(--rose-sheet);
  --ink: var(--rose-ink);
  --muted: var(--rose-muted);
  --line: var(--rose-line);
  --accent: var(--rose-accent);
  --accent-soft: var(--rose-accent-soft);
  --error: var(--light-error);
  --error-soft: var(--light-error-soft);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath d='m5 6 3 3 3-3' stroke='%23695e67' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
[data-theme=night], .theme-swatch.night {
  color-scheme: dark;
  --page: var(--night-page);
  --sheet: var(--night-sheet);
  --ink: var(--night-ink);
  --muted: var(--night-muted);
  --line: var(--night-line);
  --accent: var(--night-accent);
  --accent-soft: var(--night-accent-soft);
  --error: var(--night-error);
  --error-soft: var(--night-error-soft);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' viewBox='0 0 16 16'%3E%3Cpath d='m5 6 3 3 3-3' stroke='%23bbb7c2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Semantic aliases keep state colors coherent without adding near-duplicate hues. */
:root, [data-theme], .theme-swatch {
  --button: var(--ink);
  --button-text: var(--sheet);
  --control-line: color-mix(in srgb, var(--ink) 65%, var(--sheet));
  --button-hover: var(--accent);
  --correct: var(--ink);
  --focus: var(--accent);
  --ornament: var(--accent);
  --surface-hover: var(--accent-soft);
  --rule-soft: var(--line);
  --rule-strong: color-mix(in srgb, var(--ink) 40%, var(--page));
}

/* Native browser printing also stays legible when the reader chose Evening. */
@media print {
  :root {
    color-scheme: light;
    --page: white;
    --sheet: white;
    --ink: black;
    --muted: black;
    --line: black;
    --accent: black;
    --accent-soft: white;
    --error: black;
    --error-soft: white;
    --button: black;
    --button-text: white;
    --button-hover: black;
    --control-line: black;
    --correct: black;
    --focus: black;
    --ornament: black;
  }
}
