/* Test-MIDIS — стили в духе midis.ru. Токены сняты с их CSS (см. docs/PLAN.md, этап 7). */

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-cyrillic-wght.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-wght.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --c-accent: #fc4c00;
  --c-accent-hover: #e04400;
  --c-accent-soft: #fff1ea;
  --c-blue: #4469ea;
  --c-blue-soft: #d8deff;
  --c-bg: #e7e9ef;
  --c-surface: #ffffff;
  --c-surface-2: #f3f3f3;
  --c-text: #303030;
  --c-muted: #8794ab;
  --c-border: #d9dce4;
  --c-positive: #60cf5d;
  --c-negative: #ec4646;
  --c-warning: #ffd646;

  --radius-s: 12px;
  --radius-m: 20px;
  --radius-l: clamp(20px, 1.92vw + 13px, 40px);
  --radius-pill: 999px;

  --fs-h1: clamp(26px, 2.2vw + 16px, 45px);
  --fs-h2: clamp(20px, 1.2vw + 14px, 30px);
  --fs-h3: 18px;
  --fs-body: clamp(15px, 0.3vw + 14px, 18px);
  --fs-small: 14px;

  --gutter: clamp(16px, 3vw, 40px);
  --shadow: 0 10px 30px rgba(48, 48, 48, 0.08);
  --focus: 0 0 0 3px rgba(68, 105, 234, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--c-text);
  background: var(--c-surface);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 0.9em; }

a { color: var(--c-blue); }
a:hover { color: var(--c-accent); }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 6px;
}

img { max-width: 100%; height: auto; }

[hidden] { display: none !important; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--c-text);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius-s);
  z-index: 10;
}
.skip-link:focus { left: 8px; }

.accent { color: var(--c-accent); }
.muted { color: var(--c-muted); }
.eyebrow {
  font-size: var(--fs-small);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--c-muted);
  margin-bottom: 0.75em;
}
.lead {
  font-size: clamp(16px, 0.6vw + 14px, 22px);
  max-width: 44ch;
}
.badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--c-blue-soft);
  color: var(--c-text);
  font-weight: 600;
  font-size: var(--fs-small);
}

/* ---------- Шапка и подвал ---------- */

.site-header {
  border-bottom: 1px solid var(--c-bg);
  background: var(--c-surface);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 72px;
}
.site-header__logo img { display: block; width: 130px; }
.site-header__caption {
  font-size: 12px;
  line-height: 1.25;
  color: var(--c-muted);
  padding-left: 16px;
  border-left: 1px solid var(--c-border);
}
.site-header__phone {
  margin-left: auto;
  font-weight: 700;
  color: var(--c-text);
  text-decoration: none;
  white-space: nowrap;
}

.site-main {
  flex: 1;
  padding-top: clamp(20px, 3vw, 40px);
  padding-bottom: clamp(40px, 5vw, 80px);
}

