/* ── Помощь с ТЗ ──────────────────────────────────────────────────────────────
   Страница опроса в стиле главной: бумага, тушь, оранжевый акцент, рамки
   толщиной 2px и жёсткие тени. Токены, кнопки и шрифты — из css/main.css.
   На телефоне всё плотнее, главная кнопка закреплена под пальцем. */

.brief-page {
  --brief-width: 820px;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Направляющие колонки — как на главной, но по ширине опроса. */
.brief-page::before {
  background:
    linear-gradient(var(--line), var(--line)) calc(50% - var(--brief-width) / 2) 0 / 1px 100% no-repeat,
    linear-gradient(var(--line), var(--line)) calc(50% + var(--brief-width) / 2) 0 / 1px 100% no-repeat;
}

.brief-backdrop {
  display: none;
}

.brief-top,
.brief-main,
.brief-foot {
  position: relative;
  z-index: 1;
}

/* ── Шапка ── */

.brief-top {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-height);
  padding: 0 max(var(--gutter), calc((100% - var(--brief-width)) / 2 + var(--gutter)));
  border-bottom: 1px solid var(--ink);
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brief-top__meta {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.brief-top__back {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12.5px;
  text-decoration: none;
}

.brief-top__back:hover {
  color: var(--accent-deep);
}

/* ── Основная колонка ── */

.brief-main {
  flex: 1;
  width: min(var(--brief-width), 100%);
  margin: 0 auto;
  padding: clamp(24px, 5vh, 56px) var(--gutter) 56px;
}

/* ── Прогресс ── */

.brief-progress {
  margin-bottom: 20px;
}

.brief-progress__info {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}

.brief-progress__info [data-brief-section] {
  color: var(--accent-deep);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.brief-progress__track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1.5px solid var(--ink);
  background: var(--card);
}

.brief-progress__track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 6px, #ff7a40 6px 12px);
  transition: width 520ms var(--ease);
}

/* ── Экраны ── */

.brief-screen {
  animation: brief-arrive 380ms var(--ease) both;
}

@keyframes brief-arrive {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.brief-screen--loading {
  display: grid;
  place-items: center;
  gap: 16px;
  min-height: 40vh;
  text-align: center;
}

.brief-card {
  position: relative;
  padding: clamp(22px, 4.5vw, 44px);
  border: 2px solid var(--ink);
  background: var(--card);
  box-shadow: var(--shadow-3) var(--ink);
}

.brief-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brief-eyebrow b {
  padding: 2px 7px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}

.brief-title {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.brief-title span {
  color: var(--accent);
}

.brief-lead {
  max-width: 600px;
  margin: 0 0 26px;
  color: var(--ink-2);
  font-size: 16px;
  line-height: 1.6;
}

.brief-muted {
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.55;
}

/* ── Вступление ── */

.brief-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 24px;
  padding: 0;
  border-top: 1.5px solid var(--ink);
  border-left: 1.5px solid var(--ink);
  list-style: none;
}

.brief-steps li {
  padding: 16px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  background: var(--paper);
}

.brief-steps strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
}

.brief-steps span {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}

.brief-note {
  display: flex;
  gap: 12px;
  margin: 0 0 22px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  line-height: 1.5;
}

.brief-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 22px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
  cursor: pointer;
}

.brief-check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.brief-check a {
  color: var(--ink);
  text-underline-offset: 3px;
}

.brief-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.brief-primary {
  background: var(--accent);
  color: #fff;
}

.brief-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12.5px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.brief-link:hover {
  color: var(--accent-deep);
}

.brief-resume {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 20px;
  padding: 14px 16px;
  border: 2px dashed var(--ink);
  background: var(--paper);
  font-size: 14px;
}

/* ── Вопрос ── */

.brief-question__title {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(21px, 3.2vw, 30px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.03em;
  outline: none;
  text-wrap: balance;
}

.brief-question__hint {
  max-width: 640px;
  margin: 0 0 22px;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.55;
}

.brief-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}

.brief-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 42px 12px 12px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s, transform 0.13s var(--ease), box-shadow 0.13s var(--ease);
  animation: brief-arrive 400ms var(--ease) both;
  animation-delay: calc(var(--order, 0) * 30ms);
}

