/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Основные стили */
html {
    scroll-behavior: auto; /* Отключаем стандартный smooth scroll */
    scroll-snap-type: none; /* Отключаем snap для естественного скролла */
}

body {
    font-family: 'Arial', sans-serif;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    /* Улучшаем производительность скролла */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: auto;
}

/* Стили для секций */
.section {
    height: 100vh;
    width: 100%;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
    transform: translateZ(0); /* Hardware acceleration */
}

/* Изображения на весь экран */
.section-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

/* Стили для секции 3 */
.section3-container {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 10px;
    padding: 10px;
}

.section3-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section3-right {
    flex: 1;
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.section3-right-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.section3-right-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Все изображения в секции 3 должны быть одинаковой высоты на desktop */
.section3-left img,
.section3-right-left img,
.section3-right-right img,
.section3-container > div img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Стили для cascade-item на desktop */
#cascadeContainer .cascade-item,
#cascadeContainer2 .cascade-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Стили для галереи производства */
.production-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    width: 100%;
    padding: 0;
    margin: 0;
    height: 100vh;
}

/* Убираем flex выравнивание для секции с галереей */
#sectionphoto2 {
    align-items: stretch;
    justify-content: stretch;
}

.production-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
    margin: 0;
    padding: 0;
    border: 4px solid #CFA55B;
    outline: none;
}

.production-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
    border: none;
    outline: none;
}

.production-item:hover {
    transform: scale(1.02);
    z-index: 10;
}

/* Модальное окно для полноэкранного просмотра */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
}

.modal-close,
.modal-prev,
.modal-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 2.5rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close {
    top: 20px;
    right: 20px;
}

.modal-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.modal-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.modal-close:hover,
.modal-prev:hover,
.modal-next:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

.modal-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.modal-next:hover {
    transform: translateY(-50%) scale(1.1);
}

/* Стили для текстовой секции */
#sectionfree {
    flex-direction: column;
    padding: 2rem;
    background: #f8f9fa;
    position: relative; /* Для позиционирования логотипа */
}

/* Контейнер для текста в секции с контактами */
#sectionfree .text-container {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    height: 100%;
    width: 100%;
}

/* Текст в правой части для desktop */
#sectionfree .content-right {
    width: 50%; /* Правая 1/2 часть */
    text-align: right;
    padding-right: 2rem;
    margin-top: 60px; /* Отступ сверху */
}

/* Заголовок контактов */
#sectionfree .contacts-title {
    color: #CFA55B;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}

/* Контакты в секции 5 */
#sectionfree .contacts {
    text-align: right;
    margin-top: 1rem;
}

#sectionfree .contacts p {
    margin-bottom: 0.5rem;
    text-align: right;
}

/* Телефон как ссылка */
#sectionfree .phone-link {
    color: #CFA55B;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

#sectionfree .phone-link:hover {
    color: #B8941F;
    text-decoration: underline;
}

/* Логотип в секции */
#sectionfree .section-logo,
#sectionphoto1 .section-logo {
    position: absolute;
    bottom: 20px;
    left: 20px;
    height: 80px;
    width: auto;
    opacity: 0.8;
    z-index: 10;
}

/* Ссылка с логотипом */
#sectionfree > a {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    display: block;
}

#sectionfree > a .section-logo {
    position: relative;
    bottom: auto;
    left: auto;
}

#sectionfree h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #2c3e50;
    text-align: center;
}

#sectionfree > p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #555;
    text-align: center;
}

/* Случайный текст */
.random-text {
    max-width: 1000px;
    width: 100%;
}

.random-text p {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: justify;
    color: #444;
}

/* Горизонтальная плашка */
.top-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: rgba(0, 0, 0, 0.2   );
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    opacity: 0;
    transform: translateY(-100%);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.top-panel.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Элементы плашки */
.panel-logo {
    height: 50px;
    width: auto;
}

/* Логотип независимо от плашки */
.standalone-logo {
    position: fixed;
    top: 15px;
    left: 30px;
    height: 50px;
    width: auto;
    z-index: 1001;
    display: none;
}

.standalone-logo.visible {
    display: block;
}

