@layer components {
  /* One thing a firm is asked, or one answer being reviewed: its name, its main action or its state under it, then its facts. */
  .record-page.answers {
    gap: 0;

    .page-header {
      margin-block-end: 0;
    }

    /* 32px to the first fact's line, its row's own 4px counted. */
    .details {
      margin-block-start: calc(var(--page-header-space) - 0.25rem);
    }

    /* A number or a place beside a fact's name reads quietly, as the line under the title does. */
    .details__value :is(strong + span, .txt-subtle) {
      color: var(--color-meta);
    }
  }

  /* A date a reviewer may correct stands on its row's line, 32px tall at the value's size. */
  .answers .details__value > .input[type=date] {
    --input-padding: 1px 6px 1px 12px;

    font-size: max(16px, 1em);
    inline-size: 10rem;                                 /* 160px */
    line-height: 1.3;

    @media (min-width: 100ch) {
      inline-size: 12.3rem;                             /* 234px */
    }
  }

  /* Under the name, the main action and the state on one line while there is room. */
  .answers .answers__row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    font-size: var(--text-row);
    gap: 0.44em 0.667em;                                /* 8px 12px */
    margin-block-start: 0.5rem;

    @media (min-width: 100ch) {
      margin-block-start: 0.42rem;                      /* 8px */
    }
  }

  /* Once decided the state stands where the button was, tinted, and takes no click. */
  .answers__verdict {
    align-items: center;
    background-color: color-mix(in srgb, var(--answers-state-color) 8%, var(--color-canvas));
    border: 1px solid color-mix(in srgb, var(--answers-state-color) 45%, transparent);
    border-radius: var(--radius-lg);
    color: var(--answers-state-text);
    display: inline-flex;
    gap: 0.45em;
    min-block-size: 2.4em;
    padding: 0.35em 0.85em 0.35em 0.65em;

    .avatar {
      --avatar-size: 2.4em;                             /* 24px */

      display: inline-grid;
      font-size: 0.55em;
      vertical-align: middle;
    }

    time {
      white-space: nowrap;
    }
  }

  .answers__verdict--approved {
    --answers-state-color: var(--color-success);
    --answers-state-text: var(--color-success-text);
  }

  .answers__verdict--rejected {
    --answers-state-color: var(--color-error);
    --answers-state-text: var(--color-error-text);
  }

  /* Its state in a word and what it is, on the button's line while there is room. */
  .answers__byline {
    margin: 0;
    min-inline-size: 0;

    @media (width < 640px) {
      flex-basis: 100%;
    }

    .status {
      font-size: inherit;
      font-weight: 700;
    }

    .status--neutral {
      --status-text: var(--color-ink);
    }

    .icon {
      --icon-size: 0.9em;

      color: var(--color-ink);
      vertical-align: -0.1em;
    }
  }

  /* A button that leads on rather than settles has its icon in the links' colour. */
  .answers__row .record-page__toggle > .icon {
    color: var(--color-link);
  }

  /* Who else has the review open, as a line of its own under the buttons. */
  .answers .answers__hint.typing-indicator {
    align-items: center;
    padding-inline-start: 0;
  }

  /* Once a review is settled or an answer sent, the way on: the next one waiting, or back where it came from.
     A long name goes on to a second line inside its button. */
  .answers .answers__next {
    --form-field-text: 1rem;

    gap: var(--inline-space-half);
    margin-block-start: 1rem;

    @media (min-width: 100ch) {
      --form-field-text: 0.842rem;                      /* 16px */

      margin-block-start: 0.842rem;
    }

    .btn {
      --btn-icon-size: 0.9em;
    }

    &.form__actions .btn {
      --btn-padding: 0.4em 0.85em;

      text-align: start;
    }
  }

  /* Why it was sent back, in the reviewer's words, before anything else. */
  .answers .answers__lead {
    font-size: var(--text-row);
    line-height: 1.5;
    margin: 1rem 0 0;
    max-inline-size: 45.9rem;                           /* 872px */

    @media (min-width: 100ch) {
      margin-block-start: 0.842rem;                     /* 16px */
    }
  }

  /* A quiet line under the button's: what sending means, or why nothing can be sent. */
  .answers .answers__hint {
    color: var(--color-meta);
    font-size: var(--text-control);
    line-height: 1.5;
    margin: 0.75rem 0 0;
    text-wrap: pretty;

    @media (min-width: 100ch) {
      margin-block-start: 0.63rem;                      /* 12px */
    }

    a {
      color: var(--color-link);
    }
  }

  /* An answer in the thread: who sent it, when and its number, its state at the end of that line, then what it says. */
  .answer__head {
    align-items: baseline;
    column-gap: var(--inline-space);
    display: flex;
    flex-wrap: wrap;
  }

  .answer__author {
    font-size: inherit;
    font-weight: 400;
    margin: 0 auto 0 0;
    min-inline-size: 0;
  }

  .answer__meta {
    color: var(--color-meta);

    time {
      white-space: nowrap;
    }
  }

  .answer__state {
    font-size: 0.875em;                                 /* 14px */

    @media (min-width: 100ch) {
      font-size: 0.8em;                                 /* 16px */
    }

    .status {
      font-size: inherit;
      font-weight: 700;
    }

    .status--neutral {
      --status-text: var(--color-ink);
    }
  }

  .answer__body {
    min-inline-size: 0;

    > * {
      margin-block: 0;
    }

    > :is(.signature-mark, .details, .files) {
      margin-block-start: 0.5rem;
    }

    .history__signature {
      font-size: var(--text-control);
    }
  }

  /* What was decided on an answer, a line of its own under it: a small square mark where the avatars are, who and when, then the observation. */
  .comment.decision {
    padding-block: 1rem;

    @media (min-width: 100ch) {
      padding-block: 1.05rem;                           /* 20px */
    }

    p {
      margin: 0;
    }

    a {
      color: inherit;
      text-decoration: none;
    }
  }

  .decision__mark {
    --icon-size: 0.875rem;
    --decision-mark-size: 1.25rem;                       /* 20px */

    background-color: var(--color-ink-medium);
    block-size: var(--decision-mark-size);
    border-radius: 20%;
    color: var(--color-ink-inverted);
    display: grid;
    flex: none;
    inline-size: var(--decision-mark-size);
    margin-block-start: calc((1lh - var(--decision-mark-size)) / 2);
    margin-inline: calc((var(--avatar-size) - var(--decision-mark-size)) / 2);
    place-content: center;

    @media (min-width: 100ch) {
      --icon-size: 0.74rem;                             /* 14px */
      --decision-mark-size: 1.05rem;
    }
  }

  .decision__mark--approved {
    background-color: var(--color-success-button);
  }

  .decision__mark--rejected,
  .decision__mark--revoked {
    background-color: var(--color-error-button);
  }

  /* Where the next answer is written, at the foot of the thread: a line beside the reader's avatar that opens the box in its place. */
  .comment.answer-form {
    --form-field-text: 1rem;                            /* 16px */
    --form-gap: 1rem;

    @media (min-width: 100ch) {
      --form-field-text: 0.842rem;
      --form-gap: 0.842rem;                             /* 16px */
    }

    .comment__content {
      padding-block-start: 0;
    }

    turbo-frame {
      display: block;
    }
  }

  .answer-form__prompt {
    color: var(--color-text-placeholder);
    display: block;
    min-block-size: 4rem;                               /* 64px */
    padding-block-start: calc((var(--avatar-size) - 1lh) / 2);
    text-decoration: none;

    @media (min-width: 100ch) {
      min-block-size: 5.7rem;                           /* 108px */
    }
  }

  /* With buttons under it the line is only as tall as the avatar. */
  .answer-form__prompt--short {
    min-block-size: var(--avatar-size);
  }

  .answer-form__box {
    border: 1px solid var(--color-ink-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    font-size: var(--form-field-text);
    gap: var(--form-gap);
    padding: 0.75rem;

    @media (min-width: 100ch) {
      padding: 0.842rem 1.05rem 1.05rem;                /* 16px 20px 20px */
    }

    > * {
      margin-block: 0;
    }

    .autoresize__textarea {
      min-block-size: calc(2lh + 1em + 2px);
    }

    .conditions,
    .conditions__summary {
      font-size: inherit;
    }
  }

  /* What is typed reads at the thread's size. */
  .answer-form .answer-form__box :is(.autoresize__wrapper, .autoresize__textarea) {
    font-size: 1rem;
    line-height: 1.5;

    @media (min-width: 100ch) {
      font-size: 1.05rem;                               /* 20px */
    }
  }

  /* The files to send and the way to change them, on one line. */
  .answer-form__files {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;

    .add-file .btn {
      font-size: var(--text-control);
      min-block-size: var(--control-size);
      padding-block: 0;
    }
  }

  .answer-form .answer-form__actions {
    gap: var(--inline-space-half);
    margin-block-start: 0.75rem;

    @media (min-width: 100ch) {
      margin-block-start: 0.63rem;                      /* 12px */
    }
  }

  .answer-form__hint {
    color: var(--color-meta);
    font-size: var(--text-control);
    line-height: 1.5;
    margin: 0.6rem 0 0;
  }

  /* Nothing sent yet, and nothing here to send it with: what the thread is waiting for. */
  .answers__empty {
    color: var(--color-meta);
    margin: 0;
    padding-block: var(--comment-padding-block);
  }

  /* Other ways to answer, quietly under the thread. */
  .answers__foot {
    border-block-start: var(--border);
    color: var(--color-meta);
    font-size: var(--text-control);
    line-height: 1.5;
    padding-block-start: 1rem;

    > * + * {
      margin-block-start: 0.5rem;
    }

    p {
      margin-block: 0;
    }

    a,
    .txt-link {
      color: var(--color-link);
    }
  }
}
