/**
 * Lumo Mobile-First Gallery – Frontend Styles
 *
 * @package LumoMobileGallery
 * @version 1.0.0
 */

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.lumo-gallery-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    user-select: none;
    cursor: grab;
    outline: none;
    background: #0d0d0d;
    touch-action: pan-x;
}

.lumo-gallery-wrapper:active {
    cursor: grabbing;
}

/* ── WebGL Canvas ─────────────────────────────────────────────────────────── */
.lumo-canvas-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.lumo-webgl-canvas {
    display: none;
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    inset: 0;
}

/* ── CSS Fallback Gallery ─────────────────────────────────────────────────── */
.lumo-css-fallback {
    display: flex;
    align-items: center;
    height: 100%;
    gap: var(--lumo-gap, 20px);
    padding: 0 var(--lumo-gap, 20px);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-shrink: 0;
}

.lumo-css-fallback::-webkit-scrollbar {
    display: none;
}

/* When WebGL is active, hide fallback */
.lumo-css-fallback[style*="display: none"],
.lumo-css-fallback[style*="display:none"] {
    display: none !important;
}

/* Active CSS mode */
.lumo-css-fallback.lumo-css-active {
    display: flex;
}

/* Static mode (reduced motion) */
.lumo-css-fallback.lumo-static-mode {
    display: flex;
    flex-wrap: wrap;
    overflow: visible;
    height: auto;
    padding: 10px;
}

.lumo-css-fallback.lumo-static-mode .lumo-fallback-item {
    flex: 0 0 calc(33.333% - 14px);
}

/* ── Fallback Items ────────────────────────────────────────────────────────── */
.lumo-fallback-item {
    flex: 0 0 auto;
    height: 100%;
    overflow: hidden;
    position: relative;
    transition: transform 0.15s ease-out;
    border-radius: 4px;
}

.lumo-fallback-item img {
    display: block;
    height: 100%;
    width: auto;
    max-width: none;
    object-fit: cover;
    pointer-events: none;
    border-radius: 4px;
}

.lumo-fallback-item a {
    display: block;
    height: 100%;
}

/* ── Loading Spinner ─────────────────────────────────────────────────────── */
.lumo-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 13, 13, 0.85);
    z-index: 10;
    pointer-events: none;
}

.lumo-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: lumo-spin 0.8s linear infinite;
}

@keyframes lumo-spin {
    to { transform: rotate(360deg); }
}

/* ── Gyro Permission Button ──────────────────────────────────────────────── */
.lumo-gyro-permission-btn {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px 20px;
    border-radius: 24px;
    font-size: 14px;
    letter-spacing: 0.03em;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s ease, transform 0.2s ease;
    touch-action: manipulation;
}

.lumo-gyro-permission-btn:hover,
.lumo-gyro-permission-btn:focus-visible {
    background: rgba(255, 255, 255, 0.25);
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: 2px;
}

/* ── Keyboard / Focus Accessibility ─────────────────────────────────────── */
.lumo-gallery-wrapper:focus-visible {
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.6);
}

.lumo-keyboard-hint {
    margin: 0;
    padding: 0;
}

/* ── Editor Specific ─────────────────────────────────────────────────────── */
.lumo-gallery-empty-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: #f0f0f0;
    color: #888;
    font-size: 14px;
    border: 2px dashed #ccc;
    border-radius: 4px;
}

.lumo-editor-fallback {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    height: 100%;
    overflow-x: auto;
}

.lumo-editor-fallback .lumo-fallback-item {
    flex: 0 0 300px;
    height: 80%;
}

.lumo-editor-fallback .lumo-fallback-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ── Reduced Motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .lumo-loading-spinner {
        animation: none;
        border: 3px solid rgba(255, 255, 255, 0.5);
    }

    .lumo-fallback-item {
        transition: none;
    }

    .lumo-gyro-permission-btn {
        transition: none;
    }
}

/* ── Mobile Breakpoints ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .lumo-gyro-permission-btn {
        font-size: 13px;
        padding: 8px 16px;
    }

    .lumo-css-fallback.lumo-static-mode .lumo-fallback-item {
        flex: 0 0 calc(50% - 10px);
    }
}

@media (max-width: 480px) {
    .lumo-css-fallback.lumo-static-mode .lumo-fallback-item {
        flex: 0 0 100%;
    }
}

/* ── High Contrast Mode ──────────────────────────────────────────────────── */
@media (prefers-contrast: high) {
    .lumo-gyro-permission-btn {
        background: #000000;
        color: #ffffff;
        border-color: #ffffff;
    }
}
