/* Mamiya Page Styles - Darkroom Experience */

.mamiya-page {
    overflow-x: hidden;
    background-color: #000;
}

.mamiya-page .logo a {
    color: #fff;
    cursor: pointer;
    display: inline-block;
    transition: opacity 0.2s ease;
}

.mamiya-page .logo a:hover {
    opacity: 0.7;
}

.mamiya-page .header-icons {
    color: #fff;
    display: flex;
    gap: 1rem;
    align-items: center;
}

.mamiya-main {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

/* Full Screen Darkroom Background */
.darkroom-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('mamiyaPage/darkroomClean.png');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 1;
    object-fit: cover;
}

/* Ensure background maintains aspect ratio on all devices */
@media (max-width: 768px) {
    .darkroom-background {
        background-size: cover;
        background-position: center center;
    }
}

/* WAITING Bin */
.waiting-bin {
    position: absolute;
    left: 46%;
    bottom: 33%;
    width: clamp(100px, 8.5vw, 140px);
    height: clamp(60px, 5.5vw, 90px);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Film Roll - Draggable */
.film-roll {
    position: absolute;
    cursor: grab;
    z-index: 20;
    transition: transform 0.2s ease;
    user-select: none;
    left: 46%;
    bottom: 33%;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    touch-action: none; /* Prevent default touch behaviors */
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.film-roll:active {
    cursor: grabbing;
    transform: translate(-50%, -50%) scale(1.1);
}

.film-roll.dragging {
    opacity: 0.7;
    z-index: 1000;
    transform: translate(-50%, -50%) scale(1.1) rotate(5deg);
}

.film-roll.hopping {
    animation: filmHop 0.6s ease-in-out infinite;
}

@keyframes filmHop {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    50% {
        transform: translate(-50%, -70%);
    }
}

.film-roll-image {
    width: clamp(90px, 8vw, 140px);
    height: clamp(110px, 10vw, 170px);
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
    pointer-events: none;
}

/* DEV Bin Drop Zone */
.dev-bin {
    position: absolute;
    left: 59%;
    bottom: 50%;
    width: clamp(100px, 8.5vw, 140px);
    height: clamp(60px, 5.5vw, 90px);
    border: 3px dashed rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    cursor: pointer;
    touch-action: none;
}

.dev-bin.drag-over {
    border-color: #ff0000;
    background: rgba(255, 0, 0, 0.2);
    border-style: solid;
    transform: scale(1.1);
}

.bin-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.dev-bin.drag-over .bin-label {
    color: #ff0000;
}

/* Hint */
.hint {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    text-transform: lowercase;
    letter-spacing: 0.1em;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.hint.visible {
    opacity: 1;
    pointer-events: auto;
    animation: hintPulse 2s ease-in-out infinite;
}

@keyframes hintPulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.05);
    }
}

/* Gallery Overlay */
.gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: none;
    overflow-y: auto;
    animation: fadeIn 0.5s ease;
}

.gallery-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.gallery-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

.gallery-close {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
    z-index: 2001;
}

.gallery-close:hover {
    opacity: 0.7;
}

.gallery-header {
    margin-bottom: 3rem;
    text-align: center;
}

.gallery-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: #fff;
    text-transform: lowercase;
    font-weight: 400;
    letter-spacing: 0.1em;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding-bottom: 4rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.gallery-item:hover {
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 0, 0, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Lightbox Modal */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.98);
    z-index: 3000;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.lightbox-image-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.lightbox-caption {
    font-size: 0.9rem;
    color: #fff;
    opacity: 0.85;
    text-align: center;
    letter-spacing: 0.05em;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease;
}

.lightbox-close:hover {
    opacity: 0.7;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(42, 42, 42, 0.8);
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(42, 42, 42, 1);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

@media (max-width: 768px) {
    .darkroom-background {
        background-size: cover;
        background-position: center center;
        /* Ensure full coverage on mobile */
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .mamiya-main {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .waiting-bin {
        left: 46%;
        bottom: 33%;
        width: clamp(80px, 12vw, 120px);
        height: clamp(50px, 7vw, 80px);
    }

    .dev-bin {
        left: 59%;
        bottom: 50%;
        width: clamp(80px, 12vw, 120px);
        height: clamp(50px, 7vw, 80px);
    }

    .film-roll-image {
        width: clamp(70px, 10vw, 110px);
        height: clamp(85px, 12vw, 135px);
    }

    .hint {
        bottom: 15%;
        font-size: 0.9rem;
        padding: 0.75rem 1.5rem;
        max-width: 80%;
        text-align: center;
    }

    .gallery-container {
        padding: 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .gallery-close {
        top: 1rem;
        right: 1rem;
        font-size: 2.5rem;
        width: 40px;
        height: 40px;
    }

    .lightbox-prev,
    .lightbox-next {
        position: fixed;
        top: auto;
        bottom: 20px;
        transform: none;
        padding: 0.75rem 1rem;
        font-size: 1.5rem;
    }
    
    .lightbox-prev {
        left: 20px;
    }
    
    .lightbox-next {
        right: 20px;
    }
    
    .lightbox-close {
        top: 20px;
        right: 20px;
        font-size: 2.5rem;
    }

    .lightbox-image {
        max-height: 80vh;
    }
}

/* Additional mobile optimizations for very small screens */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }

    .hint {
        font-size: 0.85rem;
        padding: 0.6rem 1.2rem;
    }

    .bin-label {
        font-size: 0.85rem;
    }
    
    /* Make interactive elements more prominent on small screens */
    .film-roll {
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
    }
    
    .dev-bin {
        border-width: 2px;
    }
    
    .dev-bin.drag-over {
        border-color: #ff0000;
        background: rgba(255, 0, 0, 0.3);
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
    }
}

/* Touch-specific improvements */
@media (hover: none) and (pointer: coarse) {
    .film-roll {
        /* Add visual cue that element is draggable on touch devices */
        animation: subtlePulse 3s ease-in-out infinite;
    }
    
    @keyframes subtlePulse {
        0%, 100% {
            filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
        }
        50% {
            filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.4));
        }
    }
    
    .hint {
        /* Make hint more visible on touch devices */
        font-size: 1rem;
        padding: 1rem 1.5rem;
        background: rgba(0, 0, 0, 0.9);
        border: 2px solid rgba(255, 255, 255, 0.5);
    }
    
    /* Increase touch target sizes */
    .dev-bin {
        min-width: 100px;
        min-height: 80px;
    }
    
    .film-roll-image {
        min-width: 80px;
        min-height: 100px;
    }
}
