/* Gallery Styles - Arcade Edition */
.gallery-section {
    margin-top: 40px;
    text-align: center;
    position: relative;
}

.gallery-title {
    color: var(--accent);
    font-size: 16px;
    margin-bottom: 10px;
    text-shadow: 
        var(--pixel-shadow-sm),
        0 0 10px var(--accent);
    animation: neon-flicker 3s infinite;
    position: relative;
}

.gallery-title::before,
.gallery-title::after {
    content: '🎮';
    margin: 0 15px;
    animation: bounce-icon 0.5s infinite alternate;
}

@keyframes bounce-icon {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

@keyframes neon-flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; }
    93% { opacity: 0.8; }
    94% { opacity: 1; }
    96% { opacity: 0.9; }
    97% { opacity: 1; }
}

.gallery-subtitle {
    color: var(--secondary);
    font-size: 10px;
    margin-bottom: 20px;
    animation: text-glow 2s ease-in-out infinite alternate;
}

.gallery-subtitle.random-mode {
    color: var(--accent-alt);
}

@keyframes text-glow {
    from { text-shadow: 0 0 5px transparent; }
    to { text-shadow: 0 0 10px var(--secondary); }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    padding: 20px;
    background: 
        linear-gradient(135deg, var(--dark) 0%, var(--darker) 100%);
    border: 4px solid var(--secondary);
    min-height: 200px;
    position: relative;
    overflow: hidden;
    box-shadow: 
        inset 0 0 50px rgba(0,0,0,0.5),
        var(--pixel-shadow);
}

/* Arcade screen effect */
.gallery-grid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 212, 170, 0.03) 2px,
            rgba(0, 212, 170, 0.03) 4px
        );
    pointer-events: none;
    z-index: 1;
    animation: scanline-move 8s linear infinite;
}

@keyframes scanline-move {
    from { transform: translateY(0); }
    to { transform: translateY(100px); }
}

.gallery-album-title {
    grid-column: 1 / -1;
    text-align: left;
    color: var(--primary);
    font-family: "Press Start 2P", cursive;
    font-size: 0.8rem;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 2px dashed var(--secondary);
    padding-bottom: 5px;
    position: relative;
    z-index: 2;
}

.gallery-album-title::before {
    content: '► ';
    color: var(--accent);
    animation: blink 1s infinite;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4/3;
    overflow: hidden;
    border: 3px solid var(--darker);
    transition: all 0.2s ease-out;
    cursor: pointer;
    z-index: 2;
    animation: item-appear 0.5s ease-out backwards;
}

.gallery-item:nth-child(1) { animation-delay: 0.05s; }
.gallery-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-item:nth-child(7) { animation-delay: 0.35s; }
.gallery-item:nth-child(8) { animation-delay: 0.4s; }
.gallery-item:nth-child(9) { animation-delay: 0.45s; }
.gallery-item:nth-child(10) { animation-delay: 0.5s; }
.gallery-item:nth-child(11) { animation-delay: 0.55s; }
.gallery-item:nth-child(12) { animation-delay: 0.6s; }

@keyframes item-appear {
    from {
        opacity: 0;
        transform: scale(0.8) rotate(-5deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    z-index: 3;
    transition: left 0.5s;
}

.gallery-item:hover::before {
    left: 150%;
}

.gallery-item:hover {
    transform: scale(1.08) rotate(1deg);
    border-color: var(--primary);
    z-index: 10;
    box-shadow: 
        0 0 20px rgba(255, 107, 157, 0.6),
        var(--pixel-shadow);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.3s;
}

.gallery-item:hover img {
    filter: brightness(1.1) contrast(1.05);
}

.gallery-placeholder {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    font-size: 12px;
    height: 200px;
    z-index: 2;
    position: relative;
}

.gallery-placeholder p {
    animation: pulse-text 2s infinite;
}

/* Back to random button */
.back-to-random-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    margin-top: 25px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    border: 3px solid var(--accent);
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.back-to-random-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(255, 107, 157, 0.5);
    border-color: var(--neon-cyan);
}

.gallery-placeholder .loading-dots::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.02); }
}