.site-footer {
  background: var(--c-text);
  color: #cfd3dc;
  font-size: var(--fs-small);
  padding: 40px 0 24px;
}
.site-footer__inner {
  display: grid;
  gap: 24px;
  grid-template-columns: 1fr;
}
.site-footer__contacts p { margin: 0 0 4px; }
.site-footer__contacts b { color: #fff; }
.site-footer__links { display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: #fff; }
.site-footer a:hover { color: var(--c-accent); }
.site-footer__copy { grid-column: 1 / -1; margin: 0; color: var(--c-muted); }

@media (min-width: 768px) {
  .site-header__logo img { width: 161px; }
  .site-footer__inner { grid-template-columns: 2fr 1fr; }
}

@media (max-width: 480px) {
  .site-header__caption { display: none; }
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 26px;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn--lg { min-height: 58px; padding: 16px 36px; font-size: 18px; }

.btn--primary { background: var(--c-accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--c-accent-hover); color: #fff; }

.btn--ghost { background: transparent; color: var(--c-text); border-color: var(--c-text); }
.btn--ghost:hover { background: var(--c-text); color: #fff; }

.btn--light { background: #fff; color: var(--c-text); }
.btn--light:hover { background: var(--c-text); color: #fff; }

.btn--outline-light { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.7); }
.btn--outline-light:hover { background: #fff; color: var(--c-text); }

.btn--link {
  background: none;
  border: none;
  padding: 8px 0;
  min-height: auto;
  color: var(--c-muted);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn--link:hover { color: var(--c-accent); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 24px;
}
.actions form { margin: 0; }

/* ---------- Карточки ---------- */

.card {
  background: var(--c-surface);
  border-radius: var(--radius-l);
  padding: clamp(20px, 3vw, 40px);
  box-shadow: var(--shadow);
}
.card--accent { background: var(--c-accent); color: #fff; box-shadow: none; }
.card--accent h2 { color: #fff; }

.notice {
  background: var(--c-blue-soft);
  border-radius: var(--radius-m);
  padding: 14px 20px;
  margin-bottom: 24px;
}

.prose p:last-child { margin-bottom: 0; }
.prose h2 { margin-top: 1.2em; }
.prose h2:first-child { margin-top: 0; }

.doc { max-width: 860px; margin: 0 auto; }

/* ---------- Главная ---------- */

.hero {
  position: relative;
  display: grid;
  gap: 32px;
  background: var(--c-bg);
  border-radius: var(--radius-l);
  padding: clamp(28px, 5vw, 72px);
  overflow: hidden;
}
.hero h1 { font-size: clamp(30px, 3.4vw + 14px, 60px); max-width: 14ch; }
.hero__art {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  align-self: center;
  justify-self: center;
  width: min(100%, 320px);
}
.type-tile {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: var(--radius-l);
  background: #fff;
  font-size: clamp(40px, 5vw, 80px);
  font-weight: 800;
  color: var(--c-text);
  box-shadow: var(--shadow);
}
.type-tile--accent { background: var(--c-accent); color: #fff; }

.resume-card {
  margin-top: 24px;
  background: #fff;
  border-radius: var(--radius-m);
  padding: 20px 24px;
  max-width: 560px;
}
.resume-card p { margin: 0; }
.resume-card .actions { margin-top: 16px; }

.steps { margin-top: clamp(40px, 5vw, 72px); }
.steps__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.step { position: relative; }
.step__num {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--c-accent-soft);
  color: var(--c-accent);
  font-weight: 800;
  margin-bottom: 16px;
}
.step p { color: #5d6272; margin: 0; }

.instruction { margin-top: clamp(24px, 3vw, 40px); background: var(--c-surface-2); box-shadow: none; }

@media (min-width: 900px) {
  .hero { grid-template-columns: 1.4fr 1fr; }
  .steps__list { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Анкета ---------- */

.page-head { margin-bottom: 24px; }
.page-head .badge { margin-top: 8px; }

.form { max-width: 860px; }
.form__grid { display: grid; gap: 18px 24px; }
@media (min-width: 720px) {
  .form__grid { grid-template-columns: 1fr 1fr; }
}
.form__errors:empty { display: none; }
.form__errors {
  color: var(--c-negative);
  margin-bottom: 16px;
}
.form__errors ul { margin: 0; padding-left: 20px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-weight: 600; font-size: 15px; }
.field__req { color: var(--c-accent); }
.field__input {
  font: inherit;
  font-size: 16px; /* меньше 16px — iOS зумит поле */
  line-height: 1.4;
  padding: 12.5px 21px;
  border: 1px solid var(--c-text);
  border-radius: var(--radius-s);
  background: #fff;
  color: var(--c-text);
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field__input::placeholder { color: #c7c9d1; }
.field__input:focus { outline: none; border-color: var(--c-blue); box-shadow: var(--focus); }
.field--invalid .field__input { border-color: var(--c-negative); }
.field__hint { font-size: 13px; color: var(--c-muted); }
.field__error { font-size: 13px; color: var(--c-negative); }
.field__error:empty { display: none; }

.checkbox {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 24px;
  cursor: pointer;
  font-size: 15px;
}
.checkbox input {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 2px 0 0;
  accent-color: var(--c-accent);
}

/* Ловушка для ботов: убрана с экрана, но не display:none (часть ботов это проверяет) */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Тест ---------- */

.quiz { max-width: 860px; margin: 0 auto; }
.quiz__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--fs-small);
  color: var(--c-muted);
  margin-bottom: 10px;
}
.quiz__counter b { color: var(--c-text); }
.quiz__who { text-align: right; }

.progress {
  height: 8px;
  background: var(--c-bg);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 24px;
}
.progress__bar {
  display: block;
  height: 100%;
  background: var(--c-accent);
  border-radius: inherit;
  transition: width 0.3s ease;
}

.quiz__card { background: var(--c-bg); box-shadow: none; }
.quiz__card--enter { animation: quiz-enter 0.25s ease; }
@keyframes quiz-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.quiz__question {
  font-size: clamp(22px, 1.6vw + 14px, 34px);
  margin-bottom: 24px;
}
.quiz__question:focus { box-shadow: none; }
.quiz__options { display: grid; gap: 14px; }
@media (min-width: 720px) {
  .quiz__options { grid-template-columns: 1fr 1fr; }
}
.option {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  min-height: 96px;
  padding: 20px 22px;
  border: 2px solid transparent;
  border-radius: var(--radius-m);
  background: #fff;
  color: var(--c-text);
  font: inherit;
  font-size: clamp(16px, 0.4vw + 14px, 19px);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s, background-color 0.15s;
}
/* На сенсорных экранах :hover «залипает» после тапа — следующий вопрос выглядел бы уже выбранным */
@media (hover: hover) {
  .option:hover { border-color: var(--c-accent); }
}
.option:active { transform: scale(0.99); }
.option__key {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c-bg);
  font-weight: 700;
  font-size: 14px;
}
.option--selected { border-color: var(--c-accent); background: var(--c-accent-soft); }
.option--selected .option__key { background: var(--c-accent); color: #fff; }
.quiz__hint { margin: 18px 0 0; font-size: 13px; color: var(--c-muted); }
.quiz--busy .option { pointer-events: none; }
@media (hover: none) {
  .quiz__hint-keys { display: none; }
}

.quiz__nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}
.quiz__nav form { margin: 0; }

/* ---------- Результат ---------- */

.result-hero {
  background: var(--c-accent);
  color: #fff;
  border-radius: var(--radius-l);
  padding: clamp(28px, 5vw, 64px);
}
.result-hero .eyebrow { color: rgba(255, 255, 255, 0.8); }
.result-hero__type { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; }
.result-hero__code {
  font-size: clamp(64px, 8vw + 20px, 140px);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: 0.02em;
}
.result-hero__title { font-size: clamp(26px, 2.4vw + 14px, 48px); margin: 0; color: #fff; }

.result-layout {
  display: grid;
  gap: 20px;
  margin-top: 20px;
}
.result-aside { display: grid; gap: 20px; align-content: start; }
.result-description p { hyphens: auto; }
@media (min-width: 720px) {
  .result-description p { text-align: justify; }
}
@media (min-width: 960px) {
  .result-layout { grid-template-columns: 1.6fr 1fr; }
}

.chips {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--c-bg);
  font-size: 15px;
  font-weight: 500;
}

.announcement { background: var(--c-blue-soft); box-shadow: none; }
.result-footer { margin-top: 32px; text-align: center; }

/* ---------- Ошибки ---------- */

.status-page { text-align: center; padding: clamp(40px, 8vw, 100px) 0; }
.status-page .lead { margin: 0 auto 28px; }
.status-page__code {
  font-size: clamp(80px, 12vw, 160px);
  font-weight: 800;
  line-height: 1;
  color: var(--c-accent);
  margin: 0 0 12px;
}

/* ---------- Печать ---------- */

@media print {
  .site-header__phone,
  .site-footer__links,
  .no-print,
  .skip-link { display: none !important; }
  body { font-size: 11pt; }
  .card, .result-hero { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .result-hero { background: #fff; color: var(--c-text); }
  .result-hero .eyebrow, .result-hero__title { color: var(--c-text); }
  .result-hero__code { color: var(--c-accent); font-size: 60pt; }
  .result-layout { grid-template-columns: 1fr; }
  .site-footer { background: none; color: var(--c-text); padding: 12pt 0 0; }
  .site-footer b { color: var(--c-text); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Вход сотрудников ---------- */

.auth { max-width: 520px; margin: 0 auto; }
.auth__fields { display: grid; gap: 16px; }
.auth__alt { margin: 24px 0 0; font-size: var(--fs-small); color: var(--c-muted); }
.form__errors p { margin: 0 0 4px; }

/* Незаметная кнопка входа для сотрудников в углу шапки главной */
.staff-link {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  color: var(--c-muted);
  flex: none;
  transition: color 0.15s, border-color 0.15s;
}
.staff-link:hover { color: var(--c-accent); border-color: var(--c-accent); }
.site-header__phone + .staff-link { margin-left: 4px; }
