/* Фирменный шрифт знака КИГМ23 (UNCAGE): в файлах только К, И, Г, М и цифры, 1–3 КБ */
@font-face { font-family: "UNCAGE mark"; src: url("fonts/uncage-mark-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "UNCAGE mark"; src: url("fonts/uncage-mark-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #000;
  --ink: #f3f0ea;        /* основной текст */
  --muted: #8d8a85;      /* второстепенный текст */
  --line: rgb(243 240 234 / .14);
  --card: #111;          /* карточки, пузыри */
  --accent: #f2a54a;     /* янтарный акцент */
  --accent-ink: #1d1100;

  --font: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: var(--font);  /* шрифт крупных заголовков; темы меняют его */
  --gutter: clamp(16px, 3.2vw, 48px);
  --ease: cubic-bezier(.7, 0, .2, 1);

  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-stopped { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 600; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hero__title,
.reel__caption,
.loader__count,
.manifesto__text,
.marquee__inner,
.service h3,
.works__title,
.project__title,
.contact__title,
.about__title {
  font-family: var(--display);
}

/* Разбивка текста на буквы и слова (делает main.js) */
.split-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: .08em;
  margin-bottom: -.08em;
}
.split-char,
.split-word { display: inline-block; will-change: transform; }

/* ---------- Прелоадер ---------- */

.loader { display: none; }

.js .loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: var(--gutter);
  background: var(--bg);
}

.loader__name {
  font-size: clamp(1.1rem, 1.6vw, 1.4rem);
  font-weight: 600;
  letter-spacing: -.02em;
}

.loader__count {
  font-size: clamp(5rem, 18vw, 16rem);
  font-weight: 600;
  line-height: .8;
  letter-spacing: -.06em;
  font-variant-numeric: tabular-nums;
}

/* ---------- Шапка ---------- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px var(--gutter);
  mix-blend-mode: difference;
  color: #fff;
}

.nav__logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.03em;
  text-decoration: none;
}

.nav nav { display: flex; gap: clamp(18px, 3vw, 40px); }

.nav__link {
  text-decoration: none;
  font-weight: 500;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: background-size .4s var(--ease);
}
.nav__link:hover { background-size: 100% 1px; }

/* ---------- Первый экран ---------- */

.hero {
  position: relative;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
}

.hero__title {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(84px, 13vh, 130px) var(--gutter) clamp(84px, 14vh, 140px);
  font-size: clamp(3rem, 10.4vw, 11rem);
  line-height: .9;
  letter-spacing: -.055em;
  font-weight: 600;
  pointer-events: none;
  mix-blend-mode: difference;
  color: #fff;
}

.hero__line { display: block; white-space: nowrap; }
.hero__line--2 { align-self: flex-end; }

/* Кадр-шоурил: на старте маленький в центре, при прокрутке раскрывается (main.js) */
.reel {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #0b0b0b;
  clip-path: inset(calc(50% - 9.5vw) calc(50% - 17vw) round 18px);
}

.reel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
}
.reel img:first-child { opacity: 1; }

.reel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 55%, rgb(0 0 0 / .75));
}

.reel__caption {
  position: absolute;
  left: var(--gutter);
  bottom: clamp(28px, 6vh, 56px);
  z-index: 1;
  max-width: 18ch;
  margin: 0;
  font-size: clamp(1.8rem, 4.2vw, 4rem);
  line-height: 1;
  letter-spacing: -.04em;
  font-weight: 600;
  opacity: 0;
}

.hero__note,
.hero__hint {
  position: absolute;
  z-index: 3;
  bottom: 24px;
  margin: 0;
  font-size: .9375rem;
  color: var(--muted);
}
.hero__note { left: var(--gutter); max-width: 30ch; }
.hero__hint { right: var(--gutter); }

.hero__hint::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 28px;
  margin-left: 12px;
  vertical-align: middle;
  background: currentColor;
  transform-origin: top;
  animation: hint 1.8s var(--ease) infinite;
}

