@layer components {
  /* The mail log as an inbox: a row is who, then what they wrote, and at its end when and what became of it. */

  /* The link is the row's box, so it takes the focus ring */
  .mailpiece__link {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: var(--inline-space);
    min-width: 0;
    color: inherit;
    text-decoration: none;

    &:focus-visible {
      border-radius: inherit;
      outline: var(--focus-ring-size) solid var(--focus-ring-color);
      outline-offset: calc(-1 * var(--focus-ring-size));
    }
  }

  @media (any-hover: hover) {
    .row:has(> .mailpiece__link:hover) {
      background-color: var(--color-ink-lightest);
    }
  }

  .mailpiece__title {
    align-items: baseline;
    display: flex;
    gap: 0.5em;
  }

  /* The other party gives way before the own address, which is cut only past half the line. */
  .mailpiece__party {
    min-inline-size: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* The direction mark sits in the line like a letter. */
  .mailpiece__direction {
    vertical-align: -0.125em;
  }

  .mailpiece__own {
    flex: none;
    max-inline-size: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mailpiece__end {
    align-items: flex-end;
    flex-direction: column;
    font-variant-numeric: tabular-nums;
    gap: 0.2em;
  }

  /* Nothing on a row is bold: what became of a piece of mail is told by its status word's colour alone. */
  .mailpiece__end .status {
    font-weight: normal;
  }

  /* In a narrow column Yes and No go under the sender rather than squeeze them. */
  @container layout (inline-size < 640px) {
    .row:has(> .row__end > .screener-decision) {
      flex-wrap: wrap;
      padding-block-end: var(--row-padding-block);

      > .row__end {
        flex-basis: 100%;
        justify-content: flex-end;
      }
    }
  }
}
