/* Форма заявки (бриф): поля, ошибки, чипы типа задачи, отправка, подтверждение.
   Логика — assets/js/components/brief-form/ (общая с макетом «Орбита») */

.fields {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 38px 28px;
  align-content: start;
}

.fld {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.fld.w2 {
  grid-column: 1/-1;
}

.fld-l {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.2;
}

.fld-i {
  width: 100%;
  border: 0;
  border-bottom: 3px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: 500 22px/1.35 var(--f-b);
  padding: 10px 0 12px;
  outline: none;
  transition: border-color .3s,box-shadow .3s;
}

/* подсказка на томате: контраст ≥ 4.5:1 даёт только почти полный графит — от введённого текста её отличает тонкое начертание */
.fld-i::placeholder {
  color: rgba(27,23,20,.86);
  font-weight: 400;
}

/* фокус: линия становится вдвое толще. Ошибка: красный на томате не читается — линия становится пунктирной,
   подпись подчёркнута, у сообщения графитовый значок «!» */
.fld-i:focus {
  box-shadow: 0 3px 0 var(--ink);
}

textarea.fld-i {
  resize: none;
  height: 108px;
  display: block;
}

.err {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.err::before {
  content: "!";
  content: "!" / "";
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--acc);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.err:empty {
  display: none;
}

.fld.invalid .fld-i {
  border-bottom-style: dashed;
}

.fld.invalid .fld-l {
  text-decoration-line: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* вместе со scroll-padding html — 96px + safe area, как раньше */
#brief {
  scroll-margin-top: calc(96px - var(--sp));
}

.ok {
  display: none;
  grid-column: 1/-1;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  outline: none;
}

.fields[data-sent] > :not(.ok) {
  display: none;
}

.fields[data-sent] .ok {
  display: flex;
  animation: rv .8s var(--e3) both;
}

.ok-h {
  font-weight: 900;
  font-size: clamp(44px,5.4vw,84px);
  line-height: .9;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.ok-p {
  max-width: 520px;
  font-size: 18px;
  line-height: 1.5;
}

.shake.shake.shake {
  animation: shake .45s cubic-bezier(.36,.07,.19,.97);
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }
  20%,
  80% {
    transform: translateX(4px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }
  40%,
  60% {
    transform: translateX(6px);
  }
}

.chip {
  appearance: none;
  border: 0;
  cursor: pointer;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--ink);
  color: var(--ink);
  font: 600 15px/1 var(--f-b);
  transition: background-color .3s,color .3s;
}

@media (hover:hover) and (pointer:fine) {
  .chip:hover {
    background: rgba(27,23,20,.08);
  }
}

.chip:has(input:checked) {
  background: var(--ink);
  color: var(--on-ink);
}

.send {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 28px;
  margin-top: 6px;
}

.send p {
  max-width: 300px;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width:640px) {
  .fields {
    grid-template-columns: minmax(0,1fr);
  }
  .send {
    flex-direction: column;
    align-items: stretch;
  }
  .send .btn {
    width: 100%;
  }
  .fld-i {
    font-size: 19px;
  }
}

/* «Тип задачи» — радиокнопки в виде чипов: значение уходит в заявку, работает и без JS */
.chips {
  grid-column: 1/-1;
}

.chips legend {
  margin-bottom: 14px;
}

.chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

/* кнопка отправки крупнее обычной .btn */
.send-btn {
  height: 66px;
  padding: 0 10px 0 32px;
  font-size: 17px;
}

.send-btn .bi {
  width: 46px;
  height: 46px;
}

/* идёт отправка: кнопка заблокирована, стрелку в кружке заменяет индикатор */
.send-btn:disabled {
  cursor: progress;
  opacity: .85;
  background: var(--ink);
  color: var(--on-ink);
}

.send-btn:disabled .bi {
  transform: none;
}

.send-btn:disabled .bi svg {
  display: none;
}

.send-btn:disabled .bi::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(27,23,20,.3);
  border-top-color: var(--ink);
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ошибка отправки (сеть, сервер, лимит): красный на томате не читается — графитовая плашка со значком «!», как у ошибок полей */
.form-alert {
  position: relative;
  grid-column: 1/-1;
  padding: 16px 20px 16px 52px;
  border-radius: 16px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
}

.form-alert::before {
  content: "!";
  content: "!" / "";
  position: absolute;
  left: 20px;
  top: 18px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--acc);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}

.form-alert[hidden] {
  display: none;
}

.form-alert a {
  color: var(--on-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* поле-ловушка для ботов: людям не видно */
.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
