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

.panel {
  position: relative;
  scroll-margin-top: calc(96px + env(safe-area-inset-top,0px));
  border-radius: 26px;
  padding: clamp(22px,3vw,40px);
  margin-top: 36px;
  border: 1px solid transparent;
  background: radial-gradient(500px 300px at 90% 0%,rgba(255,255,255,.04),transparent 70%) padding-box,
    linear-gradient(180deg,#0F1014,#0A0B0D) padding-box,
    linear-gradient(150deg,rgba(255,255,255,.7),rgba(255,255,255,.1) 28%,rgba(255,255,255,.3) 55%,rgba(255,255,255,.06) 78%,rgba(255,255,255,.45)) border-box;
}

.panel-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 24px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.panel-h .tk {
  font-size: 22px;
  font-weight: 500;
  color: #F1F2F4;
}

.panel-h span:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #8F949D;
}

.fields {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 22px 18px;
}

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

.fld.w2 {
  grid-column: span 2;
}

.fld label,
.chips legend {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #A4A9B1;
}

.inp {
  width: 100%;
  height: 56px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: #07080A;
  color: #F0F1F3;
  font: 400 16px/1.4 var(--f-body);
  outline: none;
  transition: border-color .25s,box-shadow .25s,background .25s;
  scroll-margin-top: 110px;
  scroll-margin-bottom: 24px;
}

textarea.inp {
  height: 128px;
  padding: 16px 18px;
  resize: vertical;
}

.inp::placeholder {
  color: #7C818A;
}

.inp:hover {
  border-color: rgba(255,255,255,.22);
}

.inp:focus {
  border-color: var(--accent);
  background: #0A0A0C;
  box-shadow: 0 0 0 4px rgba(255,77,0,.16);
}

.err {
  display: block;
  min-height: 0;
  font-size: 13px;
  line-height: 1.4;
  color: #FF8A7A;
}

.err:empty {
  display: none;
}

.fld.invalid .inp {
  border-color: #FF5A4A;
  box-shadow: 0 0 0 4px rgba(255,90,74,.14);
}

.fld.invalid label {
  color: #FF8A7A;
}

.ok {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 0 6px;
  outline: none;
}

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

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

.ok-ic {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  box-shadow: 0 0 40px -6px rgba(255,77,0,.7);
}

.ok-h {
  margin: 6px 0 0;
  font: 600 clamp(26px,2.6vw,34px)/1.12 var(--f-disp);
  color: var(--ink2);
  overflow-wrap: anywhere;
}

.ok-p {
  margin: 0;
  max-width: 460px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--mute);
}

.ok-again {
  height: 50px;
  margin-top: 8px;
}

.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);
  }
}

.chips {
  border: 0;
  margin: 28px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chips legend {
  padding: 0;
  margin-bottom: 12px;
}

.chip {
  height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.16);
  background: transparent;
  color: #D5D8DE;
  font: 400 14.5px/1 var(--f-body);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: border-color .25s,background .25s,color .25s;
}

.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.45);
  transition: background .25s,border-color .25s,box-shadow .25s;
}

.chip:hover {
  border-color: rgba(255,255,255,.34);
  color: #FFF;
}

.chip:has(input:checked) {
  border-color: var(--accent);
  color: #FFF;
  background: rgba(255,77,0,.1);
}

.chip:has(input:checked)::before {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 8px rgba(255,77,0,.9);
}

.send {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 34px;
}

.send p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--dim);
}

.send p a {
  color: #B9BDC4;
  text-underline-offset: 3px;
}

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

/* идёт отправка: кнопка заблокирована, стрелку заменяет индикатор */
.send-btn:disabled {
  cursor: progress;
  opacity: .85;
  transform: none;
  box-shadow: 0 0 0 1px rgba(255,140,90,.5) inset;
}

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

.send-btn:disabled::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(10,10,12,.25);
  border-top-color: #0A0A0C;
  animation: spin .8s linear infinite;
}

/* «Тип задачи» — радиокнопки в виде чипов: значение уходит в заявку, работает и без JS */
.chip {
  position: relative;
}

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

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

/* ошибка отправки (сеть, сервер, лимит) */
.form-alert {
  margin: 26px 0 0;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(255,90,74,.45);
  background: rgba(255,90,74,.08);
  font-size: 14.5px;
  line-height: 1.55;
  color: #FFB4A8;
}

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

.form-alert a {
  color: #FFF;
  text-underline-offset: 3px;
  white-space: nowrap;
}

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

@media (max-width:1240px) and (min-width:961px) {
  /* узкая колонка формы: поля друг под другом, иначе подпись переносится и поля съезжают */
  .fields {
    grid-template-columns: minmax(0,1fr);
  }
  .fld.w2 {
    grid-column: auto;
  }
}

@media (max-width:960px) {
  .panel {
    margin-top: 8px;
  }
}

@media (max-width:640px) {
  .fields {
    grid-template-columns: minmax(0,1fr);
  }
  .fld.w2 {
    grid-column: auto;
  }
  .send {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .send .btn-o {
    width: 100%;
  }
  .ok-again {
    align-self: stretch;
    height: auto;
    min-height: 50px;
    padding: 12px 16px;
    font-size: 15px;
    white-space: normal;
    text-align: center;
  }
}
