@layer components {
  .trim-list {
    /* Deliberately between --space-l and --space-xl: tight enough to keep
       four cards on one screen, loose enough not to crowd the trimmed
       glyphs it's demonstrating. */
    --card-padding-block: 1.1rem;

    display: grid;
    gap: var(--space-l);
    max-inline-size: var(--measure-s);
    margin-inline: auto;
    padding: 0;
    list-style: none;

    li {
      display: grid;
      gap: var(--space-m);
      justify-items: start;
      padding: var(--card-padding-block) var(--space-xl);
      background: var(--color-surface);
      border: 1px solid var(--color-border);
      border-radius: var(--radius-s);
    }
  }

  .trim-label {
    margin: 0;
    font-family: ui-monospace, monospace;
    font-size: .78rem;
    line-height: 1.4;
    color: var(--color-muted);
  }

  /* The background is the whole point: it paints the element's real box,
     so an exaggerated line-height (inflating the invisible half-leading)
     shows up directly as visible highlight above/below the glyphs instead
     of something you have to infer. */
  .trim-sample {
    padding-inline: var(--space-2xs);
    background: var(--color-accent);
    color: var(--color-bg);
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 2.2;
  }

  .trim-sample--start {
    text-box-trim: trim-start;
    text-box-edge: cap alphabetic;
  }

  .trim-sample--end {
    text-box-trim: trim-end;
    text-box-edge: cap alphabetic;
  }

  .trim-sample--both {
    text-box-trim: trim-both;
    text-box-edge: cap alphabetic;
  }
}
