/* Формы заявок и модальное окно «Заказать звонок». */

/* ---------- Ошибки и результат в формах ---------- */
.field-error { display: none; margin-top: 6px; font-size: 12px; color: #C83E22; }
.field-error.is-shown { display: block; animation: field-shake .4s; }
input.is-invalid, .selection-fields input.is-invalid { border-color: #D9462A !important; box-shadow: 0 0 0 4px rgba(217, 70, 42, .12) !important; }
@keyframes field-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.selection-fields label { align-self: start; }
.selection-fields button { align-self: end; }
@media (min-width: 801px) { .selection-fields { align-items: start; } .selection-fields button { margin-top: 25px; } }
.form-result.is-success { margin: 20px 0 0; padding: 16px 20px; border-radius: 12px; background: rgba(245, 130, 32, .12); border: 1px solid rgba(245, 130, 32, .4); color: var(--text); }
.is-error { color: #C83E22 !important; }
button.is-loading { position: relative; color: transparent !important; pointer-events: none; }
button.is-loading > * { visibility: hidden; }
button.is-loading::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid #091421; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Модальное окно ---------- */
html.modal-open { overflow: hidden; padding-right: var(--scrollbar, 0); }
html.modal-open .hero .site-header { padding-right: calc(48px + var(--scrollbar, 0)); }
@media (max-width:800px) { html.modal-open .hero .site-header { padding-right:calc(32px + var(--scrollbar, 0)); } }
@media (max-width:520px) { html.modal-open .hero .site-header { padding-right:calc(20px + var(--scrollbar, 0)); } }
.modal {
  width: min(460px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0; margin: auto;
  border: 0; background: transparent; color: var(--text);
  overflow: visible;
}
.modal::backdrop { background: rgba(5, 11, 19, 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); transition: background .3s, backdrop-filter .3s; }
.modal.is-open::backdrop { background: rgba(28, 30, 36, .42); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal-card {
  position: relative;
  max-height: calc(100svh - 32px);
  overflow-y: auto;
  padding: 48px 40px 36px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(245, 130, 32, .12), transparent 55%),
    var(--card);
  box-shadow: 0 40px 80px -30px rgba(60, 40, 15, .35), 0 2px 6px rgba(60, 40, 15, .06);
  text-align: center;
  opacity: 0;
  transform: translateY(24px) scale(.96);
  transition: opacity .3s cubic-bezier(.4, 0, .2, 1), transform .45s cubic-bezier(.22, 1, .36, 1);
}
.modal.is-open .modal-card { opacity: 1; transform: none; }
.modal-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--muted);
  transition: background-color .3s, color .3s, border-color .3s, transform .4s cubic-bezier(.22, 1, .36, 1);
}
.modal-close::before, .modal-close::after { content: ""; position: absolute; left: 12px; right: 12px; top: 19px; height: 1.5px; background: currentColor; transform: rotate(45deg); }
.modal-close::after { transform: rotate(-45deg); }
.modal-close:hover { color: var(--ink); background: var(--accent); border-color: var(--accent); transform: rotate(90deg); }
.modal-eyebrow { color: var(--accent); font-size: 12px; letter-spacing: 3px; margin-bottom: 12px; }
.modal-title { font: 400 40px/1.15 Lora, serif; margin: 0 0 12px; }
.modal-form .modal-title span { display: block; }
.modal-title span { color: var(--accent); }
.modal-lead { margin: 0 auto 8px; max-width: 320px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.modal-topic {
  display: inline-block; align-self: center; margin: 4px 0 8px; padding: 6px 14px; border-radius: 100px;
  background: rgba(245, 130, 32, .12); border: 1px solid rgba(245, 130, 32, .35);
  color: var(--accent-ink); font-size: 13px;
}
.modal-form { display: flex; flex-direction: column; gap: 16px; margin-top: 8px; }
.modal-field { display: grid; gap: 8px; text-align: left; font-size: 13px; color: var(--muted); }
.modal-field input {
  width: 100%; height: 56px; padding: 0 20px;
  border: 1px solid var(--line-strong); border-radius: 100px; background: var(--field); color: var(--text);
  font: inherit; font-size: 16px;
  transition: border-color .3s, box-shadow .3s;
}
.modal-field input::placeholder { color: #A39B8F; }
.modal-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(245, 130, 32, .18); }
.modal-field .field-error { margin: 0 0 0 20px; }
.modal-submit { width: 100%; margin-top: 8px; justify-content: center; gap: 16px; font-size: 16px; }
.modal-consent { margin: 4px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted); }
.modal-consent a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.modal-consent a:hover { color: var(--accent); }

/* Успешная отправка: галочка рисуется */
.modal-success { padding: 8px 0 0; }
.modal-success-icon { width: 72px; height: 72px; color: var(--accent); margin: 0 auto 20px; display: block; }
.modal-success-icon circle, .modal-success-icon path { stroke-dasharray: 200; stroke-dashoffset: 200; }
.modal-success.is-drawn circle { animation: draw .7s cubic-bezier(.65, 0, .35, 1) forwards; }
.modal-success.is-drawn path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s cubic-bezier(.65, 0, .35, 1) .55s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.modal-success-text { color: var(--muted); line-height: 1.6; margin: 0 0 28px; }
.modal-done { min-width: 160px; }

@media (max-width: 520px) {
  .modal-card { padding: 44px 22px 28px; border-radius: 20px; }
  .modal-title { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  .modal-card { transform: none; }
  .modal-success-icon circle, .modal-success-icon path { stroke-dashoffset: 0 !important; animation: none !important; }
}
