/*
 * Bodylet AI: light scheme
 *
 * The color and elevation tokens of tokens.css, with their values on a light
 * page. Same names: components need no change. Link it after tokens.css:
 *
 *   <link rel="stylesheet" href="tokens/tokens.css">
 *   <link rel="stylesheet" href="tokens/light.css">
 *
 * Linked, the page follows the system setting (prefers-color-scheme). An
 * attribute on <html> forces one scheme: data-bl-theme="light" or "dark"
 * (css/theme.css is the control for it). Without this file a page stays dark.
 *
 * The two blocks below hold the same values: one applies when the system asks
 * for light, the other when the page forces it. Change both together.
 *
 * Windows, terminals, code blocks and the live session window take the light
 * scheme too: a near-white window on the tinted page, a white body under the title
 * bar, dark text, and a syntax palette drawn for white (the bright lime is
 * 1.2:1 on white, so prompts, strings and success take the deep lime). The
 * three dots of a title bar keep their colors. Only the remote screen inside
 * a window keeps the dark scheme (see tokens.css).
 *
 * Contrast (WCAG 2.1), on the page #f4f6f2 and on a card #ffffff:
 *   text 16.8 / 18.3, body 9.1 / 9.9, captions 5.5 / 6.0 (4.8 on the
 *   strongest fill), accent text 5.9 / 6.4, warning 6.0 / 6.5, danger
 *   6.0 / 6.5, human 6.0 / 6.6, ink on the accent fill 15.5, field edge
 *   3.4 on a card, focus ring 5.9.
 *
 * In a window, on its white body #ffffff (and on its frame and title bar
 * #f8faf6, --bl-window-bg):
 *   text 18.3 / 17.4, output 9.9 / 9.5, dim lines and punctuation
 *   6.0 / 5.7, prompt, success, strings and keys 6.4 / 6.1, typed command
 *   8.8, numbers 6.6 / 6.2, document keys 6.8, flags and warnings 6.5,
 *   errors 6.5 / 6.2, comments 5.3, a selected tab in the title bar 5.4
 *   (deep lime on its wash), a line marked missing: text 16.6, punctuation
 *   5.5 on the amber wash.
 */

