/*
 * Bitcoin Echo design tokens.
 *
 * Every colour, size and duration that the site and the GUI use is named in
 * this file, and nowhere else. Light is the reference theme. The reader's
 * system setting is followed; data-theme="light" or data-theme="dark" on the
 * root element overrides it, and on any other element re-themes that part
 * of the page.
 */

/* Fonts are served from this folder. No request leaves the reader's machine. */

@font-face {
  font-family: "Libre Baskerville";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/libre-baskerville-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Libre Baskerville";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/libre-baskerville-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Libre Baskerville";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/libre-baskerville-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Libre Baskerville";
  font-style: italic;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/libre-baskerville-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Inconsolata";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inconsolata-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inconsolata";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/inconsolata-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Colour: light, the reference theme. */

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

  --color-ground: #f8f6f3;
  --color-panel: #ffffff;

  --color-ink: #1a1a1a;
  --color-ink-2: #55524c;

  /* A rule is a decorative hairline. An edge marks the boundary of a
     control and holds 3:1 against the ground and the panel. */
  --color-rule: #cfcabf;
  --color-edge: #8a8478;

  /* Orange is the second colour, as in two-colour printing. Bitcoin's
     orange cannot meet text contrast on the paper ground, so it is used
     for fills, and the rubric tone carries orange as text and line. */
  --color-orange: #f7931a;
  --color-rubric: #b05500;
  --color-on-orange: #1a1a1a;
  --color-orange-pressed: #e07f0a;
  --color-link-visited: #7a4a1f;

  /* A verdict is always a shape and a word as well as a colour.
     "Not yet valid" has no hue of its own. */
  --color-valid: #2f6b4f;
  --color-invalid: #b0392b;
  --color-tampered: #6a3d7c;

  --color-scrim: rgb(26 26 26 / 0.45);
  --shadow-overlay: 0 8px 24px rgb(26 26 26 / 0.14);
}

/* Colour: dark. The same values appear twice, once for the system setting
   and once for the override. Keep the two blocks identical. */

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

    --color-ground: #0e0e0d;
    --color-panel: #171716;
    --color-ink: #ecebe7;
    --color-ink-2: #a8a7a1;
    --color-rule: #2e2e2b;
    --color-edge: #6f6f6a;
    --color-orange: #f7931a;
    --color-rubric: #f7931a;
    --color-on-orange: #1a1a1a;
    --color-orange-pressed: #e07f0a;
    --color-link-visited: #b9a48a;
    --color-valid: #6fbf96;
    --color-invalid: #e8796a;
    --color-tampered: #b99ad0;
    --color-scrim: rgb(0 0 0 / 0.6);
    --shadow-overlay: 0 8px 24px rgb(0 0 0 / 0.5);
  }
}

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

  --color-ground: #0e0e0d;
  --color-panel: #171716;
  --color-ink: #ecebe7;
  --color-ink-2: #a8a7a1;
  --color-rule: #2e2e2b;
  --color-edge: #6f6f6a;
  --color-orange: #f7931a;
  --color-rubric: #f7931a;
  --color-on-orange: #1a1a1a;
  --color-orange-pressed: #e07f0a;
  --color-link-visited: #b9a48a;
  --color-valid: #6fbf96;
  --color-invalid: #e8796a;
  --color-tampered: #b99ad0;
  --color-scrim: rgb(0 0 0 / 0.6);
  --shadow-overlay: 0 8px 24px rgb(0 0 0 / 0.5);
}

/* Colour by role. Declared on every themed element so that each role
   follows the theme of the part of the page it sits in. */

:root,
[data-theme] {
  --color-pending: var(--color-ink-2);
  --color-live: var(--color-orange);
  --color-progress: var(--color-orange);
  --color-link: var(--color-rubric);
  --color-focus: var(--color-rubric);
  --color-selection: rgb(247 147 26 / 0.3);

  --border-rule: var(--border-width) solid var(--color-rule);
  --border-edge: var(--border-width) solid var(--color-edge);
  --border-ink: var(--border-width) solid var(--color-ink);
}

:root {
  /* Type. Baskerville sets everything that is read; Inconsolata sets
     everything that is data, and every label. */
  --font-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --font-mono: "Inconsolata", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* The scale steps by a major third from the body size of 17 pixels.
     Nothing is set smaller than xs. */
  --text-xs: 0.8125rem;   /* 13 */
  --text-sm: 0.9375rem;   /* 15 */
  --text-md: 1.0625rem;   /* 17 */
  --text-lg: 1.3125rem;   /* 21 */
  --text-xl: 1.625rem;    /* 26 */
  --text-2xl: 2.0625rem;  /* 33 */
  --text-3xl: 2.5625rem;  /* 41 */
  --text-4xl: 3.25rem;    /* 52 */
  --text-5xl: 4rem;       /* 64 */
  --text-display: clamp(var(--text-3xl), 6vw, var(--text-5xl));

  --weight-regular: 400;
  --weight-medium: 500;   /* Inconsolata only */
  --weight-bold: 700;

  --leading-tight: 1.15;  /* headings */
  --leading-snug: 1.4;    /* interface text */
  --leading-body: 1.65;   /* reading */

  --tracking-display: -0.01em;
  --tracking-label: 0.06em;

  /* About 65 characters of Baskerville, in ems of the text it measures. */
  --measure: 36em;

  /* Space, on a base of 4 pixels. */
  --space-1: 0.25rem;   /* 4 */
  --space-2: 0.5rem;    /* 8 */
  --space-3: 0.75rem;   /* 12 */
  --space-4: 1rem;      /* 16 */
  --space-5: 1.5rem;    /* 24 */
  --space-6: 2rem;      /* 32 */
  --space-7: 3rem;      /* 48 */
  --space-8: 4rem;      /* 64 */
  --space-9: 6rem;      /* 96 */

  --width-text: var(--measure);
  --width-wide: 55rem;
  --width-page: 70rem;

  /* The smallest thing a finger or pointer is asked to hit. */
  --size-target: 2.75rem;

  /* Corners are square. Small covers inline code; full is for dots. */
  --radius-none: 0;
  --radius-small: 2px;
  --radius-full: 999px;

  --border-width: 1px;
  --border-width-strong: 2px;
  --border-width-marker: 4px;

  --focus-width: 2px;
  --focus-offset: 2px;

  /* Elevation has three levels and one shadow. The ground is level 0.
     A panel is level 1 and is marked by its colour and a rule, with no
     shadow. Only what floats over the page, a dialog or a popover, is
     level 2 and takes --shadow-overlay with an edge. */

  /* Motion. Nothing loops, and text never animates in. */
  --duration-fast: 100ms;   /* hover, press, focus */
  --duration-base: 200ms;   /* open, close, theme change */
  --duration-slow: 400ms;   /* a bar or a figure catching up */
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-base: 0ms;
    --duration-slow: 0ms;
  }
}
