@layer components {
  /* A zero floor, so a long file name in a value never widens the sheet past its edge. */
  .details {
    display: grid;
    gap: var(--block-space);
    grid-template-columns: minmax(0, 1fr);
    margin-block: var(--block-space);
  }

  .details__row {
    display: grid;
    gap: 0.125rem;
    grid-template-columns: minmax(0, 1fr);
  }

  .details__label {
    font-size: var(--text-small);
    font-weight: 600;
    color: var(--color-ink-dark);
  }

  .details__value {
    overflow-wrap: anywhere;
  }

  .details--columns {
    gap: 0;
    margin-block: 0;

    .details__row {
      grid-template-columns: 9rem 1fr;
      align-items: baseline;
      gap: var(--inline-space-double);
      padding-block: var(--block-space-half);

      @media (width < 640px) {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.125rem;
      }
    }

    > :last-child {
      padding-block-end: 0;
    }
  }

  /* A record's facts: a bold label over its value on a phone (16px, rows 64px tall); from 800 the label in a
     120px column, right-aligned, 16px from its 20px value, rows 40px tall and 8px apart, with no rule between.
     A label too long for the column goes on to a second line, close under its first. */
  .details--lined {
    gap: 0;

    .details__row {
      grid-template-columns: minmax(0, 1fr);
      align-items: start;
      gap: 0;
      padding-block: 0.25rem;

      @media (min-width: 100ch) {
        grid-template-columns: var(--record-label-size, 6.3rem) minmax(0, 1fr);   /* 120px */
        column-gap: 0.842rem;                           /* 16px */
        padding-block: 0.21rem;                         /* 8px between rows */
      }
    }

    .details__label {
      color: var(--color-ink);
      font-size: 1rem;                                  /* 16px */
      font-weight: 700;
      line-height: 2;                                   /* 32px */

      @media (min-width: 100ch) {
        font-size: 1.05rem;                             /* 20px */
        line-height: 1.3;                               /* 26px */
        padding-block: 0.35em;                          /* 40px with one line */
        text-align: end;
      }
    }

    .details__value {
      font-size: 1rem;                                  /* 16px */
      line-height: 1.5;                                 /* 24px */

      @media (min-width: 100ch) {
        font-size: 1.05rem;                             /* 20px */
        line-height: 1.5;                               /* 30px */
        padding-block: 0.26rem;                         /* centred on the label's 40px line */
      }
    }

    a {
      color: inherit;
      text-decoration-color: var(--color-ink-light);
      text-underline-offset: 0.15em;
    }
  }

  /* A quiet line under a fact's value: where it came from, or a way to more. */
  .details__note {
    color: var(--color-meta);
    display: block;
    font-size: var(--text-control);
    inline-size: fit-content;
    line-height: 1.5;
    margin-block-start: 0.15em;
  }

  .details__note--negative {
    color: var(--color-error-text);
  }

  .details__values {
    display: grid;
    gap: var(--block-space-half);
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .details__heading {
    display: grid;
    gap: 0.25rem;
    min-inline-size: 0;
  }

  .details__meta {
    margin: 0;
    color: var(--color-ink-dark);
  }
}
