/* ============================================
   ANAGLYPH 3D GALLERY STYLES
   ============================================ */

/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Schoolbell', cursive;
    background-color: #FDFDFD;
    background-image: url('white-texture.jpg');
    background-repeat: repeat;
    background-size: 1024px 1024px;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
}

/* Header Styles */
header {
    text-align: center;
    padding: 2rem 1rem;
}

.main-title {
    font-family: 'Nerko One', cursive;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #333333;
    font-weight: 400;
    text-shadow: 
        2px 0 0 #FF0000,
        -2px 0 0 #00FFFF,
        0 2px 0 rgba(0,0,0,0.08);
    transform: rotate(-1deg);
    margin-bottom: 0.5rem;
    animation: anaglyph-pulse 3s ease-in-out infinite alternate;
}

@keyframes anaglyph-pulse {
    0% {
        text-shadow: 
            3px 0 0 #FF0000,
            -3px 0 0 #00FFFF,
            0 3px 0 rgba(0,0,0,0.1);
    }
    100% {
        text-shadow: 
            4px 0 0 #FF0000,
            -4px 0 0 #00FFFF,
            0 4px 0 rgba(0,0,0,0.15);
    }
}

/* Welcome Section */
.welcome {
    max-width: 800px;
    margin: 0 auto 3rem;
    padding: 0 1rem;
    text-align: center;
}

.welcome p {
    font-size: 1.2rem;
    line-height: 1.7;
    color: #555;
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    border: 2px dashed #333;
    position: relative;
    transform: rotate(0.5deg);
    box-shadow: 
        3px 3px 0 #FF0000,
        -3px -3px 0 #00FFFF,
        6px 6px 15px rgba(0,0,0,0.1);
}

.welcome-message {
    position: relative;
    display: flex;
    align-items: flex-start;
}

.welcome-message p {
    flex: 1;
}

.welcome-close {
    position: absolute;
    top: 10px;
    right: 18px;
    background: none;
    border: none;
    color: #FF0000;
    font-size: 2rem;
    font-family: inherit;
    cursor: pointer;
    z-index: 2;
    line-height: 1;
    padding: 0 0.5rem;
    transition: color 0.2s;
}
.welcome-close:hover {
    color: #00FFFF;
}

/* Gallery Styles */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
    justify-items: center;
}

.gallery-item {
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    transform: rotate(var(--rotation));
    --rotation: 0deg;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 320px;
    /* Ensures all items have the same height for alignment */
}

.gallery-item:nth-child(3n+1) {
    --rotation: 1deg;
}

.gallery-item:nth-child(3n+2) {
    --rotation: -0.5deg;
}

.gallery-item:nth-child(3n) {
    --rotation: 0.8deg;
}

.gallery-item:hover {
    transform: rotate(0deg) scale(1.05);
    z-index: 10;
}

.gallery-item img {
    display: block;
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    border: 3px solid #333;
    background: white;
    padding: 5px;
    box-shadow: 
        2px 2px 0 #FF0000,
        -2px -2px 0 #00FFFF,
        4px 4px 10px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    margin: 0 auto;
}

.gallery-item:hover img {
    box-shadow: 
        4px 4px 0 #FF0000,
        -4px -4px 0 #00FFFF,
        8px 8px 20px rgba(0,0,0,0.3);
}

.gallery-item .creator-tag {
    position: absolute;
    bottom: -10px;
    right: -10px;
    background: white;
    color: #333;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 2px solid #333;
    font-size: 0.9rem;
    font-weight: 400;
    transform: rotate(-5deg);
    box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

/* Lightbox Styles */
.lightbox {
    display: none;
    position: fixed;
    z-index: 1000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.9);
    backdrop-filter: blur(5px);
}

.lightbox.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    position: relative;
    padding: 1.25rem;
    width: 90%;
    max-width: 50rem;
    text-align: center;
    margin: auto;
}

.close-button {
    position: absolute;
    top: -10px;
    right: 10px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    transition: color 0.3s ease;
}

.close-button:hover {
    color: #FF0000;
    text-shadow: 
        2px 0 0 #00FFFF,
        -2px 0 0 #FF0000;
}

#lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border: 4px solid white;
    border-radius: 10px;
    box-shadow: 
        4px 4px 0 #FF0000,
        -4px -4px 0 #00FFFF,
        8px 8px 25px rgba(0,0,0,0.5);
    display: block;
    margin: auto;
}

.image-info {
    margin-top: 1rem;
    color: white;
}

.creator-credit {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 400;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.download-btn {
    display: inline-block;
    background: linear-gradient(45deg, #FF0000, #FF4444);
    color: white;
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 400;
    transition: all 0.3s ease;
    border: 2px solid white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    user-select: none;
}

.download-btn:hover {
    background: linear-gradient(45deg, #00FFFF, #44FFFF);
    transform: scale(1.1);
    box-shadow: 
        2px 2px 0 #FF0000,
        -2px -2px 0 #00FFFF,
        4px 4px 15px rgba(0,0,0,0.3);
}

.download-btn:active {
    transform: scale(1.05);
}

.download-btn[style*="pointer-events: none"] {
    opacity: 0.7;
    transform: scale(1);
    cursor: wait;
}

.download-btn::before {
    content: '⬇';
    margin-right: 0.5rem;
}

/* Lightbox Loader Styles */
.lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.2) rotate(-3deg);
    z-index: 1100;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    padding: 1.5rem;
    box-shadow: 0 0 0 3px #FF0000, 0 0 0 7px #00FFFF, 0 4px 20px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: loader-bounce 1.2s infinite alternate;
}

.loader-svg {
    width: 64px;
    height: 64px;
    display: block;
    filter: drop-shadow(2px 2px 0 #FF0000) drop-shadow(-2px -2px 0 #00FFFF);
}

@keyframes loader-bounce {
    0% { transform: translate(-50%, -50%) scale(1.2) rotate(-3deg); }
    100% { transform: translate(-50%, -60%) scale(1.3) rotate(3deg); }
}

/* Footer Styles */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 1rem 1rem;
    border-top: 2px dashed #333;
    text-align: center;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-content p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
}

.copyright {
    font-weight: 400;
    margin-bottom: 1rem !important;
}

.disclaimer {
    font-size: 0.8rem !important;
    color: #888 !important;
    font-style: italic;
    transform: rotate(-0.3deg);
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 1rem;
    }
    
    .welcome p {
        font-size: 1.1rem;
        padding: 1rem;
    }
    
    .main-title {
        font-size: 2.5rem;
    }
    
    .lightbox-content {
        width: 95%;
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}
