/* The site's colours, and the sky behind everything.

   Two skies, one design: a twilight sky (the default, and the one the logo was made for) and a
   dawn sky for daylight reading. They are the same palette at two times of day — the same
   crimson, the same cyan, the same glass — so switching is a change of light, not of site.

   Everything else in the stylesheets reads these variables and never a colour of its own, which
   is why a whole retheme is this one file.

   THE RULE THAT KEEPS IT READABLE: text never sits directly on the sky, with one exception.
   Measured, white text on the low end of the twilight sky is 3.5:1 — under the 4.5 that small
   text needs — while the same text on a glass panel is 8:1 or better at every depth. So every
   paragraph, footer and control sits on --surface-glass.

   The exceptions are the header and the labels of the front-page constellation: both sit in the
   top half of the screen, which is the darkest part of twilight and the deepest blue of dawn,
   and a test measures them against exactly those stops in both skies. */

/* Both families are self-hosted (SIL Open Font License), not linked from Google: the site then
   makes no request to a third party, which matters for its privacy policy, and does not depend
   on a foreign service being reachable. Each file is a VARIABLE font, so one file per script
   covers every weight used here. font-display: swap shows the text at once in the fallback and
   swaps when the file arrives, so slow hosting never means an empty page. */
@font-face {
  font-family: 'Jura';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/fonts-v13/jura-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Jura';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('/fonts-v13/jura-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: 'Golos Text';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts-v13/golos-text-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Golos Text';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('/fonts-v13/golos-text-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 {
  --font-display: 'Jura', 'Exo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* Twilight, the default. */
  --bg: #15153F;
  --sky: linear-gradient(180deg, #15153F 0%, #2E2B78 30%, #6A4499 58%, #AE5A92 84%, #D9807A 100%);
  --sky-detail:
    radial-gradient(1.4px 1.4px at 12% 6%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 31% 12%, #fff 60%, transparent 62%),
    radial-gradient(1.6px 1.6px at 55% 5%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 77% 11%, #fff 60%, transparent 62%),
    radial-gradient(1.3px 1.3px at 91% 4%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 21% 24%, #fff 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 67% 22%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 44% 18%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 86% 31%, #fff 60%, transparent 62%),
    radial-gradient(120% 22% at 50% 112%, rgba(255, 190, 150, 0.32), transparent 70%);

  --surface-glass: rgba(20, 18, 70, 0.6);
  --surface-glass-border: rgba(255, 255, 255, 0.2);

  --accent: #B62854;
  --accent-gradient: linear-gradient(90deg, #A82248, #C4432E);
  --accent-strong: #AADDF6;
  --accent-text: #FFFFFF;

  --warm: rgba(232, 146, 95, 0.22);
  --warm-text: #FFE7D6;

  --text: #F3F0FC;
  --text-muted: #D0CDEA;
  --border: rgba(255, 255, 255, 0.2);

  --glow: 0 0 22px rgba(240, 130, 110, 0.35);

  /* Colours that MEAN something to an exercise, kept apart from the accent so a retheme cannot
     silently change what an instruction says. «Ждите, пока квадрат станет зелёным» needs green;
     «найдите квадрат другого оттенка» needs two shades far enough apart to tell. */
  --go: #3DCB82;
  --stop: #FF7A86;
  --shade-a: #55A8D8;
  --shade-b: #F7B98C;
  --white: #FFFFFF;

  /* The kids section's planets: each game tile is a small planet of its own colour, cycling
     through these six. Decoration only — no game's answer is told by these colours. */
  --planet-1: #FF6FA8;
  --planet-2: #FF9A5A;
  --planet-3: #5EC4F0;
  --planet-4: #4ED68E;
  --planet-5: #A88BFF;
  --planet-6: #FFD466;

  /* The logic tasks draw their figures in the logo's three colours. Each colour belongs to one
     shape (circle, triangle, square), so it never carries a rule by itself. */
  --logo-1: #FF6FA8;
  --logo-2: #FF9A5A;
  --logo-3: #5EC4F0;

  color-scheme: dark;
}

/* Dawn. `light` because that is what a person calls it; the attribute is set by sky.js from
   what they chose, never from the system, so the site is the same site for everyone until
   they ask for the other sky. */
[data-theme="light"] {
  --bg: #CBC8F4;
  --sky: linear-gradient(180deg, #A9BBF0 0%, #CBC8F4 34%, #EBD3EE 62%, #FBDDD4 86%, #FFEAD2 100%);
  --sky-detail:
    radial-gradient(60% 9% at 22% 20%, rgba(255, 255, 255, 0.85), transparent 72%),
    radial-gradient(50% 7% at 80% 28%, rgba(255, 255, 255, 0.75), transparent 72%),
    radial-gradient(70% 9% at 38% 70%, rgba(255, 255, 255, 0.7), transparent 72%),
    radial-gradient(45% 6% at 88% 82%, rgba(255, 255, 255, 0.7), transparent 72%);

  --surface-glass: rgba(255, 255, 255, 0.66);
  --surface-glass-border: rgba(255, 255, 255, 0.9);

  --accent: #A82248;
  --accent-strong: #1F5F86;

  --warm: #FFE3CF;
  --warm-text: #7A3410;

  --text: #1F1B3A;
  --text-muted: #45426A;
  --border: rgba(31, 27, 58, 0.22);

  --glow: 0 0 18px rgba(200, 80, 60, 0.22);

  --go: #168A4C;
  --stop: #C0283C;
  --shade-a: #1F5F86;
  --shade-b: #D2603A;

  --planet-1: #E0558F;
  --planet-2: #F08A4B;
  --planet-3: #3FA7D6;
  --planet-4: #3DBB7A;
  --planet-5: #8C6BE0;
  --planet-6: #F2B93A;

  --logo-1: #C2306E;
  --logo-2: #C2581E;
  --logo-3: #1F6F9E;

  color-scheme: light;
}

/* border-box everywhere. Without it every width set here — the reading sheet, the app sheet, the
   footers — had its padding and border added on top, so at 320px a 296px sheet was 341px wide
   and every page scrolled sideways on every phone. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  /* Room under the last line, so the footer is never the thing touching the horizon. */
  padding-bottom: 48px;
}

/* The sky is two fixed layers behind the page rather than a background on the body: a fixed
   body background repaints on every scroll frame on some phones, and iOS ignores it entirely. */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: -2;
  background: var(--sky);
}

body::after {
  z-index: -1;
  background: var(--sky-detail);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.005em;
  /* Jura is wide; «конфиденциальности» is longer than a 320px screen at 30px. Break it rather
     than push the whole page sideways. */
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Controls do not inherit a font by default: they showed the system font, not Golos Text. */
button,
input,
textarea,
select {
  font-family: inherit;
}

/* Golos Text is declared 400–600. The default bold is 700, which the browser would clamp or
   fake; say 600 so what is drawn is what was measured. */
b,
strong {
  font-weight: 600;
}

/* Links with no class of their own (the privacy page has no reading styles) would keep the
   browser's default blue and purple, which measure 1.1:1 against the dark glass. */
a {
  color: var(--accent-strong);
}

/* Keyboard focus was never visible on the old palette. A cyan ring is readable on both skies. */
:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 3px;
  border-radius: 6px;
}

::selection {
  background: rgba(143, 208, 240, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