@media (hover: hover) and (pointer: fine) {
  .brief-option:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-1) var(--ink);
  }
}

.brief-option__key {
  flex: none;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  font-family: var(--mono);
  font-size: 11px;
}

/* Отметка справа: квадрат для нескольких вариантов, круг — для одного. */
.brief-option::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 16px;
  height: 16px;
  border: 1.5px solid currentColor;
  transform: translateY(-50%);
}

.brief-options[data-type="single"] .brief-option::after {
  border-radius: 50%;
}

.brief-option[aria-checked="true"] {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-1) var(--accent);
}

.brief-option[aria-checked="true"] .brief-option__key {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.brief-option[aria-checked="true"]::after {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 3px var(--ink);
}

.brief-other {
  margin: 0 0 14px;
}

.brief-field {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  transition: box-shadow 0.14s;
}

.brief-field::placeholder {
  color: var(--ink-3);
}

.brief-field:focus {
  outline: none;
  box-shadow: var(--shadow-1) var(--accent);
}

textarea.brief-field {
  min-height: 140px;
  resize: vertical;
}

.brief-field-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11.5px;
}

.brief-clarify {
  margin: 16px 0 0;
}

.brief-clarify__label {
  display: block;
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
}

.brief-clarify__label span {
  color: var(--ink-3);
  font-weight: 400;
}

.brief-clarify__field {
  min-height: 60px;
  resize: vertical;
}

textarea.brief-clarify__field {
  min-height: 60px;
}

.brief-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.brief-controls__side {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brief-kbd {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11.5px;
}

.brief-error {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
}

/* ── Ожидание следующего вопроса ── */

.brief-thinking {
  display: grid;
  gap: 20px;
}

.brief-thinking__status {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12.5px;
}

.brief-dots {
  display: inline-flex;
  gap: 6px;
}

.brief-dots span {
  width: 8px;
  height: 8px;
  background: var(--accent);
  animation: brief-dot 1.1s ease-in-out infinite;
}

.brief-dots span:nth-child(2) { animation-delay: 0.15s; }
.brief-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes brief-dot {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-4px); }
}

.brief-skeleton {
  height: 14px;
  background:
    linear-gradient(90deg, var(--paper-2) 25%, var(--paper-3) 50%, var(--paper-2) 75%) 0 0 / 200% 100%;
  animation: brief-shimmer 1.4s linear infinite;
}

.brief-skeleton--title { height: 28px; width: 78%; }
.brief-skeleton--line { width: 52%; }

.brief-skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.brief-skeleton-grid .brief-skeleton {
  height: 58px;
}

@keyframes brief-shimmer {
  to { background-position: -200% 0; }
}

/* ── Контакты ── */

.brief-form {
  display: grid;
  gap: 16px;
}

.brief-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brief-segment {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brief-segment button {
  padding: 9px 14px;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.brief-segment button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-1) var(--accent);
}

/* ── Финал ── */

.brief-done__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border: 2px solid var(--ink);
  background: var(--accent);
  box-shadow: var(--shadow-2) var(--ink);
  color: #fff;
  font-size: 26px;
  animation: brief-pop 520ms cubic-bezier(0.22, 1.4, 0.36, 1) both;
}

@keyframes brief-pop {
  from { opacity: 0; transform: scale(0.6); }
}

.brief-callout {
  display: grid;
  gap: 14px;
  margin: 8px 0 36px;
  padding: clamp(18px, 3.5vw, 28px);
  border: 2px solid var(--ink);
  background: var(--accent);
  color: var(--ink);
}

.brief-callout h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 26px);
}

.brief-callout p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
}

.brief-callout .button {
  justify-self: start;
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-2) var(--paper);
}

.brief-cases__title {
  margin: 0 0 16px;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brief-cases {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.brief-case {
  display: flex;
  flex-direction: column;
  border: 2px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow-1) var(--ink);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
  animation: brief-arrive 460ms var(--ease) both;
  animation-delay: calc(var(--order, 0) * 90ms + 120ms);
}

@media (hover: hover) and (pointer: fine) {
  .brief-case:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--shadow-2) var(--accent);
  }
}

.brief-case__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 2px solid var(--ink);
  background: var(--paper-2);
}