@media (prefers-color-scheme: light) {
  :root:not([data-bl-theme="dark"]) {
    color-scheme: light;

    --bl-bg: #f4f6f2;
    --bl-bg-raised: #f9faf7;
    --bl-surface-1: #ffffff;
    --bl-surface-2: #fbfcfa;
    --bl-surface-3: #eef2ec;
    --bl-surface-4: #e2e8e0;

    --bl-border: rgba(22, 40, 18, 0.1);
    --bl-border-strong: rgba(22, 40, 18, 0.17);
    --bl-border-focus: rgba(59, 107, 15, 0.55);
    --bl-border-input: #848f84;
    --bl-border-input-hover: #5a665a;

    --bl-text: #0e170d;
    --bl-text-2: #3a463a;
    --bl-text-3: #5a665a;
    --bl-text-faint: #97a197;
    --bl-text-on-accent: #0b1206;

    --bl-accent: #3b6b0f;
    --bl-accent-hover: #2d540a;
    --bl-accent-fill: #c6f87a;
    --bl-accent-fill-hover: #b0f04f;
    --bl-accent-fill-shadow: inset 0 0 0 1px rgba(59, 107, 15, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    --bl-accent-wash-1: rgba(111, 174, 34, 0.07);
    --bl-accent-wash-2: rgba(111, 174, 34, 0.13);
    --bl-accent-wash-3: rgba(111, 174, 34, 0.2);
    --bl-accent-line: rgba(79, 125, 27, 0.32);
    --bl-accent-line-strong: rgba(79, 125, 27, 0.6);

    --bl-ok: #3b6b0f;
    --bl-warn: #875200;
    --bl-warn-wash: rgba(246, 196, 83, 0.2);
    --bl-warn-line: rgba(176, 116, 0, 0.38);
    --bl-danger: #b3261e;
    --bl-danger-strong-hover: #ff7a6b;
    --bl-danger-wash: rgba(179, 38, 30, 0.07);
    --bl-danger-line: rgba(179, 38, 30, 0.3);
    --bl-agent: #3b6b0f;
    --bl-human: #1d5dab;
    --bl-human-wash: rgba(29, 93, 171, 0.07);
    --bl-human-line: rgba(29, 93, 171, 0.3);

    --bl-window-bg: #f8faf6;
    --bl-code-bg: #ffffff;
    --bl-syn-prompt: #3b6b0f;
    --bl-syn-cmd: #2d540a;
    --bl-syn-arg: #3b6b0f;
    --bl-syn-key: #3b6b0f;
    --bl-syn-string: #0e170d;
    --bl-syn-number: #1d5dab;
    --bl-syn-name: #6a3fc1;
    --bl-syn-comment: #646f64;
    --bl-syn-punct: #5a665a;
    --bl-syn-flag: #875200;

    --bl-highlight: 0 1px 2px rgba(22, 40, 18, 0.05);
    --bl-shadow-1: 0 1px 2px rgba(22, 40, 18, 0.08);
    --bl-shadow-2: 0 12px 28px -14px rgba(22, 40, 18, 0.24), 0 2px 6px rgba(22, 40, 18, 0.06);
    --bl-shadow-3: 0 32px 80px -24px rgba(22, 40, 18, 0.3), 0 12px 28px -12px rgba(22, 40, 18, 0.14);
    --bl-glow-sm: 0 0 0 1px rgba(79, 125, 27, 0.25), 0 0 18px -2px rgba(111, 174, 34, 0.3);
    --bl-glow-md: 0 0 0 1px rgba(79, 125, 27, 0.3), 0 0 40px -6px rgba(111, 174, 34, 0.35);
    --bl-glow-lg: 0 0 0 1px rgba(79, 125, 27, 0.3), 0 0 100px -10px rgba(111, 174, 34, 0.4);
    --bl-inset: inset 0 1px 2px rgba(22, 40, 18, 0.06);
    --bl-scrim: rgba(14, 23, 13, 0.42);
  }
}

:root[data-bl-theme="light"] {
  color-scheme: light;

  --bl-bg: #f4f6f2;
  --bl-bg-raised: #f9faf7;
  --bl-surface-1: #ffffff;
  --bl-surface-2: #fbfcfa;
  --bl-surface-3: #eef2ec;
  --bl-surface-4: #e2e8e0;

  --bl-border: rgba(22, 40, 18, 0.1);
  --bl-border-strong: rgba(22, 40, 18, 0.17);
  --bl-border-focus: rgba(59, 107, 15, 0.55);
  --bl-border-input: #848f84;
  --bl-border-input-hover: #5a665a;

  --bl-text: #0e170d;
  --bl-text-2: #3a463a;
  --bl-text-3: #5a665a;
  --bl-text-faint: #97a197;
  --bl-text-on-accent: #0b1206;

  --bl-accent: #3b6b0f;
  --bl-accent-hover: #2d540a;
  --bl-accent-fill: #c6f87a;
  --bl-accent-fill-hover: #b0f04f;
  --bl-accent-fill-shadow: inset 0 0 0 1px rgba(59, 107, 15, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  --bl-accent-wash-1: rgba(111, 174, 34, 0.07);
  --bl-accent-wash-2: rgba(111, 174, 34, 0.13);
  --bl-accent-wash-3: rgba(111, 174, 34, 0.2);
  --bl-accent-line: rgba(79, 125, 27, 0.32);
  --bl-accent-line-strong: rgba(79, 125, 27, 0.6);

  --bl-ok: #3b6b0f;
  --bl-warn: #875200;
  --bl-warn-wash: rgba(246, 196, 83, 0.2);
  --bl-warn-line: rgba(176, 116, 0, 0.38);
  --bl-danger: #b3261e;
  --bl-danger-strong-hover: #ff7a6b;
  --bl-danger-wash: rgba(179, 38, 30, 0.07);
  --bl-danger-line: rgba(179, 38, 30, 0.3);
  --bl-agent: #3b6b0f;
  --bl-human: #1d5dab;
  --bl-human-wash: rgba(29, 93, 171, 0.07);
  --bl-human-line: rgba(29, 93, 171, 0.3);

  --bl-window-bg: #f8faf6;
  --bl-code-bg: #ffffff;
  --bl-syn-prompt: #3b6b0f;
  --bl-syn-cmd: #2d540a;
  --bl-syn-arg: #3b6b0f;
  --bl-syn-key: #3b6b0f;
  --bl-syn-string: #0e170d;
  --bl-syn-number: #1d5dab;
  --bl-syn-name: #6a3fc1;
  --bl-syn-comment: #646f64;
  --bl-syn-punct: #5a665a;
  --bl-syn-flag: #875200;

  --bl-highlight: 0 1px 2px rgba(22, 40, 18, 0.05);
  --bl-shadow-1: 0 1px 2px rgba(22, 40, 18, 0.08);
  --bl-shadow-2: 0 12px 28px -14px rgba(22, 40, 18, 0.24), 0 2px 6px rgba(22, 40, 18, 0.06);
  --bl-shadow-3: 0 32px 80px -24px rgba(22, 40, 18, 0.3), 0 12px 28px -12px rgba(22, 40, 18, 0.14);
  --bl-glow-sm: 0 0 0 1px rgba(79, 125, 27, 0.25), 0 0 18px -2px rgba(111, 174, 34, 0.3);
  --bl-glow-md: 0 0 0 1px rgba(79, 125, 27, 0.3), 0 0 40px -6px rgba(111, 174, 34, 0.35);
  --bl-glow-lg: 0 0 0 1px rgba(79, 125, 27, 0.3), 0 0 100px -10px rgba(111, 174, 34, 0.4);
  --bl-inset: inset 0 1px 2px rgba(22, 40, 18, 0.06);
  --bl-scrim: rgba(14, 23, 13, 0.42);
}

/*
 * Pictures drawn for one scheme, such as the logo: give the dark version
 * .bl-on-dark and the light version .bl-on-light, side by side. The one that
 * does not match the scheme in force is not displayed. Without this file
 * nothing hides them: a dark page shows only .bl-on-dark pictures.
 */

@media (prefers-color-scheme: light) {
  :root:not([data-bl-theme="dark"]) .bl-on-dark {
    display: none;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-bl-theme="light"]) .bl-on-light {
    display: none;
  }
}

:root[data-bl-theme="light"] .bl-on-dark,
:root[data-bl-theme="dark"] .bl-on-light {
  display: none;
}
