:root {
    --bg-color: #FAF5E4;
    --text-color: #3B2F1B;
    --accent-amber: #D28413;
    --accent-mustard: #C19A00;
    --accent-ochre: #A35B00;
    --accent-green: #254117;
    --header-bg: rgba(250, 245, 228, 0.9);
    --border-color: rgba(0, 0, 0, 0.1);
    --loader-bg: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-color: #1E1E1E;
    --text-color: #F0E6C8;
    --accent-amber: #F4B860;
    --accent-mustard: #E1C542;
    --accent-ochre: #D08B3B;
    --accent-green: #3C6E47;
    --header-bg: rgba(30, 30, 30, 0.9);
    --border-color: rgba(255, 255, 255, 0.1);
    --loader-bg: rgba(255, 255, 255, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.upload-button {
    background-color: var(--accent-amber);
    color: var(--bg-color);
    border: none;
    margin: 2rem auto;
    padding: 0.5rem 1rem;
    border-radius: 10px;
    cursor: pointer;
}


.gallery-header {
    position: sticky;
    top: 0;
    padding: 1rem;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-amber);
}

.subtitle {
    margin: 1rem auto 1rem auto;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--accent-mustard);
    padding: 0.5rem;
}

.progress-info {
    font-size: 0.85rem;
    color: var(--accent-ochre);
    background: var(--loader-bg);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    cursor: help;
}

.gallery-container {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--accent-green);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 1px;
    gap: 15px;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    border-radius: 8px;
    overflow: hidden;
    background: var(--loader-bg);
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.gallery-item:hover {
    transform: scale(1.05);
    z-index: 10;
    position: relative;
}

.gallery-image {
    width: 100%;
    height: auto;
    display: block;
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: 8px;
    flex: 1 0 auto;
}

.gallery-image.loaded {
    opacity: 1;
}

.loader {
    padding: 1.5rem;
    color: var(--accent-ochre);
    display: none;
}

/* Модалка */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s;
}

.modal-content {
    display: block;
    max-width: 90%;
    max-height: 80vh;
    margin: 5% auto;
    border: 2px solid var(--accent-mustard);
    border-radius: 4px;
}

.modal-caption {
    text-align: center;
    color: white;
    padding: 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--accent-mustard);
}

.subtitle {
    font-size: 1.2 rem;
    margin-top: 1 rem;
    margin-bottom: 2 rem;
    color: var(--accent-mustard);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

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


@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

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

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}