/* =========================
   Theme: every color of the front, in two sets of the same names, and the scales of the design.
   The light theme, a terminal on paper, is the default; the dark one, the slate of the logo,
   follows the system unless the visitor chose a theme: theme-init.js sets data-theme on <html>
   before the page is drawn. style.css, admin.css and shell.css use these tokens only. The
   contrast of each text on its background (4.5:1) and of the field borders and the focus ring
   (3:1) is checked in both themes by rs-gen-server/tests/web_front.rs (WCAG 2.2 AA).
========================= */
:root {
  color-scheme: light;

  /* Scales: text sizes, spaces, radii */
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --size-1: 13px;
  --size-2: 14px;
  --size-3: 16px;
  --size-4: 20px;
  --size-5: 28px;
  --size-6: 40px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius: 4px;
  --radius-pill: 999px;

  /* The reflections of a card as it moves, the same in both themes: the card is drawn the same in
     both, in the colors of its rarity (CARD_RARITIES and CARD_MYTHIC in word-common.js) */
  --card-shine-soft: rgb(240 244 248 / 70%);
  --card-shine-soft-edge: rgb(200 208 216 / 45%);
  --card-shine-silver: rgb(255 255 255 / 90%);
  --card-shine-silver-edge: rgb(214 224 236 / 75%);
  --card-shine-gold: rgb(255 236 179 / 95%);
  --card-shine-gold-edge: rgb(227 179 65 / 70%);
  --card-mythic-1: #f778ba;
  --card-mythic-2: #e3b341;
  --card-mythic-3: #3fb950;
  --card-mythic-4: #39c5cf;
  --card-mythic-5: #58a6ff;
  --card-mythic-6: #bc8cff;
  --rarity-common: #7d8590;
  --rarity-uncommon: #8a99a8;
  --rarity-rare: #b7860b;
  --rarity-mythic: #8957e5;

  /* Page and cards */
  --page: #f4efe4;
  --surface: #fffdf8;
  --text: #1f2328;
  --muted: #5b5f66;
  --card-border: #e2d9c6;
  /* A line of a list while it is pressed */
  --line-pressed: #f1eadb;
  --shadow: rgba(60, 40, 0, 0.08);
  --backdrop: rgba(0, 0, 0, 0.2);

  /* Terminal: dark in the dark theme, paper in the light one */
  --terminal: #fbf8f1;
  --terminal-text: #1f2328;
  --terminal-muted: #5b5f66;
  --terminal-user: #0d6b63;
  --terminal-path: #6d28d9;

  /* The trace of a word: a terminal raised over the page, its events */
  --terminal-raised: #efe8da;
  --terminal-border: #d6ccb8;
  --terminal-warning: #8a5a00;
  /* A mark in stars: gold, 4.6:1 on the terminal, never the amber of a trouble */
  --star: #a16207;
  --terminal-danger: #b42318;

  /* Buttons; the icon of a button that erases */
  --primary: #1f2328;
  --primary-hover: #000000;
  --on-primary: #fffdf8;
  --action: #1f2328;
  --action-hover: #353b44;
  --action-border: #1f2328;
  --on-action: #f4efe4;
  --on-action-off: color-mix(in srgb, var(--on-action) 45%, var(--action));
  --on-action-danger: #ff8a80;
  --on-action-accent: #8ab4ff;
  --danger: #b42318;
  --danger-hover: #912018;
  --on-danger: #ffffff;

  /* Fields and keyboard focus */
  --field-border: #8a8070;
  --focus: #1d4ed8;

  /* Status of a model */
  --success: #1a7f37;
  --busy: #8a5a00;

  /* Messages */
  --error-text: #b42318;
  --error-surface: #fdf0ee;
  --warning-text: #7a4d00;
  --warning-surface: #fbf1d9;
  --success-text: #067647;
  --success-surface: #e9f6ec;

  /* Tooltips */
  --tooltip: #1f2328;
  --on-tooltip: #fffdf8;

  /* The models of a word, read on --terminal-raised: the model with the largest share takes the first color */
  --model-1: #0a5bc4;
  --model-2: #a84300;
  --model-3: #17702f;
  --model-4: #7038c9;
  --model-5: #a8327a;
  --model-6: #176a70;
  --model-7: #785400;
  --model-8: #b51f2a;

  /* The ink of the logo: the current tab, the main command */
  --accent: #1d4ed8;
  --ink-1: #0f766e;
  --ink-2: #1d4ed8;
  --ink-3: #6d28d9;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  /* The reflections of a card as it moves, the same in both themes */
  --card-shine-soft: rgb(240 244 248 / 70%);
  --card-shine-soft-edge: rgb(200 208 216 / 45%);
  --card-shine-silver: rgb(255 255 255 / 90%);
  --card-shine-silver-edge: rgb(214 224 236 / 75%);
  --card-shine-gold: rgb(255 236 179 / 95%);
  --card-shine-gold-edge: rgb(227 179 65 / 70%);
  --card-mythic-1: #f778ba;
  --card-mythic-2: #e3b341;
  --card-mythic-3: #3fb950;
  --card-mythic-4: #39c5cf;
  --card-mythic-5: #58a6ff;
  --card-mythic-6: #bc8cff;
  --rarity-common: #7d8590;
  --rarity-uncommon: #c9d4e0;
  --rarity-rare: #e3b341;
  --rarity-mythic: #bc8cff;
  /* Page and cards */
  --page: #0b0e15;
  --surface: #11151f;
  --text: #e6edf3;
  --muted: #959ea8;
  --card-border: #2a3142;
  /* A line of a list while it is pressed */
  --line-pressed: #1b2130;
  --shadow: rgba(0, 0, 0, 0.4);
  --backdrop: rgba(0, 0, 0, 0.5);

  /* Terminal: dark in the dark theme, paper in the light one */
  --terminal: #07090e;
  --terminal-text: #e6edf3;
  --terminal-muted: #959ea8;
  --terminal-user: #2dd4bf;
  --terminal-path: #a78bfa;

  /* The trace of a word: a terminal raised over the page, its events */
  --terminal-raised: #1b2130;
  --terminal-border: #2a3142;
  --terminal-warning: #d29922;
  --star: #eab308;
  --terminal-danger: #f85149;

  /* Buttons; the icon of a button that erases */
  --primary: #e6edf3;
  --primary-hover: #ffffff;
  --on-primary: #0b0e15;
  --action: #1b2130;
  --action-hover: #252d40;
  --action-border: #3a4357;
  --on-action: #e6edf3;
  --on-action-off: color-mix(in srgb, var(--on-action) 45%, var(--action));
  --on-action-danger: #ff9b94;
  --on-action-accent: #60a5fa;
  --danger: #f85149;
  --danger-hover: #ff7b72;
  --on-danger: #0b0e15;

  /* Fields and keyboard focus */
  --field-border: #6e7681;
  --focus: #58a6ff;

  /* Status of a model */
  --success: #3fb950;
  --busy: #d29922;

  /* Messages */
  --error-text: #ff7b72;
  --error-surface: #2a1215;
  --warning-text: #e3b341;
  --warning-surface: #2a2112;
  --success-text: #56d364;
  --success-surface: #0f2418;

  /* Tooltips */
  --tooltip: #e6edf3;
  --on-tooltip: #0b0e15;

  /* The models of a word, read on --terminal-raised: the model with the largest share takes the first color */
  --model-1: #58a6ff;
  --model-2: #f0883e;
  --model-3: #3fb950;
  --model-4: #bc8cff;
  --model-5: #f778ba;
  --model-6: #39c5cf;
  --model-7: #e3b341;
  --model-8: #ffa198;

  /* The ink of the logo: the current tab, the main command */
  --accent: #60a5fa;
  --ink-1: #2dd4bf;
  --ink-2: #3b82f6;
  --ink-3: #8b5cf6;
}

