:root {
    --primary-color: #8B4513;
    --secondary-color: #D2B48C;
    --background-color: #FFF8DC;
    --text-color: #3E2723;
    --accent-color: #A52A2A;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Playfair Display', serif;
    color: var(--text-color);
    background-color: var(--background-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    word-spacing: 0.05em;
}

section {
    min-height: 100vh;
    padding: 100px 0;
    position: relative;
}

/* Обновленные стили для навигации */
.navbar {
    transition: all 0.4s ease;
    background-color: var(--primary-color); /* Коричневый цвет из переменной */
    padding: 20px 0;
}

.navbar.scrolled {
    background-color: var(--primary-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
}

/* Стили для нового бренда в навигации */
.navbar-brand {
    font-weight: 700;
    font-size: 28px;
    color: var(--background-color);
    transition: all 0.3s ease;
    display: flex;
    justify-content: flex-start;
    width: auto;
    text-align: left;
}

.brand-initial {
    opacity: 1;
    transition: opacity 0.3s ease;
    position: absolute;
}

.brand-scrolled {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.navbar.scrolled .brand-initial {
    opacity: 0;
}

.navbar.scrolled .brand-scrolled {
    opacity: 1;
}

.navbar-toggler {
    border: none;
    font-size: 24px;
    color: var(--background-color);
    z-index: 10;
}

.navbar-toggler:focus {
    box-shadow: none;
}

.navbar-collapse {
    justify-content: flex-end;
}

.nav-link {
    color: var(--background-color);
    font-weight: 500;
    margin: 0 15px;
    position: relative;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(#000000);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(#000000);
    transition: width 0.3s ease;
}

.nav-link:hover::after {
    width: 100%;
}

/* Медиа-запросы для адаптивности */
@media (max-width: 991px) {
    .navbar-brand-container {
        position: relative;
        width: auto;
        justify-content: flex-start;
    }
    
    .navbar-brand {
        position: relative;
    }
}

/* Hero Section */
#hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: var(--background-color);
    position: relative;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto; /* добавляем это для центрирования */
    text-align: center; /* обеспечиваем центрирование текста */
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.hero-content.fade-out {
    opacity: 0;
    transform: translateY(-50px);
}

.hero-title {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
    width: 100%;
}

.hero-subtitle {
    font-size: 28px;
    font-weight: 500;
    color: var(--accent-color);
    margin-bottom: 40px;
    text-align: center;
    width: 100%;
}

.btn-custom {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 30px;
    border-radius: 30px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
}

.btn-custom:hover {
    background-color: transparent;
    color: var(--primary-color);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 32px;
    color: var(--primary-color);
    animation: bounce 2s infinite;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) translateX(-50%);
    }
    40% {
        transform: translateY(-20px) translateX(-50%);
    }
    60% {
        transform: translateY(-10px) translateX(-50%);
    }
}

/* Biography Section */
#biography {
    background-color: #F5F5DC;
    padding: 150px 0;
}

/* Контейнер для фото с рамкой и эпиграфом */
.biography-image-container {
    position: relative;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.biography-image-container:hover {
    transform: scale(1.02);
}

/* Стили для рамки вокруг изображения */
.biography-image {
    width: 100%;
    height: auto;
    border-radius: 5px;
    border: 8px solid white;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 
                0 0 0 1px rgba(139, 69, 19, 0.2),
                0 0 0 5px var(--secondary-color);
    transition: all 0.3s ease;
}

/* Стили для эпиграфа */
.biography-epigraph {
    font-style: italic;
    font-size: 16px;
    color: var(--primary-color);
    margin-top: 15px;
    padding: 10px 15px;
    background-color: rgba(255, 248, 220, 0.7);
    border-left: 3px solid var(--accent-color);
    border-radius: 0 5px 5px 0;
    text-align: center;
}

.biography-epigraph cite {
    display: block;
    font-weight: 500;
    font-size: 14px;
    color: var(--accent-color);
    margin-top: 5px;
    text-align: right;
}

.section-title {
    font-size: 42px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 30px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    width: 60%;
    height: 3px;
    bottom: -10px;
    left: 0;
    background-color: var(--accent-color);
}

.biography-text {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 30px;
}

/* Carousel Section */
#carousel {
    background-color: var(--background-color);
    padding: 150px 0;
    overflow: hidden;
}

.carousel-container {
    position: relative;
    height: 500px;
    perspective: 1200px;
    transform-style: preserve-3d;
    margin-bottom: 80px;
}

.carousel-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s ease;
    will-change: transform;
}