.brief-case__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.brief-case__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
}

.brief-case__category {
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brief-case__title {
  margin: 0;
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
}

.brief-case__reason {
  flex: 1;
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
}

.brief-case__link {
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

/* ── Примерная стоимость ── */

.brief-estimate {
  margin: 0 0 20px;
  padding: clamp(16px, 3vw, 24px);
  border: 2px solid var(--ink);
  background: var(--paper);
  animation: brief-arrive 460ms var(--ease) 120ms both;
}

.brief-estimate__label {
  margin: 0 0 8px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brief-estimate__value {
  margin: 0 0 10px;
  font-family: var(--display);
  font-size: clamp(26px, 4.4vw, 40px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.brief-estimate__from {
  color: var(--ink-3);
  font-size: 0.55em;
}

.brief-estimate__note {
  margin: 0;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.5;
}

/* ── Предпросмотр и ошибки ── */

.brief-banner {
  margin: 0 0 18px;
  padding: 8px 12px;
  border: 2px dashed var(--ink);
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 12px;
}

.brief-state__code {
  margin: 0 0 8px;
  color: var(--accent-deep);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.brief-noscript {
  padding: 18px;
  border: 2px solid var(--ink);
  background: var(--card);
}

/* ── Подвал ── */

.brief-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--ink);
  color: var(--on-ink-2);
  font-family: var(--mono);
  font-size: 12px;
}

.brief-foot a {
  text-decoration: none;
}

.brief-foot a:hover {
  color: var(--accent);
}

/* ── Телефон: плотно по высоте ── */

@media (max-width: 760px) {
  .brief-top__meta {
    display: none;
  }

  .brief-main {
    padding: 14px var(--gutter) 24px;
  }

  .brief-progress {
    margin-bottom: 12px;
  }

  .brief-progress__track {
    height: 8px;
  }

  .brief-card {
    padding: 16px 14px;
    box-shadow: var(--shadow-1) var(--ink);
  }

  .brief-eyebrow {
    margin-bottom: 10px;
    font-size: 11px;
  }

  .brief-title {
    margin-bottom: 10px;
    font-size: 25px;
  }

  .brief-lead {
    margin-bottom: 16px;
    font-size: 14.5px;
    line-height: 1.5;
  }

  .brief-steps {
    grid-template-columns: 1fr;
    margin-bottom: 16px;
  }

  .brief-steps li {
    display: flex;
    gap: 10px;
    padding: 9px 12px;
  }

  .brief-steps strong {
    margin: 1px 0 0;
  }

  .brief-steps span {
    font-size: 13.5px;
  }

  .brief-note {
    margin-bottom: 14px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .brief-check {
    margin-bottom: 14px;
    font-size: 12.5px;
  }

  .brief-question__title {
    font-size: 20px;
  }

  .brief-question__hint {
    margin-bottom: 14px;
    font-size: 14px;
  }

  .brief-options,
  .brief-skeleton-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .brief-option {
    min-height: 46px;
    padding: 9px 38px 9px 10px;
    font-size: 14.5px;
  }

  .brief-option__key,
  .brief-kbd {
    display: none;
  }

  textarea.brief-field {
    min-height: 110px;
  }

  .brief-clarify {
    margin-top: 12px;
  }

  /* Главная кнопка всегда под большим пальцем. */
  .brief-controls {
    position: sticky;
    bottom: 0;
    z-index: 5;
    margin: 16px -14px -16px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 2px solid var(--ink);
    background: var(--card);
  }

  .brief-controls .button {
    flex: 1;
    min-height: 44px;
    box-shadow: var(--shadow-1) var(--ink);
  }

  .brief-controls__side {
    width: 100%;
    justify-content: space-between;
    gap: 12px;
  }

  .brief-callout {
    margin-bottom: 24px;
  }

  .brief-cases {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .brief-case__body {
    padding: 10px;
  }

  .brief-case__title {
    font-size: 14.5px;
  }

  .brief-case__reason {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12px;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .brief-foot {
    gap: 6px 16px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .brief-screen,
  .brief-option,
  .brief-case,
  .brief-done__mark {
    animation: none;
  }

  .brief-dots span,
  .brief-skeleton {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }

  .brief-progress__track span {
    transition: none;
  }
}