.panel-title {
    color: #CFA55B;
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Центрирование заголовка когда нет логотипа в плашке */
.top-panel:not(:has(.panel-logo)) .panel-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Стили для кликабельных ссылок в заголовке плашки */
.panel-title-link {
    color: #CFA55B;
    text-decoration: none;
    transition: color 0.3s ease, text-decoration 0.3s ease;
}

.panel-title-link:hover {
    color: #B8941F;
    text-decoration: underline;
}

.panel-title-link:visited {
    color: #CFA55B;
}

.panel-nav {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.panel-nav-item {
    color: white;
    text-decoration: none;
    font-size: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.panel-nav-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Бургер-меню */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
    position: fixed;
    top: 25px;
    right: 30px;
}

.burger-menu.visible {
    display: flex;
}

.burger-line {
    width: 100%;
    height: 3px;
    background-color: #CFA55B;
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

.burger-menu:hover .burger-line {
    background-color: #E6B85C;
}

/* Анимация бургер-меню при наведении */
.burger-menu:hover .burger-line:nth-child(1) {
    transform: translateY(-2px);
}

.burger-menu:hover .burger-line:nth-child(3) {
    transform: translateY(2px);
}

/* Анимация бургер-меню при открытии */
.burger-menu.active .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu.active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-menu.active .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Боковое меню */
.side-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 300px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1002; /* Увеличил z-index чтобы меню открывалось над плашкой */
    transition: right 0.3s ease;
    padding: 80px 0 0 0;
}

.side-menu.open {
    right: 0;
}

.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001; /* Увеличил z-index чтобы overlay был над плашкой */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.side-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.side-menu-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.side-menu-nav li {
    margin: 0;
}

.side-menu-nav a {
    display: block;
    padding: 20px 30px;
    color: white;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.side-menu-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #CFA55B;
    padding-left: 40px;
}

/* Центрированная плашка */
.top-panel.centered {
    top: 50%;
    left: 0; /* Прикручиваем к левому краю */
    transform: translateY(-50%); /* Только вертикальное центрирование */
    width: calc(100% - 60px); /* Отступ 60px справа для кнопок */
    max-width: none;
    height: auto;
    padding: 20px 30px;
    border-radius: 0; /* Убираем скругления для полной ширины */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Прозрачная плашка (когда showcenter без showpanel) */
.top-panel.transparent {
    background: transparent !important;
    backdrop-filter: none !important;
    box-shadow: none !important;
    border: none !important;
}

/* Элементы плашки остаются видимыми */
.top-panel.transparent .panel-title,
.top-panel.transparent .panel-nav,
.top-panel.transparent .panel-logo {
    opacity: 1;
    visibility: visible;
}

/* Бургер-меню смещенное влево */
.burger-menu.shifted-left {
    right: 60px; /* Смещаем на 30px влево от обычной позиции */
}

/* Адаптивность для центрированной плашки */
@media (max-width: 768px) {
    .top-panel.centered {
        width: calc(100% - 50px); /* Отступ 50px справа для мобильных */
        padding: 15px 20px;
    }
    
    .burger-menu.shifted-left {
        right: 45px; /* Смещаем на 20px влево для мобильных */
    }
}

@media (max-width: 480px) {
    .top-panel.centered {
        width: calc(100% - 40px); /* Отступ 40px справа для маленьких экранов */
        padding: 12px 15px;
    }
    
    .burger-menu.shifted-left {
        right: 35px; /* Смещаем на 20px влево для маленьких экранов */
    }
}

/* Индикатор прокрутки */
.scroll-indicator {
    position: fixed;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.scroll-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    margin: 10px 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.scroll-dot.active {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.2);
}

.scroll-dot:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
}

/* Адаптивность */
@media (max-width: 768px) {
    #sectionfree {
        padding: 1rem;
    }
    
    #sectionfree h1 {
        font-size: 2rem;
    }
    
    #sectionfree > p {
        font-size: 1rem;
    }
    
    .random-text p {
        font-size: 1rem;
    }
    
    .scroll-indicator {
        right: 15px;
    }
    
    /* Адаптивность для мобильных устройств */
    #sectionfree .text-container {
        justify-content: flex-start;
    }
    
    #sectionfree .content-right {
        width: 100%;
        text-align: right; /* Изменил на правый край */
        padding-right: 0;
        margin-top: 100px; /* Увеличил отступ до 100px */
    }
    
    #sectionfree .contacts-title {
        font-size: 1.2rem;
    }
    
    /* Адаптивность контактов для мобильных */
    #sectionfree .contacts {
        text-align: right; /* Изменил на правый край */
    }
    
    #sectionfree .contacts p {
        text-align: right; /* Изменил на правый край */
    }
    
    #sectionfree .phone-link {
        font-size: 1rem;
    }
    
    .scroll-dot {
        width: 10px;
        height: 10px;
    }
    
    /* Адаптивность логотипа в секции */
    #sectionfree .section-logo,
    #sectionphoto1 .section-logo {
        height: 60px;
        bottom: 15px;
        left: 15px;
    }
    
    #sectionfree > a {
        bottom: 15px;
        left: 15px;
    }
    
    /* Адаптивность плашки */
    .top-panel {
        height: 60px;
        padding: 0 1rem;
    }
    
    .panel-logo {
        height: 40px;
        /* Оптимизация для мобильных устройств */
        max-width: 120px;
        object-fit: contain;
    }
    
    /* Адаптивность отдельного логотипа */
    .standalone-logo {
        top: 10px;
        left: 15px;
        height: 40px;
        max-width: 120px;
    }
    
    .panel-title {
        font-size: 1.2rem;
    }
    
    .panel-title-link {
        font-size: 1.2rem;
    }
    
    .panel-nav {
        gap: 1rem;
    }
    
    .panel-nav-item {
        font-size: 0.9rem;
        padding: 0.3rem 0.8rem;
    }
    
    /* Адаптивность бургер-меню */
    .burger-menu {
        width: 25px;
        height: 25px;
        top: 17px;
        right: 15px;
    }
    
    .burger-line {
        height: 2px;
    }
    
    /* Адаптивность бокового меню */
    .side-menu {
        width: 250px;
        right: -250px;
    }
    
    .side-menu-nav a {
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    
    .side-menu-nav a:hover {
        padding-left: 30px;
    }
    
    /* Адаптивность для второй секции на планшетах */
    #sectionphoto2 > div {
        flex-direction: column;
        padding: 30px;
        gap: 25px;
    }
    
    #sectionphoto2 > div > div:first-child {
        order: 1;
    }
    
    #sectionphoto2 > div > div:last-child {
        order: 2;
    }
    
}