@keyframes hint {
  0%   { transform: scaleY(0); }
  50%  { transform: scaleY(1); transform-origin: top; }
  51%  { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- Манифест ---------- */

.manifesto {
  padding: clamp(120px, 24vh, 260px) var(--gutter);
}

.manifesto__text {
  max-width: 22ch;
  margin: 0;
  font-size: clamp(2rem, 5.6vw, 5.6rem);
  line-height: 1.02;
  letter-spacing: -.045em;
  font-weight: 600;
}

/* ---------- Бегущая строка ---------- */

.marquee {
  overflow: hidden;
  padding-block: clamp(18px, 3vh, 32px);
  border-block: 1px solid var(--line);
}

.marquee__row { display: flex; }

.marquee__inner {
  display: flex;
  align-items: center;
  flex: none;
  white-space: nowrap;
  font-size: clamp(2.4rem, 7vw, 7rem);
  font-weight: 600;
  letter-spacing: -.045em;
  line-height: 1;
}

.marquee__inner span { padding-inline: .25em; }

.marquee__inner i {
  width: .32em;
  height: .32em;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
}

/* ---------- Услуги ---------- */

.services {
  padding: clamp(80px, 16vh, 180px) var(--gutter);
}

.services__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.service {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px clamp(24px, 5vw, 80px);
  align-items: baseline;
  padding-block: clamp(22px, 3.6vh, 40px);
  border-bottom: 1px solid var(--line);
}

.service h3 {
  font-size: clamp(1.9rem, 4.4vw, 4.2rem);
  line-height: 1;
  letter-spacing: -.045em;
  transition: transform .5s var(--ease), color .4s;
}

.service p {
  margin: 0;
  max-width: 44ch;
  color: var(--muted);
}

@media (hover: hover) {
  .service:hover h3 { transform: translateX(.18em); color: var(--accent); }
}

/* ---------- Работы: код → сборка → результат ---------- */

.works__head {
  padding: clamp(80px, 14vh, 160px) var(--gutter) clamp(40px, 8vh, 80px);
}

.works__title {
  font-size: clamp(4rem, 17vw, 17rem);
  line-height: .85;
  letter-spacing: -.07em;
}

/* Каждый проект — экран, который закрепляется на время «сборки» (main.js).
   Сверху короткая строка о проекте, под ней большое окно редактора.
   После сборки окно раскрывается на весь экран. */
.project {
  position: relative;
  height: 100svh;
  min-height: 640px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  overflow: hidden;
}

.project__text {
  position: absolute;
  top: 78px;
  left: var(--gutter);
  right: var(--gutter);
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  grid-template-areas:
    "kind  text"
    "title text"
    "title meta";
  column-gap: clamp(24px, 4vw, 64px);
  align-items: end;
}

.project__text > .project__kind {
  grid-area: kind;
  margin: 0 0 8px;
  color: var(--accent);
  font-weight: 500;
}

.project__title {
  grid-area: title;
  margin: 0;
  font-size: clamp(2.2rem, 4.4vw, 4.6rem);
  line-height: .92;
  letter-spacing: -.055em;
}

.project__text > p:not(.project__kind) {
  grid-area: text;
  margin: 0;
  max-width: 62ch;
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--muted);
}

.project__meta {
  grid-area: meta;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-top: 14px;
}

.project__meta .action { margin-top: 0; }

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.tags li {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .8125rem;
}

/* Окно редактора: занимает всё место под строкой проекта (--win-top считает main.js) */
.window {
  position: absolute;
  top: var(--win-top, 300px);
  left: var(--gutter);
  right: var(--gutter);
  bottom: 24px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: #0a0a0a;
  box-shadow: 0 40px 120px -40px rgb(242 165 74 / .18);
}

.window__bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 42px;
  flex: none;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: #111;
}

.window__dots { display: flex; gap: 7px; }
.window__dots i {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2b2b2b;
}

