/* ========================================
   Базовые стили и сброс
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0a0a;
    --bg-secondary: #121212;
    --bg-card: rgba(25, 25, 25, 0.8);
    --accent-primary: #8b1538;
    --accent-secondary: #a31d4d;
    --accent-glow: #c41e4d;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --text-muted: #6a6a6a;
    --border-color: rgba(139, 21, 56, 0.3);
    --blur-strength: 12px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ========================================
   Фоновые эффекты
   ======================================== */
.background-effects {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow-circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s ease-in-out infinite;
}

.glow-circle-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    top: -100px;
    left: -100px;
}

.glow-circle-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    bottom: -150px;
    right: -150px;
    animation-delay: -7s;
}

.glow-circle-3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-secondary) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -30px) scale(1.05);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(20px, 30px) scale(1.02);
    }
}

/* ========================================
   Навигация
   ======================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(var(--blur-strength));
    border-bottom: 1px solid var(--border-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-logo:hover {
    color: var(--accent-glow);
}

.btn-back-nav {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: fixed;
    top: 1.2rem;
    left: 2rem;
    z-index: 101;
}

.btn-back-nav:hover {
    background: rgba(139, 21, 56, 0.3);
    border-color: var(--accent-glow);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.nav-link {
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: transparent;
    border: 1px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: rgba(139, 21, 56, 0.2);
    border-color: var(--border-color);
}

/* ========================================
   Главная страница
   ======================================== */
.main-view {
    padding-top: 80px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.hero {
    text-align: center;
    padding: 4rem 2rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-glow) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin: 2rem 0 1.5rem;
    padding: 0 2rem;
    color: var(--text-primary);
}

/* ========================================
   Карточки архивов
   ======================================== */
.archives-section {
    padding: 0 2rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.archives-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.archive-card {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.archive-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-glow);
    box-shadow: 0 8px 32px rgba(139, 21, 56, 0.3);
}

.archive-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.archive-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    flex: 1;
}

.archive-card .image-count {
    display: inline-block;
    margin-top: 1rem;
    padding: 0.25rem 0.75rem;
    background: rgba(139, 21, 56, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-primary);
    align-self: flex-start;
}

/* ========================================
   Контролы
   ======================================== */
.controls-section {
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.controls-container {
    background: var(--bg-card);
    backdrop-filter: blur(var(--blur-strength));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.control-group select,
.control-group input {
    padding: 0.6rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    min-width: 180px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: var(--accent-glow);
}

.btn-reset {
    padding: 0.6rem 1.5rem;
    background: var(--accent-primary);
    border: none;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-reset:hover {
    background: var(--accent-secondary);
}

/* ========================================
   Страница архива
   ======================================== */
.page {
    display: none;
    padding-top: 80px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.page.active {
    display: block;
}

/* ========================================
   Галерея Masonry
   ======================================== */
.gallery-container {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    grid-auto-rows: 10px;
    gap: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
    border-color: var(--accent-glow);
    box-shadow: 0 8px 32px rgba(139, 21, 56, 0.4);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
    cursor: default;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3rem 0.75rem 0.75rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

.gallery-item .date-info {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* ========================================
   Индикатор загрузки
   ======================================== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-glow);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.no-images {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

/* ========================================
   Модальное окно
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.modal.active {
    display: flex;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2.5rem;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001;
}

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

.modal-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 8px;
}

.modal-info {
    color: var(--text-secondary);
    font-size: 1rem;
    text-align: center;
}

.modal-info .date {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.modal-info .image-msg {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(139, 21, 56, 0.2);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 600px;
}

/* ========================================
   Адаптивность
   ======================================== */
@media (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }

    .btn-back-nav {
        position: fixed;
        top: 0.8rem;
        left: 1rem;
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .section-title {
        padding: 0 1rem;
        font-size: 1.5rem;
    }

    .archives-grid {
        grid-template-columns: 1fr;
    }

    .controls-container {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group select,
    .control-group input {
        width: 100%;
    }

    .gallery-masonry {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .archive-card {
        min-height: 150px;
        padding: 1.5rem;
    }
}

/* ========================================
   Скрытие элементов
   ======================================== */
.hidden {
    display: none !important;
}