/* Random images banner */
.random-banner {
    background: linear-gradient(90deg, var(--accent-alt), var(--primary), var(--accent-alt));
    background-size: 200% 100%;
    animation: gradient-shift 3s ease infinite;
    color: var(--dark);
    padding: 8px 20px;
    margin-bottom: 15px;
    font-size: 10px;
    display: inline-block;
    border: 2px solid var(--light);
    box-shadow: var(--pixel-shadow-sm);
    width: max-content;
    max-width: 100%;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    appearance: none;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.random-banner:hover,
.random-banner:focus-visible {
    transform: translate(-2px, -2px);
    filter: brightness(1.08);
    box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.45);
}

.random-banner:active {
    transform: translate(0, 0);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Lightbox - Enhanced */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.lightbox::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 107, 157, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(248, 181, 0, 0.1) 0%, transparent 50%);
    animation: lightbox-bg 10s ease infinite;
}

@keyframes lightbox-bg {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-img {
    max-width: 90%;
    max-height: 80%;
    border: 4px solid var(--primary);
    box-shadow: 
        0 0 30px rgba(255, 107, 157, 0.5),
        0 0 60px rgba(255, 107, 157, 0.3);
    animation: lightbox-appear 0.3s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes lightbox-appear {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.lightbox-caption {
    color: white;
    margin-top: 20px;
    font-family: "Press Start 2P", cursive;
    font-size: 0.8rem;
    text-align: center;
    text-shadow: 0 0 10px var(--primary);
    position: relative;
    z-index: 1;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: var(--light);
    font-size: 36px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s;
    text-shadow: 0 0 10px var(--primary);
}

.lightbox-close:hover {
    color: var(--primary);
    transform: rotate(90deg) scale(1.2);
}

/* Lightbox Navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--light);
    font-size: 48px;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s;
    padding: 20px;
}

.lightbox-nav:hover {
    color: var(--accent);
    text-shadow: 0 0 20px var(--accent);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* History Item Enhancements */
.history-item {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.history-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), transparent);
    transition: width 0.3s;
    opacity: 0.3;
}

.history-item:hover::before {
    width: 100%;
}

.history-item.active {
    background: var(--accent);
    color: var(--dark);
    animation: selected-glow 1.5s infinite;
}

@keyframes selected-glow {
    0%, 100% { box-shadow: 0 0 5px var(--accent); }
    50% { box-shadow: 0 0 20px var(--accent), 0 0 30px var(--accent); }
}

.history-item.active .year,
.history-item.active .location {
    color: var(--dark);
}

/* Pixel corners decoration */
.gallery-grid::after {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 2px dashed var(--secondary);
    opacity: 0.3;
    pointer-events: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gallery-section {
        margin-top: 30px;
    }
    
    .gallery-title {
        font-size: 12px;
    }
    
    .gallery-title::before,
    .gallery-title::after {
        display: none;
    }
    
    .gallery-subtitle {
        font-size: 8px;
        margin-bottom: 15px;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
        padding: 15px;
        border-width: 3px;
    }
    
    .gallery-grid::after {
        top: 5px;
        left: 5px;
        right: 5px;
        bottom: 5px;
    }
    
    .gallery-item {
        border-width: 2px;
    }
    
    .gallery-album-title {
        font-size: 9px;
        margin-top: 15px;
    }
    
    .gallery-placeholder {
        height: 150px;
    }
    
    .gallery-placeholder p {
        font-size: 10px;
    }
    
    .random-banner {
        font-size: 8px;
        padding: 6px 15px;
    }
    
    /* Lightbox Mobile */
    .lightbox-img {
        max-width: 95%;
        max-height: 70%;
        border-width: 3px;
    }
    
    .lightbox-caption {
        font-size: 9px;
        margin-top: 15px;
        padding: 0 15px;
    }
    
    .lightbox-close {
        top: 15px;
        right: 15px;
        font-size: 28px;
    }
    
    .lightbox-nav {
        font-size: 28px;
        padding: 8px;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 6px;
        padding: 12px;
    }
    
    .gallery-title {
        font-size: 10px;
    }
    
    .gallery-subtitle {
        font-size: 7px;
    }
    
    .gallery-placeholder p {
        font-size: 9px;
    }
    
    .lightbox-nav {
        font-size: 24px;
    }
    
    .lightbox-close {
        font-size: 24px;
    }
}
