/* Шрифты лежат в assets/fonts, лицензия OFL */
@font-face { font-family: "Sofia Sans Extra Condensed"; font-style: normal; font-weight: 1 1000; font-display: swap; src: url("assets/fonts/sofia-sans-extra-condensed-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Sofia Sans Extra Condensed"; font-style: normal; font-weight: 1 1000; font-display: swap; src: url("assets/fonts/sofia-sans-extra-condensed-latin-wght-normal.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: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("assets/fonts/onest-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("assets/fonts/onest-latin-wght-normal.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: 100 800; font-display: swap; src: url("assets/fonts/jetbrains-mono-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* taste-skill-ignore: моноширинный шрифт только для кода */
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("assets/fonts/jetbrains-mono-latin-wght-normal.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; } /* taste-skill-ignore: моноширинный шрифт только для кода */
/* Расширенная кириллица: казахские ә ғ қ ң ө ү һ. Браузер скачивает файл, только когда на странице есть эти буквы */
@font-face { font-family: "Sofia Sans Extra Condensed"; font-style: normal; font-weight: 1 1000; font-display: swap; src: url("assets/fonts/sofia-sans-extra-condensed-cyrillic-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Onest"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("assets/fonts/onest-cyrillic-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("assets/fonts/jetbrains-mono-cyrillic-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* taste-skill-ignore: моноширинный шрифт только для кода */

/* Казахские страницы: в Sofia Sans Extra Condensed и JetBrains Mono нет ә ғ қ ң ө ұ ү һ,
   поэтому там заголовки набраны Fira Sans Extra Condensed, а код — Fira Code (обе OFL).
   Файлы скачиваются, только когда шрифт нужен странице */
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-latin-700-normal.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: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-cyrillic-ext-700-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-latin-800-normal.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: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-cyrillic-800-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-cyrillic-ext-800-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 900; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-latin-900-normal.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: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 900; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-cyrillic-900-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Fira Sans Extra Condensed"; font-style: normal; font-weight: 900; font-display: swap; src: url("assets/fonts/fira-sans-extra-condensed-cyrillic-ext-900-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; }
@font-face { font-family: "Fira Code"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/fira-code-latin-wght-normal.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; } /* taste-skill-ignore: моноширинный шрифт только для кода */
@font-face { font-family: "Fira Code"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/fira-code-cyrillic-wght-normal.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; } /* taste-skill-ignore: моноширинный шрифт только для кода */
@font-face { font-family: "Fira Code"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("assets/fonts/fira-code-cyrillic-ext-wght-normal.woff2") format("woff2"); unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F; } /* taste-skill-ignore: моноширинный шрифт только для кода */

/* ---------- Токены. Плоские поля цвета, чёрный текст, синий и жёлтый Python ---------- */
:root {
  --band: #ffd249;
  --band-ink: #0a0a0a;
  --bg: #ffffff;
  --surface: #fff4cf;
  --surface-2: #ffe99f;
  --surface-3: #ffdf6f;
  --text: #0a0a0a;
  --muted: #2b2b2b;
  --line: rgba(10, 10, 10, 0.16);
  --line-strong: rgba(10, 10, 10, 0.32);
  --accent: #306998;
  --accent-hover: #0a0a0a;
  --on-accent: #ffffff;
  --mark: #306998;
  --field: #306998;
  --on-field: #ffffff;
  --field-bg: #ffffff;
  --code-bg: #0a0a0a;
  --code-bar: #1c1c1c;
  --code-text: #f0f0f0;
  --code-inline: #1d4a6e;
  --success: #116a3a;
  --danger: #b3261e;
  --float-shadow: 0 16px 40px rgba(10, 10, 10, 0.18);

  --font: "Onest", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --display: "Sofia Sans Extra Condensed", Impact, "Arial Narrow", "Roboto Condensed", sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace; /* taste-skill-ignore: моноширинный шрифт только для кода */

  --fs-title: clamp(2.25rem, 10vw + 0.5rem, 9.5rem);
  --step-head: clamp(2.25rem, 10vw + 0.5rem, 9.5rem);
  --step-mid: clamp(2.25rem, 5vw, 4.5rem);
  --step-tile: clamp(1.75rem, 3.2vw, 2.875rem);
  --fs-h2: var(--step-mid);
  --fs-h3: clamp(1.25rem, 1.7vw, 1.5rem);
  --fs-lead: clamp(1.1875rem, 1rem + 0.55vw, 1.5rem);
  --fs-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --fs-small: 1rem;

  --gutter: clamp(16px, 3vw, 40px);
  --section-gap: clamp(48px, 6vw, 80px);

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  color-scheme: light;
}

/* Шрифты с казахскими буквами, см. @font-face выше */
html[lang="kk"] {
  --display: "Fira Sans Extra Condensed", "Sofia Sans Extra Condensed", Impact, "Arial Narrow", sans-serif;
  --mono: "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace; /* taste-skill-ignore: моноширинный шрифт только для кода */
}

/* Название сайта — латиница, казахские буквы ему не нужны: на всех языках тот же шрифт, что в русской версии */
html[lang="kk"] .mark,
html[lang="kk"] .mark span,
html[lang="kk"] .brand,
html[lang="kk"] .cert-brand {
  font-family: "Sofia Sans Extra Condensed", Impact, "Arial Narrow", "Roboto Condensed", sans-serif;
}

:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --text: #f5f5f5;
  --muted: #d4d4d4;
  --line: rgba(245, 245, 245, 0.16);
  --line-strong: rgba(245, 245, 245, 0.3);
  --mark: #ffd249;
  --field-bg: #0a0a0a;
  --code-inline: #ffe27a;
  --success: #7ddc9c;
  --danger: #ff9a9a;
  --float-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* Блоки кода всегда тёмные: так их привычнее читать */
.window,
.code-block {
  --surface: #1c1c1c;
  --surface-2: #2a2a2a;
  --surface-3: #3a3a3a;
  --text: #f5f5f5;
  --muted: #d4d4d4;
  --line: rgba(245, 245, 245, 0.16);
  --line-strong: rgba(245, 245, 245, 0.3);
  --mark: #ffd249;
  --success: #7ddc9c;
  --danger: #ff9a9a;
  color: var(--text);
}

/* ---------- База ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--surface-3) var(--bg);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  overflow-x: clip;
  caret-color: var(--mark);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

[hidden] {
  display: none !important;
}

img,
svg {
  max-width: 100%;
  display: block;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--mark);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.2em;
  transition: color 150ms ease;
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--mark);
  }
}

/* Касания: без задержки двойного тапа и без серой вспышки Android, нажатие видно по своим стилям */
a,
button,
input,
select,
textarea,
label,
summary {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

main p,
main li {
  max-width: 58ch;
}

.project-step,
.saved-list li,
.flow-steps li {
  max-width: none;
}

code {
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
}

:not(pre) > code {
  padding: 1px 6px;
  background: var(--surface-2);
  color: var(--code-inline);
  font-size: 0.92em;
  overflow-wrap: anywhere;
}

.container {
  width: min(1320px, calc(100% - 2 * var(--gutter)));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 10px;
  z-index: 200;
  padding: 10px 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 10px;
}

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

main:focus {
  outline: none;
}

#progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 100;
  background: var(--mark);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: relative;
}

.brand {
  display: inline-flex;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-right: auto;
  text-decoration: none;
}

.site-nav {
  display: block;
}

.nav-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 2px;
  align-items: center;
}

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 12px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 6px;
  height: 2px;
  background: var(--mark);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms var(--ease-out);
}

.nav-link.active {
  color: var(--text);
}

.nav-link.active::after {
  transform: scaleX(1);
}

@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    color: var(--text);
  }

  .nav-link:hover::after {
    transform: scaleX(1);
  }
}

.nav-more {
  position: relative;
}

.nav-more summary {
  cursor: pointer;
  list-style: none;
  gap: 8px;
}

.nav-more summary::-webkit-details-marker {
  display: none;
}

.nav-more .caret {
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 200ms var(--ease-out);
}

.nav-more details[open] .caret {
  transform: translateY(3px) rotate(225deg);
}

.nav-more-list {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  list-style: none;
  margin: 0;
  padding: 8px;
  min-width: 260px;
  background: var(--surface);
  transform-origin: top right;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.nav-more details[open] .nav-more-list {
  box-shadow: var(--float-shadow); /* taste-skill-ignore: тень есть только у всплывающего слоя */
}

@starting-style {
  .nav-more details[open] .nav-more-list {
    opacity: 0;
    transform: scale(0.97);
  }
}

.nav-more-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding-inline: 12px;
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 120ms ease;
}

.nav-more-list a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-more-list a[aria-current="page"] {
  background: var(--surface-2);
}

/* Меню «Ещё» разбито на группы, как подвал: Понять, Сделать, Практика, Сайт */
@media (min-width: 1181px) {
  .nav-more-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 4px 8px;
    min-width: 440px;
  }
}

/* Самая длинная группа «Понять» занимает левую колонку, остальные идут справа друг под другом */
.nav-more-list .nav-group:first-child {
  grid-row: span 3;
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Заголовок группы — тёмная плашка, как у кнопок: его не спутать с пунктом меню */
.nav-group-title {
  display: inline-block;
  margin: 10px 12px 6px;
  padding: 3px 7px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Группы, которые идут друг под другом, разделены линией */
.nav-group + .nav-group {
  border-top: 2px solid var(--line);
}

.nav-more-list .nav-group:nth-child(2) {
  border-top: 0;
}

/* Пункт ведёт на русскую страницу: перевода пока нет */
.ru-mark {
  margin-left: 0.3em;
  color: var(--muted);
  font-size: 0.8em;
  font-weight: 600;
}

/* Подсказка у выбора языка: перевода этой страницы пока нет */
.nav-lang {
  position: relative;
}

.lang-hint {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 70;
  width: min(300px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-small);
  line-height: 1.45;
  box-shadow: var(--float-shadow); /* taste-skill-ignore: тень есть только у всплывающего слоя */
}

.lang-hint a {
  display: inline;
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: var(--text);
  font-size: inherit;
  text-decoration: underline;
}

/* Выбор языка: РУС · ҚАЗ · ENG */
.nav-lang {
  display: flex;
  gap: 2px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 2px solid var(--line, currentColor);
}

.nav-lang a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding-inline: 6px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 700;
  text-decoration: none;
}

.nav-lang a[aria-current="true"] {
  background: var(--text);
  color: var(--bg, #ffffff);
}

@media (hover: hover) and (pointer: fine) {
  .nav-lang a:not([aria-current="true"]):hover {
    color: var(--text);
    background: var(--surface-2);
  }
}

/* Пометка на переведённых страницах: часть разделов пока только на русском */
.lang-note {
  margin: 0;
  padding: 10px 0;
  background: var(--surface-2);
  font-size: var(--fs-small);
}

.account-logout {
  width: 100%;
  min-height: 40px;
  padding-inline: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.account-logout:hover {
  background: var(--surface-2);
}

.burger,
.search-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 150ms ease;
}

.search-toggle {
  margin-left: auto;
}

@media (hover: hover) and (pointer: fine) {
  .burger:hover,
  .search-toggle:hover,
  .theme-toggle:hover {
    background: var(--surface-2);
  }
}

.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
}

.burger span {
  width: 20px;
  height: 2px;
  margin-inline: auto;
  background: var(--text);
}

/* Значок темы рисуется маской: в тёмной теме предлагает светлую, и наоборот */
.theme-icon {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%23000'/%3E%3Cpath d='M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4.5' fill='%23000'/%3E%3Cpath d='M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8'/%3E%3C/svg%3E") center / contain no-repeat;
}

:root[data-theme="light"] .theme-icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 14.5A8.5 8.5 0 0 1 9.5 3.5a8.5 8.5 0 1 0 11 11z'/%3E%3C/svg%3E");
}

/* ---------- Главный экран ---------- */
.hero {
  padding-block: clamp(32px, 5vw, 64px) var(--section-gap);
}

.hero-title {
  margin: 0;
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-title .line {
  display: block;
  overflow: hidden;
  padding-block: 0.22em 0.14em;
  margin-block: -0.22em -0.14em;
}

.hero-title .line > span {
  display: block;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  margin-top: clamp(28px, 4vw, 48px);
}

.lead {
  margin: 0;
  max-width: 60ch;
  font-size: var(--fs-lead);
  line-height: 1.5;
}

.hero-actions,
.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.hero-hint {
  margin: 18px 0 0;
  font-size: var(--fs-small);
}

.hero-note {
  margin: 14px 0 0;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-small);
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding-inline: 24px;
  border: 0;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--accent-hover);
    color: var(--on-accent);
  }

  .btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text);
  }
}

