/* =========================================================
   Ассоциация — базовые стили
   Палитра и типографика в духе anthropic.com:
   тёплый слоновая кость + графит + глиняный акцент.
   ========================================================= */

/* ---------- Шрифты (локально, без Google — не зависим от блокировок и замедлений) ----------
   Oswald — узкий афишный для заголовков (как титры графического романа), Pangolin — «рукописный»
   для плашек-повествований и реплик, Inter — для основного текста.
   Вариативные woff2: один файл покрывает все нужные толщины. Браузер по unicode-range
   качает только наборы символов, которые есть на странице. Имена с версией → кешируются навсегда. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-cyrillic-v20.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-latin-v20.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: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-cyrillic-ext-v20.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: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/inter-latin-ext-v20.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/oswald-cyrillic-v57.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Oswald";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/oswald-latin-v57.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: "Oswald";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/oswald-cyrillic-ext-v57.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: "Oswald";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/oswald-latin-ext-v57.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pangolin-cyrillic-v12.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pangolin-latin-v12.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: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pangolin-cyrillic-ext-v12.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: "Pangolin";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pangolin-latin-ext-v12.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Токены ---------- */
:root {
  /* Палитра «графический роман»: старая бумага, чернила, ржавчина, охра контрового света */
  --c-paper: #ece2cb;
  --c-paper-light: #f5eedd;
  --c-paper-2: #e2d4b4;
  --c-paper-3: #cdb98f;
  --c-ink: #1b1611;
  --c-ink-2: #3a2f25;
  --c-muted: #5d5140;
  --c-rust: #9a3b20;
  --c-rust-dark: #7a2d17;
  --c-ochre: #d7a246;
  --c-ochre-light: #eac681;
  --c-olive: #5c6136;
  --c-denim: #4a5a6f;
  --c-night: #1c1813;
  --c-night-2: #2b241c;

  --bg: var(--c-paper);
  --bg-alt: var(--c-paper-2);
  --surface: var(--c-paper-light);
  --text: var(--c-ink);
  --text-muted: var(--c-muted);
  --border: rgb(27 22 17 / 0.3);
  --accent: var(--c-rust);

  /* Рамки и тени «панелей комикса»: чернильный контур + жёсткая сдвинутая тень, как в печати */
  --ink-line: 2px solid var(--c-ink);
  --ink-line-bold: 3px solid var(--c-ink);
  --shadow-panel: 5px 5px 0 var(--c-ink);
  --shadow-panel-lg: 8px 8px 0 var(--c-ink);

  /* Бумажное зерно: шум SVG с прозрачностью — без картинок и без mix-blend (дёшево для GPU) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .11 0 0 0 0 .08 0 0 0 0 .05 1.7 0 0 0 -.78'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* Штриховка, как тени в комиксе */
  --hatch: repeating-linear-gradient(-45deg, rgb(27 22 17 / 0.14) 0 1px, transparent 1px 7px);

  /* Шрифты */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Oswald", "Arial Narrow", "Roboto Condensed", Impact, sans-serif;
  --font-hand: "Pangolin", "Comic Sans MS", "Segoe Print", cursive;

  /* Флюидная типографическая шкала */
  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-lead: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --fs-h3: clamp(1.3rem, 1.15rem + 0.6vw, 1.6rem);
  --fs-h2: clamp(2.25rem, 1.5rem + 3vw, 4rem);
  --fs-display-sm: clamp(2.5rem, 1.6rem + 3.6vw, 4.75rem);
  --fs-display: clamp(3rem, 1.6rem + 5.6vw, 6.75rem);

  /* Отступы */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --section-y: clamp(4.5rem, 3rem + 6vw, 9rem);

  --container: 1240px;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --radius: 3px;
  --radius-lg: 4px;
  --header-h: 4.25rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}
body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Бумажное зерно поверх всей страницы — и поверх видео, как единая «плёнка». Клики не ловит. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 60;
  background-image: var(--grain);
  opacity: 0.45;
  pointer-events: none;
}
::selection { background: var(--c-ochre-light); color: var(--c-ink); }

