/*
 * The run's own rhythm over the stepper geometry. A group heading takes more air above than rows
 * give each other and less below, so name and first row are one block. A rung is `row.css`'s row at
 * `rung` density: a position, keeping the run's rhythm.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  /* Stated on the class the caller holds, not on `.lotics-stepper`. */
  .lotics-checklist {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }

  .lotics-checklist__group {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    gap: var(--lotics-space-10);
    min-width: 0;
    padding-bottom: var(--lotics-space-4);
  }

  /* The air that makes a name a heading rather than the last row's caption. */
  .lotics-checklist__group:not([data-first]) {
    padding-top: var(--lotics-space-16);
  }

  /* A closed phase's space belongs to the rows it heads. */
  .lotics-checklist__group[data-collapsible]:not([data-open]) {
    padding-bottom: 0;
  }

  .lotics-checklist__phase {
    min-width: 0;
    font-family: var(--font-sans);
    font-size: var(--lotics-text-sm);
    line-height: var(--lotics-leading-sm);
    letter-spacing: var(--lotics-tracking-sm);
    font-weight: var(--lotics-weight-medium);
    font-feature-settings: var(--lotics-font-features);
    color: var(--lotics-ink-default);
  }

  .lotics-checklist__toggle,
  .lotics-checklist__action {
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    flex-shrink: 0;
    border: 0 solid transparent;
    border-radius: calc(var(--lotics-radius-control) - var(--lotics-space-2));
    background: transparent;
    background-image: none;
    appearance: none;
    color: var(--lotics-ink-default);
    font-family: var(--font-sans);
    font-size: var(--lotics-text-xs);
    line-height: var(--lotics-leading-xs);
    letter-spacing: var(--lotics-tracking-xs);
    font-feature-settings: var(--lotics-font-features);
    cursor: pointer;
    touch-action: manipulation;
  }

  .lotics-checklist__toggle:focus-visible,
  .lotics-checklist__action:focus-visible {
    outline: var(--lotics-ring-width) solid var(--ring);
    outline-offset: 0;
  }

  /*
   * On the edge a rung's figure closes on (`Row.Figure`), so headings and rungs share one value
   * column.
   */
  .lotics-checklist__group > .lotics-checklist__trailing {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 0;
    gap: var(--lotics-space-4);
  }

  .lotics-checklist__note {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: var(--lotics-space-6);
    min-width: 0;
  }

  .lotics-checklist__text {
    min-width: 0;
    font-family: var(--font-sans);
    font-size: var(--lotics-text-xs);
    line-height: var(--lotics-leading-xs);
    letter-spacing: var(--lotics-tracking-xs);
    font-weight: var(--lotics-weight-regular);
    font-feature-settings: var(--lotics-font-features);
    color: var(--lotics-ink-muted);
  }

  .lotics-checklist__note[data-tone="warning"] .lotics-checklist__text {
    color: var(--lotics-ink-warning);
  }

  .lotics-checklist__note[data-tone="danger"] .lotics-checklist__text {
    color: var(--lotics-ink-danger);
  }

  .lotics-checklist__actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--lotics-space-8);
    min-width: 0;
    padding-top: var(--lotics-space-2);
  }
}
