/* ==========================================================================
   ГОРТЕКС — ОПРОСНЫЙ ЛИСТ (квиз), стили. Версия 1.3

   Заливается на https://static.gortex.su/quiz/quiz.css
   Подключается в блоке Тильды: <link rel="stylesheet" href="...quiz.css?v=1.3">

   Палитра и шрифты — те же, что в каталоге (gortex-catalog/style.css).
   Все классы с префиксом gq- : Тильда навешивает свои правила и !important
   на всё внутри .t-rec, поэтому пересечений имён быть не должно.
   ========================================================================== */

.gx-quiz {
  --gq-bg: #383838;
  --gq-bg-alt: #2f2f2f;
  --gq-panel: #434343;
  --gq-panel-2: #3d3d3d;
  --gq-border: #565656;
  --gq-accent: #f5be6e;
  --gq-accent-strong: #e2a24a;
  --gq-accent-dim: rgba(245, 190, 110, 0.14);
  --gq-gray: #b0b0b0;
  --gq-text: #f7f7f7;
  --gq-text-dim: #c9c9c9;
  --gq-danger: #e2705a;
  --gq-radius: 2px;
  --gq-radius-lg: 8px;
  --gq-font: "Golos Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --gq-font-display: "Oswald", "Golos Text", "Segoe UI", Arial, sans-serif;
  --gq-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* Переменные дублируются на самой модалке: <dialog> уезжает в top layer,
   и в некоторых браузерах наследование от обёртки там не срабатывает. */
.gq-modal {
  --gq-bg: #383838;
  --gq-bg-alt: #2f2f2f;
  --gq-panel: #434343;
  --gq-panel-2: #3d3d3d;
  --gq-border: #565656;
  --gq-accent: #f5be6e;
  --gq-accent-strong: #e2a24a;
  --gq-accent-dim: rgba(245, 190, 110, 0.14);
  --gq-gray: #b0b0b0;
  --gq-text: #f7f7f7;
  --gq-text-dim: #c9c9c9;
  --gq-danger: #e2705a;
  --gq-radius: 2px;
  --gq-radius-lg: 8px;
  --gq-font: "Golos Text", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --gq-font-display: "Oswald", "Golos Text", "Segoe UI", Arial, sans-serif;
  --gq-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* --------------------------------------------------------------------------
   Режим «блок всплывающего окна Тильды».
   Окно рисует сама Тильда, поэтому своё убираем: рамку, тень, затемнение
   и крестик — иначе получилось бы окно внутри окна с двумя крестиками.
   -------------------------------------------------------------------------- */
.t-popup .gq-modal,
[class*="t-popup"] .gq-modal {
  position: static;
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

.t-popup .gq-shell,
[class*="t-popup"] .gq-shell {
  max-height: none;
  height: auto;
}

.t-popup .gq-scroll,
[class*="t-popup"] .gq-scroll {
  overflow: visible;
}

/* у попапа Тильды свой крестик */
.t-popup .gq-close,
[class*="t-popup"] .gq-close {
  display: none;
}

/* ---------- Сброс тильдовских стилей ---------- */
.gq-modal,
.gq-modal *,
.gq-modal *::before,
.gq-modal *::after {
  box-sizing: border-box;
}

.gq-modal {
  font-family: var(--gq-font);
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: normal;
  color: var(--gq-text);
  text-align: left;
}

.gq-modal button,
.gq-modal input,
.gq-modal textarea,
.gq-modal select {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  letter-spacing: normal;
  color: inherit;
  margin: 0;
  text-transform: none;
}

.gq-modal p,
.gq-modal h2,
.gq-modal h3,
.gq-modal ul,
.gq-modal li {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- Оболочка модалки ---------- */
.gq-modal {
  width: min(1060px, 96vw);
  max-width: 96vw;
  max-height: 92vh;
  padding: 0;
  border: 1px solid var(--gq-border);
  border-radius: var(--gq-radius);
  background: var(--gq-bg);
  box-shadow: var(--gq-shadow);
  overflow: hidden;
}

.gq-modal::backdrop {
  background: rgba(8, 7, 5, 0.78);
}

.gq-shell {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
  position: relative;
}

.gq-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

/* ---------- Прогресс-бар ---------- */
.gq-progress {
  height: 4px;
  background: var(--gq-bg-alt);
  flex: 0 0 auto;
}

.gq-progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gq-accent);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Кнопка закрытия ---------- */
.gq-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 20, 0.55);
  border: 1px solid var(--gq-border);
  border-radius: var(--gq-radius);
  color: var(--gq-text-dim);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.gq-close:hover {
  color: var(--gq-accent);
  border-color: var(--gq-accent);
  background: rgba(20, 20, 20, 0.85);
}

/* ---------- Скроллящееся тело ---------- */
.gq-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.gq-scroll::-webkit-scrollbar {
  width: 8px;
}

.gq-scroll::-webkit-scrollbar-track {
  background: var(--gq-bg-alt);
}

.gq-scroll::-webkit-scrollbar-thumb {
  background: var(--gq-accent);
}

/* Две колонки: слева вопрос, справа сводка ответов.
   Без второй колонки правая половина окна на коротких шагах пустует. */
.gq-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 44px;
  align-items: start;
  padding: 40px 44px 28px;
  min-height: 340px;
}

/* Шаг с карточками занимает всю ширину — шести плиткам нужно место */
.gq-step--wide {
  grid-template-columns: minmax(0, 1fr);
}

.gq-step--wide .gq-aside {
  display: none;
}

.gq-step-main {
  min-width: 0;
}

/* ---------- Боковая сводка ---------- */
.gq-aside {
  border-left: 1px solid var(--gq-border);
  padding-left: 28px;
  align-self: stretch;
}

.gq-aside-title {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gq-gray);
  margin-bottom: 16px;
}

