/*
 * Rows render in DATA order and move by transform, so nothing reflows during a
 * gesture and a row's identity never changes hands mid-drag.
 *
 * Only the DISPLACED rows animate — they slide one slot aside to open the gap
 * the dragged row will land in. The held row tracks the pointer 1:1 and states
 * `transition: none` on its own, because a transition there would lag the
 * finger by exactly the animation's duration.
 *
 * A pointer drag across rows is a text selection as far as the browser is
 * concerned, so the labels would highlight blue as the pointer travels. The
 * suppression is scoped to the drag: outside it, the labels stay selectable.
 */
@layer theme, base, lotics, components, utilities;
@layer lotics.tokens, lotics.reset, lotics.components;

@layer lotics.components {
  .lotics-reorder-list {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  /* The rail runs THROUGH the rows, so a buttons list spends nothing between
     them and each row pads its own bottom instead. The drag's gap is a
     MEASUREMENT its own maths reads, so that one arrives inline. */
  .lotics-reorder-list[data-reorder="buttons"] {
    gap: 0;
  }

  .lotics-reorder-list[data-dragging] {
    user-select: none;
  }

  .lotics-reorder-list__item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex-shrink: 0;
  }

  /* Only a dragged row moves, so only a drag list pays for the transition. */
  .lotics-reorder-list[data-reorder="drag"] .lotics-reorder-list__item {
    transition: transform var(--lotics-duration-base) var(--lotics-ease-standard);
  }

  .lotics-reorder-list__item[data-dragging] {
    /* Above the rows it passes, on the ladder's drag rung — a flex item takes a
       stacking context from `z-index` alone, so it needs no positioning. */
    z-index: var(--lotics-z-drag);
    transition: none;
  }
}