img, svg, video { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
ul[role="list"], ol { list-style: none; padding: 0; }
a { color: inherit; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

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

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

/* ---------- Утилиты / лейаут ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  z-index: 100;
  padding: var(--space-1) var(--space-2);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-2); }

.section { padding-block: var(--section-y); }
.section-alt { background: var(--bg-alt); border-block: var(--ink-line); }
.section-dark {
  --text: var(--c-paper);
  --text-muted: #b3a68c;
  --border: rgb(236 226 203 / 0.2);
  /* Ночная сцена с тёплым отсветом, как костёр за кадром */
  background:
    radial-gradient(ellipse 60% 70% at 15% 0%, rgb(215 162 70 / 0.16), transparent 70%),
    var(--c-night);
  color: var(--text);
}

.section-head { margin-bottom: var(--space-5); max-width: 48rem; }
.section-head .lead { margin-top: var(--space-3); }

.split {
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 900px) {
  .split { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
}

/* ---------- Типографика ---------- */
/* Заголовки — как титры графического романа: узкие, заглавные, плотные */
.display, .display-sm, .h2, .h3 {
  font-family: var(--font-display);
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.02;
}
.display { font-size: var(--fs-display); letter-spacing: -0.005em; }
.display-sm { font-size: var(--fs-display-sm); }
.h2 { font-size: var(--fs-h2); line-height: 1.05; }
.h3 { font-size: var(--fs-h3); font-weight: 500; letter-spacing: 0.02em; line-height: 1.15; }

/* Плашка-повествование из комикса: охра, чернильный контур, «от руки», чуть наискось */
.eyebrow {
  display: inline-block;
  margin-bottom: var(--space-3);
  padding: 0.2em 0.65em 0.15em;
  background: var(--c-ochre);
  border: var(--ink-line);
  box-shadow: 3px 3px 0 var(--c-ink);
  color: var(--c-ink);
  font-family: var(--font-hand);
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  transform: rotate(-1.2deg);
  /* в сетке и во флексе не растягиваться на всю ширину */
  justify-self: start;
  align-self: flex-start;
}

/* Мазок кистью под ключевым словом заголовка */
.ink-mark {
  padding-bottom: 0.06em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 13 C 40 6, 110 5, 197 9' fill='none' stroke='%239a3b20' stroke-width='7' stroke-linecap='round'/%3E%3Cpath d='M14 17 C 70 12, 140 12, 190 15' fill='none' stroke='%239a3b20' stroke-width='3' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E") no-repeat 0 100% / 100% 0.3em;
}

.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 38rem;
}

.prose { display: grid; gap: var(--space-2); font-size: var(--fs-lead); color: var(--text-muted); }

/* ---------- Кнопки / ссылки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.875rem;
  padding: 0.625rem 1.35rem;
  border: var(--ink-line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--c-ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}
/* Кнопка «печатная»: при наведении приподнимается, при нажатии вдавливается в бумагу */
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--c-ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--c-ink); }
.btn-primary { background: var(--c-ink); color: var(--c-paper); box-shadow: 3px 3px 0 var(--c-rust); }
.btn-primary:hover { background: var(--c-ink-2); box-shadow: 4px 4px 0 var(--c-rust); }
.btn-primary:active { box-shadow: 1px 1px 0 var(--c-rust); }
.btn-ghost { background: var(--surface); color: var(--c-ink); }
.btn-ghost:hover { background: var(--c-ochre-light); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.link-arrow::after { content: "→"; transition: transform 0.2s var(--ease); }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s var(--ease);
}
/* Размытие — на псевдоэлементе: backdrop-filter на самой шапке сделал бы её
   контейнером для position: fixed, и мобильное меню сжалось бы до высоты шапки */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.site-header.is-scrolled { border-bottom-color: var(--c-ink); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
}
.logo-mark { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 2.25; }

.nav { display: flex; align-items: center; gap: var(--space-4); }
.nav-list { display: flex; gap: var(--space-3); list-style: none; padding: 0; }
.nav-list a {
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-ink-2);
  transition: color 0.2s var(--ease);
}
.nav-list a:hover { color: var(--accent); }

.nav-toggle { display: none; }

