/* Support page. Figma: Support 1440 7556:292, 390 7629:709; form states 7618:430 and
   7939:1096. Mobile first; the form card switches its own layout with container
   queries, the page goes to two columns from 1200. */

/* Intro: H1 with P5 to its right on mobile; text at cols 1-6 and P5 320 at the right
   edge on desktop. */
.support-intro {
  display: grid;
  /* min-content keeps «Поддержка» on one line; P5 shrinks to make room. */
  grid-template-columns: minmax(min-content, 1fr) minmax(0, 160px);
  grid-template-areas:
    'title art'
    'lead lead'
    'req req';
  column-gap: var(--gutter);
  row-gap: var(--space-4);
  padding-top: clamp(24px, 6.8571vw - 2.74px, 96px);
  padding-bottom: clamp(40px, 2.2857vw + 31.09px, 64px);
}

.support-intro__title {
  grid-area: title;
  align-self: end;
  font-size: clamp(40px, 31.09px + 2.2857vw, 64px);
  line-height: clamp(44px, 35.09px + 2.2857vw, 68px);
  letter-spacing: -0.03em;
}

:lang(ru) .support-intro__title {
  hyphens: manual;
}

.support-intro__lead {
  grid-area: lead;
}

.support-intro__req {
  grid-area: req;
  color: var(--muted);
}

.support-intro__art {
  grid-area: art;
  aspect-ratio: 1;
}

.support-intro__art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Below 375 «Поддержка» would leave P5 under 100 px beside it, so P5 moves above. */
@media (max-width: 374px) {
  :lang(ru) .support-intro {
    grid-template-columns: 1fr;
    grid-template-areas:
      'art'
      'title'
      'lead'
      'req';
  }

  :lang(ru) .support-intro__art {
    justify-self: end;
    width: 120px;
  }
}

@media (min-width: 960px) {
  .support-intro {
    grid-template-columns: minmax(0, 640px) minmax(0, 1fr) 320px;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      'title . art'
      'lead . art'
      'req . art';
    row-gap: var(--space-5);
  }

  .support-intro__title {
    align-self: start;
  }
}

/* Body: form card, then quick help; side by side at cols 1-7 and 9-12 from 1200. */
.support-body {
  display: grid;
  row-gap: var(--space-8);
  padding-bottom: var(--space-9);
}

.support-form,
.quick-help {
  max-width: 752px;
}

@media (min-width: 1200px) {
  .support-body {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    column-gap: var(--gutter);
    align-items: start;
  }

  .support-form,
  .quick-help {
    max-width: none;
  }

  .support-form {
    grid-column: 1 / span 7;
  }

  .quick-help {
    grid-column: 9 / span 4;
  }
}

/* Form card */
.support-form {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5);
  border-radius: var(--radius-card);
  background: var(--sheet);
}

