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

html, body {
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Background Container */
.background-container {
    position: relative;
    width: 100%;
    min-height: 100vh;
    background-image: url('./assets/img/mountain range.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.background-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 7, 4, 0.3);
    z-index: 0;
}

/* Fixed Overlay Title */
.gallery-title {
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    pointer-events: none;
    z-index: 10;
    user-select: none;
}

.gallery-title h1 {
    font-size: clamp(3rem, 8vw, 7rem);
    margin-bottom: 1rem;
    letter-spacing: -0.05em;
    opacity: 0.85;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    font-weight: 300;
}

/* Floating Grid Layout */
.floating-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(200px, 45vw), 1fr));
    gap: clamp(0.5rem, 2vw, 1rem);
    padding: clamp(1rem, 4vw, 2rem);
    position: relative;
    z-index: 2;
}

.floating-item {
    position: relative;
    aspect-ratio: 1;
    will-change: transform;
    animation: float var(--duration, 6s) ease-in-out infinite;
    animation-delay: var(--delay, 0s);
}

.floating-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.floating-img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    opacity: 0.9;
}

/* Floating Animation */
@keyframes float {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
    }
    25% { 
        transform: translate(calc(var(--x-offset) * 0.5), calc(var(--y-offset) * 0.3)) rotate(0.5deg); 
    }
    50% { 
        transform: translate(var(--x-offset), var(--y-offset)) rotate(-0.5deg); 
    }
    75% { 
        transform: translate(calc(var(--x-offset) * 0.3), calc(var(--y-offset) * 0.7)) rotate(0.3deg); 
    }
}

/* Modal Styles - Single Image View */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 0.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.close {
    position: fixed;
    top: 20px;
    left: 20px;
    color: #ffffff;
    font-size: 36px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    transition: all 0.3s ease;
    user-select: none;
}

.close:hover,
.close:focus {
    background: rgba(0, 0, 0, 0.8);
    color: #ff6b6b;
    transform: scale(1.1);
}

/* Modal fade-in animation */
.modal.show {
    opacity: 1;
}

.modal.show .modal-content {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Hide caption in single image view */
#caption {
    display: none;
}

/* Hide scrollbar */
::-webkit-scrollbar {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .floating-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .gallery-title h1 {
        font-size: 3rem;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .floating-item {
        animation: none;
    }
}

/* Loading placeholder */
.img-placeholder {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}