/* Общий слой демо: шрифт, токены (цвет, радиусы, высоты, типографическая шкала), шапка и общие компоненты —
   кнопка, поле ввода, полоса прогресса и ожидание генерации. entry.css и workspace.css берут значения отсюда и описывают только свои экраны. */

/* Onest лежит рядом с демо: лендинг не делает внешних запросов, а шрифт не зависит от того, что стоит в системе.
   Inter отклонён 2026-11-21: шрифт по умолчанию у большинства сервисов, страница с ним выглядела шаблонной.
   Вариативный файл с осью wght; лицензия SIL OFL 1.1 — OFL-Onest.txt рядом со шрифтом. */
@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/onest-cyrillic.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.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --font: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;

  --ink: #141414;
  --muted: #63635e;
  --placeholder: var(--muted); /* один серый со всеми подсказками: два почти одинаковых серых читались как ошибка */
  --line: #dcdcd6;
  --line-field: #c6c6bf;
  --line-hover: #9e9e98;
  --soft: #f3f3ef;
  --paper: #ffffff;
  --accent: #f45b2c;
  --error: #b3261e;

  /* Радиусы: мелкие чипы и миниатюры, элементы управления и плитки, крупные изображения. */
  --radius-s: 8px;
  --radius: 10px;
  --radius-l: 14px;

  /* Высота элементов управления: кнопки, поля и варианты ответа — одна; компактная — для чипов в боковой форме. */
  --control: 48px;
  --control-compact: 40px;

  /* Сетка страницы: шапка, лендинг и экран стенда стоят на одной левой линии. */
  --page: 1280px;
  --gutter: clamp(20px, 3.4vw, 48px);
  --page-top: clamp(28px, 3.4vw, 48px);

  /* Типографическая шкала. Заголовки — 600, плотный интервал и отрицательный трекинг; текст — 400/500. */
  --text-display: clamp(36px, 4.4vw, 60px); /* заголовок лендинга */
  --text-title: clamp(28px, 2.6vw, 36px);   /* вопрос анкеты, заголовок раздела */
  --text-heading: clamp(24px, 2.1vw, 28px); /* заголовок боковой формы и экрана стенда */
  --text-lead: 17px;                        /* подзаголовок, статус */
  --text-field: 16px;                       /* текст в полях: меньше 16 px iOS увеличивает страницу при фокусе */
  --text-body: 15px;                        /* основной текст, кнопки, варианты ответа */
  --text-compact: 14px;                     /* чипы ответов и идей, подписи плиток, навигация */
  --text-hint: 14px;                        /* подсказки и ошибки под полями: 13 px терялись (Илья, 2026-11-21) */
  --text-caption: 13px;                     /* мелкие подписи: счётчик вопросов, статусы, сноски */

  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#screen:focus { outline: none; }

.skip-link { position: absolute; left: 12px; top: -100px; z-index: 9; background: var(--paper); color: var(--ink); padding: 12px; }
.skip-link:focus { top: 10px; }

/* Шапка */

