body {
    justify-content: center;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: rgba(245, 242, 237, 0.952);
}

main {
    background-color: rgba(245, 242, 237, 0.952);
}

.first-block {
    max-height: auto;
    max-width: 100%;
}

.main-theme {
    height: 800px;
    max-width: 100%;
}

.navigation-pannel {
    height: 50px;
    max-width: 100%;
    margin: 10px;
    text-align: auto;
    background-color: rgba(245, 242, 237, 0.952);
}

.in-navigation-pannel, .logotip-button {
    position: relative;
}

.logotip-button {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
    margin-left: 30px;
    margin-right: 30px;
}

.logotip {
    margin-top: 10px;
    margin-left: 30px;
    text-align: left;
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    display: inline-block;
    transition: transform 0.3s ease;
    border-radius: 8px;
    border: 1px solid #E0D5C7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease;
    color:#2a312e;
}

.logotip:hover {
    color: #222; 
    text-shadow: 0 0 30px #9e5a01;
    transform: translateY(-2px);
}

.navigation-buttons {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    margin-right: 30px;
    text-align: right;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
}

@media (max-width: 768px) {
    /* Показываем кнопку бургера */
    .menu-toggle {
        display: block;
        cursor: pointer;
        background: none;
        border: none;
        font-size: 24px;
    }

    /* Изначально скрываем меню и выстраиваем ссылки вертикально */
    .navigation-buttons {
        display: none; 
        position: absolute;
        top: 60px; /* Высота подстраивается под твою шапку */
        left: 0;
        width: 100%;
        background-color: rgba(245, 242, 237, 0.98); /* В цвет сайта */
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        box-shadow: 0px 4px 6px rgba(0,0,0,0.05);
        z-index: 999;
    }

    /* Когда JavaScript добавляет класс .active — меню показывается */
    .navigation-buttons.active {
        display: flex !important;
    }

    .navigation-buttons a {
        padding: 15px 0;
        width: 100%;
        text-align: center;
    }
}

.catalog-button {
    text-decoration: none;
    color: #2a312e;
    display: inline-block;
    transition: transform 0.3s ease;
}

.catalog-button span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.catalog-button span:hover {
    transform: translateY(-5px);
    animation: jump 0.4s ease infinite alternate;
}

.catalog-button:hover {
    color: #222;
    text-shadow: 0 0 30px #9e5a01;
    transform: translateY(-2px);
}

.projects-button {
    text-decoration: none;
    color: #2a312e;
    display: inline-block;
    transition: transform 0.3s ease;
}

.projects-button span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.projects-button span:hover {
    transform: translateY(-5px);
    animation: jump 0.4s ease infinite alternate;
}

.projects-button:hover {
    color: #222;
    text-shadow: 0 0 30px #9e5a01;
    transform: translateY(-2px);
}

.about-button {
    text-decoration: none;
    color: #2a312e;
    display: inline-block;
    transition: transform 0.3s ease;
}

.about-button span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.about-button span:hover {
    transform: translateY(-5px);
    animation: jump 0.4s ease infinite alternate;
}

.about-button:hover {
    color: #222;
    text-shadow: 0 0 30px #9e5a01;
    transform: translateY(-2px);
}

.contacts-button {
    text-decoration: none;
    color: #2a312e;
    display: inline-block;
    transition: transform 0.3s ease;
}

.contacts-button span {
    display: inline-block;
    transition: transform 0.3s ease;
}

.contacts-button span:hover {
    transform: translateY(-5px);
    animation: jump 0.4s ease infinite alternate;
}

.contacts-button:hover {
    color: #222;
    text-shadow: 0 0 30px #9e5a01;
    transform: translateY(-2px);
}

.title-block {
    height: auto;
    max-width: 100%;
}

.image-block {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
}

.author-img {
    max-width: 600px;
    height: auto;
}

@media (max-width: 768px) {
    .title-block {
        display: flex;
        flex-direction: column;
        position: relative;
        padding: 0 20px;
        max-width: 100%;
        margin: 20 px auto;
        width: 100%;
        align-items: center;
        text-align: center;
        box-sizing: border-box;
    }

    .title-block img {
        max-width: 80%;
        height: auto;
        margin-bottom: 15px;
    }

    .title-block h1 {
        font-size: 28px;
        line-height: 1.2;
        margin-bottom: 10px;
    }

    .title-block p {
        font-size: 16px;
        line-height: 1.4;
    }
}

.name-block {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
}

.home-hero-title {
    text-align: center;
}

.block {
    text-align: center;
    font-size: 3rem;
}

.home-hero-main-theme {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    text-align: center;
}

.projects {
    max-height: auto;
    max-width: 100%;
    align-items: center;
}

.project-title {
    border: rgba(245, 242, 237, 0.952) 30px;
    padding: 50px;
    margin-top: 60px;
    margin-left: 60px;
    text-align: left;
}

