@layer components {
  /* Steps in a row, each a bar with its label below, e.g. the weeks left to write: <ol class="timeline"> of
     <li class="timeline__step">, the current one marked with .is-current */
  .timeline {
    display: flex;
    gap: var(--space-1);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .timeline__step {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 2px; /* bar, date and label close together, below the spacing scale */
    text-align: center;
    min-inline-size: 0;
    font-size: var(--text-small);
    color: var(--color-muted);
    overflow-wrap: break-word;
  }

  .timeline__step::before {
    content: "";
    align-self: stretch;
    block-size: 0.5rem;
    margin-block-end: var(--space-1);
    border-radius: var(--radius-pill);
    background-color: var(--color-border);
  }

  /* A date above the bar, at its right end, in the first step at its left (the slot stays when empty, so the bars line up) */
  .timeline__date {
    align-self: flex-end;
    order: -1;
    min-block-size: 1lh;
    margin-block-end: 1px;
    white-space: nowrap;
    font-size: var(--text-x-small);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--letter-spacing-uppercase);
  }

  .timeline__date--start {
    align-self: flex-start;
  }

  /* Set apart from the date where the last week ends, which stands right before it */
  .timeline__step--buffer .timeline__date {
    margin-inline-start: var(--space-3);
  }

  .timeline__label {
    font-size: var(--text-small);
    font-weight: var(--font-weight-semibold);
    color: var(--color-ink);
  }

  /* In the ink color, not the accent blue: blue is for what is done (see .progress), the timeline is only time */
  .timeline__step.is-current::before {
    background-color: var(--color-ink);
  }

  /* The first step (the days up to the first full week) and the buffer have the width of their days (flex-grow, in
     weeks), but never so narrow that their label doesn't fit */
  .timeline__step.is-current,
  .timeline__step--buffer {
    min-inline-size: max-content;
  }

  /* The ends of the row line up with the dates above them: the label of the first step at its start, the buffer's
     at its end */
  .timeline__step.is-current {
    align-items: flex-start;
    text-align: start;
  }

  .timeline__step--buffer {
    align-items: flex-end;
    text-align: end;
  }

  /* Time that isn't for writing: hatched instead of filled */
  .timeline__step--buffer::before {
    background: repeating-linear-gradient(135deg, var(--color-border) 0 3px, transparent 3px 6px);
    box-shadow: inset 0 0 0 1px var(--color-border);
  }
}
