/* Design tokens, fonts and element defaults shared by every component. */

/* The full JetBrains Mono NL (no ligatures), not a Latin subset: the board and component
   drawings use its box drawing characters, which only line up with the letters in one font. */
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-nl-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-nl-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* A dark terminal, with the rubber duck's yellow as the only warm color. */
  --color-screen: #161a20;
  --color-screen-raised: #1d222a;
  --color-rule: #2e3542;
  --color-text: #d5dce4;
  --color-muted: #7c8798;
  --color-duck: #f6c945;
  --color-duck-ink: #241c05;
  --color-beak: #f39a3b;
  --color-water: #4f7db3;
  --color-user: #7fcf8f;
  --color-path: #7aa7e8;
  --color-error: #ff7a6b;

  --font-terminal: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --text-base: 0.9375rem;
  --text-small: 0.8125rem;
  --line-height: 1.6;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;

  --transcript-width: 88ch;
  /* Wide enough for the ESP32 drawing with its component labels. */
  --board-pane-width: 72ch;
  --control-height: 2.25rem;
}

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

html {
  color-scheme: dark;
}

body {
  margin: 0;
  font: var(--text-base) / var(--line-height) var(--font-terminal);
  /* No ligatures: "<=", "==" and "!=" must show the exact characters a student has to type. */
  font-variant-ligatures: none;
  font-feature-settings: "calt" 0, "liga" 0;
  color: var(--color-text);
  background: var(--color-screen);
}

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

/* Without this, any component that sets its own display would ignore the hidden attribute. */
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--color-duck);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