@media (max-width: 899px) {
  .nav-toggle {
    display: grid;
    place-content: center;
    gap: 6px;
    width: 2.75rem;
    height: 2.75rem;
    background: none;
    border: 0;
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    width: 22px;
    height: 1.5px;
    background: currentColor;
    transition: transform 0.25s var(--ease);
  }
  .nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.75px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-4) var(--gutter);
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0.25s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-list { flex-direction: column; gap: 0; }
  .nav-list a {
    display: block;
    padding-block: var(--space-2);
    border-bottom: 1px solid var(--border);
    font-family: var(--font-display);
    font-size: 1.75rem;
    color: var(--text);
  }
  body.nav-open { overflow: hidden; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(3rem, 2rem + 6vw, 7rem) var(--section-y);
  /* Контровой свет золотого часа, как в кадрах-референсах */
  background:
    radial-gradient(ellipse 50% 55% at 82% 45%, rgb(234 198 129 / 0.75), transparent 72%),
    radial-gradient(ellipse 40% 45% at 68% 70%, rgb(215 162 70 / 0.2), transparent 70%);
}
.hero::before {
  /* Штриховка-тень в углу, как в комиксе */
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: min(48vw, 600px);
  height: 65%;
  background: var(--hatch);
  -webkit-mask-image: radial-gradient(ellipse at 0% 100%, #000 5%, transparent 70%);
  mask-image: radial-gradient(ellipse at 0% 100%, #000 5%, transparent 70%);
  pointer-events: none;
}
.hero-grid { position: relative; display: grid; gap: var(--space-5); align-items: center; }
@media (min-width: 900px) {
  .hero-grid { grid-template-columns: 1.15fr 1fr; gap: var(--space-6); }
}
.hero-text .display { margin-bottom: var(--space-3); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

/* Коллаж из трёх видео. Пропорции кадров совпадают с роликами → без обрезки */
.frames {
  position: relative;
  aspect-ratio: 1 / 0.82;
}
.frame {
  position: absolute;
  overflow: hidden;
  background: var(--c-ink);
  border: var(--ink-line-bold);
  border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--c-ink);
}
.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.frame::after {
  /* перфорация киноплёнки поверх видео */
  content: "";
  position: absolute;
  inset: 10px 10px auto 10px;
  height: 6px;
  background: radial-gradient(circle, rgb(236 226 203 / 0.7) 2px, transparent 2.5px) 0 0 / 14px 6px repeat-x;
  pointer-events: none;
}
/* Наведение на коллаж — кадры расходятся в стороны.
   Используем transform, а не translate: он не конфликтует с float-анимацией */
@media (hover: hover) and (pointer: fine) {
  .frame { transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease); }
  .frames:hover .frame { box-shadow: 10px 10px 0 var(--c-ink); }
  .frames:hover .f1 { transform: translate(-18px, -14px); }
  .frames:hover .f2 { transform: translate(18px, -8px); }
  .frames:hover .f3 { transform: translate(-10px, 18px); }
}

.f1 { top: 0; left: 0; width: 68%; aspect-ratio: 16 / 9; z-index: 1; background: var(--c-rust); }
.f2 { top: 6%; right: 0; width: 36%; aspect-ratio: 9 / 16; z-index: 2; background: var(--c-olive); }
.f3 { bottom: 0; left: 8%; width: 60%; aspect-ratio: 16 / 9; z-index: 3; background: var(--c-denim); }

/* Кадры-панели «наклеены» чуть вразнобой; rotate — отдельное свойство, не мешает transform и translate */
.f1 { rotate: -1.6deg; }
.f2 { rotate: 1.8deg; }
.f3 { rotate: -0.7deg; }

@media (prefers-reduced-motion: no-preference) {
  .frame { animation: float 9s var(--ease) infinite alternate; }
  .f2 { animation-delay: -3s; }
  .f3 { animation-delay: -6s; }
  @keyframes float { to { translate: 0 -10px; } }
}

/* ---------- Статистика ---------- */
.stats {
  display: grid;
  /* Колонки подстраиваются под число цифр — можно добавлять и убирать без правки стилей */
  grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  margin-top: var(--space-6);
  border-top: var(--ink-line-bold);
}
.stat { display: flex; flex-direction: column; padding: var(--space-3) var(--space-2) 0 0; }
.stat dd { margin-top: auto; } /* цифры в одну линию, даже если подписи разной длины */
.stat dt { font-family: var(--font-hand); font-size: 1.05rem; line-height: 1.3; color: var(--c-ink-2); }
.stat dd {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.2rem + 3vw, 4rem);
  font-weight: 600;
  line-height: 1.05;
  text-transform: uppercase;
}

/* ---------- Карточки курсов ---------- */
.cards {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  border: var(--ink-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--c-ink); }
.card p:not(.card-meta) { color: var(--text-muted); }
.card .link-arrow { margin-top: auto; padding-top: var(--space-2); }
.card-meta { font-family: var(--font-hand); font-size: 1.05rem; color: var(--accent); }

/* ---------- Шаги ---------- */
.steps {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
}
.step { display: grid; align-content: start; gap: var(--space-1); padding-top: var(--space-3); border-top: var(--ink-line-bold); }
.step p { color: var(--text-muted); }
.step-num { font-family: var(--font-display); font-size: 2.75rem; font-weight: 600; line-height: 1; color: var(--accent); }

