/* Цвета из Брендинг.ai: CMYK 0/100/75/4 → #f4003d, акцент 7/100/64/33 → #9e003d */
:root {
  --red: #f4003d;
  --red-dark: #9e003d;
  --red-soft: #f8809f;
  --red-pale: #fcc0d0;
  --red-faint: #fde8ee;
  --text: #1a1a1a;
  --text-muted: #5c5c5c;
  --white: #ffffff;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --radius: 12px;
  --radius-pill: 999px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Фон из Брендинг.ai (SVG по фирменным дугам и цветам) */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--white);
}

.brand-bg {
  position: absolute;
  opacity: 0;
  transition: opacity 0.55s ease;
}

/* Стартовая страница: ~половина круга справа на экране (мобильные) */
.brand-bg--light {
  opacity: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 100% 42%;
}

.brand-bg--red {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

body.screen-red .brand-bg--light {
  opacity: 0;
}

body.screen-red .brand-bg--red {
  opacity: 1;
}

/* Вопросительные знаки (визуал 5) — только на экране вопроса */
.decor {
  position: absolute;
  opacity: 0;
  transition: opacity 0.4s ease;
}

body.screen-red[data-active="question"] .decor--questions {
  opacity: 1;
}

.decor--questions .q {
  position: absolute;
  font-weight: 700;
  color: var(--red-pale);
  opacity: 0.35;
  line-height: 1;
  pointer-events: none;
}

.decor--questions .q:nth-child(1) {
  top: 6%;
  left: 2%;
  font-size: clamp(7rem, 18vw, 14rem);
  transform: rotate(-12deg);
}

.decor--questions .q:nth-child(2) {
  bottom: 12%;
  right: 5%;
  font-size: clamp(6rem, 16vw, 12rem);
  transform: rotate(10deg);
}

.decor--questions .q:nth-child(3) {
  top: 40%;
  right: 0%;
  font-size: clamp(4rem, 12vw, 9rem);
  transform: rotate(20deg);
  opacity: 0.25;
}

.decor--questions .q:nth-child(4) {
  bottom: 35%;
  left: 0%;
  font-size: clamp(3.5rem, 10vw, 7rem);
  transform: rotate(-18deg);
  opacity: 0.25;
}

.decor--questions .q:nth-child(5) {
  top: 55%;
  right: 25%;
  font-size: clamp(2.5rem, 7vw, 5rem);
  transform: rotate(5deg);
  opacity: 0.2;
}

/* Молнии (визуал 47) — акцент на форме сертификата */
body.screen-red[data-active="cert-form"] .decor--bolts {
  opacity: 1;
}

.decor--bolts::before {
  content: "";
  position: absolute;
  top: 15%;
  right: 8%;
  width: 48px;
  height: 72px;
  background: var(--white);
  clip-path: polygon(50% 0%, 0% 55%, 38% 55%, 22% 100%, 100% 38%, 58% 38%, 50% 0%);
  opacity: 0.15;
  filter: blur(1px);
}

.site-header {
  position: relative;
  z-index: 2;
  padding: 12px 16px 8px;
  display: flex;
  justify-content: center;
}

.site-logo {
  height: clamp(120px, 32vw, 168px);
  width: auto;
  max-width: 95vw;
  object-fit: contain;
}

main {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.screen {
  display: none;
  animation: screenIn 0.45s ease-out;
}

.screen.active {
  display: block;
}

@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen--light .subtitle {
  color: var(--text-muted);
}

.screen--red {
  color: var(--white);
}

.screen--red h2,
.screen--red .lead,
.screen--red label {
  color: var(--white);
}

.screen--red .lead {
  opacity: 0.95;
}

.headline {
  text-align: center;
  font-size: clamp(1.05rem, 3.2vw, 1.45rem);
  font-weight: 700;
  margin: 0;
  line-height: 1.35;
}

.headline-title {
  display: block;
  color: var(--text);
}

.headline-slogan {
  display: block;
  margin-top: 0.35em;
  color: var(--red);
}

.subtitle {
  text-align: center;
  font-size: 1.15rem;
  margin: 20px 0 28px;
  color: var(--text-muted);
}

.screen--red .subtitle {
  color: var(--white);
}

/* Приветственная анимация */
.welcome-stage {
  animation: welcomeReveal 1.2s ease-out forwards;
}

@keyframes welcomeReveal {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  60% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.subtitle-animated {
  animation: fadeIn 0.8s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

h2 {
  font-size: clamp(1.25rem, 4vw, 1.6rem);
  font-weight: 700;
  margin: 0 0 20px;
  line-height: 1.3;
}

#question .lead {
  margin: 0 0 16px;
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.4;
}

.lead {
  margin: 0 0 20px;
  font-size: 1rem;
}

.field-group,
.cert-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--text);
  box-shadow: var(--shadow);
}

.screen--light input[type="text"] {
  border: 1px solid #e0e0e0;
  box-shadow: none;
}

input[type="text"]::placeholder {
  color: #999;
}

input:focus {
  outline: 2px solid var(--red-soft);
  outline-offset: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  align-self: flex-start;
}

.btn--primary {
  background: var(--red);
  color: var(--white);
  margin: 0 auto;
  display: flex;
}

.btn--primary:hover {
  background: var(--red-dark);
}

.btn--light {
  background: var(--white);
  color: var(--red);
}

.btn--light:hover {
  background: var(--red-faint);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#welcome-next {
  width: 100%;
  max-width: 280px;
}

.message {
  margin-top: 16px;
  padding: 12px 16px;
  font-size: 14px;
  border-radius: var(--radius);
}

.message--error {
  background: rgba(0, 0, 0, 0.2);
  color: var(--white);
}

.message-success {
  background: rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.message-error {
  background: rgba(0, 0, 0, 0.25);
  color: var(--white);
}

.message-info {
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
}

.screen--light .message--error {
  background: #f8d7da;
  color: #721c24;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.captcha {
  margin-top: 16px;
  animation: fadeIn 0.35s ease-out;
}

.captcha-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
}

.captcha-box input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.captcha-box__mark {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 2px solid #ccc;
  border-radius: 4px;
  background: var(--white);
  transition: border-color 0.2s, background 0.2s;
}

.captcha-box input:checked + .captcha-box__mark {
  border-color: var(--red);
  background: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 10px;
}

.captcha-box__text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

/* Чекбокс согласия на обработку данных */
.consent-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-weight: 400;
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--white);
}