.window__label {
  font: 400 .8125rem/1 "JetBrains Mono", ui-monospace, monospace;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Подпись окна меняется с имени файла на адрес результата */
.window__label--live {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  max-width: 60%;
  padding: 5px 14px;
  border-radius: 8px;
  background: #1b1b1b;
  color: var(--ink);
}

.window__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.code {
  margin: 0;
  height: 100%;
  padding: 18px 0;
  overflow: hidden;
  font: 400 clamp(.75rem, 1vw, 1rem)/1.65 "JetBrains Mono", ui-monospace, monospace;
  color: #d8d4cc;
  tab-size: 4;
}

.code code { position: relative; display: block; font: inherit; }

/* Строки кода (размечает main.js): номер + текст, который «печатается» */
.ln {
  position: relative;
  display: flex;
  white-space: pre;
}

.ln__no {
  flex: none;
  width: 3.4em;
  padding-right: 1.2em;
  text-align: right;
  color: #4a4744;
  user-select: none;
}

.ln__text {
  clip-path: inset(0 calc((1 - var(--p, 1)) * 100%) 0 0);
}

.caret {
  position: absolute;
  top: 0;
  left: 0;
  width: .6em;
  height: 1.3em;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}

/* Подсветка синтаксиса */
.tk-k { color: #ff8f6b; }   /* ключевые слова */
.tk-s { color: #a8d99a; }   /* строки */
.tk-c { color: #6d6a65; font-style: italic; }  /* комментарии */
.tk-n { color: #f2c46d; }   /* числа */
.tk-f { color: #7fc6ff; }   /* вызовы функций */
.tk-t { color: #e7a3ff; }   /* JSX-теги */

/* Строка сборки внизу окна */
.build {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgb(17 17 17 / .92);
  font: 400 .8125rem/1.3 "JetBrains Mono", ui-monospace, monospace;
  opacity: 0;
}

.build p { margin: 0; }
.build__cmd { color: var(--ink); }
.build__done { color: #a8d99a; opacity: 0; }

.build__bar {
  height: 3px;
  border-radius: 3px;
  background: #222;
  overflow: hidden;
}
.build__bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left;
  transform: scaleX(0);
}

/* Готовый результат поверх кода. Без JS он виден сразу. */
.live {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #000;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.live img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.live img.pixel { image-rendering: pixelated; }

.live--chat {
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  cursor: default;
  background:
    radial-gradient(80% 60% at 50% 0%, rgb(242 165 74 / .08), transparent 70%),
    #050505;
}

/* Кнопки под текстом проекта */
.action {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  padding: 14px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font: 600 1rem/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .3s;
}

.action:hover { background: var(--accent); }

.action.play { padding-left: 14px; }

.action.play::before {
  content: "";
  width: 30px;
  height: 30px;
  margin: -8px 0;
  border-radius: 50%;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3E%3Cpath fill-rule='evenodd' d='M15 0a15 15 0 1 1 0 30 15 15 0 0 1 0-30zM12 9v12l10-6z'/%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 30 30'%3E%3Cpath fill-rule='evenodd' d='M15 0a15 15 0 1 1 0 30 15 15 0 0 1 0-30zM12 9v12l10-6z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.action.play:hover::before { background: var(--accent-ink); }

/* Ролики игр в окне результата */
.live__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}

/* Кнопки на готовом результате: «Повторить» и «Открыть сайт» */
.live__controls {
  position: absolute;
  right: clamp(16px, 2.4vw, 32px);
  bottom: clamp(16px, 2.4vw, 32px);
  z-index: 6;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.live__controls .live__cta { position: static; text-decoration: none; }

.kintro__replay {
  padding: 14px 20px;
  border: 1px solid rgb(255 255 255 / .35);
  border-radius: 999px;
  background: rgb(0 0 0 / .45);
  color: #fff;
  font: 600 1rem/1 var(--font);
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.kintro__replay:hover { background: rgb(0 0 0 / .7); }

/* ---------- Заставка сайта КИГМ (перенесена с сайта колледжа) ----------
   Кадры-фото с крупными надписями и финальный знак по брендбуку.
   Размеры — от ширины окна (cqw), поэтому одинаково смотрится и в окне, и на весь экран. */

.live--intro { cursor: default; }

.kintro {
  --k-ink: #0b0c0e;
  --k-paper: #f1f2f4;
  --k-accent: #b94027;   /* терракота брендбука КИГМ23 */

  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  background: var(--k-ink);
  color: #fff;
  font-family: "Unbounded", "Inter Tight", sans-serif;
}

.kintro__beat {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .22s linear;
}
.kintro__beat[data-on="true"] { opacity: 1; }

.kintro__shot { position: absolute; inset: 0; overflow: hidden; }

.kintro__shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(.8) contrast(1.06) brightness(.82);
  transform: scale(1.08);
}

.kintro__beat[data-on="true"] .kintro__shot img {
  animation: kintro-push var(--dur, 1700ms) linear both;
}

@keyframes kintro-push {
  from { transform: scale(1.08); }
  to   { transform: scale(1.18); }
}

.kintro__veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(105% 80% at 50% 50%, rgb(11 12 14 / .06) 0%, rgb(11 12 14 / .72) 82%),
    linear-gradient(180deg, rgb(11 12 14 / .48), rgb(11 12 14 / .16) 42%, rgb(11 12 14 / .8));
}

.kintro__line {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 6px;
  padding: 0 5cqw;
}

.kintro__word { overflow: hidden; padding-bottom: .1em; }

.kintro__word span {
  display: block;
  font-weight: 800;
  font-size: clamp(22px, 8.4cqw, 112px);
  line-height: .86;
  letter-spacing: -.05em;
  text-transform: uppercase;
  transform: translateY(110%);
}

.kintro__beat[data-on="true"] .kintro__word span {
  animation: kintro-rise .6s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes kintro-rise { to { transform: translateY(0); } }

.kintro__sub {
  max-width: 44ch;
  margin: 14px 0 0;
  font-weight: 700;
  font-size: clamp(9px, 1.3cqw, 12px);
  letter-spacing: .22em;
  text-transform: uppercase;
  color: rgb(255 255 255 / .6);
  opacity: 0;
}

.kintro__beat[data-on="true"] .kintro__sub { animation: kintro-fade .6s ease .26s both; }

@keyframes kintro-fade { to { opacity: 1; } }

/* Финальный кадр — светлый, со знаком «КИГМ23» */
.kintro__beat[data-kind="mark"] { background: var(--k-paper); }
.kintro__beat[data-kind="mark"] .kintro__line { justify-items: center; text-align: center; }

.kintro__mark {
  display: flex;
  align-items: flex-end;
  gap: .2em;
  font-family: "UNCAGE mark", "Unbounded", sans-serif;
  font-synthesis: none;
  font-size: clamp(36px, 15cqw, 196px);
  line-height: .84;
  letter-spacing: -.06em;
  text-transform: uppercase;
  color: var(--k-ink);
}

.kintro__mark i { display: inline-block; font-style: normal; transform: translateY(110%); }

.kintro__beat[data-on="true"] .kintro__mark i {
  animation: kintro-rise .66s cubic-bezier(.16, 1, .3, 1) both;
  animation-delay: calc(var(--n) * 48ms);
}

.kintro__markName,
.kintro__markNum { display: flex; gap: .01em; }

.kintro__markName {
  font-weight: 700;
  line-height: 1;
  padding-bottom: .016em;
  border-bottom: .084em solid var(--k-accent);
}

.kintro__markNum {
  margin: 0 -.13em -.25em .04em;
  font-weight: 500;
  font-size: 1.43em;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--k-accent);
  transform: scaleX(.89);
  transform-origin: left bottom;
}

.kintro__beat[data-kind="mark"] .kintro__sub { margin-top: .5em; color: rgb(11 12 14 / .55); }

/* Полоски прогресса сверху, как у сторис */
.kintro__progress {
  position: absolute;
  top: clamp(10px, 2.4cqw, 22px);
  left: 5cqw;
  right: 5cqw;
  z-index: 5;
  display: flex;
  gap: 5px;
}

.kintro__progress i {
  flex: 1;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgb(255 255 255 / .22);
}

.kintro[data-light="true"] .kintro__progress i { background: rgb(11 12 14 / .16); }

.kintro__progress i::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
}

.kintro[data-light="true"] .kintro__progress i::after { background: var(--k-accent); }
.kintro__progress i[data-state="done"]::after { transform: scaleX(1); }
.kintro__progress i[data-state="active"]::after { animation: kintro-bar var(--dur, 1700ms) linear both; }

@keyframes kintro-bar { to { transform: scaleX(1); } }

/* На светлом финальном кадре «Повторить» — тёмная */
.live--intro:has(.kintro[data-light="true"]) .kintro__replay {
  border-color: rgb(11 12 14 / .2);
  background: rgb(11 12 14 / .06);
  color: #0b0c0e;
}

@media (prefers-reduced-motion: reduce) {
  .kintro__beat[data-kind="mark"] { opacity: 1; }
  .kintro__mark i,
  .kintro__word span { transform: none; }
  .kintro__sub { opacity: 1; }
}

/* ---------- Копия интерфейса Telegram (тёмная тема) для ботов ---------- */

.live--chat { display: block; padding: 0; background: #0e1621; }

.tg {
  --tg-bg: #0e1621;
  --tg-panel: #17212b;
  --tg-in: #182533;
  --tg-out: #2b5278;
  --tg-text: #f5f5f5;
  --tg-muted: #708499;
  --tg-accent: #5eb5f7;

  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 70% at 80% 0%, rgb(94 181 247 / .07), transparent 60%),
    radial-gradient(90% 60% at 0% 100%, rgb(43 82 120 / .18), transparent 70%),
    var(--tg-bg);
  color: var(--tg-text);
  font: 400 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  text-align: left;
}

.tg__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
  padding: 10px 16px;
  background: var(--tg-panel);
  border-bottom: 1px solid rgb(0 0 0 / .3);
}

.tg__back { width: 22px; height: 22px; color: var(--tg-muted); }

.tg__avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6ec1ff, #3a82d6);
  color: #fff;
  font-weight: 600;
  font-size: 17px;
}
.tg[data-bot="jarvis"] .tg__avatar { background: linear-gradient(135deg, #ffb36b, #e0703a); }

.tg__who { display: grid; line-height: 1.25; }
.tg__who b { font-weight: 600; }
.tg__status { color: var(--tg-muted); font-size: 13px; }
.tg__status.is-typing { color: var(--tg-accent); }

.tg__log {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 16px clamp(10px, 3vw, 28px) 8px;
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgb(255 255 255 / .15) transparent;
}

.tg-msg {
  position: relative;
  max-width: min(78%, 520px);
  padding: 7px 12px 6px;
  border-radius: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  animation: tg-in .25s ease-out both;
}

@keyframes tg-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
}

.tg-msg--bot { align-self: flex-start; background: var(--tg-in); border-bottom-left-radius: 4px; }
.tg-msg--me { align-self: flex-end; background: var(--tg-out); border-bottom-right-radius: 4px; }

.tg-msg b { font-weight: 600; }
.tg-msg a { color: var(--tg-accent); }

/* Время и галочки — справа внизу пузыря */
.tg-msg__meta {
  float: right;
  margin: 6px -4px -2px 10px;
  color: rgb(255 255 255 / .45);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.tg-msg--me .tg-msg__meta { color: rgb(174 214 255 / .75); }

/* «печатает…» */
.tg-typing { display: inline-flex; gap: 4px; padding: 6px 2px; }
.tg-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tg-muted);
  animation: tg-dot 1.2s infinite ease-in-out;
}
.tg-typing i:nth-child(2) { animation-delay: .15s; }
.tg-typing i:nth-child(3) { animation-delay: .3s; }

@keyframes tg-dot {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* Голосовое */
.tg-voice { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.tg-voice__play {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  color: var(--tg-out);
}
.tg-voice__play svg { width: 16px; height: 16px; }
.tg-voice__wave {
  flex: 1;
  height: 22px;
  background: currentColor;
  opacity: .7;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9h3V5h3v8h3V2h3v14h3V6h3v6h3V3h3v12h3V7h3v4h3V1h3v16h3V5h3v8h3V4h3v10h3V8h3v2h3V5h3v8h3V3h3v12h3V6h3v6h3V8h3v2h3V9z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9h3V5h3v8h3V2h3v14h3V6h3v6h3V3h3v12h3V7h3v4h3V1h3v16h3V5h3v8h3V4h3v10h3V8h3v2h3V5h3v8h3V3h3v12h3V6h3v6h3V8h3v2h3V9z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.tg-voice small { color: rgb(255 255 255 / .6); font-size: 12px; }

/* Файл */
.tg-file { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.tg-file__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  background: var(--tg-accent);
  color: var(--tg-in);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.tg-file b { display: block; font-weight: 500; }
.tg-file small { color: rgb(255 255 255 / .55); font-size: 13px; }

/* Фото-альбом (чеки) */
.tg-photos { display: grid; grid-template-columns: repeat(3, 64px); gap: 3px; }
.tg-photos span {
  height: 84px;
  border-radius: 6px;
  background:
    repeating-linear-gradient(transparent 0 9px, rgb(0 0 0 / .12) 9px 11px),
    linear-gradient(#f4f1ea, #e3ddd2);
}

/* Инлайн-кнопки под сообщением бота */
.tg-buttons {
  align-self: flex-start;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  width: min(78%, 520px);
  margin-top: -2px;
}
.tg-buttons button {
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: rgb(24 37 51 / .85);
  color: var(--tg-text);
  font: 500 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  transition: background-color .2s;
}
.tg-buttons button:hover { background: #22364a; }
.tg-buttons button:disabled { opacity: .5; cursor: default; }

.tg-note {
  align-self: center;
  padding: 4px 10px;
  border-radius: 10px;
  background: rgb(0 0 0 / .3);
  color: var(--tg-muted);
  font-size: 13px;
}

/* Подсказки (клавиатура бота) */
.tg__suggest {
  display: flex;
  gap: 6px;
  flex: none;
  padding: 8px clamp(10px, 3vw, 28px);
  overflow-x: auto;
  scrollbar-width: none;
}
.tg__suggest:empty { display: none; }
.tg__suggest button {
  flex: none;
  padding: 8px 12px;
  border: 1px solid rgb(94 181 247 / .35);
  border-radius: 999px;
  background: rgb(23 33 43 / .9);
  color: var(--tg-accent);
  font: 500 14px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.tg__suggest button:hover { background: #1e2c3a; }
.tg__suggest button:disabled { opacity: .45; cursor: default; }

.tg__input {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 8px 10px 8px 16px;
  background: var(--tg-panel);
}

.tg__input input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--tg-text);
  font: inherit;
  outline: none;
}
.tg__input input::placeholder { color: var(--tg-muted); }

.tg__input button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tg-accent);
  cursor: pointer;
}
.tg__input button svg { width: 24px; height: 24px; }
.tg__input button:disabled { color: var(--tg-muted); cursor: default; }

@media (max-width: 640px) {
  .tg { font-size: 14px; }
  .tg-msg { max-width: 88%; }
  .tg-buttons { width: 88%; }
}

/* Кнопка на готовом результате (появляется после сборки) */
.live__cta {
  position: absolute;
  right: clamp(16px, 2.4vw, 32px);
  bottom: clamp(16px, 2.4vw, 32px);
  z-index: 1;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 1rem/1 var(--font);
  box-shadow: 0 12px 40px rgb(0 0 0 / .45);
}

/* Телефон и планшет: строка проекта в столбик, окно ниже */
@media (max-width: 899px) {
  .project__text {
    top: 70px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "kind" "title" "text" "meta";
  }

  .project__title { font-size: clamp(2rem, 9vw, 3rem); margin: 0 0 8px; }

  .project__text > p:not(.project__kind) {
    font-size: .875rem;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .project .tags { display: none; }
  .project__meta { margin-top: 10px; }
  .action { padding: 11px 18px; }

  .window { bottom: 16px; }
  .window__label--live { max-width: 55%; }
  .code { font-size: .625rem; }
}

/* ---------- Переписка в боте ---------- */

.chat {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #0c0c0c;
  max-width: 520px;
  width: 100%;
  justify-self: center;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}

.chat__head small { font-weight: 400; color: var(--muted); }

.chat__avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
}

.chat__log {
  list-style: none;
  margin: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: .9375rem;
  line-height: 1.45;
}

.msg {
  max-width: 85%;
  padding: 9px 14px;
  border-radius: 16px;
}

.msg--bot {
  align-self: flex-start;
  background: #1c1c1c;
  border-bottom-left-radius: 4px;
}

.msg--me {
  align-self: flex-end;
  background: var(--ink);
  color: #111;
  border-bottom-right-radius: 4px;
}

.msg__buttons { display: flex; gap: 6px; margin-top: 10px; }

.msg__buttons span {
  flex: 1;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgb(243 240 234 / .07);
  text-align: center;
  font-size: .8125rem;
}

.msg--voice { display: flex; align-items: center; gap: 10px; font-size: .8125rem; }

.voice__play {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #111;
}
.voice__play::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  border-left: 9px solid var(--ink);
  border-block: 6px solid transparent;
}

.voice__wave {
  width: 96px;
  height: 18px;
  background: #111;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9h3V5h3v8h3V2h3v14h3V6h3v6h3V3h3v12h3V7h3v4h3V1h3v16h3V5h3v8h3V4h3v10h3V8h3v2h3V5h3v8h3V3h3v12h3V6h3v6h3V8h3v2h3V9z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 96 18' preserveAspectRatio='none'%3E%3Cpath d='M0 9h3V5h3v8h3V2h3v14h3V6h3v6h3V3h3v12h3V7h3v4h3V1h3v16h3V5h3v8h3V4h3v10h3V8h3v2h3V5h3v8h3V3h3v12h3V6h3v6h3V8h3v2h3V9z'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  opacity: .8;
}

.msg--file { display: flex; align-items: center; gap: 12px; }

.file__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #2f7d4f;
  color: #fff;
  font-size: .6875rem;
  font-weight: 600;
}

.msg--file b { display: block; font-weight: 500; }
.msg--file small { color: var(--muted); }

/* ---------- Связаться: форма → готовое сообщение в Telegram ---------- */

.contact {
  padding: clamp(100px, 16vh, 180px) var(--gutter);
}

.contact__title {
  font-size: clamp(2.6rem, 7vw, 7rem);
  line-height: .9;
  letter-spacing: -.05em;
}

.contact__lead {
  max-width: 52ch;
  margin: 18px 0 0;
  color: var(--muted);
}

.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
  margin-top: clamp(32px, 6vh, 56px);
}

.contact__form {
  display: grid;
  gap: 26px;
  padding: clamp(20px, 3vw, 36px);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgb(255 255 255 / .02);
}

.field {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field label,
.field legend {
  padding: 0;
  font-weight: 500;
}

.field legend { margin-bottom: 10px; }

.field input[type="text"],
.field textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #050505;
  color: var(--ink);
  font: inherit;
  transition: border-color .2s, box-shadow .2s;
}

.field textarea { min-height: 140px; resize: vertical; }

.field input::placeholder,
.field textarea::placeholder { color: var(--muted); opacity: .7; }

.field input[type="text"]:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.field textarea[aria-invalid="true"] { border-color: #ff7a6b; }

.field__error { margin: 0; color: #ff7a6b; font-size: .875rem; }

.field__note { margin: 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }

/* Поле ссылки или подсказка про файл под переключателем «ТЗ» */
.brief { display: grid; gap: 10px; margin-top: 14px; }
.brief[hidden] { display: none; }

.field input[aria-invalid="true"] { border-color: #ff7a6b; }

/* Выбор проекта — «таблетки» поверх обычных радиокнопок */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip { position: relative; cursor: pointer; }

.chip input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.chip span {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: background-color .2s, color .2s, border-color .2s;
}

.chip:hover span { border-color: var(--muted); }
.chip input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }

.contact__submit {
  justify-self: start;
  padding: 16px 26px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 1rem/1 var(--font);
  cursor: pointer;
  transition: box-shadow .25s;
}
.contact__submit:hover { box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); }

.contact__status { min-height: 1.5em; margin: -10px 0 0; color: var(--muted); font-size: .875rem; }

/* Предпросмотр: как сообщение будет выглядеть в Telegram */
.contact__preview { position: sticky; top: 96px; margin: 0; }
.contact__preview figcaption { margin-bottom: 12px; color: var(--muted); font-size: .875rem; }
.contact__preview .chat { max-width: none; }
.contact__message { max-width: 94%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg__hint { opacity: .5; }

.contact__direct { margin: 32px 0 0; color: var(--muted); }
.contact__direct a { color: var(--ink); }

@media (max-width: 899px) {
  .contact__grid { grid-template-columns: minmax(0, 1fr); }
  .contact__preview { position: static; }
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .875rem;
}
.footer a { text-decoration: none; }
.footer a:hover { color: var(--ink); }

/* ---------- Окно с игрой ---------- */

.player {
  width: min(1280px, 100vw);
  height: min(820px, 100svh);
  max-width: 100vw;
  max-height: 100svh;
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
}

.player::backdrop { background: rgb(0 0 0 / .88); }

.player iframe {
  display: block;
  width: 100%;
  height: calc(100% - 48px);
  border: 0;
}

.player__close {
  width: 100%;
  height: 48px;
  border: 0;
  background: #0c0c0c;
  color: var(--muted);
  font: 500 .9375rem var(--font);
  cursor: pointer;
}
.player__close:hover { color: var(--ink); }

/* ---------- Телефон ---------- */

@media (max-width: 640px) {
  .hero__note { max-width: 22ch; font-size: .875rem; }
  .service { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .player { border-radius: 0; }

  /* Код для телефона — строки до 42 символов: кегль подстраивается под ширину экрана */
  .code { font-size: min(.75rem, calc((100vw - 34px) / 29.5)); }

  /* Названия проектов не шире экрана, даже на 320 px */
  .project__title { font-size: min(2.6rem, calc((100vw - 32px) / 10.6)); }
}

@media (prefers-reduced-motion: reduce) {
  .hero__hint::after { animation: none; }
  .reel { clip-path: none; }
  .reel__caption { opacity: 1; }
}