.gq-sum {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gq-sum-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: var(--gq-radius);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.gq-sum-item:hover {
  background: var(--gq-panel);
}

.gq-sum-item:hover .gq-sum-label {
  color: var(--gq-accent);
}

.gq-sum-label {
  display: block;
  font-size: 0.76rem;
  color: var(--gq-gray);
  line-height: 1.3;
  transition: color 0.15s ease;
}

.gq-sum-value {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gq-text);
  line-height: 1.35;
  margin-top: 1px;
}

/* Пока ответов нет — вместо сводки короткий блок «что дальше» */
.gq-aside-facts {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gq-aside-facts li {
  position: relative;
  padding-left: 20px;
  font-size: 0.86rem;
  color: var(--gq-text-dim);
  line-height: 1.45;
}

.gq-aside-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 7px;
  height: 7px;
  background: var(--gq-accent);
}

/* ---------- Интро ---------- */
.gq-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
  min-height: 460px;
}

.gq-intro-media {
  background: var(--gq-bg-alt) center / cover no-repeat;
  min-height: 240px;
}

.gq-intro-body {
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
}

.gq-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gq-accent);
  font-weight: 600;
}

.gq-intro-body h2 {
  font-family: var(--gq-font-display);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.06;
}

.gq-intro-lead {
  color: var(--gq-text-dim);
  font-size: 1rem;
  max-width: 44ch;
}

.gq-intro-facts {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 2px;
}

.gq-intro-facts li {
  position: relative;
  padding-left: 20px;
  color: var(--gq-text-dim);
  font-size: 0.92rem;
}

.gq-intro-facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 7px;
  height: 7px;
  background: var(--gq-accent);
}

.gq-intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