.tools {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: var(--ink-line);
}
.tools-label { font-family: var(--font-hand); font-size: 1.05rem; color: var(--text-muted); }
.tools-list { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-3); font-family: var(--font-display); font-size: 1.15rem; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Галерея ---------- */
.gallery {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: 1fr;
}
@media (min-width: 700px) {
  .gallery { grid-template-columns: repeat(6, 1fr); }
  .g1 { grid-column: span 4; }
  .g2 { grid-column: span 2; }
  .g3 { grid-column: span 2; }
  .g4 { grid-column: span 4; }
}
.gallery-item {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: clamp(14rem, 10rem + 12vw, 22rem);
  padding: var(--space-3);
  border: 3px solid var(--c-paper);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: var(--fs-sm);
  color: var(--c-paper);
}
.gallery-item span { position: relative; font-family: var(--font-hand); font-size: 1.05rem; }
.gallery-item::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgb(0 0 0 / 0.45), transparent 55%);
}
.g1 { background: var(--hatch), linear-gradient(135deg, #a4472a, #3b1f14); }
.g2 { background: var(--hatch), linear-gradient(135deg, #5d7188, #1f2a36); }
.g3 { background: var(--hatch), linear-gradient(135deg, #6f7442, #262a14); }
.g4 { background: var(--hatch), linear-gradient(135deg, #b98a3e, #3d2c14); }

/* ---------- Работы преподавателей ----------
   Горизонтальная лента во всю ширину экрана: первая карточка стоит по левому краю контейнера,
   следующая выглядывает справа — видно, что можно листать. Свайп, тачпад, Shift+колесо, Tab или стрелки.
   Карточки одной высоты: 16:9 по умолчанию, .work--tall — вертикальные 9:16. */
.works-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  max-width: none;
  margin-bottom: var(--space-4);
}
.works-head > div { max-width: 48rem; }
.works-nav { display: flex; gap: 0.75rem; }
.works-nav[hidden] { display: none; }
/* На телефоне ленту листают свайпом, а выглядывающая справа карточка подсказывает, что там есть ещё */
@media (max-width: 599px) { .works-nav { display: none; } }
.works-arrow {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  background: var(--c-paper);
  border: var(--ink-line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--c-ink);
  color: var(--c-ink);
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.2s var(--ease);
}
.works-arrow svg { width: 1.375rem; height: 1.375rem; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.works-arrow:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--c-ink); }
.works-arrow:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--c-ink); }
.works-arrow:disabled { opacity: 0.35; box-shadow: none; cursor: default; }

ul.works { /* ul — чтобы перебить сброс ul[role="list"] { padding: 0 } */
  /* Отступ = левый край контейнера: (ширина − 1240) / 2 + поле. % здесь — ширина секции */
  --rail-pad: calc(max(0px, (100% - var(--container)) / 2) + var(--gutter));
  --work-h: clamp(10.5rem, 44vw, 20rem);
  display: flex;
  gap: var(--space-3);
  /* Сверху — место под рамку фокуса, снизу — под тень карточек и полосу прокрутки */
  padding: var(--space-1) var(--rail-pad) var(--space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--rail-pad);
  scrollbar-width: thin;
  scrollbar-color: var(--c-ink) transparent;
}
.works::-webkit-scrollbar { height: 6px; }
.works::-webkit-scrollbar-thumb { background: var(--c-ink); border-radius: 3px; }
.works::-webkit-scrollbar-track { margin-inline: var(--gutter); }

.work {
  position: relative;
  flex: 0 0 auto;
  height: var(--work-h);
  aspect-ratio: 16 / 9;
  scroll-snap-align: start;
}
.work--tall { aspect-ratio: 9 / 16; }
.work-media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--c-ink);
  border: var(--ink-line-bold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel);
  color: var(--c-paper);
  text-align: left;
  cursor: pointer;
}
.work-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s var(--ease);
}
.work-media:hover video, .work-media:focus-visible video { transform: scale(1.03); }
.work-media:focus-visible { outline-offset: 4px; }

.work-info {
  position: absolute;
  inset: auto 0 0 0;
  display: grid;
  gap: 0.125rem;
  padding: 3rem var(--space-3) var(--space-2);
  background: linear-gradient(to top, rgb(27 22 17 / 0.8), transparent);
  pointer-events: none;
}
.work-title { font-family: var(--font-display); font-size: clamp(1.2rem, 1rem + 0.8vw, 1.6rem); font-weight: 600; line-height: 1.05; letter-spacing: 0.02em; text-transform: uppercase; }
.work-author { font-family: var(--font-hand); font-size: 1.05rem; }
.work-meta { font-size: 0.75rem; color: rgb(236 226 203 / 0.75); }
.work--tall .work-info { padding-inline: var(--space-2); }

.work-play {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem 0.375rem 0.625rem;
  background: var(--c-ochre);
  border: var(--ink-line);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--c-ink);
  color: var(--c-ink);
  font-family: var(--font-hand);
  font-size: 1rem;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.work-play::before {
  content: "";
  border-style: solid;
  border-width: 0.3em 0 0.3em 0.5em;
  border-color: transparent transparent transparent currentColor;
}
.work-media:hover .work-play, .work-media:focus-visible .work-play { opacity: 1; transform: none; }
/* Видно только в кабинете: работа скрыта с сайта или ещё сжимается */
.work-badge {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  z-index: 1;
  padding: 0.25rem 0.6rem;
  background: var(--c-paper);
  border: var(--ink-line);
  border-radius: var(--radius);
  color: var(--c-ink);
  font-family: var(--font-hand);
  font-size: 0.875rem;
}
.work--hidden .work-media { opacity: 0.55; }
.work--pending .work-media { background: var(--hatch), var(--c-night-2); }

/* На сенсорных экранах наведения нет — подсказку показываем всегда */
@media (hover: none) { .work-play { opacity: 1; transform: none; } }
@media (max-width: 599px) { .work-play { top: 0.625rem; left: 0.625rem; padding: 0.25rem 0.5rem; font-size: 0.8125rem; } }

/* ---------- Плеер (dialog): видео, под ним «О проекте» ----------
   Прокручивается внутренний .player-scroll, а не сам dialog — иначе крестик, вынесенный за рамку, обрежется. */
.player {
  margin: auto; /* глобальный сброс margin: 0 отключает штатное центрирование dialog */
  width: min(94vw, 64rem);
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: visible;
  background: var(--c-ink);
  border: 3px solid var(--c-paper);
  border-radius: var(--radius);
  color: var(--c-paper);
}
.player::backdrop { background: rgb(27 22 17 / 0.85); backdrop-filter: blur(4px); }
.player-scroll {
  max-height: 94dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #5d5140 transparent;
}
.player video {
  display: block;
  width: 100%;
  aspect-ratio: var(--player-ratio, 16 / 9);
  /* Верх «О проекте» виден сразу — понятно, что ниже есть текст */
  max-height: 72dvh;
  background: #000;
}
.player-about {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-4);
}
@media (min-width: 800px) {
  .player-about { grid-template-columns: 16rem 1fr; gap: var(--space-5); padding: var(--space-4) var(--space-5) var(--space-5); }
}
.player-head { display: grid; gap: 0.375rem; align-content: start; }
.player-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.player-author { font-family: var(--font-hand); font-size: 1.1rem; color: var(--c-ochre); }
.player-body { display: grid; gap: var(--space-2); align-content: start; }
.player-label {
  justify-self: start;
  padding: 0.15em 0.6em 0.1em;
  background: var(--c-ochre);
  border: 2px solid var(--c-paper);
  box-shadow: 3px 3px 0 var(--c-rust);
  color: var(--c-ink);
  font-family: var(--font-hand);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.player-text { display: grid; gap: var(--space-2); max-width: 40rem; color: #d8ccb2; line-height: 1.6; }
.work-facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid rgb(236 226 203 / 0.2);
}
.work-facts div { display: grid; gap: 0.125rem; }
.work-facts dt { font-size: 0.75rem; letter-spacing: 0.06em; text-transform: uppercase; color: #9d917a; }
.work-facts dd { margin: 0; color: var(--c-paper); }

.player-close {
  position: absolute;
  top: -0.75rem;
  right: -0.75rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--c-paper);
  border: var(--ink-line);
  border-radius: 50%;
  color: var(--c-ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 16px rgb(0 0 0 / 0.3);
}
@media (max-width: 599px) {
  .player { width: 100vw; border-inline: 0; }
  .player-close { top: 0.5rem; right: 0.5rem; }
}
body:has(.player[open]) { overflow: hidden; }

/* ---------- Преподаватели ---------- */
.mentors {
  display: grid;
  gap: var(--space-4) var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}
.mentor p { color: var(--text-muted); }
.avatar {
  aspect-ratio: 1;
  margin-bottom: var(--space-2);
  border-radius: var(--radius);
  background: var(--hatch), var(--c-paper-2);
  border: var(--ink-line);
  box-shadow: var(--shadow-panel);
}

/* ---------- FAQ ---------- */
.faq { border-top: var(--ink-line-bold); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  padding-block: var(--space-3);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.9rem;
  line-height: 1;
  transition: transform 0.2s var(--ease);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding-bottom: var(--space-3); color: var(--text-muted); max-width: 40rem; }

/* ---------- CTA / форма ---------- */
/* Финал страницы — тот же тёплый свет, что в первом кадре: история замыкается */
.cta { background: radial-gradient(ellipse 55% 70% at 50% 0%, rgb(234 198 129 / 0.6), transparent 72%); }
.cta-inner { display: grid; justify-items: center; gap: var(--space-3); text-align: center; }
.cta .lead { margin-inline: auto; }
.form {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: 32rem;
  margin-top: var(--space-2);
  text-align: left;
}
.field { display: grid; gap: 0.375rem; }
.field label { font-family: var(--font-hand); font-size: 1.05rem; }
.field input {
  min-height: 3rem;
  padding: 0.625rem 0.875rem;
  background: var(--c-paper-light);
  border: var(--ink-line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease);
}
.field input:hover { border-color: var(--c-ink-2); }
.field input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.field input[aria-invalid="true"] { border-color: var(--c-rust-dark); }
.form .btn { margin-top: var(--space-1); }
.form-status { min-height: 1.5em; font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Подвал ---------- */
.site-footer { padding-block: var(--space-5); background: var(--bg-alt); border-top: var(--ink-line-bold); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--space-3); list-style: none; padding: 0; }
.footer-links a, .copyright { font-size: var(--fs-sm); color: var(--text-muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ---------- Схема генерации «Попробуйте сами» ----------
   Мобильная раскладка — вертикальная цепочка; с 1024px — 4 этапа в ряд,
   и от Seedance линия уходит вниз к широкому блоку «Сайт». */
.pipe {
  --gap: 2.5rem;
  --flow: 0.8s;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--gap);
  max-width: 36rem;
  padding: 0;
  list-style: none;
  transition: opacity 0.6s var(--ease);
}
.pipe.is-fading { opacity: 0; }

@media (min-width: 1024px) {
  .pipe {
    --gap: 3rem;
    grid-template-columns: 1fr 1fr 1.35fr 1.1fr;
    max-width: none;
  }
  .pipe-site { grid-column: 1 / -1; }
}

.pipe-node {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.25rem;
  background: var(--surface);
  border: var(--ink-line);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--c-ink);
  transition: border-color 0.4s var(--ease), box-shadow 0.4s var(--ease), transform 0.4s var(--ease), opacity 0.4s var(--ease);
}
.pipe.is-running .pipe-node:not(.is-active, .is-done, .is-error) { opacity: 0.45; }
.pipe-node.is-active {
  z-index: 1;
  transform: translate(-3px, -3px);
  box-shadow: 0 0 0 5px rgb(215 162 70 / 0.5), 7px 7px 0 var(--c-ink);
}

.pipe-tag { font-family: var(--font-display); font-size: 0.9rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.pipe-title { font-family: var(--font-display); font-size: 1.35rem; font-weight: 500; line-height: 1.1; letter-spacing: 0.02em; text-transform: uppercase; }
.pipe-desc, .pipe-meta, .pipe-status { font-size: var(--fs-sm); color: var(--text-muted); }

/* Галочка «этап пройден» */
.pipe-check {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border: var(--ink-line);
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s var(--ease), transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.pipe-check::before {
  content: "";
  width: 0.5rem;
  height: 0.28rem;
  margin-top: -0.12rem;
  border: solid var(--c-paper);
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
}
.pipe-node.is-done .pipe-check { opacity: 1; transform: none; }
/* На широком экране справа в блоке «Сайт» окно браузера — галочку переносим влево, чтобы не наезжала */
@media (min-width: 1024px) { .pipe-site .pipe-check { right: auto; left: 1rem; } }

/* Печать текста: полный текст держит место (нет прыжков вёрстки), поверх печатается живой */
.type { display: grid; }
.type > span { grid-area: 1 / 1; }
.js .type-full { color: transparent; }
.pipe-node.is-active .type-live::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: currentColor;
  animation: caret 1s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.pipe-idea {
  /* Реплика в «речевом пузыре» комикса */
  position: relative;
  margin-bottom: 0.5rem;
  padding: 0.7rem 0.9rem;
  background: #fbf7ec;
  border: var(--ink-line);
  border-radius: 18px;
  font-family: var(--font-hand);
  font-size: 1.15rem;
  line-height: 1.3;
}
.pipe-idea::after {
  content: "";
  position: absolute;
  left: 1.5rem;
  bottom: -9px;
  width: 15px;
  height: 15px;
  background: #fbf7ec;
  border-right: var(--ink-line);
  border-bottom: var(--ink-line);
  transform: rotate(45deg) skew(10deg, 10deg);
}
.pipe-prompt {
  padding: 0.75rem;
  background: #fbf7ec;
  border: 1px dashed rgb(27 22 17 / 0.45);
  border-radius: var(--radius);
  font: 0.75rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--c-ink-2);
}

/* Kimi «думает» */
.pipe-status { display: flex; align-items: center; gap: 0.5rem; }
.thinking { display: none; gap: 3px; }
.thinking i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: think 1s var(--ease) infinite; }
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
.pipe-node.is-active .thinking { display: inline-flex; }
@keyframes think { 0%, 100% { transform: none; opacity: 0.4; } 40% { transform: translateY(-4px); opacity: 1; } }

/* Seedance: плёнка из 7 кадров (= 7 секунд) + прогресс */
.reel {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  padding: 10px 5px;
  background: var(--c-ink);
  border-radius: 2px;
}
.reel::before, .reel::after {
  content: "";
  position: absolute;
  inset-inline: 6px;
  height: 4px;
  background: radial-gradient(circle, rgb(236 226 203 / 0.55) 1.5px, transparent 2px) 0 0 / 9px 4px repeat-x;
}
.reel::before { top: 3px; }
.reel::after { bottom: 3px; }
.reel i {
  aspect-ratio: 3 / 4;
  border-radius: 2px;
  background: #2e2720;
  transition: background-color 0.3s var(--ease), transform 0.3s var(--ease);
}
.reel i.is-lit { background: var(--c-ochre); transform: scale(1.06); }
.reel i.is-lit:nth-child(even) { background: var(--c-rust); }

.bar { height: 3px; background: var(--border); border-radius: 2px; overflow: hidden; }
.bar span {
  display: block;
  height: 100%;
  background: var(--c-rust);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}

/* Блок «Сайт» с окном браузера */
.site-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }
.chip {
  padding: 0.375rem 0.75rem;
  border: var(--ink-line);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.35;
  transition: opacity 0.4s var(--ease), background-color 0.4s var(--ease), color 0.4s var(--ease);
}
.chip:first-child { background: var(--c-ink); color: var(--c-paper); }
.pipe-site.is-active .chip, .pipe-site.is-done .chip { opacity: 1; }

.browser {
  overflow: hidden;
  border: var(--ink-line);
  border-radius: var(--radius);
  background: var(--bg-alt);
  box-shadow: var(--shadow-panel);
}
.browser-bar { display: flex; align-items: center; gap: 5px; height: 1.75rem; padding-inline: 0.625rem; border-bottom: var(--ink-line); }
.browser-bar i { width: 7px; height: 7px; border-radius: 50%; background: var(--c-paper-3); }
.browser-bar span {
  flex: 1;
  margin-left: 0.5rem;
  padding: 1px 0.5rem;
  background: var(--bg);
  border-radius: 4px;
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.browser-screen { position: relative; aspect-ratio: 16 / 9; background: var(--c-ink); }
.browser-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.8s var(--ease), transform 1.2s var(--ease);
}
.browser-screen video.is-playing { opacity: 1; transform: none; }

@media (min-width: 1024px) {
  .pipe-site {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    align-items: center;
    gap: 2.5rem;
    padding: 1.5rem;
  }
  .site-text { display: grid; gap: 0.75rem; max-width: 22rem; }
}

/* Связи между этапами: линия «прорисовывается», по ней бежит пакет.
   По умолчанию вертикальные (мобильные + связь Seedance → Сайт). */
.pipe-link {
  position: absolute;
  top: 100%;
  left: 50%;
  width: 2px;
  height: var(--gap);
  margin-left: -1px;
  background: var(--border);
}
.pipe-fill {
  position: absolute;
  inset: 0;
  background: var(--c-ink);
  transform: scaleY(0);
  transform-origin: top;
}
.pipe-packet {
  position: absolute;
  top: 0;
  left: 50%;
  width: 13px;
  height: 13px;
  border: var(--ink-line);
  border-radius: 50%;
  background: var(--c-ochre);
  box-shadow: 0 0 14px var(--c-ochre);
  opacity: 0;
  transform: translate(-50%, -50%);
}
.pipe-link.is-flowing .pipe-fill { transform: none; transition: transform var(--flow) var(--ease); }
.pipe-link.is-done .pipe-fill { transform: none; }
.pipe-link.is-flowing .pipe-packet { animation: packet-y var(--flow) var(--ease) forwards; }

@keyframes packet-y {
  0% { top: 0; opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
@keyframes packet-x {
  0% { left: 0; opacity: 0; }
  15%, 85% { opacity: 1; }
  100% { left: 100%; opacity: 0; }
}

@media (min-width: 1024px) {
  .pipe-link:not(.pipe-link--down) {
    top: 50%;
    left: 100%;
    width: var(--gap);
    height: 2px;
    margin: -1px 0 0;
  }
  .pipe-link:not(.pipe-link--down) .pipe-fill { transform: scaleX(0); transform-origin: left; }
  .pipe-link:not(.pipe-link--down).is-flowing .pipe-fill,
  .pipe-link:not(.pipe-link--down).is-done .pipe-fill { transform: none; }
  .pipe-link:not(.pipe-link--down) .pipe-packet { top: 50%; left: 0; }
  .pipe-link:not(.pipe-link--down).is-flowing .pipe-packet { animation-name: packet-x; }
}

/* ---------- Генерация: форма над схемой ---------- */
.gen-form {
  display: grid;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-5);
  padding: clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
  background: var(--surface);
  border: var(--ink-line-bold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel-lg);
}
@media (min-width: 900px) {
  .gen-form { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .gen-feedback { grid-column: 1 / -1; }
}
.gen-main, .gen-side { display: grid; gap: var(--space-2); align-content: start; }

.gen-form textarea {
  min-height: 7rem;
  padding: 0.75rem 0.875rem;
  resize: vertical;
  background: #fbf7ec;
  border: var(--ink-line);
  border-radius: var(--radius);
  font-family: var(--font-hand);
  font-size: 1.2rem;
  line-height: 1.4;
  transition: border-color 0.2s var(--ease);
}
.gen-form textarea:hover { border-color: var(--c-ink-2); }
.gen-form textarea:focus-visible { outline-offset: 0; border-color: var(--accent); }
.gen-form [aria-invalid="true"] { border-color: var(--c-rust-dark); }

.gen-examples { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.gen-chip {
  padding: 0.375rem 0.85rem;
  background: var(--bg-alt);
  border: 1.5px solid var(--c-ink);
  border-radius: 999px;
  font-family: var(--font-hand);
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.gen-chip:hover { background: var(--c-ochre-light); }

.gen-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.gen-consent, .form-consent { display: flex; gap: 0.625rem; align-items: flex-start; font-size: var(--fs-sm); color: var(--text-muted); cursor: pointer; }
.gen-consent input, .form-consent input { flex-shrink: 0; width: 1.125rem; height: 1.125rem; margin-top: 0.15rem; accent-color: var(--c-ink); }
.gen-consent a, .form-consent a { color: var(--text); }
.form .btn:disabled { opacity: 0.6; cursor: progress; }

.gen-side .btn { justify-self: start; margin-top: var(--space-1); }
.gen-side .btn:disabled { opacity: 0.6; cursor: progress; }
.gen-note { font-size: var(--fs-sm); color: var(--text-muted); }

.gen-feedback { display: grid; gap: 0.75rem; }
.gen-feedback:has(.gen-error:empty):has(.gen-message[hidden]) { display: none; }
.gen-error { font-size: var(--fs-sm); color: var(--c-rust-dark); }
.gen-error:empty { display: none; }
.gen-message {
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--c-ochre-light);
  border: var(--ink-line);
  border-radius: var(--radius);
  font-family: var(--font-hand);
  font-size: 1.05rem;
}
.gen-message[hidden] { display: none; }

.pipe-caption {
  margin-bottom: var(--space-2);
  font-family: var(--font-hand);
  font-size: 1.15rem;
  color: var(--c-ink-2);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Живой режим схемы ---------- */
.pipe-node.is-error { border-color: var(--c-rust-dark); }
.pipe-node.is-error .pipe-check { opacity: 1; transform: none; background: var(--c-rust-dark); }
.pipe-node.is-error .pipe-check::before {
  content: "!";
  width: auto;
  height: auto;
  margin: 0;
  border: 0;
  transform: none;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  color: var(--c-paper);
}
.pipe-node.is-error .pipe-status, .pipe-node.is-error .pipe-meta { color: var(--c-rust-dark); }

/* Длинный настоящий промпт — прокручиваемый блок, чтобы не растягивать всю схему */
.pipe.is-live .pipe-prompt { max-height: 14rem; overflow-y: auto; overscroll-behavior: contain; }

/* Вертикальное видео 9:16 внутри окна «браузера» */
.pipe.is-live .browser-screen { aspect-ratio: 3 / 4; }
@media (min-width: 1024px) { .pipe.is-live .browser-screen { aspect-ratio: 4 / 3; } }
.pipe.is-live .browser-screen video { object-fit: contain; transform: none; }

.site-actions .btn { min-height: 2.5rem; padding: 0.5rem 1rem; font-size: var(--fs-sm); }
.site-actions { flex-wrap: wrap; align-items: center; }
.site-actions .link-arrow { font-size: var(--fs-sm); }
.site-share-status { flex-basis: 100%; font-size: var(--fs-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.site-share-status:empty { display: none; }

.share-prompt { border-top: 1px solid var(--border); padding-top: 0.75rem; font-size: var(--fs-sm); color: var(--text-muted); }
.share-prompt summary { font-weight: 500; color: var(--text); cursor: pointer; }
.share-prompt p { margin-top: 0.5rem; }
.share-prompt-en { font: 0.75rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* ---------- Страница ролика /v/:id ---------- */
.share-grid { display: grid; gap: var(--space-5); align-items: center; }
@media (min-width: 900px) { .share-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr); } }
.share-video video {
  width: min(100%, 24rem);
  max-height: 80dvh;
  margin-inline: auto;
  background: var(--c-ink);
  border: var(--ink-line-bold);
  border-radius: var(--radius);
  box-shadow: var(--shadow-panel-lg);
}
.share-text { display: grid; gap: var(--space-2); max-width: 34rem; }
.share-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--space-1); }
.share-status { min-height: 1.5em; font-size: var(--fs-sm); color: var(--text-muted); overflow-wrap: anywhere; }
.share-cta { display: grid; gap: 0.5rem; margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.share-simple { display: grid; gap: var(--space-2); max-width: 40rem; }

/* ---------- Появление при скролле (только если JS включён) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  }
  .js [data-reveal].is-visible { opacity: 1; transform: none; }
}
