/*
 * Design tokens.
 *
 * Colors, type and spacing follow the look of a reference encyclopedia:
 * white page, gray rules, blue links, serif headings over a system sans body.
 * Every token is a custom property named --fb-* on :root.
 *
 * Themes
 *   Light is the default. Dark is a deep navy blue.
 *   Dark applies when the device asks for it, unless the page sets
 *   <html data-theme="light">. <html data-theme="dark"> forces dark.
 *   The two dark blocks below must stay identical. The site build checks this.
 *
 * No url() values. Pages that load these files run under a Content-Security-Policy
 * that allows no data: URIs and no third-party hosts.
 */

:root {
  color-scheme: light;

  /* Type */
  --fb-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Lato, Helvetica, Arial, sans-serif;
  --fb-font-serif: "Linux Libertine", Georgia, "Times New Roman", Times, serif;
  --fb-font-mono: Menlo, Consolas, "Liberation Mono", monospace;

  --fb-text-xs: 0.75rem;
  --fb-text-sm: 0.875rem;
  --fb-text-md: 1rem;
  --fb-text-lg: 1.2rem;
  --fb-text-xl: 1.5rem;
  --fb-text-2xl: 1.8rem;
  --fb-text-control: 1rem;

  --fb-leading: 1.6;
  --fb-leading-tight: 1.375;

  /* Space */
  --fb-space-25: 0.25rem;
  --fb-space-50: 0.5rem;
  --fb-space-75: 0.75rem;
  --fb-space-100: 1rem;
  --fb-space-150: 1.5rem;
  --fb-space-200: 2rem;
  --fb-space-300: 3rem;

  /* Size */
  --fb-gutter: 1rem;
  --fb-width-page: 80rem;
  --fb-width-content: 60rem;
  --fb-width-sidebar: 13.75rem;
  --fb-control-height: 2rem;
  --fb-radius: 2px;
  --fb-border-width: 1px;

  /* Solid fills. White text sits on these in both themes. */
  --fb-color-on-fill: #ffffff;
  --fb-fill-progressive: #3366cc;
  --fb-fill-progressive-hover: #3056a9;
  --fb-fill-progressive-active: #233566;
  --fb-fill-destructive: #d73333;
  --fb-fill-destructive-hover: #bf3c2c;
  --fb-fill-destructive-active: #9f3526;
  --fb-fill-success: #177860;

  /* Text */
  --fb-color-text: #202122;
  --fb-color-text-subtle: #54595d;
  --fb-color-text-placeholder: #72777d;
  --fb-color-text-disabled: #a2a9b1;

  /* Links */
  --fb-color-link: #3366cc;
  --fb-color-link-hover: #3056a9;
  --fb-color-link-visited: #6a60b0;
  --fb-color-link-missing: #bf3c2c;

  /* Meaning */
  --fb-color-progressive: #3366cc;
  --fb-color-destructive: #d73333;
  --fb-color-success: #177860;
  --fb-color-warning: #edab00;
  --fb-color-protect: #72777d;
  --fb-color-sample: #9932cc;
  --fb-color-focus: #3366cc;

  /* Surfaces */
  --fb-surface-page: #ffffff;
  --fb-surface-subtle: #f8f9fa;
  --fb-surface-interactive: #eaecf0;
  --fb-surface-interactive-hover: #dadde3;
  --fb-surface-disabled: #dadde3;
  --fb-surface-progressive-subtle: #f1f4fd;
  --fb-surface-warning-subtle: #fef6e7;
  --fb-surface-error-subtle: #ffe9e5;
  --fb-surface-success-subtle: #dff2eb;
  --fb-surface-mark: #ffe49c;

  /* Borders */
  --fb-border: #a2a9b1;
  --fb-border-subtle: #c8ccd1;
  --fb-border-muted: #dadde3;
  --fb-border-interactive: #72777d;

  /* Main page boxes */
  --fb-box-green-surface: #f5fffa;
  --fb-box-green-border: #cef2e0;
  --fb-box-green-title: #cef2e0;
  --fb-box-green-title-border: #a3bfb1;
  --fb-box-blue-surface: #f5faff;
  --fb-box-blue-border: #cedff2;
  --fb-box-blue-title: #cedff2;
  --fb-box-blue-title-border: #a3b0bf;
  --fb-box-purple-surface: #faf5ff;
  --fb-box-purple-border: #ddcef2;
  --fb-box-purple-title: #ddcef2;
  --fb-box-purple-title-border: #afa3bf;
  --fb-box-neutral-surface: #f8f9fa;
  --fb-box-neutral-border: #dadde3;
  --fb-box-neutral-title: #eaecf0;
  --fb-box-neutral-title-border: #a2a9b1;

  /* Related-links box */
  --fb-navbox-title: #ccccff;
  --fb-navbox-group: #ddddff;

  /* The only shadow. Menus use it. */
  --fb-shadow-menu: 0 2px 2px 0 rgba(0, 0, 0, 0.2);
}