/* ---------- Вопрос ---------- */
.gq-q {
  font-family: var(--gq-font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: clamp(1.2rem, 2.6vw, 1.75rem);
  line-height: 1.14;
}

.gq-hint {
  color: var(--gq-text-dim);
  font-size: 0.9rem;
  margin-top: 10px;
  max-width: 60ch;
}

/* Отступ задаётся здесь, а не через margin заголовка: на шагах без
   подсказки иначе получалось всего 8px и поле липло к заголовку. */
.gq-controls {
  margin-top: 30px;
}

/* ---------- Поля ввода ---------- */
.gq-inputrow {
  position: relative;
}

.gq-input {
  width: 100%;
  background: var(--gq-bg-alt);
  border: 1px solid var(--gq-border);
  border-radius: var(--gq-radius);
  color: var(--gq-text);
  padding: 14px 16px;
  min-height: 52px;
  font-size: 1.05rem;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

.gq-input::placeholder {
  color: #8d8d8d;
}

.gq-input:hover {
  border-color: #6b6b6b;
}

.gq-input:focus {
  outline: none;
  border-color: var(--gq-accent);
  background: #2a2a2a;
}

.gq-inputrow--unit .gq-input {
  padding-right: 68px;
}

.gq-unit {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gq-text-dim);
  font-size: 0.92rem;
  pointer-events: none;
}

.gq-textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.55;
}

.gq-input[type="number"]::-webkit-outer-spin-button,
.gq-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.gq-input[type="number"] {
  -moz-appearance: textfield;
}

/* ---------- Варианты ответа ---------- */
.gq-optlist {
  display: grid;
  gap: 12px;
}

.gq-opt {
  display: block;
  position: relative;
  padding: 18px 20px 18px 54px;
  background: var(--gq-panel);
  border: 1px solid var(--gq-border);
  border-radius: var(--gq-radius);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.gq-opt:hover {
  border-color: var(--gq-accent-strong);
  background: var(--gq-panel-2);
}

.gq-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.gq-opt::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 21px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gq-gray);
  border-radius: 50%;
  transition: border-color 0.15s ease;
}

.gq-opt.is-selected {
  border-color: var(--gq-accent);
  background: var(--gq-accent-dim);
}

.gq-opt.is-selected::before {
  border-color: var(--gq-accent);
  box-shadow: inset 0 0 0 4px var(--gq-accent);
}

.gq-opt-title {
  display: block;
  font-weight: 600;
  font-size: 1.02rem;
}

.gq-opt-note {
  display: block;
  color: var(--gq-text-dim);
  font-size: 0.88rem;
  margin-top: 3px;
}

/* ---------- Карточки исполнения (шаг 2) ---------- */
.gq-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.gq-card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  background: var(--gq-panel);
  border: 1px solid var(--gq-border);
  border-radius: var(--gq-radius);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.gq-card:hover {
  transform: translateY(-3px);
  border-color: var(--gq-card-accent, var(--gq-accent));
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.4);
}

.gq-card-media {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #2a2a2a center / cover no-repeat;
  border-bottom: 1px solid var(--gq-border);
}

.gq-card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.gq-card-title {
  font-family: var(--gq-font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--gq-text);
}

.gq-card-sub {
  font-size: 0.85rem;
  color: var(--gq-text-dim);
  line-height: 1.4;
}

.gq-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  pointer-events: none;
  transition: border-color 0.15s ease;
}

.gq-card.is-selected::after {
  border-color: var(--gq-accent);
}

.gq-card-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gq-accent);
  color: #2b2b2b;
  font-size: 15px;
  font-weight: 700;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.gq-card.is-selected .gq-card-check {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Шаг контактов ---------- */
.gq-fields {
  display: grid;
  gap: 16px;
}

.gq-field label {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gq-text-dim);
  margin-bottom: 7px;
}

.gq-consent {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  font-size: 0.88rem;
  color: var(--gq-text-dim);
  cursor: pointer;
  line-height: 1.45;
  max-width: 640px;
}

.gq-consent input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--gq-accent);
  cursor: pointer;
}

