@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
@layer cinder.components {
  /* One centered row: "Showing 10 of 19" beside its button. The sentinel is full width, so it
     takes a row of its own above, and the row wraps on a narrow container instead of
     overflowing. */
  .cinder-load-more {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--cinder-space-3);
    padding: var(--cinder-space-3) var(--cinder-space-4);
  }

  .cinder-load-more__summary {
    color: var(--cinder-text-muted);
    font-size: var(--cinder-text-xs);
    line-height: var(--cinder-leading-snug);
    text-align: center;
    text-wrap: balance;
  }

  /* The foot of a framed table or list: the count or the message at the start, the button at the
     end. A failure is the warning tone, with its first sentence in bold. */
  .cinder-load-more[data-cinder-variant='footer'] {
    justify-content: space-between;
    padding-block: var(--cinder-space-2);
  }

  .cinder-load-more[data-cinder-variant='footer'] .cinder-load-more__summary {
    text-align: start;
  }

  .cinder-load-more[data-cinder-variant='footer'] .cinder-load-more__summary[data-cinder-error] {
    color: var(--cinder-status-warning-text);
  }

  .cinder-load-more[data-cinder-variant='footer'] .cinder-load-more__summary strong {
    font-weight: var(--cinder-font-semibold);
  }

  .cinder-load-more__sentinel {
    inline-size: 100%;
    block-size: 1px;
  }

  /* The button is Cinder's own Button at `size="sm"` and `variant="secondary"`, so its paint, its
     focus ring and its 44px touch hit area are the Button's. Only the wait is the footer's. */
  .cinder-load-more__button:disabled {
    cursor: progress;
  }

  .cinder-load-more__spinner {
    inline-size: 0.875rem;
    block-size: 0.875rem;
    border: 2px solid color-mix(in oklch, var(--cinder-text-muted), transparent 65%);
    border-top-color: var(--cinder-text-default);
    border-radius: 9999px;
  }

  @media (prefers-reduced-motion: no-preference) {
    .cinder-load-more__spinner {
      animation: cinder-load-more-spin var(--cinder-duration-spin) linear infinite;
    }
  }

  :root:is([data-cinder-reduced-motion='false'], [data-reduced-motion='off'])
    .cinder-load-more__spinner {
    animation: cinder-load-more-spin var(--cinder-duration-spin) linear infinite;
  }

  @keyframes cinder-load-more-spin {
    to {
      transform: rotate(360deg);
    }
  }
}
