/* Shared customer-facing media viewer.
   Ready Designs and Custom Gallery use this owner for rail/stage geometry,
   thumbnail interaction states and responsive rail behavior. */
.storefront-media-viewer {
    --media-thumb-width: 80px;
    --media-thumb-height: 90px;
    --media-rail-gap: 12px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    min-width: 0;
}

.storefront-media-thumbs {
    flex: 0 0 var(--media-thumb-width);
    display: flex;
    flex-direction: column;
    gap: var(--media-rail-gap);
    max-height: 590px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    padding-right: 2px;
}

.storefront-media-thumbs[hidden] { display: none !important; }

.storefront-media-thumb {
    position: relative;
    flex: 0 0 auto;
    width: var(--media-thumb-width);
    height: var(--media-thumb-height);
    display: block;
    overflow: hidden;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(247,244,236,.02);
    cursor: pointer;
    transition: var(--transition-fast);
}

.storefront-media-thumb:hover {
    border-color: var(--border-color-hover);
    background: rgba(247,244,236,.04);
}

.storefront-media-thumb.active {
    border-color: var(--accent-secondary);
    background: rgba(0,126,135,.05);
}

.storefront-media-thumb > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.storefront-media-main {
    flex: 1;
    min-width: 0;
    position: relative;
}

.storefront-media-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    display: grid;
    place-items: center;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--card-bg);
}

.storefront-media-stage > img {
    width: 100%;
    height: 100%;
    display: block;
}

@media (max-width: 600px) {
    .storefront-media-viewer {
        --media-thumb-width: 68px;
        --media-thumb-height: 76px;
        flex-direction: column;
    }

    .storefront-media-thumbs {
        order: 0;
        width: 100%;
        max-height: none;
        flex-basis: auto;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 0 4px;
        scroll-snap-type: x proximity;
        touch-action: pan-x pan-y;
    }

    .storefront-media-main { order: 1; }
    .storefront-media-thumb { scroll-snap-align: start; }
    .storefront-media-thumb:last-child { scroll-snap-align: end; margin-right: 0; }
}


/* Shared media control capsule used beneath Ready Designs and Custom Gallery stages. */
.storefront-media-controls {
    width: max-content;
    max-width: calc(100% - 24px);
    min-height: 42px;
    margin: 8px auto 0;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    position: relative;
    border: 1px solid rgba(247,244,236,.13);
    border-radius: 999px;
    background: rgba(11,11,13,.96);
    box-shadow: 0 8px 20px rgba(11,11,13,.28), 0 0 0 1px rgba(0,126,135,.10);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.storefront-media-controls[hidden] { display: none !important; }
.storefront-media-control {
    position: relative;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    color: rgba(170,167,160,.52);
    background: transparent;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: color .16s ease, background-color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease;
    -webkit-tap-highlight-color: transparent;
}
.storefront-media-control:hover {
    color: rgba(247,244,236,.82);
    background: rgba(247,244,236,.035);
}
.storefront-media-control.active {
    color: var(--thq-text);
    background: rgba(27,27,32,.96);
    border-color: rgba(0,126,135,.34);
    box-shadow: inset 0 0 0 1px rgba(247,244,236,.035), 0 0 12px rgba(0,126,135,.10);
}
.storefront-media-control:active { transform: scale(.96); }
.storefront-media-control:focus-visible {
    outline: 1px solid rgba(0,126,135,.82);
    outline-offset: 2px;
}
.storefront-media-control-icon {
    width: 19px;
    height: 19px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}
.storefront-media-control.active .storefront-media-control-icon { stroke-width: 1.75; }

@media (max-width: 600px) {
    .storefront-media-controls { min-height: 40px; margin-top: 6px; padding: 4px; gap: 2px; }
    .storefront-media-control { width: 42px; height: 42px; flex-basis: 42px; }
    .storefront-media-control-icon { width: 18px; height: 18px; }
}