/* ---------- Разделы ---------- */
.section {
  padding-block: clamp(32px, 4vw, 56px);
}

.home .section {
  padding-block: var(--section-gap);
}

.section-head {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 16px clamp(28px, 5vw, 72px);
  align-items: end;
  margin-bottom: clamp(28px, 3.5vw, 48px);
}

.section-head h2,
.cta-panel h2 {
  margin: 0;
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 0;
}

.part-title {
  margin: 0 0 12px;
  font-size: var(--fs-h3);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--mark);
}

/* ---------- Текстовые блоки вместо одинаковых карточек ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: clamp(28px, 3.5vw, 48px) clamp(24px, 3vw, 44px);
}

.card {
  min-width: 0;
}

.card h3 {
  margin: 0 0 10px;
  font-size: var(--fs-h3);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.card p,
.info-item p,
.faq details p,
.timeline-content p,
.step p {
  margin: 0;
}

/* Плоские поверхности: шаг тона вместо рамки и тени */
.panel,
.form-card,
.info-card,
.compare-card,
.quiz,
.step,
.info-item,
.project-step,
.task,
.continue-box {
  background: var(--surface);
  padding: clamp(18px, 2.4vw, 28px);
  min-width: 0;
}

.panel h3 {
  margin: 0 0 8px;
}

/* ---------- Хлебные крошки и шапка раздела ---------- */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: var(--fs-small);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--mark);
}

.page-hero {
  padding-block: clamp(28px, 4vw, 56px) clamp(8px, 2vw, 24px);
}

.page-hero h1 {
  margin: 0 0 18px;
  font-size: var(--fs-title);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.page-hero .note {
  margin-top: 14px;
}

/* ---------- Дорожная карта ---------- */
.timeline {
  display: grid;
  gap: 4px;
}

.timeline-item {
  display: grid;
  grid-template-columns: clamp(36px, 5vw, 72px) minmax(0, 1fr);
  background: var(--surface);
  padding: clamp(18px, 2.4vw, 28px);
}

.timeline-dot {
  font-size: var(--fs-h3);
  font-weight: 800;
  line-height: 1.2;
  color: var(--mark);
}

.timeline-content h3 {
  margin: 0 0 6px;
  font-size: var(--fs-h3);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.is-done .timeline-dot,
.is-done .step-check,
.project-step.is-done h3,
.project-step.is-done h2 {
  color: var(--success);
}

.progress-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 20px;
  margin-bottom: 40px;
}

.progress-label {
  margin: 0;
  font-weight: 700;
}

.progress-track {
  flex: 1 1 200px;
  height: 8px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-fill {
  width: 100%;
  height: 100%;
  background: var(--mark);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms var(--ease-out);
}

.progress-reset {
  min-height: 44px;
  font-size: var(--fs-small);
}

.step-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 4px;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

.step-check input {
  width: 22px;
  height: 22px;
  min-height: auto;
  padding: 0;
  accent-color: var(--mark);
}

/* ---------- Дерево понятий ---------- */
.tree {
  overflow: auto;
}

.tree ul {
  list-style: none;
  margin: 0;
  padding-left: 22px;
}

.tree-root {
  padding-left: 0;
}

.tree li {
  position: relative;
  padding: 7px 0 7px 18px;
}

.tree li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}

.tree li::after {
  content: "";
  position: absolute;
  left: 0;
  top: 21px;
  width: 13px;
  height: 1px; /* taste-skill-ignore: линия соединяет узлы схемы */
  background: var(--line-strong);
}

.tree-root > li::before,
.tree-root > li::after {
  display: none;
}

.tree-node {
  display: inline-flex;
  padding: 6px 12px;
  background: var(--surface-2);
  font-weight: 700;
}

.tree-node.strong {
  background: var(--field);
  color: var(--on-field);
}

/* Схема нарисована для тёмного фона: он сохраняется и в светлой теме */
.map-scroll {
  overflow-x: auto;
  padding: 16px;
  background: var(--code-bg);
}

.map-scroll img {
  min-width: 560px;
  width: 100%;
  height: auto;
}

/* ---------- Метки ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.chip {
  padding: 10px 16px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease;
}

a.chip:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------- Шаги ---------- */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 4px;
}

.step strong {
  display: block;
  margin-bottom: 8px;
  font-size: var(--fs-h3);
  font-weight: 800;
  line-height: 1;
  color: var(--mark);
}

.step h3 {
  margin: 0 0 8px;
  font-size: var(--fs-h3);
  line-height: 1.2;
}

/* ---------- Таблицы: здесь линии уместны ---------- */
.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

caption {
  text-align: left;
  padding-bottom: 12px;
  color: var(--muted);
}

th,
td {
  padding: 14px 16px 14px 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th:last-child,
td:last-child {
  padding-right: 0;
}

th {
  font-size: var(--fs-small);
  border-bottom-color: var(--line-strong);
}

/* ---------- Код ---------- */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 16px;
}

.code-block {
  overflow: hidden;
  background: var(--code-bg);
}

.code-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  color: var(--muted);
  background: var(--code-bar);
  font-size: var(--fs-small);
}

.code-block pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
}

.code-block code {
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
  font-size: var(--fs-small);
  color: var(--code-text);
  white-space: pre;
}

.copy-btn,
.run-btn,
.copy-btn-plain {
  min-height: 36px;
  padding-inline: 12px;
  border: 0;
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 150ms ease;
}

.copy-btn:active,
.run-btn:active,
.copy-btn-plain:active {
  transform: scale(0.97);
}

.copy-btn,
.copy-btn-plain {
  background: var(--surface-2);
  color: var(--text);
}

.copy-btn.copied {
  color: var(--success);
}

.run-btn {
  margin-left: auto;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

@media (hover: hover) and (pointer: fine) {
  .copy-btn:hover,
  .copy-btn-plain:hover {
    background: var(--surface-3);
  }

  .run-btn:hover {
    background: var(--accent-hover);
  }
}

.run-btn:disabled {
  opacity: 0.7;
  cursor: progress;
}

.code-head .run-btn + .copy-btn-plain,
.code-head .run-btn ~ .copy-btn,
.window-bar .run-btn:not([hidden]) + .copy-btn {
  margin-left: 0;
}

.code-edit,
.editor-area {
  display: block;
  width: 100%;
  padding: 16px;
  border: 0;
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
  font-size: var(--fs-small);
  line-height: 1.6;
  tab-size: 4;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}

.editor-area {
  min-height: 240px;
}

/* «Во весь экран» нужен только на узком экране */
.expand-btn {
  display: none;
}

@media (max-width: 760px) {
  .code-block[data-run] .expand-btn {
    display: inline-flex;
  }

  /* Длинные строки переносятся, а не уезжают вбок за край узкого окна */
  .code-edit,
  .editor-area {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  /* В уроках окно кода занимает всю ширину карточки: отступы карточки код не съедают */
  .lesson .lesson-code .code-block:not(.is-expanded) {
    margin-inline: calc(-1 * clamp(18px, 2.4vw, 28px));
  }
}

/* Развёрнутый редактор: код и результат на весь экран телефона, страница под ним не прокручивается */
.code-block.is-expanded {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.code-block.is-expanded .code-head {
  position: sticky;
  top: 0;
  z-index: 1;
}

.code-block.is-expanded .code-edit {
  flex: 1 1 auto;
  min-height: 40vh;
  resize: none;
}

.code-block.is-expanded .run-output {
  flex: none;
}

.code-block.is-expanded .code-hint {
  display: none;
}

.has-expanded-code body {
  overflow: hidden;
}

.code-edit:focus,
.editor-area:focus {
  outline: 2px solid var(--mark);
  outline-offset: -2px;
}

.run-output {
  padding: 12px 16px;
  background: var(--code-bar);
  color: var(--code-text);
}

/* Окно с результатом HTML-примера: белая «страница», как в браузере */
.run-preview {
  display: block;
  width: 100%;
  height: 280px;
  border: 0;
  background: #ffffff;
  color-scheme: light;
}

.run-status {
  margin: 0 0 6px;
  color: #c9d1da;
  font-size: var(--fs-small);
}

.run-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
  font-size: var(--fs-small);
}

.run-text:empty {
  display: none;
}

/* Кнопка «Скачать Python для работы без интернета» в песочнице */
.offline-python {
  margin-top: 20px;
}

.offline-python .note {
  margin: 8px 0 0;
}

/* Объяснение ошибки простыми словами под текстом Python */
.run-explain {
  max-width: 70ch;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--code-text);
  font-size: var(--fs-small);
  line-height: 1.5;
}

.run-output.is-error .run-status {
  color: #ff9a9a;
  font-weight: 700;
}

.run-output.is-ok .run-status {
  color: #7ddc9c;
  font-weight: 700;
}

/* Подсветка синтаксиса Python (код всегда на тёмном фоне) */
.tok-k { color: #ffc4ef; }
.tok-s { color: #a4f6f8; }
.tok-c { color: #a8a8a8; font-style: italic; }
.tok-d { color: #f9a21f; }
.tok-f { color: #ffd249; }
.tok-n { color: #f9a21f; }

/* ---------- Сравнение ---------- */
.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 4px;
}

.compare-card h3 {
  margin: 0 0 8px;
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.compare-card .subtitle {
  margin: 0 0 14px;
}

.list {
  margin: 0;
  padding-left: 20px;
}

.list li {
  margin: 8px 0;
}

.list li::marker {
  color: var(--mark);
}

.badge-inline {
  display: inline-flex;
  margin-bottom: 12px;
  font-size: var(--fs-small);
  font-weight: 700;
}

/* ---------- Вопросы ---------- */
.faq details {
  padding: 16px clamp(18px, 2.4vw, 28px);
  margin-bottom: 4px;
  background: var(--surface);
}

.faq summary,
.self-check summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
}

.faq summary::-webkit-details-marker,
.self-check summary::-webkit-details-marker {
  display: none;
}

.faq summary::after,
.self-check summary::after {
  content: "+";
  flex: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--mark);
  transition: transform 200ms var(--ease-out);
}

.faq details[open] summary::after,
.self-check details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  margin-top: 10px;
}

/* ---------- Тесты и формы ---------- */
.quiz h3 {
  margin: 0 0 8px;
  font-size: var(--fs-h3);
}

.quiz fieldset {
  border: 0;
  padding: 0;
  margin: 18px 0 0;
  min-width: 0;
}

.quiz legend,
.knowledge-check legend {
  padding: 0;
  margin-bottom: 10px;
  font-weight: 700;
}

.quiz-options {
  display: grid;
  gap: 4px;
}

.quiz-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  cursor: pointer;
  transition: background-color 120ms ease;
}

.quiz-option:hover {
  background: var(--surface-3);
}

.quiz-option input {
  flex: none;
  margin-top: 4px;
  width: 20px;
  height: 20px;
  min-height: auto;
  padding: 0;
  accent-color: var(--mark);
}

.quiz-result {
  margin-top: 18px;
  min-height: 26px;
  font-weight: 700;
}

.quiz-result.is-error {
  color: var(--danger);
}

.quiz-result.is-django {
  color: var(--success);
}

.quiz-next {
  margin-top: 6px;
}

.quiz-next .cta-actions {
  margin-top: 10px;
}

.knowledge-check fieldset {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  min-width: 0;
}

.knowledge-check .quiz-option.is-right {
  background: color-mix(in srgb, var(--success) 22%, var(--surface));
}

.knowledge-check .quiz-option.is-wrong {
  background: color-mix(in srgb, var(--danger) 18%, var(--surface));
}

.check-explain {
  margin: 8px 0 0;
  padding: 10px 14px;
  background: var(--surface-2);
}

.check-score {
  margin: 14px 0 0;
  min-height: 26px;
  font-weight: 700;
}

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 4px;
  align-items: start;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-weight: 700;
  font-size: var(--fs-small);
}

input,
select,
textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--field-bg);
  color: var(--text);
  font: inherit;
  transition: border-color 150ms ease;
}