@media (max-width: 480px) {
    #sectionfree h1 {
        font-size: 1.5rem;
    }
    
    .random-text p {
        font-size: 0.9rem;
    }
    
    /* Дополнительная адаптивность для маленьких экранов */
    #sectionfree .contacts-title {
        font-size: 1rem;
    }
    
    #sectionfree .phone-link {
        font-size: 0.9rem;
    }
    
    #sectionfree .content-right {
        margin-top: 80px; /* Отступ для маленьких экранов */
    }
    
    /* Дополнительная адаптивность логотипа в секции */
    #sectionfree .section-logo,
    #sectionphoto1 .section-logo {
        height: 50px;
        bottom: 10px;
        left: 10px;
    }
    
    #sectionfree > a {
        bottom: 10px;
        left: 10px;
    }
    
    /* Дополнительная оптимизация для очень маленьких экранов */
    .panel-logo {
        height: 35px;
        max-width: 100px;
    }
    
    .panel-title {
        font-size: 1rem;
    }
    
    .panel-title-link {
        font-size: 1rem;
    }
    
    .panel-nav-item {
        font-size: 0.8rem;
        padding: 0.2rem 0.6rem;
    }
    
    /* Дополнительная адаптивность отдельного логотипа */
    .standalone-logo {
        top: 8px;
        left: 10px;
        height: 35px;
        max-width: 100px;
    }
    
    /* Дополнительная адаптивность бургер-меню */
    .burger-menu {
        width: 22px;
        height: 22px;
        top: 14px;
        right: 10px;
    }
    
    .burger-line {
        height: 2px;
    }
    
    /* Дополнительная адаптивность бокового меню */
    .side-menu {
        width: 200px;
        right: -200px;
    }
    
    .side-menu-nav a {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    .side-menu-nav a:hover {
        padding-left: 25px;
    }
    
    /* Адаптивность для второй секции на мобильных */
    #sectionphoto2 > div {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    
    #sectionphoto2 > div > div:first-child {
        order: 1;
        margin-top: 1px;
    }
    
    #sectionphoto2 > div > div:last-child {
        order: 2;
    }
    
    /* Адаптивность для первой секции в about на мобильных */
    #sectionphoto1 > div {
        flex-direction: column;
        padding: 20px;
        gap: 20px;
    }
    
    #sectionphoto1 > div > div:first-child {
        order: 2;
    }
    
    #sectionphoto1 > div > div:last-child {
        order: 1;
        margin-top: 1px;
    }
    
    /* Уменьшение шрифта для мобильных */
    #sectionphoto2 h3 {
        font-size: 1.5em !important;
    }
    
    /* Убираем отступы у секции с галереей на мобильных */
    #sectionphoto2 {
        padding: 0 !important;
        margin: 0 !important;
        display: block !important;
        height: 100vh !important;
        align-items: stretch !important;
        justify-content: stretch !important;
    }
    
    /* Адаптивность для галереи производства на мобильных */
    .production-gallery {
        grid-template-columns: repeat(2, 1fr) !important;
        grid-template-rows: repeat(3, 1fr) !important;
        gap: 0 !important;
        height: 100vh !important;
        width: 100vw !important;
        padding: 0 !important;
        margin: 0 !important;
        align-items: stretch !important;
        align-content: stretch !important;
        box-sizing: border-box !important;
    }
    
    .production-item {
        display: block !important;
        position: relative !important;
        overflow: hidden !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 4px solid #CFA55B !important;
        min-height: 0 !important;
        min-width: 0 !important;
        height: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .production-item img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        object-position: center !important;
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        min-height: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Убираем отступы у h2 в секции с галереей */
    #sectionphoto2 h2 {
        margin: 0;
        padding: 0;
    }
    
    
    #sectionphoto2 p {
        font-size: 0.95em !important;
    }
    
    /* Адаптивность текста для секции design на мобильных */
    #sectionphoto1 h1 {
        font-size: 2em !important;
    }
    
    /* Адаптивность модального окна на мобильных */
    .modal-close,
    .modal-prev,
    .modal-next {
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }
    
    .modal-content img {
        max-height: 85vh;
    }
    
    /* Стили для секции 3 на мобильных */
    .section3-container {
        flex-direction: column;
    }
    
    .section3-container img {
        width: 100%;
        height: auto;
    }
    
    /* Каскадное расположение для мобильных - вертикально */
    #cascadeContainer {
        position: relative;
        height: auto;
    }
    
    #cascadeContainer .cascade-item {
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
        width: 100%;
    }
    
    /* Первое фото - внизу */
    #cascadeContainer .cascade-item[data-index="1"] {
        z-index: 1;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    /* Второе фото - посередине с перекрытием */
    #cascadeContainer .cascade-item[data-index="2"] {
        z-index: 2;
        margin-top: -150px;
    }
    
    /* Третье фото - сверху с перекрытием */
    #cascadeContainer .cascade-item[data-index="3"] {
        z-index: 3;
        margin-top: -150px;
    }
    
    /* При клике - изображение выходит на передний план */
    #cascadeContainer .cascade-item.active {
        z-index: 1000 !important;
        transform: translateY(-30px) scale(1.05) !important;
    }
    
    /* Каскадное расположение для staircase3 - два фото */
    #cascadeContainer2 {
        position: relative;
        height: auto;
    }
    
    #cascadeContainer2 .cascade-item {
        position: relative;
        cursor: pointer;
        transition: all 0.3s ease;
        width: 100%;
    }
    
    /* Первое фото - внизу */
    #cascadeContainer2 .cascade-item[data-index="1"] {
        z-index: 1;
        margin-top: 0;
        margin-bottom: 0;
    }
    
    /* Второе фото - сверху с перекрытием */
    #cascadeContainer2 .cascade-item[data-index="2"] {
        z-index: 2;
        margin-top: -150px;
    }
    
    /* При клике - изображение выходит на передний план */
    #cascadeContainer2 .cascade-item.active {
        z-index: 1000 !important;
        transform: translateY(-30px) scale(1.05) !important;
    }
}