.consent-box__label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-weight: 400;
}

.consent-box input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.consent-box__mark {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
}

.consent-box input:checked + .consent-box__mark {
  border-color: var(--white);
  background: var(--white);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath fill='none' stroke='%23f4003d' stroke-width='2' d='M1 5l3 3 7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px 10px;
}

.consent-box__link {
  color: var(--white);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.consent-box__link:hover {
  text-decoration: none;
}

/* Модальное окно */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.hidden {
  display: none !important;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.2s ease-out;
}

.modal__content {
  position: relative;
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.modal__close:hover {
  background: var(--red-faint);
  color: var(--red);
}

.modal__content h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  padding-right: 24px;
}

.modal__body {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.modal__body p {
  margin: 0 0 12px;
}

.modal__body p:last-child {
  margin-bottom: 0;
}

.modal__ok {
  margin-top: 20px;
  width: 100%;
}

/* Мобильные: основная аудитория */
@media (max-width: 768px) {
  main {
    padding: 16px 16px 40px;
  }

  .btn {
    width: 100%;
    align-self: stretch;
  }

  .brand-bg--light {
    object-fit: contain;
    object-position: 100% 28%;
    width: 156%;
    height: 144%;
    right: 0;
    left: auto;
    top: -5%;
    bottom: auto;
  }
}

@media (min-width: 769px) {
  .site-logo {
    height: clamp(72px, 10vw, 120px);
    max-width: min(420px, 90vw);
  }

  .brand-bg--light {
    object-fit: cover;
    object-position: 100% 45%;
    inset: 0;
    width: 100%;
    height: 100%;
    top: 0;
    right: auto;
    left: 0;
  }
}