textarea {
  min-height: 145px;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--mark);
  outline-offset: 0;
  border-color: var(--mark);
}

.form-status {
  min-height: 26px;
  margin: 0;
  font-weight: 700;
}

.form-status.error {
  color: var(--danger);
}

.form-status.success {
  color: var(--success);
}

/* Ошибка у самого поля */
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  margin: 6px 0 0;
  color: var(--danger);
  font-size: var(--fs-small);
  font-weight: 700;
}

/* Кнопка ждёт второго нажатия перед удалением */
.btn.is-armed {
  background: var(--surface);
  border-color: var(--danger);
  box-shadow: inset 0 0 0 2px var(--danger);
  color: var(--danger);
}

/* Подсказка про Tab нужна только при наборе с клавиатуры: видна, пока поле в фокусе.
   Скринридер читает её всегда через aria-describedby */
.code-hint {
  display: none;
  margin: 0;
  padding: 0 16px 12px;
  font-size: var(--fs-small);
}

@media (pointer: fine) {
  textarea:focus-visible + .code-hint {
    display: block;
  }
}

.info-list {
  display: grid;
  gap: 4px;
}

.info-item {
  background: var(--surface-2);
  padding: 13px 14px;
}

.info-item strong {
  display: block;
  margin-bottom: 3px;
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 30px;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.3em;
  width: 18px;
  height: 18px;
  background: var(--mark);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='M2 9.5l5 5L16 4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='M2 9.5l5 5L16 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.notice {
  margin: 18px 0 0;
  padding: 14px 18px;
  background: var(--surface-2);
  font-weight: 600;
}

.saved-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.saved-list li {
  padding: 12px 14px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
}

.saved-list small {
  color: var(--muted);
}

.saved-list p {
  margin: 6px 0 0;
}

.cta-lead {
  margin-top: 12px;
}

.note-gap {
  margin-bottom: 10px;
}

.stack-gap {
  margin-top: 16px;
}

.saved-clear {
  margin-top: 14px;
}

/* ---------- Первый проект ---------- */
.project-steps {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-step h3 {
  margin: 0 0 8px;
  font-size: var(--fs-h3);
  line-height: 1.2;
}

.project-step > p {
  margin: 0 0 14px;
}

.page-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 20px;
}

.page-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 600;
  text-decoration: none;
  transition: background-color 150ms ease;
}

.page-toc a:hover {
  background: var(--surface-2);
  color: var(--text);
}

#prep,
#errors,
#sources,
#flask,
#django,
#authors,
#quiz {
  scroll-margin-top: 96px;
}

.sources h2 {
  margin: 0 0 10px;
  font-size: var(--fs-h2);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.sources .list {
  margin-top: 16px;
  columns: 2;
  column-gap: clamp(28px, 5vw, 72px);
}

.sources .list li {
  break-inside: avoid;
}

/* ---------- Продолжить обучение ---------- */
.continue-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
}

.continue-box h2 {
  margin: 0 0 4px;
  font-size: var(--fs-h3);
}

.continue-box p {
  margin: 0;
}

.continue-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* В кнопке-флексе пробел перед счётчиком схлопывается */
.continue-links .btn {
  gap: 0.3em;
}

/* ---------- Частые ошибки и 404 ---------- */
.error-text {
  display: block;
  margin: 8px 0 0;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.not-found {
  padding: 80px 0 40px;
  text-align: center;
}

.not-found .code-404 {
  margin: 0;
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--mark);
}

.not-found .lead {
  margin-inline: auto;
}

.not-found .hero-actions {
  justify-content: center;
}

/* ---------- Призыв: поле синего цвета Python ---------- */
.cta-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(24px, 4vw, 56px);
  background: var(--field);
  color: var(--on-field);
}

/* ---------- Подвал ---------- */
.footer {
  padding-block: 40px;
  margin-top: var(--section-gap);
  background: var(--surface);
  font-size: var(--fs-small);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-note {
  flex-basis: 100%;
  max-width: 58ch;
  margin: 0;
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border: 0;
  background: var(--surface-3);
  color: var(--text);
  font-size: 1.125rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 200ms;
  z-index: 60;
}

.to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ---------- Поиск ---------- */
.search-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(640px, calc(100dvh - 64px));
  margin: 8vh auto auto;
  padding: 16px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--float-shadow); /* taste-skill-ignore: тень есть только у всплывающего слоя */
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}

@starting-style {
  .search-dialog[open] {
    opacity: 0;
    transform: scale(0.98);
  }
}

.search-dialog::backdrop {
  background: rgba(5, 8, 14, 0.66);
}

.search-bar {
  display: flex;
  gap: 8px;
}

.search-input {
  flex: 1;
  min-width: 0;
  min-height: 46px;
  padding-inline: 14px;
}

.search-close {
  width: 46px;
  flex: none;
  border: 0;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
}

.search-status {
  margin: 10px 2px;
  color: var(--muted);
  font-size: var(--fs-small);
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.search-results a {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
  transition: background-color 120ms ease;
}

.search-results a:hover,
.search-results a:focus {
  background: var(--surface-3);
  color: var(--text);
}

.search-results small {
  color: var(--mark);
}

.search-results span {
  color: var(--muted);
  font-size: var(--fs-small);
}

/* ---------- Содержание длинной страницы ---------- */
.page-rail {
  position: fixed;
  right: 18px;
  bottom: 122px;
  z-index: 40;
  width: min(300px, calc(100vw - 32px));
  max-height: min(60vh, 520px);
  overflow: auto;
  padding: 14px;
  background: var(--surface);
  box-shadow: var(--float-shadow); /* taste-skill-ignore: тень есть только у всплывающего слоя */
  display: none;
  font-size: var(--fs-small);
}

.page-rail.open {
  display: block;
}

.rail-title {
  margin: 0 0 8px;
  font-weight: 700;
}

.page-rail ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.page-rail a {
  display: block;
  padding: 5px 8px;
  color: var(--muted);
  text-decoration: none;
}

.page-rail a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.page-rail a[aria-current] {
  color: var(--text);
  background: var(--surface-2);
  font-weight: 600;
}

.page-rail .toc-sub {
  padding-left: 18px;
}

/* Кнопка над «Наверх»: справа нет текста, поэтому она ничего не закрывает */
.rail-toggle {
  position: fixed;
  right: 18px;
  bottom: 70px;
  z-index: 41;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: var(--surface-3);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 600;
  cursor: pointer;
}

.rail-toggle::before {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M1 3h16v2H1zM1 8h16v2H1zM1 13h16v2H1z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M1 3h16v2H1zM1 8h16v2H1zM1 13h16v2H1z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.rail-label {
  display: none;
}

/* На широком экране содержание стоит слева от текста. Под ним при прокрутке проезжают и жёлтая шапка,
   и белые разделы, поэтому у панели свой сплошной фон и основной цвет текста: контраст не зависит
   от того, что под ней, и от темы. Ширина — свободное место слева от контейнера (1320px), шрифт растёт с экраном */
@media (min-width: 1800px) {
  .page-rail {
    display: block;
    left: 16px;
    right: auto;
    top: 96px;
    bottom: auto;
    max-height: calc(100vh - 120px);
    width: clamp(200px, calc((100vw - 1320px) / 2 - 32px), 300px);
    padding: 14px 10px;
    background: var(--bg);
    box-shadow: inset 0 0 0 1px var(--line); /* taste-skill-ignore: тонкая рамка вместо тени */
    font-size: clamp(1.0625rem, 0.4rem + 0.6vw, 1.3rem);
  }

  .page-rail a {
    color: var(--text);
  }

  .rail-toggle {
    display: none;
  }
}

@media print {
  .page-rail,
  .rail-toggle,
  .search-toggle {
    display: none !important;
  }
}

/* ---------- Песочница, задачи, путь запроса, курс ---------- */
.tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.tool-row select {
  width: auto;
  min-height: 44px;
  max-width: 100%;
  padding-block: 0;
}

.task {
  display: grid;
  gap: 12px;
}

.task + .task {
  margin-top: 4px;
}

.task h3 {
  margin: 0;
  font-size: var(--fs-h3);
}

.task.is-solved h3 {
  color: var(--success);
}

.task.is-solved h3::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.4em;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='M2 9.5l5 5L16 4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18' fill='none' stroke='%23000' stroke-width='3'%3E%3Cpath d='M2 9.5l5 5L16 4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.task details summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 32px;
}

.task details pre {
  margin: 8px 0 0;
  padding: 14px;
  background: var(--code-bg);
  color: var(--code-text);
  overflow: auto;
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
  font-size: var(--fs-small);
}

.flow-map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 8px 0 16px;
}