.catalog-second-button {
    margin-left: 60px;
    text-align: left;
    text-decoration: none
}

.second-block {
    max-height: auto;
    max-width: 100%;
}

.short-story {
    display: flex;
    justify-content: center;
    max-height: auto;
    max-width: 100%;
}

.story-title {
    max-height: auto;
    max-width: 100%;
}

.story-header {
    margin-left: 30px;
    text-align: left;
}

.story-body {
    max-height: auto;
    max-width: 900px;
}

.story {
    text-align: justify;
    font-family: Palatino, URW Palladio L, serif;
    font-size: 25px;
    padding: 20px;
    text-indent: 20px;
}

.story-img {
    display: flex;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    height: auto;
}

.other-main-title-information {
    text-align: justify;
    padding: 20px;
}

.third-block {
    height: 600px;
    max-width: 100%;
    display: flex;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.contact-to-me-block {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-to-me-section {
    display: flex;
    justify-content: center;
}

.contact-form-message {
    font-size: 1.1rem;
    color: black;
    margin: 0;
}

.social-networks-buttons {
    display: flex;
    justify-content: center;
    gap: 30px;
}

.instagram-button {
    text-decoration: none;
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #f1b8c5, #FAF0E6);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.instagram-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #d183a9, #F5E6D3);
}

.instagram-button-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.telegram-button {
    text-decoration: none;
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: #333;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #9fd6f0, #FAF0E6);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.telegram-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #7bbde9, #F5E6D3);
}

.telegram-button-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: inherit;
    text-decoration: none;
}

.gallery {
    margin: 15px;
    padding: 15px;
    border: 1px solid #ccc;
    float: left;
    max-width: 600px;
}

.gallery:hover {
    border: 1px solid #777;
}

.gallery img {
    width: 100%;
    height: auto;
}

.desc {
    padding: 15px;
    text-align: center;
}

.end-of-page {
    margin-top: auto;
}

.terem-muhi-book-title {
    max-width: 570px;
    height: auto;
}

.about-me-description {
    display: flex;
    justify-content: center; /* Центр по горизонтали */
    align-items: center; /* Центр по вертикали */
    box-sizing: border-box;
}

.about-me-description-paragraf {
    text-align: justify;
    font-family: Palatino, URW Palladio L, serif;
    font-size: 25px;
    padding: 20px;
    text-indent: 20px;
    max-width: 900px;
}

.about-me-section {
    max-height: auto;
    max-width: 100%;
}

/* Стили для модального окна */

#gallery-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    margin: 40px auto;
    padding: 20px;
    max-width: 90%;
}

#gallery-container img {
    width: 350px;
    height: auto;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

#gallery-container img:hover {
    transform: scale(1.05);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: hidden;
    cursor: zoom-in;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    transition: transform 0.1s ease;
    cursor: pointer;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

.controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1001;
}

.controls button {
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    background: #007bff;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.controls button:hover {
    background: #0055b3;
}

.loading {
    color: white;
    font-size: 18px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1002;
    display: none;
}

.cv-description {
    display: flex;
    justify-content: center;
}

.cv-description-paragraf {
    text-align: justify;
    font-family: Palatino, URW Palladio L, serif;
    font-size: 21px;
    padding: 0;
    text-indent: 20px;
    max-width: 900px;
}

.cv-name-and-education {
    max-width: 450px;
    margin: 0;
    margin-right: 25px;
}

.cv-exhibition {
    max-width: 450px;
    margin: 0;
    margin-left: 25px;
}

@media (max-width: 768px) {
    .cv-description {
        display: flex;
        flex-direction: column;
        justify-content: center; /* Центр по горизонтали */
        align-items: center; /* Центр по вертикали */
        box-sizing: border-box;
    }

    .cv-name-and-education {
        max-width: 450px;
        margin: 20px;
    }

    .cv-exhibition {
        max-width: 450px;
        margin: 20px;
    }
}

@media (max-width: 1024px) {
    .cv-description {
        display: flex;
        flex-direction: column;
        justify-content: center; /* Центр по горизонтали */
        align-items: center; /* Центр по вертикали */
        box-sizing: border-box;
    }

    .cv-name-and-education {
        max-width: 800px;
        margin: 20px;
    }

    .cv-exhibition {
        max-width: 800px;
        margin: 20px;
    }
}