@media (min-width: 720px) {
  :root {
    --fb-gutter: 2rem;
    --fb-text-control: 0.875rem;
  }
}

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

    --fb-color-text: #e8ecf6;
    --fb-color-text-subtle: #a7b2cc;
    --fb-color-text-placeholder: #a7b2cc;
    --fb-color-text-disabled: #66749a;

    --fb-color-link: #8eaaf2;
    --fb-color-link-hover: #b4c5f4;
    --fb-color-link-visited: #ab9dd6;
    --fb-color-link-missing: #fd7865;

    --fb-color-progressive: #8eaaf2;
    --fb-color-destructive: #fd7865;
    --fb-color-success: #2cb491;
    --fb-color-warning: #ffcc33;
    --fb-color-protect: #a7b2cc;
    --fb-color-sample: #c58af9;
    --fb-color-focus: #8eaaf2;

    --fb-surface-page: #0a1128;
    --fb-surface-subtle: #142043;
    --fb-surface-interactive: #1b2952;
    --fb-surface-interactive-hover: #263664;
    --fb-surface-disabled: #263664;
    --fb-surface-progressive-subtle: #14255a;
    --fb-surface-warning-subtle: #2d2212;
    --fb-surface-error-subtle: #3c1a13;
    --fb-surface-success-subtle: #153d31;
    --fb-surface-mark: #5a4a14;

    --fb-border: #4b5b85;
    --fb-border-subtle: #34436b;
    --fb-border-muted: #25325a;
    --fb-border-interactive: #9aa7c7;

    --fb-box-green-surface: #0f1c17;
    --fb-box-green-border: #1e3b30;
    --fb-box-green-title: #173a2c;
    --fb-box-green-title-border: #2c5c49;
    --fb-box-blue-surface: #0e1a3a;
    --fb-box-blue-border: #22386e;
    --fb-box-blue-title: #1a2f62;
    --fb-box-blue-title-border: #36548f;
    --fb-box-purple-surface: #1a1426;
    --fb-box-purple-border: #35284f;
    --fb-box-purple-title: #2e2247;
    --fb-box-purple-title-border: #51407a;
    --fb-box-neutral-surface: #0f1830;
    --fb-box-neutral-border: #25325a;
    --fb-box-neutral-title: #1b2952;
    --fb-box-neutral-title-border: #34436b;

    --fb-navbox-title: #26336e;
    --fb-navbox-group: #1c2858;

    --fb-shadow-menu: 0 2px 2px 0 rgba(0, 0, 0, 0.6);
  }
}

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

  --fb-color-text: #e8ecf6;
  --fb-color-text-subtle: #a7b2cc;
  --fb-color-text-placeholder: #a7b2cc;
  --fb-color-text-disabled: #66749a;

  --fb-color-link: #8eaaf2;
  --fb-color-link-hover: #b4c5f4;
  --fb-color-link-visited: #ab9dd6;
  --fb-color-link-missing: #fd7865;

  --fb-color-progressive: #8eaaf2;
  --fb-color-destructive: #fd7865;
  --fb-color-success: #2cb491;
  --fb-color-warning: #ffcc33;
  --fb-color-protect: #a7b2cc;
  --fb-color-sample: #c58af9;
  --fb-color-focus: #8eaaf2;

  --fb-surface-page: #0a1128;
  --fb-surface-subtle: #142043;
  --fb-surface-interactive: #1b2952;
  --fb-surface-interactive-hover: #263664;
  --fb-surface-disabled: #263664;
  --fb-surface-progressive-subtle: #14255a;
  --fb-surface-warning-subtle: #2d2212;
  --fb-surface-error-subtle: #3c1a13;
  --fb-surface-success-subtle: #153d31;
  --fb-surface-mark: #5a4a14;

  --fb-border: #4b5b85;
  --fb-border-subtle: #34436b;
  --fb-border-muted: #25325a;
  --fb-border-interactive: #9aa7c7;

  --fb-box-green-surface: #0f1c17;
  --fb-box-green-border: #1e3b30;
  --fb-box-green-title: #173a2c;
  --fb-box-green-title-border: #2c5c49;
  --fb-box-blue-surface: #0e1a3a;
  --fb-box-blue-border: #22386e;
  --fb-box-blue-title: #1a2f62;
  --fb-box-blue-title-border: #36548f;
  --fb-box-purple-surface: #1a1426;
  --fb-box-purple-border: #35284f;
  --fb-box-purple-title: #2e2247;
  --fb-box-purple-title-border: #51407a;
  --fb-box-neutral-surface: #0f1830;
  --fb-box-neutral-border: #25325a;
  --fb-box-neutral-title: #1b2952;
  --fb-box-neutral-title-border: #34436b;

  --fb-navbox-title: #26336e;
  --fb-navbox-group: #1c2858;

  --fb-shadow-menu: 0 2px 2px 0 rgba(0, 0, 0, 0.6);
}
