* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Gallery Header - уникальные стили только для заголовка страницы галереи */
.gallery-header {
    border-bottom: 1px solid #e5e7eb;
    padding: 2rem 0;
    position: static;
}

.gallery-header h1 {
    font-size: 2.5rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 1rem;
}

.gallery-header p {
    font-size: 1.125rem;
    color: #6b7280;
    text-align: center;
    max-width: 42rem;
    margin: 0 auto;
}

/* Gallery Grid */
.gallery-main {
    padding: 3rem 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 640px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 768px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 4/3;
}

.gallery-item:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

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

.gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background-color 0.3s ease;
}

.gallery-item:hover .gallery-overlay {
    background: rgba(0, 0, 0, 0.2);
}

.gallery-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    color: white;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    max-width: 64rem;
    max-height: 100%;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0.5rem;
}

.modal-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    border-radius: 0 0 0.5rem 0.5rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-nav.prev {
    left: 1rem;
}

.modal-nav.next {
    right: 1rem;
}

.modal-fullscreen {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 3rem;
    height: 3rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
}

.modal-fullscreen:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mobile optimizations */
@media (max-width: 640px) {
    .gallery-header h1 {
        font-size: 2rem;
    }
    
    .gallery-header p {
        font-size: 1rem;
    }
    
    .gallery-main {
        padding: 2rem 0;
    }
    
    .modal-close, .modal-nav, .modal-fullscreen {
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.25rem;
    }
}

body.modal-open {
    overflow: hidden;
}

/* Отключаем фиксацию шапки сайта только на странице галереи */
.page-gallery header,
.page-gallery .site-header,
.page-gallery .header-main,
.page-gallery .header {
    position: static !important;
    top: auto !important;
}