/* The system asks for the dark theme, and the visitor chose none */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    /* The reflections of a card as it moves, the same in both themes */
    --card-shine-soft: rgb(240 244 248 / 70%);
    --card-shine-soft-edge: rgb(200 208 216 / 45%);
    --card-shine-silver: rgb(255 255 255 / 90%);
    --card-shine-silver-edge: rgb(214 224 236 / 75%);
    --card-shine-gold: rgb(255 236 179 / 95%);
    --card-shine-gold-edge: rgb(227 179 65 / 70%);
    --card-mythic-1: #f778ba;
    --card-mythic-2: #e3b341;
    --card-mythic-3: #3fb950;
    --card-mythic-4: #39c5cf;
    --card-mythic-5: #58a6ff;
    --card-mythic-6: #bc8cff;
    --rarity-common: #7d8590;
    --rarity-uncommon: #c9d4e0;
    --rarity-rare: #e3b341;
    --rarity-mythic: #bc8cff;
    /* Page and cards */
    --page: #0b0e15;
    --surface: #11151f;
    --text: #e6edf3;
    --muted: #959ea8;
    --card-border: #2a3142;
    /* A line of a list while it is pressed */
    --line-pressed: #1b2130;
    --shadow: rgba(0, 0, 0, 0.4);
    --backdrop: rgba(0, 0, 0, 0.5);

    /* Terminal: dark in the dark theme, paper in the light one */
    --terminal: #07090e;
    --terminal-text: #e6edf3;
    --terminal-muted: #959ea8;
    --terminal-user: #2dd4bf;
    --terminal-path: #a78bfa;

    /* The trace of a word: a terminal raised over the page, its events */
    --terminal-raised: #1b2130;
    --terminal-border: #2a3142;
    --terminal-warning: #d29922;
    --star: #eab308;
    --terminal-danger: #f85149;

    /* Buttons; the icon of a button that erases */
    --primary: #e6edf3;
    --primary-hover: #ffffff;
    --on-primary: #0b0e15;
    --action: #1b2130;
    --action-hover: #252d40;
    --action-border: #3a4357;
    --on-action: #e6edf3;
    --on-action-off: color-mix(in srgb, var(--on-action) 45%, var(--action));
    --on-action-danger: #ff9b94;
    --on-action-accent: #60a5fa;
    --danger: #f85149;
    --danger-hover: #ff7b72;
    --on-danger: #0b0e15;

    /* Fields and keyboard focus */
    --field-border: #6e7681;
    --focus: #58a6ff;

    /* Status of a model */
    --success: #3fb950;
    --busy: #d29922;

    /* Messages */
    --error-text: #ff7b72;
    --error-surface: #2a1215;
    --warning-text: #e3b341;
    --warning-surface: #2a2112;
    --success-text: #56d364;
    --success-surface: #0f2418;

    /* Tooltips */
    --tooltip: #e6edf3;
    --on-tooltip: #0b0e15;

    /* The models of a word, read on --terminal-raised: the model with the largest share takes the first color */
    --model-1: #58a6ff;
    --model-2: #f0883e;
    --model-3: #3fb950;
    --model-4: #bc8cff;
    --model-5: #f778ba;
    --model-6: #39c5cf;
    --model-7: #e3b341;
    --model-8: #ffa198;

    /* The ink of the logo: the current tab, the main command */
    --accent: #60a5fa;
    --ink-1: #2dd4bf;
    --ink-2: #3b82f6;
    --ink-3: #8b5cf6;
  }
}