.site-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 10px max(var(--gutter), calc(50% - var(--page) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.045em;
  color: var(--ink);
}
.site-brand img { width: 26px; height: 26px; margin-right: 4px; }
.site-brand b { font-size: 16px; line-height: 22px; font-weight: 700; letter-spacing: -0.02em; background: var(--ink); color: #fff; border-radius: 5px; padding: 0 5px; }

.site-nav, .site-tools { display: flex; align-items: center; gap: 4px; }
.site-tools { margin-left: auto; }

.site-header .nav-btn {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  background: transparent;
  padding: 0 12px;
  font-size: var(--text-compact);
  font-weight: 500;
  line-height: 20px;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.site-header .nav-btn:hover, .site-header [aria-current=page] { background: var(--soft); }
.site-header .nav-outlined { border-color: var(--line); }
.site-header .nav-outlined:hover { background: var(--paper); border-color: var(--line-hover); }
/* Недоступное действие шапки: серое и без подсветки при наведении; причину показывает подсказка. */
.site-header [aria-disabled=true], .site-header [aria-disabled=true]:hover { color: #a3a39d; background: none; border-color: var(--line); cursor: default; }
.nav-anchor { position: relative; }
.nav-tip { position: absolute; right: 0; top: calc(100% + 9px); width: max-content; max-width: min(240px, 75vw); padding: 10px 14px; background: #242421; color: #fff; border-radius: var(--radius-s); font-size: var(--text-caption); box-shadow: 0 3px 12px #0002; }
#notice { margin: 0; padding: 10px max(var(--gutter), calc(50% - var(--page) / 2)); font-size: var(--text-compact); background: #fff5e9; }

@media (max-width: 650px) {
  .site-header { gap: 4px 8px; flex-wrap: wrap; padding-block: 8px; min-height: 56px; }
  .site-nav, .site-tools { gap: 0; }
  .site-header .nav-btn { padding: 0 8px; }
  .site-brand { font-size: 20px; gap: 4px; }
  .site-brand img { width: 23px; height: 23px; margin: 0; }
}

/* Кнопка. Тёмная — основное действие экрана; остальные варианты описаны в entry.css. */

.en-root .en-button,
.ws-root .ws-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--control);
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: var(--text-body);
  font-weight: 600;
  line-height: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.en-root .en-button-dark,
.ws-root .ws-primary {
  background: var(--ink);
  color: #fff;
}

.en-root .en-button-dark:hover:not(:disabled),
.ws-root .ws-primary:hover:not(:disabled) {
  background: #2e2e2c;
}

.en-root .en-button:disabled,
.ws-root .ws-button:disabled {
  background: #ebebe6;
  border-color: #ebebe6;
  color: #85857f;
  cursor: not-allowed;
}

/* Контурная — второе действие рядом с тёмной. Неактивная остаётся контуром, чтобы не спорить с тёмной. */
.ws-root .ws-secondary {
  background: var(--paper);
  border-color: var(--ink);
  color: var(--ink);
}

.ws-root .ws-secondary:hover:not(:disabled) {
  background: #f4f4f1;
}

.ws-root .ws-secondary:disabled {
  background: var(--paper);
  border-color: var(--line);
  color: #a3a39d;
}

/* Поле ввода: однострочное, многострочное и список — один вид. Фокус показывает потемневшая рамка той же
   толщины, без кольца и без утолщения. */

:is(.en-root, .ws-root) :is(input[type="text"], input[type="tel"], input[type="email"], textarea, select) {
  display: block;
  width: 100%;
  margin: 0;
  padding: 11px 16px;
  border: 1px solid var(--line-field);
  border-radius: var(--radius);
  background-color: var(--paper);
  color: var(--ink);
  font-size: var(--text-field);
  line-height: 24px;
  appearance: none;
  transition: border-color 0.15s;
}

:is(.en-root, .ws-root) :is(input[type="text"], input[type="tel"], input[type="email"], select) {
  min-height: var(--control);
}

:is(.en-root, .ws-root) :is(input, textarea, select)::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

:is(.en-root, .ws-root) :is(input, textarea, select):is(:disabled, [readonly]) {
  background-color: var(--soft);
  border-color: var(--line);
}

:is(.en-root, .ws-root) :is(input, textarea):disabled {
  color: var(--muted);
}

:is(.en-root, .ws-root) :is(input[type="text"], input[type="tel"], input[type="email"], textarea, select):hover:where(:not(:disabled, [readonly])) {
  border-color: var(--line-hover);
}

:is(.en-root, .ws-root) :is(input[type="text"], input[type="tel"], input[type="email"], textarea, select):focus {
  outline: none;
  border-color: var(--ink);
}

/* Многострочное поле не растягивается за уголок: оно само растёт вместе с текстом (где браузер умеет
   field-sizing), а дальше прокручивается. Минимум — три строки. */
:is(.en-root, .ws-root) textarea {
  min-height: calc(24px * 3 + 24px);
  max-height: 264px;
  resize: none;
  field-sizing: content;
  overflow-y: auto;
}

/* Стрелка только у выпадающего списка. */
:is(.en-root, .ws-root) select:not([multiple]) {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2363635e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
}

/* Полоса прогресса с процентами справа: подбор идей в анкете и ожидание генерации (wait-panel.js). */
.progress-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-caption);
  line-height: 16px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  display: block;
  width: 160px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}

.progress-fill {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--ink);
}

/* Ожидание генерации (wait-panel.js): первая идея и доработка стенда. Под этапом и полосой — размытая
   картинка (плитка стиля или текущая версия стенда), осветлённая до читаемости текста. Рамку задаёт экран. */
.wait-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--ink);
}

.wait-backdrop {
  position: absolute;
  inset: -40px;
  z-index: -1;
  background: var(--soft) center / cover no-repeat;
  filter: blur(28px) brightness(1.08) saturate(0.9);
}

.wait-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(255 255 255 / 0.5);
}


.wait-body {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(320px, 100%);
}

.wait-note {
  margin: -6px 0 0;
  font-size: var(--text-compact);
  line-height: 20px;
  color: var(--muted);
}

.wait-title {
  margin: 0;
  font-size: var(--text-lead);
  font-weight: 600;
  line-height: 1.4;
}

.wait-panel .progress-line {
  display: flex;
  width: 100%;
}

.wait-panel .progress-bar {
  flex: 1;
  width: auto;
  background: rgb(20 20 20 / 0.12);
}

.wait-panel .progress-fill {
  transition: width 300ms linear;
}

/* Добег до 100 % рисуется по кадрам: переход сгладил бы его с опозданием. */
.wait-finishing .progress-fill {
  transition: none;
}

/* Три точки после этапа загораются по очереди: видно, что работа идёт, даже пока полоса почти стоит. */
.wait-dots {
  display: inline-flex;
  width: 1.2em;
}

.wait-dots span {
  animation: wait-dot 1.2s infinite both;
}

.wait-dots span:nth-child(2) { animation-delay: 0.2s; }
.wait-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes wait-dot {
  0%, 80%, 100% { opacity: 0.15; }
  40% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .wait-panel .progress-fill {
    transition: none;
  }

  .wait-dots span {
    animation: none;
  }
}
