/* Design tokens, reset and the pieces shared by the landing page and the app. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-latin-wght.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* Fonts to choose from in Settings. A browser only downloads a file once a page uses that font. */
@font-face {
  font-family: "Lexend";
  src: url("/fonts/lexend-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Literata";
  src: url("/fonts/literata-latin-wght.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("/fonts/nunito-latin-wght.woff2") format("woff2");
  font-weight: 200 1000;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("/fonts/opendyslexic-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "OpenDyslexic";
  src: url("/fonts/opendyslexic-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* The font for the whole app. Settings → Font sets data-font on <html>; the list is in js/lib/fonts.js. */
:root {
  --gram: #6a46cf; /* grammar: violet, next to the blue words */
  --font: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-font="system"] {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

:root[data-font="lexend"] {
  --font: "Lexend", system-ui, sans-serif;
}

:root[data-font="atkinson"] {
  --font: "Atkinson Hyperlegible", system-ui, sans-serif;
}

:root[data-font="nunito"] {
  --font: "Nunito", system-ui, sans-serif;
}

:root[data-font="literata"] {
  --font: "Literata", Georgia, serif;
}

:root[data-font="dyslexic"] {
  --font: "OpenDyslexic", system-ui, sans-serif;
}

:root {
  color-scheme: light;
  --bg: #f3f5fb;
  --surface: #fff;
  --surface-2: #eceff8;
  --ink: #13203f;
  --mut: #56627f;
  --line: #d8dfef;

  /* Item types: roots are blue, compound words are orange. */
  --root: #2447b0;
  --word: #c64708;
  --on: #fff;

  /* Direction of a question: Dutch shown (answer in English) is blue, English shown (answer in Dutch) is green. */
  --nl: #2447b0;
  --en: #0b7a62;
  --banner-ink: #fff;

  --ok: #2c8a3c;
  --ok-ink: #fff;
  --bad: #bd2433;
  --bad-ink: #fff;
  --warn: #fff1c2;
  --warn-ink: #4a3600;
  --gold: #f0b429;
  --gold-ink: #3b2a00;

  /* Apprentice, Guru, Master, Enlightened, Burned */
  --g0: #df4d7a;
  --g1: #8650cf;
  --g2: #2d6ee0;
  --g3: #14a0b5;
  --g4: #4b5568;

  --salmon: #ffa99c;
  --salmon-ink: #4a1008;
  --sky: #a9ccff;
  --sky-ink: #0b1a40;
  --teal: #0f766e;
  --teal-ink: #fff;

  --shadow: 0 1px 2px rgba(19, 32, 63, 0.06), 0 8px 24px rgba(19, 32, 63, 0.06);
  --radius: 16px;
}

/* Dark: js/theme.js sets data-scheme from the mode (Light, Dark, or Auto = the device's setting). */
:root[data-scheme="dark"] {
  color-scheme: dark;
  --bg: #0b1222;
  --surface: #141d38;
  --surface-2: #1a2547;
  --ink: #e8edfb;
  --mut: #9aa6c6;
  --line: #27335c;
  --root: #6b8ff2;
  --word: #f4915a;
  --on: #0b1222;
  --nl: #2a4fc4;
  --en: #0e8a70;
  --ok: #4cc27d;
  --ok-ink: #08210f;
  --bad: #ff7a88;
  --bad-ink: #3a0610;
  --warn: #4a3b0c;
  --warn-ink: #ffe8a3;
  --g0: #f2709a;
  --g1: #a982ec;
  --g2: #5b8ff0;
  --g3: #3fc3d6;
  --g4: #8791a8;
  --salmon: #f08b84;
  --sky: #8ab4ff;
  --teal: #1aa090;
  --teal-ink: #04201c;
  --shadow: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* No zooming in by double-tapping (easy to do by accident while answering); pinch zoom still works. */
  touch-action: manipulation;
}

/* Touch screens: no double-tap zoom or grey flash on controls, no sideways rubber band that fights swiping. */
a,
button,
summary,
label,
select,
[data-a] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-x: none;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  line-height: 1.15;
  letter-spacing: -0.02em;
}

p {
  margin: 6px 0;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--root);
  outline-offset: 2px;
}

.mut {
  color: var(--mut);
  font-size: 15px;
}

.center {
  text-align: center;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mut);
}

kbd {
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 6px;
  margin-left: 6px;
  color: var(--mut);
  background: var(--surface);
}

/* Hints: phones and tablets are told to tap and swipe, computers get keyboard shortcuts. */
.hint-touch {
  display: none;
}

@media (hover: none) and (pointer: coarse) {
  .hint-touch {
    display: inline;
  }

  .hint-keys,
  .kbd-only {
    display: none;
  }
}

.boot {
  text-align: center;
  color: var(--mut);
  padding: 64px 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 22px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
}

.btn b {
  font-weight: 800;
  font-size: 14px;
  padding: 1px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
}

.btn.solid {
  background: var(--ink);
  color: var(--bg);
}

.btn.solid b {
  background: rgba(127, 127, 127, 0.3);
}

.btn.salmon {
  background: var(--salmon);
  color: var(--salmon-ink);
}

.btn.sky {
  background: var(--sky);
  color: var(--sky-ink);
}

.btn.teal {
  background: var(--teal);
  color: var(--teal-ink);
}

.btn.ghost {
  background: none;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line);
}

.btn.ghost:hover {
  box-shadow: inset 0 0 0 2px var(--mut);
}

.btn.bad {
  background: var(--bad);
  color: var(--bad-ink);
}

.btn[aria-disabled="true"],
.btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.link {
  border: 0;
  background: none;
  padding: 9px 0; /* a comfortable finger target */
  color: var(--mut);
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
}

/* Forms */
.form {
  display: grid;
  gap: 14px;
}

.form[hidden] {
  display: none;
}

.form label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 700;
}

.form small {
  font-size: 13px;
  font-weight: 400;
  color: var(--mut);
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bad) 16%, var(--surface));
  color: var(--bad);
  font-size: 15px;
}

.form-ok {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--ok) 16%, var(--surface));
  color: color-mix(in srgb, var(--ok) 75%, var(--ink));
  font-size: 15px;
}

.form-error[hidden],
.form-ok[hidden] {
  display: none;
}

.wide {
  width: 100%;
}

.form h4 {
  margin: 0;
  font-size: 17px;
}


input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="search"],
input:not([type]) {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

select {
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--surface);
}

input::placeholder {
  color: var(--mut);
  opacity: 0.8;
}

/* Marks in mnemonics: the item's own word, and the words of its parts */
/* Words in a mnemonic: coloured and lightly tinted, so they help without pulling the eye from the answer. */
mark {
  background: color-mix(in srgb, var(--root) 14%, transparent);
  color: var(--root);
  font-weight: 600;
  padding: 0 2px;
  border-radius: 4px;
}

mark.p {
  background: color-mix(in srgb, var(--word) 16%, transparent);
  color: var(--word);
}



/* Stage colours, used by bars, legends and tiles */
.stack i.g0,
.sw.g0 {
  background: var(--g0);
}
.stack i.g1,
.sw.g1 {
  background: var(--g1);
}
.stack i.g2,
.sw.g2 {
  background: var(--g2);
}
.stack i.g3,
.sw.g3 {
  background: var(--g3);
}
.stack i.g4,
.sw.g4 {
  background: var(--g4);
}

/* Shown by boot-guard.js when the app could not start */
.boot-fail h3 {
  color: var(--ink);
  margin: 0 0 8px;
}
.boot-fail .boot-err {
  font-size: 12px;
  word-break: break-word;
  max-width: 560px;
  margin: 12px auto;
}