.flow-node {
  position: relative;
  z-index: 1;
  padding: 14px 8px;
  background: var(--surface-2);
  text-align: center;
  font-weight: 700;
  font-size: var(--fs-small);
  transition: background-color 200ms ease, color 200ms ease;
}

.flow-node small {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
}

.flow-node.is-active {
  background: var(--accent);
  color: var(--on-accent);
}

.flow-dot {
  display: none;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: var(--mark);
  transition: transform 500ms var(--ease-in-out);
}

.is-live .flow-dot {
  display: block;
}

.flow-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.flow-steps li {
  padding: 12px 14px;
  background: var(--surface-2);
}

.flow-steps code {
  overflow-wrap: anywhere;
}

.flow-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.flow-count {
  color: var(--muted);
  font-size: var(--fs-small);
  margin-left: auto;
}

.dash-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 0;
}

.dash-row .progress-track {
  grid-column: 1 / -1;
}

.dash-count {
  color: var(--muted);
  font-size: var(--fs-small);
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.course-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  counter-reset: lesson;
}

.course-list li {
  counter-increment: lesson;
  max-width: none;
}

.course-list a {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 2px 12px;
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.course-list a::before {
  content: counter(lesson);
  grid-row: span 2;
  color: var(--mark);
  font-family: var(--display);
  font-size: var(--step-tile);
  font-weight: 900;
  line-height: 1;
}

.course-list a:hover {
  color: var(--text);
}

.course-list strong {
  font-family: var(--display);
  font-size: var(--step-tile);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.course-list span {
  color: var(--muted);
}

/* Части курса «Python с нуля»: четыре страницы в ряд, текущая обведена */
.part-nav {
  margin-bottom: clamp(24px, 3vw, 40px);
}

.part-list {
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
}

.part-list strong {
  font-size: clamp(1.375rem, 2vw, 1.75rem);
}

.part-list a {
  height: 100%;
  align-content: start;
}

.part-list a[aria-current="page"] {
  box-shadow: inset 0 0 0 3px var(--text);
}

/* На телефоне четыре карточки с описаниями заняли бы целый экран до первого урока: только номер и название */
@media (max-width: 640px) {
  .part-list a {
    align-items: center;
    padding-block: 10px;
  }

  .part-list a::before {
    grid-row: auto;
  }

  .part-list span {
    display: none;
  }
}

.cheat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(340px, 100%), 1fr));
  gap: 16px;
}

.cert-canvas {
  display: block;
  width: 100%;
  height: auto;
  margin: 12px 0;
}

.cert-field {
  display: grid;
  gap: 6px;
  max-width: 420px;
  font-weight: 600;
}

.cert-field input {
  min-height: 46px;
  padding-block: 0;
}

/* ---------- Уроки «С нуля» и словарь ---------- */
.lesson {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 20px clamp(28px, 5vw, 72px);
  align-items: start;
  scroll-margin-top: 84px;
}

