/* Listing hero spin gallery (js/spin-viewer.js). Linked only on a model page with a spin set. */

/* ---- the photo: turn by drag, swipe or arrow keys ------------------------------------ */
.spin-stage { position: relative; touch-action: pan-y; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; outline: none; }
.spin-stage.can-turn { cursor: grab; }
.spin-stage.is-dragging { cursor: grabbing; }
.spin-stage img { -webkit-user-drag: none; }
/* Frames swap in above the hero picture, edge to edge in the same 4:3 box: pixel-steady. */
.spin-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.spin-layer .spin-frame { width: 100%; height: 100%; object-fit: contain; display: block; }
/* The frame clips anything outside it (.car-visual overflow), so focus is drawn inside. */
.spin-stage::after { content: ''; position: absolute; inset: 0; z-index: 3; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 0 3px var(--rd-ink, #17211f), inset 0 0 0 5px #fffdf5; opacity: 0; }
.spin-stage:focus-visible::after { opacity: 1; }
.spin-status { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- the hint: the word Swipe and a left/right arrow, on a faint shade at the photo's foot,
   bottom-right. Appears once the script is live; fades for good after the first turn. */
.spin-hint { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 30%; display: flex; align-items: flex-end; justify-content: flex-end; padding: 0 16px 13px 0; pointer-events: none;
    background: linear-gradient(to top, rgba(18, 22, 20, .42), rgba(18, 22, 20, .14) 55%, rgba(18, 22, 20, 0));
    opacity: 0; transition: opacity .7s ease .3s; }
.spin-stage.is-live.can-turn .spin-hint { opacity: 1; }
.spin-stage.is-live.is-turned .spin-hint { opacity: 0; transition: opacity .6s ease; }
.spin-cue { display: inline-flex; align-items: center; gap: 7px; color: #fff; font: 600 13px/1 var(--rd-font, system-ui, sans-serif); letter-spacing: .04em; text-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
.spin-arrow { width: 24px; height: 12px; overflow: visible; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); animation: spin-sway 2.8s ease-in-out infinite; }
.spin-arrow path { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@keyframes spin-sway { 0%, 100% { transform: translateX(-2px); } 50% { transform: translateX(2px); } }

/* ---- the colors: swatches floating on the page under the photo; only the chosen name ---- */
.spin-colors { display: flex; flex-direction: column; align-items: center; margin-top: 14px; }
.spin-swatches { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.spin-swatch { --swatch: #888; position: relative; width: 44px; height: 44px; padding: 0; margin: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; display: grid; place-items: center; -webkit-tap-highlight-color: transparent; }
/* The paint: the manifest's hex under a clear-coat highlight and a soft underside, so it reads as a glossy chip. */
.spin-swatch::before { content: ''; width: 26px; height: 26px; border-radius: 50%; background-color: var(--swatch);
    background-image:
        radial-gradient(circle at 34% 26%, rgba(255, 255, 255, .9) 0, rgba(255, 255, 255, .42) 13%, rgba(255, 255, 255, 0) 40%),
        radial-gradient(circle at 50% 118%, rgba(0, 0, 0, .38), rgba(0, 0, 0, 0) 62%),
        linear-gradient(160deg, rgba(255, 255, 255, .12), rgba(0, 0, 0, .12));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), inset 0 1px 1px rgba(255, 255, 255, .35), 0 1px 2px rgba(0, 0, 0, .16), 0 5px 12px -5px rgba(0, 0, 0, .38);
    transition: transform .18s ease; }
.spin-swatch[data-finish="metallic"]::before {
    background-image:
        radial-gradient(circle at 34% 26%, rgba(255, 255, 255, .85) 0, rgba(255, 255, 255, .35) 14%, rgba(255, 255, 255, 0) 42%),
        radial-gradient(circle at 68% 72%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 38%),
        radial-gradient(circle at 50% 118%, rgba(0, 0, 0, .4), rgba(0, 0, 0, 0) 62%),
        linear-gradient(135deg, rgba(255, 255, 255, .2), rgba(0, 0, 0, .18)); }
/* Pearl and tricoat: a cool-to-warm sheen across the chip, as the paint shifts in light. */
.spin-swatch[data-finish="pearl"]::before, .spin-swatch[data-finish="tricoat"]::before {
    background-image:
        radial-gradient(circle at 34% 26%, rgba(255, 255, 255, .9) 0, rgba(255, 255, 255, .4) 13%, rgba(255, 255, 255, 0) 40%),
        conic-gradient(from 210deg at 50% 55%, rgba(255, 255, 255, 0), rgba(200, 225, 255, .22), rgba(255, 220, 245, .16), rgba(255, 255, 255, 0) 60%),
        radial-gradient(circle at 50% 118%, rgba(0, 0, 0, .38), rgba(0, 0, 0, 0) 62%),
        linear-gradient(160deg, rgba(255, 255, 255, .14), rgba(0, 0, 0, .14)); }
.spin-swatch[data-finish="tricoat"]::before { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 -3px 6px rgba(0, 0, 0, .18), 0 1px 2px rgba(0, 0, 0, .16), 0 5px 12px -5px rgba(0, 0, 0, .4); }
/* Matte: no clear coat, so no highlight; just the shape. */
.spin-swatch[data-finish="matte"]::before {
    background-image: radial-gradient(circle at 50% 118%, rgba(0, 0, 0, .28), rgba(0, 0, 0, 0) 65%), linear-gradient(160deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .08));
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), 0 1px 2px rgba(0, 0, 0, .14), 0 5px 12px -5px rgba(0, 0, 0, .3); }
/* The chosen one: a fine ring around the chip. */
.spin-swatch::after { content: ''; position: absolute; width: 34px; height: 34px; left: 5px; top: 5px; border-radius: 50%; box-shadow: 0 0 0 1.5px var(--rd-ink, #17211f); opacity: 0; transform: scale(.86); transition: opacity .18s ease, transform .18s ease; }
.spin-swatch[aria-pressed="true"]::after { opacity: 1; transform: none; }
.spin-swatch:hover::before { transform: translateY(-1px); }
.spin-swatch:focus { outline: none; }
.spin-swatch:focus-visible::after { opacity: 1; transform: none; box-shadow: 0 0 0 2px var(--rd-ink, #17211f), 0 0 0 5px #fffdf5, 0 0 0 7px var(--rd-ink, #17211f); }
.spin-color-name { align-self: stretch; margin: 2px 0 0; font-size: 14px; line-height: 1.4; font-weight: 500; letter-spacing: .01em; color: var(--rd-ink, #17211f); text-align: center; }

/* Phone: the same, a touch closer to the photo. */
@media (max-width: 860px) {
    .spin-colors { margin-top: 10px; }
    .spin-hint { padding: 0 12px 10px 0; }
}
@media (prefers-reduced-motion: reduce) {
    .spin-arrow { animation: none; }
    .spin-hint, .spin-stage.is-live.is-turned .spin-hint { transition: none; }
    .spin-swatch::before, .spin-swatch::after { transition: none; }
}