.project-list {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.project-block {
    display: flex;
    justify-content: center;
    max-width: 900px;
    margin: 20px;
}

.project-image {
    max-width: 450px;
    max-height: auto;
    margin-right: 20px;
    margin-top: 29px;
}

.project-description-block {
    max-width: 450px;
}

.project-description {
    text-align: justify;
    font-family: Palatino, URW Palladio L, serif;
    font-size: 25px;
    text-indent: 20px;
}

.project-description span {
    font-weight: 800;
}

@media (max-width: 768px) {
    .project-list {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .project-block {
        display: flex;
        flex-direction: column;
        max-width: 400px;
        margin: 20px;
    }

    .project-image {
    max-width: 350px;
    max-height: auto;
    margin: 20px;
    }

    .project-description-block {
        display: flex;
        flex-direction: column;
        max-width: 450px;
        margin: 20px;
    }
}

/* Контейнер галереи */
.project-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 колонки на десктопе */
    gap: 28px; /* Отступы между постами, как в Insta */
    max-width: 935px; /* Стандартная ширина контента Instagram */
    margin: 0 auto padding-bottom;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Элемент галереи */
.gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* Делает элемент строго квадратным */
    overflow: hidden;
    display: block;
    background-color: #e0d5c7;
}

/* Картинка внутри */
.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Обрезает картинку по квадрату без деформации */
    transition: transform 0.5s ease;
}

/* Эффект наведения (темный слой, как в веб-версии Instagram) */
.item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4); /* Полупрозрачный черный */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 15px;
    box-sizing: border-box;
}

.item-text {
    color: #ffffff;
    font-family: 'Palatino', serif;
    font-size: 18px;
    text-align: center;
    line-height: 1.4;
}

/* Логика ховера */
.gallery-item:hover img {
    transform: scale(1.05); /* Легкое увеличение картинки */
}

.gallery-item:hover .item-overlay {
    opacity: 1; /* Проявление текста */
}

/* Адаптивность под мобильные устройства */
@media (max-width: 768px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 колонки на планшетах */
        gap: 10px; /* Меньше отступы */
    }
    .item-text {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .project-grid {
        grid-template-columns: repeat(3, 1fr); /* 3 в ряд на мобилках, прямо как в приложении Instagram */
        gap: 3px; /* Минимальные швы */
        padding: 0;
    }
    
    /* На мобильных тач-скринах ховер неудобен, можно отключить overlay или сделать его видимым всегда */
    .item-overlay {
        display: none; /* Скрываем текст на смартфонах, оставляя чистый визуал */
    }
}

/* 📸 Значок мульти-изображения (Instagram Carousel Icon) */
.carousel-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 3px;
    background-color: transparent;
    z-index: 5; /* Чтобы значок был поверх картинки */
    filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.5)); /* Тень, чтобы иконку было видно на белых рисунках */
    transition: opacity 0.3s ease;
}

/* Второй фоновый квадратик для создания эффекта слоя */
.carousel-icon::after {
    content: '';
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    border-top: 2px solid #ffffff;
    border-right: 2px solid #ffffff;
    border-radius: 3px;
}

/* 🌟 Дополнительный интерактив: скрываем значок, когда пользователь наводит мышь на десктопе, 
   так как в этот момент проявляется текстовая плашка */
.gallery-item:hover .carousel-icon {
    opacity: 0;
}

/* Адаптация под мобильные устройства */
@media (max-width: 480px) {
    .carousel-icon {
        top: 8px;
        right: 8px;
        width: 12px;
        height: 12px;
        border-width: 1.5px;
    }
    .carousel-icon::after {
        top: -4px;
        right: -4px;
        width: 12px;
        height: 12px;
        border-width: 1.5px;
    }
    
    /* На смартфонах ховер-текста нет, поэтому значок должен гореть ВСЕГДА */
    .gallery-item:hover .carousel-icon {
        opacity: 1;
    }
}

/* Контейнер модального окна */
.modal {
    display: none; /* Переключается на 'flex' через JS класс .show */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.9); /* Темный фон */
    
    /* Центрируем всё внутри модалки на уровне самого контейнера */
    justify-content: center;
    align-items: center;
}

/* Класс, который JS добавляет при открытии */
.modal.show {
    display: flex !important;
}

/* Обертка для контента */
.modal-content-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 10px; /* Чуть уменьшил отступы для мобильных экранов */
    box-sizing: border-box;
}

/* Сама картинка */
.modal-content {
    max-width: 95%; /* Разрешаем занимать чуть больше места на мобилках */
    max-height: 85vh; /* Ограничиваем по высоте, чтобы не вылезала за экран */
    width: auto;
    height: auto;
    object-fit: contain;
    transition: transform 0.1s ease; /* Плавный зум */
    display: block;
    margin: auto; /* Авто-отступы центрируют картинку в любых непонятных ситуациях */
}

/* Кнопка закрытия (крестик) сверху справа */
.close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1010;
    padding: 10px; /* Увеличиваем зону клика для пальцев */
}

/* МЕДИА-ЗАПРОС ДЛЯ СМАРТФОНОВ */
@media (max-width: 768px) {
    .modal-content {
        max-width: 98%;
        max-height: 80vh; /* Оставляем место сверху/снизу под пальцы */
    }
    .close {
        top: 10px;
        right: 15px;
        font-size: 40px; /* Делаем крестик крупнее, чтобы по нему было легче попасть */
    }
}
