/* Base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #1a1a1a;
    --ink: #eef0f4;
    --ink-2: #d9dde6;
    --muted-ink: #c5cad6;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--ink);
    background: var(--bg);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Loading screen */
#loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease;
}

#loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-text {
    font-size: 1.1rem;
    color: var(--ink-2);
    letter-spacing: 0.05em;
}

.loading-progress {
    margin-top: 30px;
    width: 300px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a9eff, #7b61ff);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted-ink);
    font-weight: 500;
}

/* Gallery container */
#gallery-container {
    width: 100%;
    height: 100%;
}

/* UI Overlay */
#ui-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

.ui-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 24px 32px;
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
    backdrop-filter: blur(10px);
}

.back-button {
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--ink);
    text-decoration: none;
    transition: all 0.2s ease;
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-4px);
}

.gallery-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}

/* Controls panel */
.controls-panel {
    position: absolute;
    top: 24px;
    right: 32px;
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.control-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.control-key {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
}

.control-label {
    font-size: 0.7rem;
    color: var(--muted-ink);
    letter-spacing: 0.05em;
}

/* Menu toggle */
.menu-toggle {
    position: absolute;
    bottom: 32px;
    right: 32px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
    z-index: 101;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Artwork modal */
.artwork-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.artwork-modal.active {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.modal-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--ink);
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-content {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 40px;
    align-items: center;
}

#modal-image {
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px var(--shadow);
}

.modal-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#modal-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

#modal-artist {
    font-size: 1.2rem;
    color: var(--ink-2);
    font-weight: 500;
}

#modal-description {
    font-size: 1rem;
    color: var(--muted-ink);
    line-height: 1.7;
}

/* Instructions overlay */
.instructions-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.instructions-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.instructions-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--ink);
}

.instructions-text {
    font-size: 1.2rem;
    color: var(--ink-2);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 40px;
}

.click-prompt {
    font-size: 1rem;
    color: var(--muted-ink);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Responsive */
@media (max-width: 900px) {
    .controls-panel {
        top: auto;
        bottom: 100px;
        right: 24px;
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .modal-content {
        grid-template-columns: 1fr;
        gap: 24px;
        max-height: 85vh;
        overflow-y: auto;
    }

    #modal-title {
        font-size: 2rem;
    }

    .gallery-title {
        font-size: 1.4rem;
    }

    .ui-header {
        padding: 20px 24px;
    }
}

@media (max-width: 600px) {
    .controls-panel {
        display: none;
    }

    .ui-header {
        padding: 16px 20px;
    }

    .gallery-title {
        font-size: 1.2rem;
    }

    .menu-toggle {
        bottom: 24px;
        right: 24px;
        width: 48px;
        height: 48px;
    }

    .modal-content {
        padding: 20px;
    }

    #modal-title {
        font-size: 1.6rem;
    }
}

/* Crosshair for aiming at artworks */
.crosshair {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 200;
}

.crosshair::before,
.crosshair::after {
    content: '';
    position: absolute;
    background: rgba(255, 255, 255, 0.6);
}

.crosshair::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.crosshair::after {
    left: 50%;
    top: 0;
    height: 100%;
    width: 2px;
    transform: translateX(-50%);
}

.crosshair.hover {
    animation: crosshairPulse 0.5s ease;
}

.crosshair.hover::before,
.crosshair.hover::after {
    background: rgba(255, 255, 255, 1);
}

@keyframes crosshairPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
}

