:root {
    --primary-bg: #f5f5f5;
    --secondary-bg: #ffffff;
    --text-color: #333333;
    --accent: #007bff;
}

[data-theme="dark"] {
    --primary-bg: #1a1a1a;
    --secondary-bg: #2d2d2d;
    --text-color: #e0e0e0;
    --accent: #007bff;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--primary-bg);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

.filter-buttons {
    margin: 1rem 0;
}

button {
    background: var(--secondary-bg);
    border: 1px solid var(--accent);
    color: var(--text-color);
    padding: 0.5rem 1rem;
    margin: 0 0.5rem;
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 4px;
}

button.active {
    background: var(--accent);
    color: white;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
}

.gallery-item:hover {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.3s;
}

.gallery-item img.loaded {
    opacity: 1;
}

figcaption {
    padding: 0.5rem;
    text-align: center;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 80%;
    max-height: 80%;
    animation: zoomIn 0.3s;
}

.modal-content img {
    width: 100%;
    height: auto;
    display: block;
}

.modal-navigation {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.modal-navigation button {
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 1rem;
    cursor: pointer;
    pointer-events: auto;
}

.close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

@keyframes zoomIn {
    from { transform: translate(-50%, -50%) scale(0.9); }
    to { transform: translate(-50%, -50%) scale(1); }
}

@media (max-width: 768px) {
    .gallery-item {
        height: auto;
    }
    
    .modal-content {
        max-width: 95%;
        max-height: 90%;
    }
}