/* The few layout helpers that are not components. Gaps are tuned per use through custom properties. */
@layer utilities {
  /* Read by screen readers, invisible on screen. */
  .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  /* Vertical flow; a component overrides --stack-gap instead of adding margins. */
  .stack {
    display: flex;
    flex-direction: column;
    gap: var(--stack-gap, var(--space-4));
  }

  /* Horizontal group that wraps: buttons, tags, metadata. */
  .cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--cluster-gap, var(--space-2));
  }

  /* List without bullets or indent: lesson lists, menus, card grids. */
  .list-plain {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  /* Card grid: one column on phones, two from sm, three from lg. */
  .grid {
    display: grid;
    gap: var(--grid-gap, var(--space-4));

    @media (min-width: 37.5em) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    @media (min-width: 75em) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }

  /* One line, cut with an ellipsis; the full text goes in a title or a visually hidden span. */
  .truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

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

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

  /* Digits of equal width, for columns of numbers and timers. */
  .tabular {
    font-variant-numeric: tabular-nums;
  }

  /* Repeated from the reset in the last layer: a component's display:flex (alert, field__error)
     must not undo the hidden attribute. */
  [hidden] {
    display: none;
  }
}