.gq-consent a {
  color: var(--gq-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Honeypot: скрыт от людей, виден ботам */
.gq-hp {
  position: absolute !important;
  left: -9999px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------- Ошибка ---------- */
.gq-error {
  display: none;
  margin-top: 12px;
  color: var(--gq-danger);
  font-size: 0.88rem;
  font-weight: 600;
}

.gq-error.is-shown {
  display: block;
}

@keyframes gq-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

.gq-shake {
  animation: gq-shake 0.32s ease;
}

/* ---------- Подвал навигации ---------- */
.gq-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 44px 22px;
  border-top: 1px solid var(--gq-border);
  background: var(--gq-bg);
}

.gq-counter {
  font-size: 0.85rem;
  color: var(--gq-gray);
  letter-spacing: 0.03em;
}

.gq-nav-btns {
  display: flex;
  gap: 10px;
}

/* ---------- Кнопки ---------- */
.gq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: none;
  border-radius: var(--gq-radius-lg);
  font-family: var(--gq-font);
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 26px;
  min-height: 52px;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease,
    transform 0.12s ease, opacity 0.18s ease;
}

.gq-btn:active {
  transform: scale(0.98);
}

.gq-btn-primary {
  background: var(--gq-accent);
  color: #2b2b2b;
}

.gq-btn-primary:hover {
  background: var(--gq-accent-strong);
}

.gq-btn-ghost {
  background: transparent;
  border: 1px solid var(--gq-border);
  color: var(--gq-text-dim);
  padding: 14px 18px;
}

.gq-btn-ghost:hover {
  border-color: var(--gq-accent);
  color: var(--gq-accent);
}

.gq-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.gq-btn-back {
  min-width: 56px;
  padding: 14px 16px;
  font-size: 1.15rem;
}

/* ---------- Экран успеха ---------- */
.gq-done {
  padding: 64px 44px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.gq-done-mark {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--gq-accent);
  color: #2b2b2b;
  font-size: 2.2rem;
  font-weight: 700;
}

.gq-done h2 {
  font-family: var(--gq-font-display);
  text-transform: uppercase;
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  letter-spacing: 0.02em;
}

.gq-done p {
  color: var(--gq-text-dim);
  max-width: 46ch;
}

.gq-done-phone {
  color: var(--gq-accent);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}

/* ---------- Фокус с клавиатуры ---------- */
.gq-modal button:focus-visible,
.gq-modal input:focus-visible,
.gq-modal textarea:focus-visible,
.gq-modal a:focus-visible,
.gq-modal label:focus-visible {
  outline: 2px solid var(--gq-accent);
  outline-offset: 3px;
}

/* ---------- Адаптив ---------- */
@media (max-width: 900px) {
  .gq-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gq-intro {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .gq-intro-media {
    aspect-ratio: 16 / 9;
    min-height: 0;
  }

  .gq-intro-body {
    padding: 30px 26px 34px;
  }

  /* Сводка съедает место, нужное самому вопросу — убираем её */
  .gq-step {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 30px 26px 22px;
    min-height: 0;
  }

  .gq-aside {
    display: none;
  }

  .gq-nav {
    padding: 16px 26px 18px;
  }
}

@media (max-width: 560px) {
  .gq-modal {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    height: 100dvh;
    border: none;
    border-radius: 0;
  }

  .gq-shell {
    max-height: 100dvh;
    height: 100dvh;
  }

  .gq-cards {
    grid-template-columns: 1fr;
  }

  .gq-step {
    padding: 26px 18px 18px;
  }

  .gq-nav {
    padding: 14px 18px 16px;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 10px;
  }

  .gq-counter {
    text-align: center;
  }

  .gq-nav-btns {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .gq-intro-body {
    padding: 26px 18px 30px;
  }

  /* 16px минимум — иначе iOS зумит страницу при фокусе на поле */
  .gq-input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gq-modal *,
  .gq-modal *::before,
  .gq-modal *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
