/* Korpora — base: fonts, tokens, type. Colours are named after the board decors they come from:
   W1000 (premium white) is the paper, U961 (graphite) the ink, H1145 (Bardolino oak) the material, spoilboard MDF
   the machine bed; green is the drawing ink, gold the router path. */

/* Cyrillic is preloaded on the Bulgarian pages: `optional` uses it when it is there in time and otherwise keeps
   the fallback for that view, instead of swapping late and shifting the layout. */
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 300 800;
  font-display: optional;
  src: url('/static/fonts/geologica-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/static/fonts/geologica-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-20C0, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: 'Geologica';
  font-style: normal;
  font-weight: 300 800;
  font-display: swap;
  src: url('/static/fonts/geologica-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: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url('/static/fonts/jetbrains-mono-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;
}

:root {
  --paper: #f6f7f1;
  --panel: #ffffff;
  --panel-2: #eef0e8;
  --rule: #d6d7ce;
  --rule-strong: #b9b9ad;
  --ink: #34302f;
  --ink-2: #5d5752;
  --ink-3: #6f6963;
  --green: #2c6a10;
  --green-soft: #e3ecd8;
  --on-green: #ffffff;
  --gold: #a87406;
  --gold-ink: #865c04;
  --gold-soft: #f4ead2;
  --oak: #c2a588;
  --mdf: #c9a97c;
  /* the paper of a drawing (PAPER in engine/drawing-kit.js); always light, so the dark theme keeps it */
  --drawing-paper: #fbfcf9;
  --red: #a8261b;
  --red-soft: #f6e1dd;
  --amber: #8a5a00;
  --amber-soft: #f6ebd3;
  --focus: #2c6a10;
  --shadow: 0 1px 0 rgb(52 48 47 / 0.06), 0 8px 24px -14px rgb(52 48 47 / 0.35);
  --f-text: 'Geologica', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  --radius: 6px;
  --radius-lg: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #2a2c2f;
    --panel: #323438;
    --panel-2: #3a3c40;
    --rule: #4a4c50;
    --rule-strong: #5f6166;
    --ink: #efede7;
    --ink-2: #c8c3bb;
    --ink-3: #aaa49b;
    --green: #9cc97b;
    --green-soft: #33402b;
    --on-green: #1b2414;
    --gold: #e2b33d;
    --gold-ink: #e8c060;
    --gold-soft: #4a3f22;
    --mdf: #5f4f39;
    --red: #ff9b8f;
    --red-soft: #4d2c28;
    --amber: #f0c060;
    --amber-soft: #4b3c1d;
    --focus: #b9de9c;
    --shadow: 0 1px 0 rgb(0 0 0 / 0.25), 0 10px 28px -14px rgb(0 0 0 / 0.7);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.55 var(--f-text);
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}
/* Geologica and JetBrains Mono carry the Bulgarian cursive letter shapes behind `locl` (т as m, и as u, д as g, в as B),
   which read as Latin in upright text: „код“ turns into „kog“. Switched off on every Bulgarian page, for every element,
   because the `font` shorthand (editor, read-outs) resets font-feature-settings to its initial value on each element it
   sets — hence the universal selector and !important instead of one inherited declaration on <html>. */
:lang(bg),
:lang(bg) *,
:lang(bg) *::before,
:lang(bg) *::after {
  font-feature-settings: 'locl' 0 !important;
}
img,
svg {
  max-width: 100%;
}
a {
  color: var(--green);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  text-decoration-thickness: 2px;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
h1,
h2,
h3,
h4 {
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 {
  font-size: clamp(1.7rem, 3vw, 2.2rem);
}
h2 {
  font-size: 1.35rem;
}
h3 {
  font-size: 1.08rem;
}
p {
  margin: 0 0 0.9em;
  text-wrap: pretty;
}
code,
kbd,
.mono {
  font-family: var(--f-mono);
  font-size: 0.92em;
}
small,
.muted {
  color: var(--ink-2);
}
.skip {
  position: absolute;
  left: 8px;
  top: -60px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: var(--radius);
  z-index: 50;
}
.skip:focus {
  top: 8px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* icons from the sprite */
.i {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