.carousel-item-3d {
    position: absolute;
    width: 60%;
    height: 80%;
    left: 20%;
    top: 10%;
    transform-style: preserve-3d;
    transition: all 0.6s ease;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-radius: 5px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

.carousel-item-3d.active,
.carousel-item-3d.prev,
.carousel-item-3d.next {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.carousel-item-3d.active {
    z-index: 10;
    transform: translateZ(200px) scale(1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.carousel-item-3d.prev {
    transform: translateX(-75%) translateZ(100px) rotateY(10deg) scale(0.8);
    z-index: 5;
    opacity: 0.7;
}

.carousel-item-3d.next {
    transform: translateX(75%) translateZ(100px) rotateY(-10deg) scale(0.8);
    z-index: 5;
    opacity: 0.7;
}

.carousel-item-3d img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    transition: transform 0.3s ease;
}

.carousel-item-3d:hover img {
    transform: scale(1.05);
}

.carousel-controls {
    position: absolute;
    bottom: -70px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.carousel-control {
    background-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-control:hover {
    background-color: transparent;
    color: var(--primary-color);
}

/* Стили для стихотворений в карусели */
.carousel-item-3d.poem-item {
    background-color: rgba(139, 69, 19, 0.85);
    padding: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
}

.poem-content {
    max-width: 90%;
}

.poem-content h3 {
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--secondary-color);
}

.poem-text {
    font-size: 18px;
    line-height: 1.8;
    margin-bottom: 20px;
    font-style: italic;
}

.poem-author {
    font-size: 16px;
    font-weight: 500;
    color: var(--secondary-color);
}

/* Gallery Section */
#gallery {
    background-color: #F5F5DC;
    padding: 150px 0;
}

.gallery-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease, transform 0.5s ease;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background-color: white;
    opacity: 0;
    margin-bottom: 30px;
    cursor: pointer;
}

.gallery-card.visible {
    opacity: 1;
}

.gallery-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.2);
}

.gallery-card .overflow-hidden {
    padding-bottom: 56.25%; /* 16:9 аспект-соотношение */
    position: relative;
}
.gallery-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.gallery-card:hover .gallery-card-img {
    transform: scale(1.1);
}

.gallery-card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.gallery-card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.gallery-card-text {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 5px;
}
.dimensions-badge {
    display: inline-block;
    background-color: #f0f0f0;
    color: #333;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-top: 5px;
}

.gallery-card-text.dimensions {
    margin-top: 5px;
}

/* Contact Section */
#contact {
    background-color: var(--background-color);
    padding: 150px 0 100px;
}

.contact-info {
    margin-bottom: 40px;
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.contact-icon {
    font-size: 24px;
    color: var(--primary-color);
    margin-right: 15px;
}

.contact-text {
    font-size: 18px;
}

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 20px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-link:hover {
    background-color: var(--accent-color);
    transform: translateY(-5px);
}

.copyright {
    text-align: center;
    margin-top: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--secondary-color);
    font-size: 16px;
    color: var(--text-color);
}

/* Modal Styles - объединенная версия */
.artwork-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1050;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.artwork-modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background-color: white;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.artwork-modal.open .modal-content {
    transform: scale(1);
}

.modal-scroll-container {
    width: 100%;
    height: 100%;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #555 #f1f1f1;
}

/* Стилизация скроллбара для Chrome/Safari/Edge */
.modal-scroll-container::-webkit-scrollbar {
    width: 8px;
}

.modal-scroll-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.modal-scroll-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

.modal-image {
    width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.modal-text-content {
    padding: 20px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.modal-details {
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 15px;
}

.modal-description {
    line-height: 1.6;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 20px;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: var(--accent-color);
    transform: rotate(90deg);
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    will-change: opacity, transform;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Adjustments - объединенные и улучшенные */
@media (max-width: 992px) {
    .hero-title {
        font-size: 56px;
    }
    
    .hero-subtitle {
        font-size: 24px;
    }
    
    .carousel-item-3d {
        width: 80%;
        left: 10%;
    }
    
    .carousel-item-3d.prev {
        transform: translateX(-60%) translateZ(50px) rotateY(10deg) scale(0.7);
    }
    
    .carousel-item-3d.next {
        transform: translateX(60%) translateZ(50px) rotateY(-10deg) scale(0.7);
    }
}

@media (max-width: 768px) {
    .hero-title {
        font-size: 42px;
    }
    
    .hero-subtitle {
        font-size: 20px;
    }
    
    .section-title {
        font-size: 36px;
    }
    
    .carousel-item-3d {
        width: 90%;
        left: 5%;
    } 
    .carousel-item-3d {
        transform: none !important;
        width: 90% !important;
        left: 5% !important;
    }
    .carousel-item-3d.active {
        transform: translateZ(0) scale(1) !important;
    }
    .carousel-item-3d.prev, .carousel-item-3d.next {
        display: none !important;
    }

    .carousel-item-3d.prev, 
    .carousel-item-3d.next {
        opacity: 0;
    }
    
    .poem-content h3 {
        font-size: 22px;
    }
    
    .poem-text {
        font-size: 16px;
    }
    
    .carousel-item-3d.poem-item {
        padding: 30px 20px;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 36px;
    }
    
    .hero-subtitle {
        font-size: 18px;
    }
    
    .btn-custom {
        padding: 10px 25px;
        font-size: 14px;
    }
    
    .biography-image {
        margin-bottom: 30px;
    }
}