.lesson h2 {
  margin: 0 0 14px;
  font-size: clamp(1.5rem, 2.6vw, 2.25rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.lesson-text p {
  margin: 0 0 12px;
}

.lesson-code {
  display: grid;
  gap: 12px;
  min-width: 0;
}

/* В коде для новичка строки крупнее */
.lesson .code-edit,
.hero .code-edit {
  font-size: 1rem;
  background: var(--code-bg);
}

.hero .code-block .code-head {
  font-weight: 700;
  color: var(--text);
}

.glossary-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
}

.glossary-grid h3 {
  scroll-margin-top: 96px;
}

.glossary-grid h3:target {
  color: var(--mark);
}

/* ---------- Элементы сеток могут сжиматься уже своего содержимого ---------- */
.hero-grid > *,
.card-grid > *,
.code-grid > *,
.compare-grid > *,
.contact-grid > *,
.steps > * {
  min-width: 0;
}

/* ---------- Движение. Кривые и длительности по правилам Эмиля Ковальски ---------- */

@keyframes line-up {
  from {
    transform: translateY(130%);
  }

  to {
    transform: translateY(0);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes picture-settle {
  from {
    transform: scale(1.12);
  }

  to {
    transform: scale(1);
  }
}

/* Появление при прокрутке только на главной: разделы курса открывают часто, им движение мешает читать */
.reveal {
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}

/* Блоки скрываются только когда script.js готов их показать: без него текст виден сразу */
.js-reveal .home .reveal:not(.visible):not(.mark) {
  opacity: 0;
  transform: translateY(24px);
}

.shake {
  animation: shake 300ms var(--ease-out);
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }

  75% {
    transform: translateX(-3px);
  }
}

/* Меньше движения: остаётся плавное появление, смещений и масштаба нет */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-title .line > span,
  .hero-grid > * {
    animation: fade-in 300ms ease both;
  }

  .reveal {
    transition: opacity 200ms ease;
    transition-delay: 0s;
    transform: none !important;
  }

  .btn:active,
  .copy-btn:active,
  .run-btn:active,
  .copy-btn-plain:active {
    transform: none;
  }

  .to-top,
  .nav-more-list,
  .search-dialog,
  .site-nav {
    transform: none !important;
  }

  .flow-dot {
    transition: none;
  }

  .shake {
    animation: none;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* ---------- Адаптивность ---------- */
@media (max-width: 1180px) {
  .burger {
    display: flex;
    order: 3;
  }

  .search-toggle {
    margin-left: 0;
    order: 2;
  }

  .theme-toggle {
    order: 4;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 12px;
    background: var(--surface);
    box-shadow: var(--float-shadow); /* taste-skill-ignore: тень есть только у всплывающего слоя */
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out), visibility 200ms;
  }

  .site-nav.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Меню висит под «липкой» шапкой: без ограничения высоты его низ уходил за край экрана
     и не прокручивался. Теперь меню не выше экрана и листается само (шапка — 68px) */
  .site-nav {
    max-height: calc(100vh - 68px);
    max-height: calc(100dvh - 68px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* Пока меню открыто, страница под ним стоит на месте (класс ставит script.js) */
  html.nav-open {
    overflow: hidden;
  }

  .nav-menu {
    display: grid;
    gap: 2px;
  }

  .nav-link {
    width: 100%;
    min-height: 46px;
    font-size: var(--fs-body);
  }

  .nav-link::after {
    display: none;
  }

  .nav-link.active {
    background: var(--surface-2);
  }

  .nav-more summary {
    width: 100%;
  }

  .nav-more-list {
    position: static;
    min-width: 0;
    margin-top: 2px;
    background: var(--surface-2);
    box-shadow: none; /* taste-skill-ignore: тень есть только у всплывающего слоя */
  }

  .nav-lang {
    margin: 8px 0 0;
    padding: 8px 0 0;
    border-left: 0;
    border-top: 2px solid var(--line, currentColor);
  }

  .nav-lang a {
    flex: 1;
    min-height: 46px;
    font-size: var(--fs-body);
  }

  .nav-lang {
    flex-wrap: wrap;
  }

  /* В мобильном меню группы «Ещё» идут в две колонки, чтобы список был короче */
  .nav-more details[open] .nav-more-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 4px;
    box-shadow: none; /* taste-skill-ignore: в мобильном меню список стоит в потоке */
  }

  .nav-more-list a {
    min-height: 44px;
    padding-inline: 10px;
  }

  .lang-hint {
    position: static;
    flex-basis: 100%;
    width: auto;
    margin-top: 8px;
    background: var(--surface-2);
    box-shadow: none; /* taste-skill-ignore: в мобильном меню подсказка стоит в потоке */
  }
}

@media (max-width: 1020px) {
  .footer-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-grid,
  .section-head,
  .contact-grid,
  .lesson {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 760px) {
  .cta-panel {
    flex-direction: column;
    align-items: flex-start;
  }

  .sources .list {
    columns: 1;
  }
}

@media (max-width: 640px) {
  .hero-actions .btn,
  .cta-actions .btn,
  .continue-links .btn {
    width: 100%;
  }

  .flow-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 360px) {
  .code-head {
    flex-wrap: wrap;
  }
}

/* Длинные казахские слова («Пайдаланушылардың») не помещаются в заголовок панели на экране 320 px:
   на самых узких экранах он чуть меньше, слово не разбивается */
@media (max-width: 340px) {
  [data-band="white"] main .panel > h2 {
    font-size: 1.375rem;
  }
}

/* ==================================================================
   Плакат: плоские поля цвета, самый тяжёлый шрифт, у каждого раздела своё поле
   ================================================================== */
[data-band="yellow"] { --band: #ffd249; }
[data-band="pink"] { --band: #ffc4ef; }
[data-band="cyan"] { --band: #a4f6f8; }
[data-band="orange"] { --band: #f9a21f; }
[data-band="white"] { --band: #eeeeee; }

/* Цвет раздела окрашивает и его поверхности: у каждой страницы курса свой */
body {
  --surface: var(--band);
  --surface-2: color-mix(in srgb, var(--band) 45%, #ffffff);
  --surface-3: color-mix(in srgb, var(--band) 72%, #ffffff);
}

:root[data-theme="dark"] body:not(.home) {
  --surface: color-mix(in srgb, var(--band) 11%, var(--bg));
  --surface-2: color-mix(in srgb, var(--band) 19%, var(--bg));
  --surface-3: color-mix(in srgb, var(--band) 28%, var(--bg));
}

/* Всё, что лежит на цветном поле: чёрный текст и белые вкладки в обеих темах */
.field-yellow,
.field-white,
.field-pink,
.field-cyan,
.field-orange,
.page-band,
.not-found,
.site-header,
.footer,
.lesson,
body:not(.home) main > .section:nth-of-type(3n + 2) {
  --bg: #ffffff;
  --text: #0a0a0a;
  --muted: #0a0a0a;
  --mark: #0a0a0a;
  --line: rgba(10, 10, 10, 0.24);
  --line-strong: rgba(10, 10, 10, 0.5);
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: rgba(255, 255, 255, 0.62);
  --field-bg: #ffffff;
  --code-inline: #0a0a0a;
  --success: #0a0a0a;
  --danger: #8a120c;
  color: #0a0a0a;
  color-scheme: light;
}

body:not(.home) main > .section:nth-of-type(3n + 2) {
  --surface-2: color-mix(in srgb, var(--band) 45%, #ffffff);
  --surface-3: color-mix(in srgb, var(--band) 72%, #ffffff);
  background: var(--band);
}

.field-white,
.site-header,
.footer {
  --surface-2: #eeeeee;
  --surface-3: #dddddd;
}

.field-yellow { background: #ffd249; }
.field-white { background: #ffffff; }
.field-pink { background: #ffc4ef; }
.field-cyan { background: #a4f6f8; }
.field-orange { background: #f9a21f; }

.field-blue,
.cta-panel {
  --text: #ffffff;
  --muted: #ffffff;
  --mark: #ffd249;
  background: #306998;
  color: #ffffff;
}

.field-ink {
  --text: #ffd249;
  --muted: #ffd249;
  background: #0a0a0a;
  color: #ffd249;
}

/* Главная всегда плакат: тема меняет только страницы для чтения */
.home {
  --bg: #ffffff;
  --text: #0a0a0a;
  --muted: #0a0a0a;
  --mark: #0a0a0a;
  --line: rgba(10, 10, 10, 0.24);
  --line-strong: rgba(10, 10, 10, 0.5);
  --surface: #ffffff;
  --surface-2: #ffffff;
  --surface-3: #eeeeee;
  --code-inline: #0a0a0a;
  background: #ffffff;
  color: #0a0a0a;
  color-scheme: light;
}

.home .theme-toggle {
  display: none;
}

.code-block,
.window {
  color-scheme: dark;
}

/* ---------- Тяжёлый узкий шрифт ---------- */
.hero-title,
.band-title,
.slogan,
.words,
.brand,
.page-hero h1,
.section-head h2,
.sources h2,
.lesson h2,
.compare-card h3,
.cta-panel h2,
.part-bar strong,
.idea h3,
.tile-text h3,
.faq-band h3,
.stage-block,
.mark span,
.poster-out span,
.lineup span:first-child,
.not-found .code-404 {
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: 0;
}

.hero-title,
.band-title,
.slogan,
.words,
.brand,
.page-hero h1,
.part-bar strong,
.stage-block,
.poster-out span,
.lineup span:first-child {
  text-transform: uppercase;
}

/* ---------- Шапка: продолжает верхнее поле страницы ---------- */
.site-header {
  background: var(--band);
}

.brand {
  font-size: var(--step-tile);
  line-height: 1;
}

.nav-link {
  font-weight: 500;
}

.burger,
.search-toggle,
.theme-toggle,
.to-top,
.rail-toggle {
  background: #0a0a0a;
  color: #ffffff;
}

.burger span {
  background: #ffffff;
}

@media (hover: hover) and (pointer: fine) {
  .burger:hover,
  .search-toggle:hover,
  .theme-toggle:hover,
  .to-top:hover,
  .rail-toggle:hover {
    background: #306998;
  }
}

#progress {
  background: #0a0a0a;
}

/* ---------- Кнопки: плоские, синие цвета Python ---------- */
.btn {
  font-weight: 600;
}

.btn-primary {
  background: #306998;
  color: #ffffff;
}

.field-blue .btn-primary,
.cta-panel .btn-primary {
  background: #ffd249;
  color: #0a0a0a;
}

.cta-panel .btn-secondary {
  background: #ffffff;
  color: #0a0a0a;
}

@media (hover: hover) and (pointer: fine) {
  /* Чёрная заливка поднимается снизу, поле кнопки остаётся под ней */
  .btn-primary:hover {
    background: #306998;
    color: #ffffff;
  }

  .field-blue .btn-primary:hover,
  .cta-panel .btn-primary:hover {
    background: #ffd249;
    color: #ffffff;
  }

  .cta-panel .btn-secondary:hover {
    background: #0a0a0a;
    color: #ffffff;
  }
}

.hero-actions .btn,
.cta-open .btn {
  min-height: 64px;
  padding-inline: 36px;
  font-size: var(--fs-lead);
}

/* В тёмных блоках кода кнопка запуска всегда жёлтая */
.run-btn {
  background: #ffd249;
  color: #0a0a0a;
}

@media (hover: hover) and (pointer: fine) {
  .run-btn:hover {
    background: #ffffff;
  }
}

/* ---------- Шапка раздела курса: поле своего цвета ---------- */
.page-band {
  background: var(--band);
}

.page-hero {
  padding-block: clamp(16px, 2.4vw, 32px) clamp(32px, 4.4vw, 64px);
}

.page-hero h1 {
  margin: 0 0 clamp(14px, 2vw, 24px);
  font-size: var(--fs-title);
  line-height: 0.84;
}

/* «Конфиденциальности» не разбивается: заголовок юридических страниц чуть меньше на узких экранах */
[data-band="white"] .page-hero h1 {
  font-size: min(var(--fs-title), 10.6vw);
}

.page-hero .lead {
  max-width: 46ch;
}

.breadcrumb a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
}

.page-hero--picture {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: clamp(24px, 4vw, 56px);
}

.page-hero--picture > * {
  grid-column: 1;
}

.page-hero--picture .breadcrumb,
.page-hero--picture h1 {
  grid-column: 1 / -1;
}

.page-hero--picture .band-picture {
  grid-column: 2;
  grid-row: 3 / span 6;
  align-self: start;
  justify-self: end;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(50svh, 400px);
  margin-top: 8px;
  rotate: 2.5deg;
  mix-blend-mode: multiply;
  filter: contrast(1.12);
}

[data-band="white"] main .panel {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  column-gap: clamp(24px, 4vw, 56px);
}

[data-band="white"] main .panel > * {
  grid-column: 2;
}

[data-band="white"] main .panel > h2,
[data-band="white"] main .panel > h3 {
  grid-column: 1;
  grid-row: 1 / span 12;
  margin: 0;
}

.contact-grid .section-head {
  grid-template-columns: minmax(0, 1fr);
}

.page-band .progress-box {
  margin: clamp(18px, 2vw, 28px) 0 0;
}

/* Заголовки учебных страниц: регистр как в тексте, потому что в них бывает код */
.section-head h2,
.sources h2,
.cta-panel h2 {
  font-size: var(--step-mid);
  line-height: 1;
}

.lesson h2 {
  font-size: var(--step-tile);
  line-height: 1;
}

.compare-card h3 {
  font-size: var(--step-mid);
  line-height: 1;
}

.section-head h2 code,
.lesson h2 code {
  font-size: 0.72em;
  text-transform: none;
}

/* Уроки «С нуля»: у каждого своё поле */
.lesson {
  padding: clamp(20px, 3vw, 44px);
}

.project-steps .lesson:nth-child(4n + 1) { background: #ffd249; }
.project-steps .lesson:nth-child(4n + 2) { background: #ffc4ef; }
.project-steps .lesson:nth-child(4n + 3) { background: #a4f6f8; }
.project-steps .lesson:nth-child(4n + 4) { background: #f9a21f; }

/* ---------- Главный экран ---------- */
.poster-hero {
  --hero-size: min(19vw, 31svh, 17.2rem);
  padding-block: calc(var(--hero-size) * 0.2) clamp(28px, 3.4vw, 48px);
  overflow-x: clip;
}

.poster-hero .container {
  position: relative;
}

/* Заголовок лежит поверх гравюры: змея проползает за буквами */
.hero-title {
  position: relative;
  z-index: 2;
  font-size: var(--hero-size);
  line-height: 0.74;
  white-space: nowrap;
}

/* «Алғашқы сайт» длиннее «Первый сайт»: уменьшаем, чтобы строка помещалась целиком */
html[lang="kk"] .hero-title {
  font-size: calc(var(--hero-size) * 0.76);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-sticker {
  position: absolute;
  z-index: 1;
  right: clamp(-12px, -1vw, 0px);
  top: calc(var(--hero-size) * 0.3);
  width: calc(var(--hero-size) * 1.3);
  height: auto;
  rotate: -5deg;
  mix-blend-mode: multiply;
}

.poster-hero .hero-grid {
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(20px, 3vw, 40px);
  margin-top: clamp(14px, 1.6vw, 24px);
}

.poster-hero .lead {
  max-width: 32ch;
  line-height: 1.35;
}

.poster-hero .hero-actions {
  margin-top: 20px;
}

.poster-hero .hero-hint {
  margin-top: 12px;
  font-size: var(--fs-body);
}

.hero-live {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: 8px;
}

.hero-live .code-block {
  display: flex;
  flex-direction: column;
}

.hero-live .code-edit {
  flex: 1;
  min-height: 140px;
  font-size: var(--fs-body);
}

.poster-out {
  display: flex;
  align-items: flex-end;
  min-height: 200px;
  padding: clamp(16px, 2vw, 24px);
  overflow: hidden;
}

.poster-out span {
  display: block;
  font-size: var(--step-mid);
  line-height: 0.95;
  overflow-wrap: anywhere;
}

.hero-note {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  font-size: var(--fs-body);
}

/* ---------- Плитки ---------- */
.band {
  padding-block: clamp(48px, 7vw, 104px);
}

.band-title {
  margin: 0 0 clamp(28px, 4vw, 56px);
  font-size: var(--step-head);
  line-height: 0.84;
}

.band-title--mid {
  font-size: var(--step-mid);
  line-height: 1;
}

/* У казахских букв есть хвосты (Ң, Қ, Ғ) и значки сверху (Й, Ә, Ө): при плотной строке
   они залезают в соседнюю, и «сайтыңызға» читается как «ҫайтыңызға» */
html[lang="kk"] h2,
html[lang="kk"] h3,
html[lang="kk"] .band-title,
html[lang="kk"] .slogan,
html[lang="kk"] .page-hero h1 {
  line-height: 1.14;
}

html[lang="kk"] .hero-title {
  line-height: 0.92;
}

html[lang="kk"] .poster-out span {
  line-height: 1.12;
}

html[lang="kk"] .band-title--mid {
  line-height: 1.08;
}

.board {
  padding-block: 8px;
  background: #ffffff;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(220px, 34svh));
  gap: 8px;
}

.tile {
  display: flex;
  align-items: flex-end;
  min-width: 0;
  padding: clamp(16px, 2vw, 28px);
  overflow: hidden;
}

.tile-a {
  grid-column: 1 / span 8;
  grid-row: 1 / span 2;
}

.tile-b {
  grid-column: 9 / span 4;
  grid-row: 1;
}

.tile-c {
  grid-column: 9 / span 4;
  grid-row: 2;
  padding: 0;
  isolation: isolate;
}

.tile-c img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 78% 50%;
  mix-blend-mode: multiply;
  filter: contrast(1.12);
}

.slogan {
  margin: 0;
  font-size: var(--step-head);
  line-height: 0.84;
}

.slogan span {
  display: block;
}

.slogan .m {
  overflow: hidden;
  padding-block: 0.12em 0.06em;
  margin-block: -0.12em -0.06em;
}

.tile-b .slogan span:last-child {
  font-size: var(--step-mid);
  line-height: 1;
}

.tile-text {
  display: grid;
  align-items: start;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: clamp(32px, 4vw, 56px) 0;
}

.tile-text h3 {
  grid-column: 1 / span 4;
  margin: 0;
  font-size: var(--step-tile);
  line-height: 1;
}

.tile-text p {
  grid-column: 6 / -1;
  margin: 0;
  font-size: var(--fs-lead);
  line-height: 1.4;
  max-width: 46ch;
}

/* ---------- План как одна полоса: ширина отрезка следует за объёмом шага ---------- */
.stage-bar {
  display: grid;
  grid-template-columns: minmax(190px, 7fr) minmax(190px, 8fr) minmax(190px, 3fr) minmax(190px, 3fr) minmax(190px, 6fr);
  gap: 6px;
}

.timeline-item.stage {
  display: block;
  padding: 0;
  background: none;
}

.stage-block {
  display: block;
  min-height: 20vh;
  padding: 16px;
  font-size: var(--step-tile);
  line-height: 1;
}

.stage .timeline-content {
  padding: 16px 12px 0 0;
}

.stage .timeline-content h3 {
  font-size: var(--fs-h3);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.is-done .stage-block {
  color: #ffd249;
}

.is-done .step-check {
  color: inherit;
}

/* ---------- Доска снимков: снимок напечатан чёрным по цветному полю ---------- */
.parts-board {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: clamp(84px, 7.4vw, 112px);
  gap: 8px;
}

.part-head {
  grid-column: 1 / span 6;
  grid-row: span 2;
  padding: 8px 0;
}

.part-head .band-title {
  margin: 0 0 10px;
  font-size: var(--step-mid);
  line-height: 1;
}

.part-head p {
  margin: 0;
}

.part {
  position: relative;
  display: block;
  min-width: 0;
  overflow: hidden;
  isolation: isolate;
  color: #0a0a0a;
  text-decoration: none;
}

.part img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: multiply;
  filter: contrast(1.12);
}

.part-route {
  grid-column: 7 / span 6;
  grid-row: 1 / span 4;
}

.part-server {
  grid-column: 1 / span 6;
  grid-row: 3 / span 4;
}

.part-server img {
  object-position: 78% 40%;
}

.part-base {
  grid-column: 7 / span 3;
  grid-row: 5 / span 4;
}

.part-frame {
  grid-column: 10 / span 3;
  grid-row: 5 / span 4;
}

.part-frame img {
  object-position: 42% 20%;
}

.part-more {
  grid-column: 1 / span 6;
  grid-row: 7 / span 2;
  display: flex;
  align-items: flex-end;
  padding: clamp(16px, 2vw, 24px);
}

.part-more p {
  margin: 0;
  font-family: var(--display);
  font-size: var(--step-tile);
  font-weight: 900;
  line-height: 1;
}

.part-bar {
  position: absolute;
  z-index: 1;
  left: 0;
  bottom: 0;
  display: grid;
  gap: 2px;
  max-width: min(92%, 30em);
  padding: 10px 14px 12px;
  transition: transform 200ms var(--ease-out);
}

.part-bar strong {
  font-size: var(--step-tile);
  line-height: 1;
}

.part-bar span {
  font-size: var(--fs-small);
  line-height: 1.35;
}

/* ---------- Что внутри: таблица на всю ширину ---------- */
.lineup {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lineup li {
  max-width: none;
  border-top: 2px solid #0a0a0a;
}

.lineup li:last-child {
  border-bottom: 2px solid #0a0a0a;
}

.lineup a {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 6fr) minmax(0, 2fr);
  gap: 2px 24px;
  align-items: baseline;
  padding: 8px;
  margin-inline: -8px;
  font-size: var(--fs-h3);
  line-height: 1.2;
  color: inherit;
  text-decoration: none;
  transition: color 120ms ease;
}

.lineup span:first-child {
  font-size: var(--step-tile);
  line-height: 1;
}

.lineup span:last-child {
  text-align: right;
}

@media (hover: hover) and (pointer: fine) {
  .lineup a:hover {
    color: #ffffff;
  }

  .words a:hover {
    color: #ffffff;
  }

  .part:hover .part-bar {
    transform: translateY(-4px);
  }
}

/* ---------- Слова: стена из терминов ---------- */
.words {
  display: flex;
  flex-wrap: wrap;
  gap: 0.02em 0.28em;
  font-size: var(--step-head);
  line-height: 0.9;
}

/* Хвосты Қ и J не должны касаться следующей строки */
html[lang="kk"] .words {
  line-height: 1.04;
}

.words a {
  color: inherit;
  text-decoration: none;
  transition: color 120ms ease;
}

/* ---------- Идеи: плитки разной ширины ---------- */
.ideas {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.idea {
  min-width: 0;
  padding: clamp(20px, 2.4vw, 32px);
}

.idea:nth-child(1) { flex: 5 1 320px; }
.idea:nth-child(2) { flex: 3 1 240px; }
.idea:nth-child(3) { flex: 4 1 280px; }
.idea:nth-child(4) { flex: 7 1 320px; }

.idea h3 {
  margin: 0 0 clamp(32px, 5vw, 72px);
  font-size: var(--step-tile);
  line-height: 1;
}

.idea p {
  margin: 0;
}

/* Идея без инструкции на сайте: ученик делает её сам */
.idea .idea-tag {
  margin-top: 16px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---------- Вопросы: у каждого своя полоса ---------- */
.faq-head {
  display: flex;
  align-items: flex-end;
  min-height: 32svh;
  padding-block: clamp(32px, 4vw, 56px);
}

.faq-head .band-title {
  margin: 0;
}

.faq-band {
  padding-block: clamp(24px, 3.4vw, 48px);
}

.faq-band .container {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 10px clamp(28px, 5vw, 72px);
}

.faq-band h3 {
  margin: 0;
  font-size: var(--step-tile);
  line-height: 1.02;
}

.faq-band p {
  margin: 0;
  max-width: 58ch;
}

.home .sources-band {
  padding-block: clamp(32px, 4vw, 56px) clamp(64px, 7vw, 72px);
}

body:not(.home) main {
  padding-bottom: clamp(72px, 9vw, 120px);
}

.home .sources {
  padding: 0;
  background: none;
}

.home .continue-box {
  background: #a4f6f8;
}

/* ---------- Финал: первый шаг уже открыт ---------- */
.cta-open {
  padding-block: clamp(64px, 5.6vw, 80px);
}

.cta-open .container {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(20px, 2.4vw, 32px) clamp(28px, 5vw, 72px);
  align-items: start;
}

.cta-open .band-title {
  position: relative;
  z-index: 2;
  grid-column: 1 / -1;
  margin: 0;
  font-size: min(15.2vw, 13.8rem);
  white-space: nowrap;
}

/* Fira Sans Extra Condensed шире Sofia: «Қазір бастаңыз» не должна вылезать за экран */
html[lang="kk"] .cta-open .band-title {
  font-size: min(12.9vw, 11.7rem);
}

.cta-side p {
  margin: 0;
  font-size: var(--fs-lead);
  line-height: 1.35;
}

.sticker {
  width: min(340px, 72%);
  height: auto;
  margin: 8px 0 clamp(16px, 2vw, 24px);
  rotate: 4deg;
  mix-blend-mode: multiply;
}

.cta-try {
  display: grid;
  gap: 12px;
  justify-items: start;
}

.cta-try .code-block {
  width: 100%;
}

.cta-try .code-edit {
  min-height: 190px;
  font-size: var(--fs-body);
}

/* ---------- Подвал: имя, собранное из блоков ---------- */
.footer {
  margin-top: 0;
  padding-block: 8px 40px;
  background: #ffffff;
}

.mark {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: clamp(120px, 28svh, 300px);
  margin-bottom: clamp(32px, 4vw, 56px);
}

.mark span {
  flex: 1 1 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  padding-bottom: 0.05em;
  overflow: hidden;
  font-size: min(12.6vw, 11.4rem);
  line-height: 0.8;
}

.mark span:nth-child(5n + 1) { height: 100%; background: #ffd249; }
.mark span:nth-child(5n + 2) { height: 72%; background: #ffc4ef; }
.mark span:nth-child(5n + 3) { height: 88%; background: #a4f6f8; }
.mark span:nth-child(5n + 4) { height: 64%; background: #f9a21f; }
.mark span:nth-child(5n + 5) { height: 80%; background: #306998; color: #ffffff; }

.footer-links {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.footer-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.footer-links strong {
  display: block;
  margin-bottom: 10px;
}

.footer-copy {
  margin: 0 0 8px;
  font-weight: 600;
}

.not-found {
  padding-block: clamp(24px, 4vw, 56px);
  background: var(--band);
  text-align: left;
}

.not-found .code-404 {
  font-size: min(40vw, 30rem);
  line-height: 0.8;
  letter-spacing: 0;
  color: inherit;
}

.not-found h1 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: var(--step-head);
  font-weight: 900;
  line-height: 0.84;
  letter-spacing: 0;
  text-transform: uppercase;
}

.not-found .lead {
  margin-inline: 0;
}

.not-found .hero-actions {
  justify-content: flex-start;
}

/* ---------- Движение на плакате ----------
   Сайт двигается как двухкрасочная печать: сначала цвет, затем чёрный оттиск. Жестов четыре:
   подъём  — тяжёлый заголовок выходит из-под своей базовой линии;
   плашка  — цветное поле прокатывается снизу вверх, а за ним ложится снимок;
   штамп   — гравюра или итог опускается на лист;
   заливка — краска заполняет строку или кнопку под курсором.
   Разделы курса открывают часто, поэтому их текст анимации не ждёт: в них двигаются только
   шапка и заголовки у самого края экрана, где их ещё никто не читает. */

/* Подъём без лишней разметки: рамка обрезки идёт навстречу сдвигу, поэтому её нижний край стоит на месте.
   Запас в 0,3em нужен, чтобы не срезать хвосты букв и краткую над «Й» */
@keyframes mask-rise {
  from {
    transform: translateY(100%);
    clip-path: inset(0.3em -1em calc(100% - 0.3em) -1em);
  }

  to {
    transform: translateY(0);
    clip-path: inset(-0.5em -1em -0.3em -1em);
  }
}

@keyframes plate-in {
  from {
    clip-path: inset(100% 0 0 0);
  }

  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Чёрный оттиск ложится со сдвигом и совмещается с цветом, как при печати */
@keyframes ink-in {
  from {
    opacity: 0;
    translate: 14px -10px;
  }

  to {
    opacity: 1;
    translate: 0 0;
  }
}

@keyframes bar-in {
  from {
    transform: translateY(101%);
  }
}

@keyframes roll-in {
  from {
    clip-path: inset(-2px 100% -2px -8px);
  }

  to {
    clip-path: inset(-2px -8px -2px -8px);
  }
}

@keyframes stamp {
  from {
    opacity: 0;
    scale: 1.16;
    rotate: calc(var(--tilt, 0deg) - 6deg);
  }

  to {
    opacity: 1;
    scale: 1;
    rotate: var(--tilt, 0deg);
  }
}

@keyframes number-stamp {
  from {
    opacity: 0;
    scale: 1.3;
  }
}

@keyframes snake-crawl {
  to {
    transform: translateX(-16%) rotate(7deg);
  }
}

@keyframes run-bar {
  from {
    transform: translateX(-100%);
  }

  to {
    transform: translateX(100%);
  }
}

@keyframes output-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.hero-sticker { --tilt: -5deg; }
.sticker { --tilt: 4deg; }
.band-picture { --tilt: 2.5deg; }

@media (prefers-reduced-motion: no-preference) {
  /* Переход между страницами: лист нового раздела накрывает старый снизу вверх, назад уходит тем же путём */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
    mix-blend-mode: normal;
  }

  ::view-transition-new(root) {
    animation: plate-in 300ms var(--ease-in-out) both;
  }

  html:active-view-transition-type(back)::view-transition-old(root) {
    z-index: 1;
    animation: plate-in 300ms var(--ease-in-out) reverse both;
  }

  html:active-view-transition-type(back)::view-transition-new(root) {
    animation: none;
  }

  /* Главный экран: строки поднимаются, гравюра ложится, затем фраза и окно кода */
  .hero-title .line > span {
    animation: line-up 900ms var(--ease-out) both;
  }

  .hero-title .line:nth-child(2) > span {
    animation-delay: 110ms;
  }

  .hero-grid > * {
    animation: rise-in 600ms var(--ease-out) 520ms both;
  }

  .hero-sticker {
    animation: stamp 520ms var(--ease-out) 420ms backwards;
  }

  /* Лист с выводом программы печатается последним: цвет, потом буквы */
  .poster-out {
    animation: plate-in 640ms var(--ease-in-out) 760ms backwards;
  }

  .poster-out > span {
    animation: mask-rise 640ms var(--ease-out) 1080ms backwards;
  }

  /* Шапка раздела курса: тот же подъём, но короче, потому что её видят часто */
  .page-hero h1,
  .not-found h1 {
    animation: mask-rise 640ms var(--ease-out) backwards;
  }

  .not-found .code-404 {
    animation: mask-rise 900ms var(--ease-out) backwards;
  }

  .not-found h1 {
    animation-delay: 140ms;
  }

  .band-picture {
    animation: stamp 480ms var(--ease-out) 140ms backwards;
  }

  /* Заголовки на главной поднимаются при прокрутке.
     До появления блок скрыт только прозрачностью: обрезка на нём самом не дала бы сработать IntersectionObserver,
     и он остался бы пустым навсегда. Обрезку включает уже сама анимация */
  .js-reveal .home .band-title.reveal,
  .js-reveal .home .faq-band h3.reveal,
  .js-reveal .home .words a.reveal {
    transition: color 120ms ease;
  }

  .js-reveal .home .band-title.reveal:not(.visible),
  .js-reveal .home .faq-band h3.reveal:not(.visible),
  .js-reveal .home .words a.reveal:not(.visible),
  .js-reveal .home .part-head:not(.visible) .band-title {
    opacity: 0;
    transform: none;
  }

  .js-reveal .home .band-title.visible,
  .js-reveal .home .part-head.visible .band-title {
    animation: mask-rise 900ms var(--ease-out) calc(var(--i, 0) * 70ms) backwards;
  }

  .js-reveal .home .faq-band h3.visible {
    animation: mask-rise 640ms var(--ease-out) backwards;
  }

  .js-reveal .home .words a.visible {
    animation: mask-rise 640ms var(--ease-out) calc(var(--i, 0) * 45ms) backwards;
  }

  /* В блоке с заголовком сдвигается только подпись: заголовок уже поднимается сам */
  .js-reveal .home .part-head.reveal:not(.visible) {
    opacity: 1;
    transform: none;
  }

  .js-reveal .home .part-head:not(.visible) p {
    opacity: 0;
  }

  .js-reveal .home .part-head.visible p {
    animation: rise-in 600ms var(--ease-out) 320ms backwards;
  }

  /* Цветные плитки: поле прокатывается, снимок совмещается с ним, подпись выезжает последней */
  .js-reveal .home .tile-a.reveal,
  .js-reveal .home .tile-b.reveal,
  .js-reveal .home .tile-c.reveal,
  .js-reveal .home .part.reveal,
  .js-reveal .home .part-more.reveal,
  .js-reveal .home .idea.reveal,
  .js-reveal .home .lineup li.reveal {
    transition: background-color 200ms ease;
  }

  .js-reveal .home .tile-a.reveal:not(.visible),
  .js-reveal .home .tile-b.reveal:not(.visible),
  .js-reveal .home .tile-c.reveal:not(.visible),
  .js-reveal .home .part.reveal:not(.visible),
  .js-reveal .home .part-more.reveal:not(.visible),
  .js-reveal .home .idea.reveal:not(.visible) {
    opacity: 0;
    transform: none;
  }

  .js-reveal .home .tile-a.visible,
  .js-reveal .home .tile-b.visible,
  .js-reveal .home .tile-c.visible,
  .js-reveal .home .part.visible,
  .js-reveal .home .part-more.visible,
  .js-reveal .home .idea.visible {
    animation: plate-in 700ms var(--ease-in-out) calc(var(--i, 0) * 70ms) backwards;
  }

  .js-reveal .home .tile-c.visible img,
  .js-reveal .home .part.visible img {
    animation: ink-in 520ms var(--ease-out) calc(var(--i, 0) * 70ms + 400ms) backwards;
  }

  .js-reveal .home .part.visible .part-bar {
    animation: bar-in 480ms var(--ease-out) calc(var(--i, 0) * 70ms + 560ms) backwards;
  }

  .js-reveal .home .tile-b.visible .slogan span:first-child {
    transform-origin: left bottom;
    animation: number-stamp 520ms var(--ease-out) calc(var(--i, 0) * 70ms + 320ms) backwards;
  }

  /* Лозунг на чёрном поле начинается, когда поле уже открылось */
  .slogan .m > span {
    transition: transform 900ms var(--ease-out) 240ms;
  }

  .slogan .m:nth-child(2) > span {
    transition-delay: 350ms;
  }

  .js-reveal .home .tile-a:not(.visible) .slogan .m > span {
    transform: translateY(105%);
  }

  /* Строки «Что внутри» прокатываются слева направо вместе со своей линейкой */
  .js-reveal .home .lineup li.reveal:not(.visible) {
    opacity: 0;
    transform: none;
  }

  .js-reveal .home .lineup li.visible {
    animation: roll-in 600ms var(--ease-in-out) calc(var(--i, 0) * 45ms) backwards;
  }

  /* Вторая гравюра опускается тем же штампом */
  .js-reveal .home .sticker.reveal {
    transition: none;
  }

  .js-reveal .home .sticker.reveal:not(.visible) {
    opacity: 0;
    transform: none;
  }

  .js-reveal .home .sticker.visible {
    animation: stamp 520ms var(--ease-out) calc(var(--i, 0) * 70ms) backwards;
  }

  /* Отрезки плана заполняются слева направо, как полоса загрузки */
  .stage-block {
    transition: clip-path 700ms var(--ease-in-out), color 200ms ease;
    transition-delay: calc(var(--i, 0) * 90ms), 0s;
  }

  .js-reveal .home .stage:not(.visible) .stage-block {
    clip-path: inset(0 100% 0 0);
  }

  /* Блоки имени вырастают снизу один за другим. У наведения своя задержка, нулевая */
  .mark span {
    transform-origin: center bottom;
    transition: clip-path 700ms var(--ease-in-out), scale 200ms var(--ease-out);
    transition-delay: calc(var(--n, 0) * 45ms), 0s;
  }

  .mark span:nth-child(2) { --n: 1; }
  .mark span:nth-child(3) { --n: 2; }
  .mark span:nth-child(4) { --n: 3; }
  .mark span:nth-child(5) { --n: 4; }
  .mark span:nth-child(6) { --n: 5; }
  .mark span:nth-child(7) { --n: 6; }
  .mark span:nth-child(8) { --n: 7; }
  .mark span:nth-child(9) { --n: 8; }
  .mark span:nth-child(10) { --n: 9; }

  .js-reveal .mark:not(.visible) span {
    clip-path: inset(100% 0 0 0);
  }

  /* Ответы, которых ждали: появление вывода, решённая задача, сертификат */
  .run-output:not([hidden]) {
    animation: output-in 180ms var(--ease-out);
  }

  .run-btn:disabled::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: #0a0a0a;
    animation: run-bar 1100ms linear infinite;
  }

  .task.just-solved h3::after {
    animation: stamp 420ms var(--ease-out) backwards;
  }

  #certificate:not([hidden]) {
    animation: plate-in 700ms var(--ease-in-out) backwards;
  }

  @media (hover: hover) and (pointer: fine) {
    .part img {
      transition: scale 300ms var(--ease-out);
    }

    .part:hover img {
      scale: 1.04;
    }

    .mark span:hover {
      scale: 1 1.07;
    }
  }

  /* То, что привязано к прокрутке, работает без скриптов и вне основного потока */
  @supports (animation-timeline: view()) {
    /* Снимки чуть приближаются к зрителю */
    .tile-c img,
    .part img {
      animation: picture-settle linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 45%;
    }

    .js-reveal .home .tile-c.visible img,
    .js-reveal .home .part.visible img {
      animation:
        picture-settle linear both,
        ink-in 520ms var(--ease-out) calc(var(--i, 0) * 70ms + 400ms) backwards;
      animation-timeline: view(), auto;
      animation-range: entry 0% cover 45%, normal;
    }

    /* Змея уползает за буквы заголовка, пока первый экран уезжает вверх */
    .hero-sticker {
      animation:
        stamp 520ms var(--ease-out) 420ms backwards,
        snake-crawl linear both;
      animation-timeline: auto, scroll(root);
      animation-range: normal, 0 100vh;
    }

    /* Заголовки учебных страниц к прокрутке не привязаны: mask-rise начинается со сдвига вниз на всю высоту,
       и в Safari (iPhone) анимация от view() иногда застревала — заголовок оставался поверх текста под ним
       до перезагрузки страницы. Подъём заголовков при прокрутке убран, вид страницы тот же */
  }
}

/* ---------- Заливка: одна и та же краска у кнопок и строк ---------- */
.btn-primary,
.lineup a,
.words a,
.course-list a,
.stage-block,
.poster-out {
  position: relative;
  isolation: isolate;
}

.btn-primary {
  overflow: hidden;
  transition: transform 160ms var(--ease-out), color 120ms ease;
}

.btn-primary::before,
.lineup a::before,
.words a::before,
.course-list a::after,
.stage-block::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: #0a0a0a;
  transition: transform 200ms var(--ease-out);
}

.btn-primary::before {
  transform: translateY(101%);
}

/* Строка заливается слева, а краска сходит вправо: движение не возвращается назад */
.lineup a::before,
.course-list a::after {
  transform: scaleX(0);
  transform-origin: right;
}

.words a::before {
  inset: 0.04em -0.08em;
  transform: scaleY(0);
  transform-origin: bottom;
}

.course-list a::after {
  background: var(--surface-2);
}

.stage-block::before {
  transform: scaleX(0);
  transform-origin: left;
  transition-duration: 300ms;
  transition-timing-function: var(--ease-in-out);
}

.is-done .stage-block::before {
  transform: scaleX(1);
}

.lineup a:focus-visible::before {
  transform: scaleX(1);
  transform-origin: left;
}

.lineup a:focus-visible {
  color: #ffffff;
}

.lineup span:first-child {
  transition: translate 200ms var(--ease-out);
}

.part {
  transition: background-color 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover::before {
    transform: translateY(0);
  }

  .lineup a:hover::before,
  .course-list a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
  }

  .lineup a:hover span:first-child {
    translate: 10px 0;
  }

  .words a:hover::before {
    transform: scaleY(1);
  }

  /* Под курсором снимок получает другую краску: чёрный оттиск остаётся, цвет под ним меняется */
  .part-route:hover { background-color: #a4f6f8; }
  .part-server:hover { background-color: #ffd249; }
  .part-base:hover { background-color: #ffc4ef; }
  .part-frame:hover { background-color: #ffd249; }
}

.poster-out > span {
  position: relative;
  z-index: 1;
}

.poster-plate {
  position: absolute;
  inset: 0;
}

.run-btn {
  position: relative;
  overflow: hidden;
}

/* Бургер складывается в крестик */
.burger span {
  transition: transform 200ms var(--ease-out), opacity 120ms ease;
}

.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Меньше движения: краска появляется сразу, а гравюры и шапки только проявляются */
@media (prefers-reduced-motion: reduce) {
  .hero-sticker,
  .band-picture,
  .poster-out {
    animation: fade-in 300ms ease both;
  }

  .btn-primary::before,
  .lineup a::before,
  .words a::before,
  .course-list a::after,
  .stage-block::before,
  .lineup span:first-child,
  .burger span {
    transition: none;
  }

  .lineup a:hover span:first-child {
    translate: none;
  }
}

/* На бумаге всё видно сразу */
@media print {
  .js-reveal .reveal,
  .js-reveal .reveal *,
  .js-reveal .mark span {
    opacity: 1 !important;
    transform: none !important;
    translate: none !important;
    clip-path: none !important;
  }
}

/* ---------- Адаптивность плаката ---------- */
@media (max-width: 1020px) {
  .poster-hero .hero-grid,
  [data-band="white"] main .panel,
  .faq-band .container,
  .cta-open .container,
  .page-hero--picture {
    grid-template-columns: minmax(0, 1fr);
  }

  .page-hero--picture .band-picture {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
    max-height: none;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: 50% 30%;
    margin-top: 20px;
    rotate: 0deg;
  }

  .poster-hero .lead {
    max-width: 44ch;
  }

  [data-band="white"] main .panel > *,
  [data-band="white"] main .panel > h2,
  [data-band="white"] main .panel > h3 {
    grid-column: 1;
    grid-row: auto;
  }

  [data-band="white"] main .panel > h2,
  [data-band="white"] main .panel > h3 {
    margin-bottom: 10px;
  }

  .stage-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage:last-child {
    grid-column: 1 / -1;
  }

  .stage-block {
    min-height: 96px;
  }

  .board-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 6px;
  }

  .tile-a {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 38svh;
  }

  .tile-b,
  .tile-c {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 1;
  }

  .tile-text {
    display: block;
  }

  .tile-text h3 {
    margin-bottom: 14px;
  }

  .parts-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 6px;
  }

  .part-head,
  .part-route,
  .part-server,
  .part-more {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .part-route,
  .part-server {
    aspect-ratio: 4 / 3;
  }

  .part-base,
  .part-frame {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 3 / 4;
  }

  .part-bar {
    max-width: 100%;
    padding: 8px 10px 10px;
  }
}

@media (max-width: 760px) {
  :root {
    --step-head: 15.2vw;
    --fs-title: 12vw;
    --fs-h3: 1.1875rem;
  }

  .hero-sticker {
    top: calc(var(--hero-size) * 0.42);
    right: -6px;
    width: calc(var(--hero-size) * 1.4);
  }

  .hero-live {
    grid-template-columns: minmax(0, 1fr);
  }

  .poster-out {
    min-height: 120px;
  }

  .stage-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .lineup a {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-block: 10px;
  }

  .lineup span:first-child {
    grid-column: 1 / -1;
  }

  .lineup span:nth-child(2),
  .lineup span:last-child {
    font-size: var(--fs-small);
  }

  .footer-links {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .to-top,
  .rail-toggle {
    right: 6px;
    width: 40px;
    height: 40px;
  }

  .to-top {
    bottom: 8px;
  }

  .rail-toggle {
    bottom: 52px;
  }
}

/* Связь без GitHub на странице «Контакты» */
.no-github {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 2px solid var(--line, currentColor);
}

.no-github h3 {
  margin: 0 0 8px;
}

.no-github p {
  margin: 0;
}

/* Поиск по словарю */
.glossary-search-band {
  padding-bottom: 0;
}

.glossary-search {
  display: grid;
  gap: 8px;
  max-width: 560px;
}

.glossary-search label {
  font-weight: 700;
}

.glossary-search .note {
  min-height: 1.5em;
  margin: 0;
}

/* Текст только для скринридеров */
.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;
}

/* Задачи: уровень и подсказки */
.task-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}

.task-head h3 {
  margin-bottom: 0;
}

.level {
  flex: none;
  padding: 2px 10px;
  color: #0a0a0a;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.level-easy { background: #b9f3c4; }
.level-medium { background: #ffd249; }
.level-hard { background: #ffc4ef; }

.hints {
  margin-top: 12px;
}

.hint-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.hint-list li {
  padding: 10px 14px;
  background: var(--surface-2);
}

.hint-list li:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.hint-list li[hidden] {
  display: none;
}

.task .solution {
  margin-top: 12px;
}

/* Первый проект: вкладки систем, снимки результата, скачивание кода */
.os-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.os-tablist [role="tab"] {
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--text);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--fs-small);
  font-weight: 700;
  cursor: pointer;
}

.os-tablist [role="tab"][aria-selected="true"] {
  background: var(--text);
  color: var(--bg, #ffffff);
}

.os-caption {
  margin: 12px 0 6px;
  font-size: var(--fs-small);
  font-weight: 700;
}

/* Со скриптом подпись заменяет вкладка */
.os-tabs.is-tabbed .os-caption {
  display: none;
}

.shot {
  margin: 20px 0 8px;
}

.shot-title {
  margin: 0 0 8px;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.shot img {
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
  border: 2px solid var(--text);
  background: #ffffff;
}

.shot figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--fs-small);
}

/* «Ожидаемый результат» в шаге: черта слева цветом метки, вывод терминала — как блок кода */
.step-result {
  margin: 20px 0 8px;
  padding-left: 16px;
  border-left: 4px solid var(--mark);
}

.step-result-title {
  margin: 0 0 8px;
  font-size: var(--fs-small);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.step-result p {
  margin: 0 0 10px;
}

.step-result > :last-child {
  margin-bottom: 0;
}

/* Вывод не прокручивается вбок: длинные строки переносятся, отступы дерева файлов сохраняются */
.step-output {
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--code-bg);
  color: var(--code-text);
  color-scheme: dark;
  font-family: var(--mono); /* taste-skill-ignore: моноширинный шрифт только для кода */
  font-size: var(--fs-small);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.step-result-note {
  color: var(--muted);
  font-size: var(--fs-small);
}

/* «Проверь себя»: вопросы раскрываются как частые ошибки, но внутри панели — с чертой сверху */
.self-check details {
  padding: 12px 0;
  border-top: 1px solid var(--line-strong);
}

/* В вопросах бывает <code>: при flex текст и код стали бы отдельными элементами и не переносились бы вместе */
.self-check summary {
  display: block;
  position: relative;
  padding-right: 36px;
}

.self-check summary::after {
  position: absolute;
  top: 0;
  right: 0;
}

.self-check details p {
  margin: 10px 0 0;
}

.self-task {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 4px solid var(--mark);
}

.self-task > p {
  margin: 0 0 10px;
}

.self-solution .code-block {
  margin-top: 12px;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  margin-top: 16px;
}

/* «Код после этого шага (.zip)»: между окном кода и «Ожидаемым результатом» */
.project-step > .step-download {
  margin: 14px 0 0;
}

/* «Попробовать в браузере»: окно с адресной строкой */
.try-app {
  margin: 16px 0;
}

.try-app .note {
  margin-top: 8px;
}

.mini-browser {
  margin-top: 12px;
  border: 2px solid var(--text);
  background: #ffffff;
}

.mb-bar {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--surface-2);
  border-bottom: 2px solid var(--text);
}

.mb-address {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  background: var(--surface);
}

.mb-host {
  padding-left: 10px;
  color: var(--muted);
  font-family: var(--font-mono, monospace);
  font-size: 0.875rem;
  white-space: nowrap;
}

.mb-address input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  border: 0;
  padding-inline: 2px 8px;
  font-family: var(--font-mono, monospace);
  font-size: 0.875rem;
}

.mb-back,
.mb-go {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: var(--text);
  color: var(--bg, #ffffff);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mb-go {
  padding-inline: 12px;
}

.mb-back:disabled {
  opacity: 0.4;
  cursor: default;
}

.mini-browser iframe {
  display: block;
  width: 100%;
  height: 320px;
  border: 0;
  background: #ffffff;
}

.mb-status {
  margin: 0;
  padding: 8px 10px;
  border-top: 2px solid var(--text);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-mono, monospace);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}

/* Сертификат: тот же лист в предпросмотре и при печати */
.cert-sheet {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: clamp(20px, 4vw, 48px) 16px;
  border: 3px solid #0a0a0a;
  background: #ffd249;
  color: #0a0a0a;
  text-align: center;
}

.cert-sheet p {
  margin: 0;
}

.cert-brand {
  font-family: var(--display);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.cert-kind {
  font-family: var(--display);
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
}

.cert-name {
  width: 100%;
  padding: 10px 8px;
  background: #ffc4ef;
  font-family: var(--display);
  font-size: clamp(1.75rem, 5vw, 3.25rem);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.cert-text,
.cert-score {
  font-size: clamp(1rem, 2vw, 1.25rem);
}

.cert-note {
  font-size: 0.8125rem;
}

#cert-print {
  display: none;
}

@page cert {
  size: A4 landscape;
  margin: 12mm;
}

@media print {
  html.print-cert body > *:not(#cert-print) {
    display: none !important;
  }

  html.print-cert body {
    background: #ffffff;
  }

  html.print-cert #cert-print {
    display: block;
    page: cert;
  }

  html.print-cert .cert-sheet {
    min-height: 180mm;
    align-content: center;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
