/* ==========================================================================
   The Contact Sheet — collage-maker photo tray.

   Only the tray needs bespoke styling; every other control reuses the
   shared dk-* components in darkroom.css. Flat design only — solid colors,
   no gradients. Scoped under .pt-scope so it inherits the instrument tokens.
   ========================================================================== */

.dk-tray {
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--pt-surface);
    border: 1px solid var(--pt-border);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    overflow-x: auto;
}

.dk-tray__list {
    display: flex;
    gap: 0.625rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.dk-tray__item {
    position: relative;
    width: 64px;
    height: 64px;
    flex: 0 0 auto;
    border: 2px solid var(--pt-border-strong);
    border-radius: 0.375rem;
    overflow: hidden;
    cursor: grab;
    background: var(--pt-chrome-bg);
    touch-action: none;
    transition: border-color var(--pt-dur) var(--pt-ease);
}

.dk-tray__item:hover { border-color: var(--pt-text-muted); }

.dk-tray__item.is-selected { border-color: var(--pt-accent); }

.dk-tray__item.is-dragging {
    opacity: 0.5;
    border-color: var(--pt-accent);
    cursor: grabbing;
}

.dk-tray__thumb {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    pointer-events: none;
}

/* Number + remove sit ON the photo thumbnail, so they use the sanctioned
   white-text-over-photo scrim (a flat solid-rgba box) rather than page
   tokens — a page-token color would be unreadable over an arbitrary image
   in one theme or the other. */
.dk-tray__num {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 1px 4px;
    font-family: var(--pt-font-mono);
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.3;
    color: #ffffff;
    background: rgba(28, 28, 28, 0.75);
    border-radius: 3px;
    pointer-events: none;
}

.dk-tray__remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    line-height: 1;
    color: #ffffff;
    background: rgba(28, 28, 28, 0.7);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--pt-dur) var(--pt-ease), background-color var(--pt-dur) var(--pt-ease);
}

.dk-tray__item:hover .dk-tray__remove,
.dk-tray__item:focus-within .dk-tray__remove { opacity: 1; }

.dk-tray__remove:hover { background: var(--pt-bad); }

.dk-tray__add {
    flex: 0 0 auto;
    padding: 0.5rem 0.875rem;
    font-family: var(--pt-font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--pt-text-secondary);
    background: var(--pt-chrome-bg);
    border: 1px dashed var(--pt-border-strong);
    border-radius: 0.375rem;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--pt-dur) var(--pt-ease), border-color var(--pt-dur) var(--pt-ease);
}

.dk-tray__add:hover { color: var(--pt-text); border-color: var(--pt-accent); }

/* --- Mobile ---------------------------------------------------------------
   Filmstrip already scrolls horizontally (overflow-x on .dk-tray). Touch has
   no hover, so the per-thumb remove control must stay visible, and the panel
   chips need a ≥40px tap height. */
@media (max-width: 640px) {
    .dk-tray { padding: 0.625rem; }

    .dk-tray__remove {
        opacity: 1;
        width: 1.5rem;
        height: 1.5rem;
        font-size: 1rem;
    }

    #dk-collage-stage .dk-chip {
        display: inline-flex;
        align-items: center;
        min-height: 2.5rem;
    }
}
