@layer layout {
  .stage {
    --stage-max: 1100px;
    --stage-min: 220px;
  }
}

@layer components {
  .table {
    --state: 0;
    display: grid;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    transition: --state .2s ease-out;

    @media (prefers-reduced-motion: reduce) {
      transition: none;
    }

    @container (width >= 320px) { --state: 1; }
    @container (width >= 560px) { --state: 2; }
    @container (width >= 800px) { --state: 3; }
    @container (width >= 1040px) { --state: 4; }
  }

  .row {
    display: grid;
    /* --state doubles as a column count here: it's exactly the number of
       optional columns currently visible below, so the track list never
       needs its own separate per-threshold overrides */
    grid-template-columns: 2fr repeat(var(--state), 1fr);
    gap: var(--space-m);
    padding-block: var(--space-s);
    padding-inline: var(--space-l);
    border-block-end: 1px solid var(--color-border);

    &.head {
      background: var(--color-surface-2);
      font-weight: 600;
    }

    &:last-child {
      border-block-end: 0;
    }

    span {
      font-variant-numeric: tabular-nums;
    }

    .up {
      color: color-mix(in oklch, var(--color-accent) 80%, white);
    }

    .down {
      color: color-mix(in oklch, oklch(70% 0.19 25) 85%, var(--color-text));
    }
  }

  :is(.t1, .t2, .t3, .t4) {
    display: none;
  }

  @container (width >= 320px) { .t1 { display: block; } }
  @container (width >= 560px) { .t2 { display: block; } }
  @container (width >= 800px) { .t3 { display: block; } }
  @container (width >= 1040px) { .t4 { display: block; } }
}
