/*
 * Drag and drop, one look (#826). Loaded by every page whose lists reorder;
 * js/reorder_drag.js adds and removes the classes below.
 *
 *   .v-drag-grip     the grip: same icon, cursor and focus ring everywhere
 *   .v-drag-lifted   the card in the hand: raised, a touch larger, accent outline
 *   .v-drag-active   on every list while one is being dragged
 *   html.reorder-active   the whole page, so the cursor stays a fist
 *   .v-drag-live     the screen-reader announcements
 *
 * The cards around the lifted one slide into place (a transform transition set
 * by the script) and the lifted one settles into its slot the same way. With
 * prefers-reduced-motion: reduce none of that runs; the script skips it and the
 * rules below make sure no transition is left behind.
 */

.v-drag-grip {
    color: var(--v-ink-subtle);
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    border-radius: var(--v-radius-sm, 6px);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.v-drag-grip:hover {
    color: var(--v-ink-muted);
    background: color-mix(in srgb, var(--v-ink-muted) 12%, transparent);
}

.v-drag-grip:focus-visible {
    outline: 2px solid var(--v-accent);
    outline-offset: 2px;
    color: var(--v-accent);
}

.v-drag-grip:active,
.v-drag-lifted .v-drag-grip {
    cursor: grabbing;
    color: var(--v-accent);
}

/* The card in the hand. The script sets --v-drag-x/--v-drag-y so it stays under
   the pointer while the DOM moves its slot around. Doubled class: pages that
   style a bare .dragging (or a card's own transition) must not win. */
.v-drag-lifted.v-drag-lifted {
    /* Individual properties, not transform: the script's slide and settle use
       transform, and the lift can ease in on its own (scale) while the position
       (translate) follows the pointer with no lag. */
    translate: var(--v-drag-x, 0px) var(--v-drag-y, 0px);
    scale: 1.02;
    box-shadow: var(--v-lift-high);
    outline: 2px solid var(--v-accent);
    outline-offset: -2px;
    opacity: 1;
    z-index: 1000;
    cursor: grabbing;
    transition: scale 0.18s var(--v-ease, ease), box-shadow 0.18s var(--v-ease, ease), outline-color 0.18s var(--v-ease, ease);
    will-change: translate, scale;
}

/* The drop target: a dashed outline that glides to the slot the card would land in. */
.v-drag-slot {
    position: fixed;
    left: 0;
    top: 0;
    box-sizing: border-box;
    border: 2px dashed var(--v-accent);
    border-radius: var(--v-radius-md, 12px);
    pointer-events: none;
    /* On the body, so above any modal the list sits in; an outline only, so the card passing over it is not tinted. */
    z-index: 2147483000;
    transition: transform 0.18s var(--v-ease, ease), width 0.18s var(--v-ease, ease), height 0.18s var(--v-ease, ease);
}

/* Nothing inside the lifted card takes the pointer: the pointer belongs to the drag. */
.v-drag-lifted * {
    pointer-events: none;
}

html.reorder-active,
html.reorder-active * {
    cursor: grabbing !important;
    user-select: none;
    -webkit-user-select: none;
}

/* Hidden but read aloud. */
.v-drag-live {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .v-drag-lifted.v-drag-lifted {
        transition: none;
        will-change: auto;
    }
    .v-drag-slot {
        transition: none;
    }
    .v-drag-active > * {
        transition: none !important;
    }
}
