/* =========================================================
   360° Spin Viewer — auto-spin, hover-pause, click-to-modal
   ========================================================= */

.spin-viewer-wrapper {
    margin: 0 auto;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    border-radius: 16px;
    box-sizing: border-box;
    overflow: hidden;
    /* box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12); */
}

.spin-viewer-container {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    overflow: hidden;
    cursor: zoom-in;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.spin-viewer-container:active { cursor: zoom-in; }

.spin-viewer-container .spin-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
    transition: transform 0.08s linear;
    will-change: transform;
}

/* =========================================================
   Modal
   ========================================================= */
.spin-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    padding: 20px;
    box-sizing: border-box;
}

.spin-modal-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.spin-modal-content {
    position: relative;
    width: min(92vw, 900px);
    height: min(92vh, 900px);
    background: #ffffff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.2s ease;
    cursor: grab;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.spin-modal-backdrop.is-open .spin-modal-content {
    transform: scale(1);
}

.spin-modal-content:active { cursor: grabbing; }

.spin-modal-content .spin-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    transform-origin: center center;
    transition: transform 0.08s linear;
    will-change: transform;
}

/* Modal close button */
.spin-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    color: #111;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
    transition: background 0.15s, transform 0.15s;
    z-index: 2;
}

.spin-modal-close:hover {
    background: #ffffff;
    transform: scale(1.05);
}

.spin-modal-close:active { transform: scale(0.96); }

/* Body scroll lock when modal open */
body.spin-modal-open {
    overflow: hidden;
}

/* Responsive */
@media (max-width: 500px) {
    .spin-viewer-wrapper { border-radius: 12px; }
    .spin-modal-content  { border-radius: 12px; }
    .spin-modal-close    { top: 10px; right: 10px; width: 40px; height: 40px; font-size: 20px; }
}