@media (min-width: 768px) {
  .support-form {
    padding: var(--space-7);
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* A legend is not a flex item, so the topic group spaces its parts with margins. */
.field--topic {
  display: block;
}

.field--topic legend {
  margin-bottom: var(--space-2);
}

.field--topic .field__error {
  margin-top: var(--space-2);
}

.field__label {
  padding: 0;
  font-weight: 500;
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
}

.field__control {
  width: 100%;
  min-height: 48px;
  /* Figma counts the 1 px inside stroke in the layout: text sits 17 px in, 12 down. */
  padding: 11px 16px;
  border: 1px solid var(--field);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 24px;
}

.field__control--area {
  display: block;
  min-height: 160px;
  padding-block: 12px;
  resize: vertical;
}

.field__control::placeholder {
  color: var(--muted);
  opacity: 1;
}

/* 2 px ember-ink without moving the text: the border plus a 1 px inset ring. */
.field__control[aria-invalid='true'] {
  border-color: var(--ember-ink);
  box-shadow: inset 0 0 0 1px var(--ember-ink);
}

.field__hint,
.field__error {
  font-size: var(--fs-legal);
  line-height: var(--lh-legal);
}

.field__hint {
  color: var(--muted);
}

.field__error {
  color: var(--ember-ink);
}

.support-form__row {
  display: grid;
  gap: var(--space-5);
}

/* Side by side, the two fields share label, input and hint rows (subgrid), so a
   two-line RU label does not push one input below the other. */
@container (min-width: 560px) {
  .support-form__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: var(--space-5);
    row-gap: var(--space-2);
  }

  .support-form__row > .field {
    display: grid;
    grid-row: span 3;
    grid-template-rows: subgrid;
    align-content: start;
  }
}

/* Topic chips: real radios laid over the chip face. One per row, 44 tall, on a
   narrow card; wrapped 40 tall chips (44 px hit area) on a wide one. */
.chips {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chip {
  position: relative;
  display: flex;
}

.chip__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  z-index: 1;
  opacity: 0;
  cursor: pointer;
}

.chip__face {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 4px 16px;
  border: 1px solid var(--field);
  border-radius: var(--radius-control);
  background: var(--sheet);
  font-weight: 500;
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

@media (hover: hover) {
  .chip:hover .chip__input:not(:checked) + .chip__face {
    background: var(--ink-wash);
  }
}

.chip__input:checked + .chip__face {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.chip__input:focus-visible + .chip__face {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

@container (min-width: 480px) {
  .chips {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .chip__face {
    width: auto;
    min-height: 40px;
  }

  .chip::after {
    content: '';
    position: absolute;
    inset: -2px 0;
  }
}

/* Without scripts nothing can send or copy what the fields hold, so only the address
   line and the consent text show. */
@media (scripting: none) {
  .support-form .field,
  .support-form__row {
    display: none;
  }
}

/* Actions */
.support-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.support-actions__buttons {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@container (min-width: 480px) {
  .support-actions__buttons {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.icon {
  flex: none;
  width: 16px;
  height: 16px;
}

.icon--check,
.is-copied .icon--copy {
  display: none;
}

.is-copied .icon--check {
  display: block;
}

.support-note {
  margin-block: var(--space-1);
  font-size: 15px;
  line-height: 24px;
  color: var(--ink-soft);
}

.support-note a {
  color: var(--ink);
}

.support-note--alert {
  margin: var(--space-2) 0 0;
  color: var(--ember-ink);
}

.support-address {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: var(--space-4);
}

.support-address__line {
  font-size: 15px;
  line-height: 24px;
  color: var(--ink-soft);
}

/* 24 px line + 20 px padding = 44 px hit area. */
.support-address__link {
  display: inline-block;
  padding-block: 10px;
  color: var(--ink);
}

.copy-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-weight: 500;
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  transition: color var(--dur-fast) var(--ease);
}

@media (hover: hover) {
  .copy-action:hover {
    color: var(--ember-ink);
  }
}

.support-form__consent {
  color: var(--ink-soft);
}

/* Quick help */
.quick-help__title {
  font-size: clamp(24px, 22.51px + 0.381vw, 28px);
  line-height: clamp(30px, 29.26px + 0.1905vw, 32px);
  letter-spacing: -0.01em;
}

.quick-help__list {
  margin-top: var(--space-5);
  border-top: 1px solid var(--hairline);
}

.quick-help__item {
  border-bottom: 1px solid var(--hairline);
}

.quick-help__q {
  position: relative;
  display: block;
  padding: var(--space-4) var(--space-6) var(--space-4) 0;
  list-style: none;
  font-weight: 500;
  font-size: 17px;
  line-height: 24px;
  cursor: pointer;
}

.quick-help__q::-webkit-details-marker {
  display: none;
}

/* Plus drawn from two 2 px strips; the upright one turns flat when the row opens. */
.quick-help__q::before,
.quick-help__q::after {
  content: '';
  position: absolute;
  background: var(--ink);
}

.quick-help__q::before {
  top: 27px;
  right: 2px;
  width: 12px;
  height: 2px;
}

.quick-help__q::after {
  top: 22px;
  right: 7px;
  width: 2px;
  height: 12px;
  transition: transform var(--dur-fast) var(--ease);
}

.quick-help__item[open] > .quick-help__q::after {
  transform: rotate(90deg);
}

.quick-help__a {
  margin-top: calc(-1 * var(--space-2));
  padding-bottom: 20px;
  font-size: 15px;
  line-height: 24px;
  color: var(--ink-soft);
}

.developer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
}

.developer__text {
  color: var(--muted);
}

/* 44 px tall links; the negative margins keep Figma's 8 px gap above a single row. */
.developer__links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1ch;
  margin-block: -4px -12px;
}

.developer__links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.developer__links span {
  white-space: pre;
}

.developer__item {
  display: inline-flex;
  align-items: center;
}
