/* Sarapshy — форма регистрации. Цвета в стиле kipd.kz, меняются здесь. */
:root {
  --brand-primary: #3E0B59;   /* фирменный тёмно-фиолетовый КИОР */
  --brand-accent: #5A2178;    /* ссылки, наведение, фокус */
  --brand-tint: #F8EAFF;      /* светлая лаванда: выбранные варианты */
  --bg: #F6F4F8;
  --surface: #FFFFFF;
  --text: #222222;
  --muted: #5C5C5C;
  --border: #8C8790;          /* рамки полей: контраст ≥ 3:1 с белым */
  --line: #E2DDE6;            /* тонкие разделители */
  --error: #B3261E;
  --success: #1E6B3A;

  --radius: 8px;
  --font: "Mulish", system-ui, sans-serif;
  --focus: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand-accent);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 16px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: break-word;
}

img { max-width: 100%; }

a { color: var(--brand-accent); }
a:hover { color: var(--brand-primary); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.container-narrow { max-width: 760px; }

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 10;
  padding: 10px 16px;
  background: var(--brand-primary); color: #fff;
  border-radius: var(--radius); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 8px; color: #fff; }

/* ---------- Шапка ---------- */
/* Логотипы КИОР белые — шапка в фирменном цвете, как на kipd.kz */
.site-header { background: var(--brand-primary); border-bottom: 1px solid rgba(255, 255, 255, .16); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 72px; }
.brand { display: flex; align-items: center; min-width: 0; }
.brand-logo { display: block; height: 44px; width: auto; }
.brand-text {
  font-weight: 800; font-size: .8125rem; line-height: 1.2; text-transform: uppercase;
  color: #fff; max-width: 180px;
}
.lang-switch { display: flex; gap: 4px; flex-shrink: 0; }
.lang-btn {
  min-width: 52px; min-height: 44px; padding: 0 10px;
  background: none; border: 0; border-bottom: 2px solid transparent;
  font: inherit; font-weight: 700; font-size: .875rem; letter-spacing: .02em;
  color: #D9C4E6; cursor: pointer;
}
.lang-btn:hover { color: #fff; }
.lang-btn[aria-pressed="true"] { color: #fff; border-bottom-color: #fff; }
.site-header :focus-visible { box-shadow: 0 0 0 2px var(--brand-primary), 0 0 0 4px #fff; }

/* ---------- Первый экран ---------- */
.hero { background: var(--brand-primary); color: #fff; padding: 40px 0 44px; }
.hero-kicker {
  margin: 0 0 12px; font-size: .875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: #E9D7F5;
}
.hero-title {
  margin: 0 0 16px; font-weight: 800; line-height: 1.15;
  font-size: clamp(1.75rem, 4.2vw + .9rem, 3rem); max-width: 22ch;
}
.hero-support { margin: 0 0 20px; font-size: 1.0625rem; max-width: 60ch; color: #F3EAF8; }
.hero-dates {
  display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; gap: 4px 8px;
  margin: 0 0 28px; padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: var(--radius);
}
.hero-dates-label { color: #E9D7F5; }
.hero .btn:focus-visible { box-shadow: 0 0 0 3px var(--brand-primary), 0 0 0 5px #fff; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 24px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-weight: 700; font-size: 1rem; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-accent); color: #fff; }
.btn-primary[disabled] { cursor: progress; opacity: .75; }
.btn-light { background: #fff; color: var(--brand-primary); }
.btn-light:hover { background: var(--brand-tint); color: var(--brand-primary); }
.btn-outline { background: var(--surface); color: var(--brand-primary); border-color: var(--border); }
.btn-outline:hover { border-color: var(--brand-primary); background: var(--brand-tint); }
.btn-text {
  min-height: 44px; padding: 8px 12px; background: none; color: var(--error);
  font-size: .9375rem;
}
.btn-text:hover { background: #FCEDEC; }

/* ---------- Вводный текст ---------- */
.intro { background: var(--surface); padding: 32px 0 16px; border-bottom: 1px solid var(--line); }
.intro p { margin: 0 0 16px; font-size: 1.0625rem; }

/* ---------- Форма ---------- */
.apply { padding: 32px 0 56px; }
.apply:focus { outline: none; }
.section-title { margin: 0 0 16px; font-size: 1.5rem; font-weight: 800; color: var(--brand-primary); }
.required-note { margin: 0 0 16px; color: var(--muted); font-size: .9375rem; }
.req { color: var(--error); font-weight: 700; }

.q {
  margin: 0 0 12px; padding: 20px 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  min-width: 0;
}
fieldset.q { padding-top: 20px; }
.q.has-error { border-color: var(--error); box-shadow: inset 4px 0 0 var(--error); }
.q-label {
  display: block; margin: 0 0 8px; padding: 0;
  font-weight: 700; font-size: 1.0625rem; line-height: 1.4; color: var(--text);
}
legend.q-label { float: left; width: 100%; }
legend.q-label + * { clear: both; }
.q-hint { margin: 0 0 12px; color: var(--muted); font-size: .9375rem; }

.input {
  display: block; width: 100%; min-height: 48px; padding: 11px 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 1rem; /* 16px — iOS не зумит поле */
}
.input::placeholder { color: #767676; opacity: 1; }
.input:hover { border-color: var(--brand-accent); }
.input:focus-visible, .input:focus { outline: none; border-color: var(--brand-accent); box-shadow: 0 0 0 3px rgba(90, 33, 120, .3); border-radius: var(--radius); }
.input[aria-invalid="true"] { border-color: var(--error); }
.input-date { max-width: 240px; }
.textarea { resize: vertical; min-height: 120px; }

.q-error {
  display: flex; gap: 6px; align-items: flex-start;
  margin: 10px 0 0; color: var(--error); font-weight: 600; font-size: .9375rem;
}
.q-error::before { content: "!"; flex: 0 0 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: var(--error); color: #fff; font-size: .75rem; line-height: 18px; text-align: center; font-weight: 800; }
.q-error.is-new { animation: error-in .2s ease-out; }
@keyframes error-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Чекбоксы */
.options { display: flex; flex-direction: column; gap: 2px; }
.option, .option-other-check {
  display: flex; align-items: flex-start; gap: 12px;
  min-height: 44px; padding: 10px 8px; margin: 0 -8px;
  border-radius: var(--radius); cursor: pointer;
}
.option:hover, .option-other-check:hover { background: var(--bg); }
.option input[type="checkbox"], .option-other-check input[type="checkbox"] {
  flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0;
  accent-color: var(--brand-primary); cursor: pointer;
}
.option input[type="checkbox"]:focus-visible, .option-other-check input[type="checkbox"]:focus-visible {
  box-shadow: none; outline: 3px solid var(--brand-accent); outline-offset: 2px;
}
.option:focus-within, .option-other-check:focus-within { background: var(--bg); }
.option-other { display: block; padding: 0; margin: 0; cursor: default; }
.option-other:hover { background: none; }
.option-other-check { margin-bottom: 4px; }
.input-other { margin-left: 34px; width: calc(100% - 34px); }

/* Файлы */
.file-field { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.file-btn { cursor: pointer; }
.file-input:focus-visible ~ .file-btn { box-shadow: var(--focus); }
.file-preview {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.file-preview img { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; background: var(--line); flex-shrink: 0; }
.file-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size, .file-status { color: var(--muted); font-size: .875rem; }
.file-status { margin: 0; }
.file-status:empty { display: none; }

/* Отправка и уведомления */
.form-footer { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.btn-submit { width: 100%; }
.btn-submit.is-loading::before {
  content: ""; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.form-status {
  margin: 0; padding: 14px 16px; border-radius: var(--radius);
  background: #FCEDEC; color: var(--error); border: 1px solid var(--error); font-weight: 600;
}

.notice { padding: 24px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); font-size: 1.125rem; font-weight: 700; }
.notice p { margin: 0; }
.notice:focus { outline: none; box-shadow: var(--focus); }
.notice-success { border-color: var(--success); box-shadow: inset 4px 0 0 var(--success); color: var(--success); }
.notice-closed { border-color: var(--brand-primary); box-shadow: inset 4px 0 0 var(--brand-primary); color: var(--brand-primary); }

/* ---------- Подвал ---------- */
.site-footer { background: var(--brand-primary); color: #F3EAF8; padding: 28px 0 32px; font-size: .9375rem; }
.footer-inner p { margin: 0 0 8px; }
.site-footer a { color: #fff; font-weight: 700; display: inline-flex; align-items: center; min-height: 44px; }
.site-footer a:focus-visible { box-shadow: 0 0 0 2px #fff; }

/* ---------- Планшет и десктоп ---------- */
@media (min-width: 768px) {
  .header-inner { min-height: 88px; }
  .brand-logo { height: 56px; }
  .hero { padding: 64px 0 72px; }
  .intro { padding: 40px 0 24px; }
  .apply { padding: 48px 0 80px; }
  .q { padding: 24px 28px; }
  .section-title { font-size: 1.75rem; }
  .btn-submit { width: auto; align-self: flex-start; min-width: 240px; }
  .footer-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 0 32px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .btn-submit.is-loading::before { animation: none; border-top-color: rgba(255, 255, 255, .45); }
}
