@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');

@font-face {
    font-family: 'Jikharev';
    src: url('fonts/JIKHAR_2.ttf') format('truetype');
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: #F3F7F0;
    color: #2E1F27;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    height: auto;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow-y: auto;
}

/* Фоновое изображение только для первой страницы */
#home .background-image {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #F3F7F0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
}

/* ФОНЫ ДЛЯ РАЗДЕЛОВ — фиксированные, не прокручиваются */
#catalog {
    background: url('background2.png') center/cover no-repeat fixed;
}

#contacts {
    background: url('background3.png') center/cover no-repeat fixed;
}

#support {
    background: url('background4.png') center/cover no-repeat fixed;
}

/* Навигация — новый цвет #64161D */
.navbar {
    display: flex;
    flex-direction: row;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    /*backdrop-filter: blur(15px);
    box-shadow: 0 2px 30px rgba(0, 0, 0, 0.4);*/
}

.nav-container {
    padding: 2.5rem 6.5rem;     
    display: flex;
    justify-content: left;
    gap: 4.5rem;                
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    transition: all 0.5s ease;         /* добавил перенос на маленьких экранах */
}

.logo {
    font-family: 'Jikharev', serif;
    font-size: 48px;
    color: #F3F7F0;
}

.nav-menu {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    gap: 1.5rem;            
    flex-wrap: wrap;        
    border: 1px solid #64161D;
    border-radius: 25px;
    padding: 0.6rem 0.2rem;    
}

.nav-link {
    color: #64161D;
    padding: 0.5rem 2.5rem; 
    white-space: nowrap;     
    text-decoration: none;
}

.nav-link:hover {
    color: #64161D;
    padding: 0.5rem 2.5rem; 
    border: 1px solid #64161D;
    border-radius: 25px;
}

.nav-link.active {
    color: #F3F7F0;
    background: #64161D;
    border-radius: 25px;
}

/* Основной контент */
.main-content {
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 80px);
}

.page-section {
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
    padding: 0;
}

.page-section.active {
    display: block;
    opacity: 1;
}



/* Раздел "О фабрике" */
.about-factory {
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.fullscreen-section {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.transparent-photo-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transparent-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.scroll-down {
    position: absolute;
    bottom: 4px;
    left: 0;
    width: 100%;
    align-items: center;
    display: flex;
    padding-left: 470px;
    padding-bottom: 90px;
    justify-content: left;
    z-index: 2;
}

.arrow-button {
    color: #9e8983;
    background-color: transparent;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    min-width: 250px;
    justify-content: center;
    border-color: transparent;
}

.arrow-button:hover {
    color: white;
    background-color: transparent;
    transform: translateY(5px);
}

/* История фабрики */
.history-section {
    width: 100%;
    min-height: 100vh;
    background: #F3F7F0;
    padding: 96px 100px;
    display: flex;
    transition: opacity 0.8s ease, transform 0.8s ease;
    color: #2E1F27;
}

.history-container h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #2E1F27;
    text-align: center;
}

.history-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.history-container {
    padding: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}



.history-content {
    line-height: 1.8;
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center; /* Выравниваем по центру вертикали */
    gap: clamp(20px, 4vw, 72px); /* Отступ между фото и текстом меняется плавно */
    padding: clamp(20px, 4vw, 48px);
    width: 100%;
}

.history-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 300px;
}

.history-title {
    font-size: clamp(2rem, 4vw, 3.5rem); 
    text-align: center; /* Центрируем для красоты */
    color: #2E1F27;
    position: relative;
    width: 100%;
}

.history-buttons{
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 36px;
}

.history-content {
    transition: opacity 0.4s ease, transform 0.4s ease;
    opacity: 0;
    transform: translateY(20px);
}
.history-content.active {
    opacity: 1;
    transform: translateY(0);
}

.back-button-container {
    text-align: center;
}

.back-button {
    background: transparent;
    border: transparent;
    border-radius: 50px;
    color: #64161D;
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.back-button:hover {
    background: transparent;
    color: #2E1F27;
    transform: translateY(-5px);
}

/* Раздел "Каталог" */
.catalog-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    padding-top: 40px;
    align-items: center;
    justify-content: center;
    background: none;
    border-radius: 25px;
    box-shadow: none;
}

.catalog-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5rem;
    height: 70vh;
}

/* Three.js сцена */
.scene-container {
    position: relative;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
}

#threejs-scene {
    width: 50vw;
    height: 70vh;
}

.scene-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0 1rem;
}

.control-btn {
    padding: 1rem 2rem;
    background: #64161D;
    border: none;
    color: #F3F7F0;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

.control-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    color: #F3F7F0;
}

.control-btn:active {
    padding: 1rem 2rem;
    background: #F3F7F0;
    border: 2px solid #64161D;
    color: #64161D;
    border-radius: 25px;
}



/* Контейнер с игрушками */
.toys-container {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 2.5rem;
    width: 30vw;
    height: 70vh;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* важно: скролл будет у сетки, а не у контейнера */
}

.toys-container h3 {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    color: #2E1F27;
    background: none;
    -webkit-text-fill-color: #2E1F27;
}

.toys-container p {
    color: #2E1F27;
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
}

/* Сетка игрушек */
.toys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 1.5rem;
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
    /* Убираем height: calc(...) и любую фиксированную высоту */
}

/* Плашки игрушек – без фиксированной высоты, контент внутри сам растягивает */
.toy-item {
    background: #ffffff;
    border-radius: 15px;
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: grab;
    transition: all 0.4s ease;
    border: 1px solid #e0e0e0;
    /* Убираем overflow: hidden, если он мешает */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.toy-item:hover {
    /*transform: translateY(-8px) scale(1.05);*/
    border-color: #65160B;
    /*background: linear-gradient(135deg, #ffffff, #F3F7F0);
    box-shadow: 0 10px 30px rgba(100,22,29,0.15);*/
}


.toy-icon {
    width: 150px;
    height: 150px;
    margin-bottom: 8px;
    object-fit: contain;
}

/* Название и цена */
.toy-name {
    font-size: 1rem;
    text-align: center;
    font-weight: 500;
    margin: 5px 0 2px;
}

.toy-price {
    font-size: 0.9rem;
    color: #947977;
    padding: 4px 8px;
    margin-top: 5px;
}

/* Полоса прокрутки */
.toys-grid::-webkit-scrollbar {
    width: 15px;
    border-radius: 3px;
}
.toys-grid::-webkit-scrollbar-track {
    background: #ffffff;
    outline: 1px solid #65160B;
    border-radius: 10px;
}
.toys-grid::-webkit-scrollbar-thumb {
    background: #65160B;
    border: 2px solid #ffffff;
    border-radius: 10px;
}

/* Обертки для контактов и поддержки */
.contacts-wrapper, .support-wrapper {
    width: 100%;
    min-height: calc(100vh - 80px);
    padding-top: 90px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: none;
}

.contacts-container {
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    padding: 3rem;
    text-align: left;
    background: none;
    /*border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;*/
}

.contacts-container h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #2E1F27;
    text-align: center;
}

.support-container {
    max-width: 1200px;
    width: 100%;
    margin: 2rem auto;
    padding: 3rem;
    text-align: left;
    background: none;
    /*border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;*/
}

.support-container h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: #2E1F27;
    text-align: center;
}

/* Стили для контактов */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.contact-item {
    background: none;
    display: flex;
    flex-direction: column;
    padding: 1.8rem;
    /*border-radius: 15px;
    border-left: 4px solid #64161D;*/
    transition: all 0.3s ease;
}

.contact-item-inside{
    display: flex;
    flex-direction: row;
    gap: 16px;
    align-items: self-start;
}

.contact-item:hover {
    background: none;
    /*transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);*/
}

.contact-item h3 {
    color: #2E1F27;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.contact-item p {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    font-size: 1.1rem;
    color: #2E1F27;
}

.contact-item a {
    color: #64161D;
    text-decoration: none;
    transition: all 0.3s ease;
}

.contact-item a:hover {
    color: #2E1F27;
    text-decoration: underline;
}

.social-links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.social-link {
    background: #e0e0e0;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    color: #2E1F27;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.social-link:hover {
    background: #64161D;
    color: #F3F7F0;
    transform: translateY(-3px);
}

.map-container {
    margin-top: 2rem;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.map-container iframe {
    display: block;
}

/* FAQ */
.faq-section {
    margin-bottom: 3rem;
}

.faq-item {
    background: none;
    border-radius: 45px;
    margin-bottom: 1rem;
    overflow: hidden;
    border: 1.5px solid #65160B;
}

.faq-question {
    padding: 1.5rem 2rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
}

.faq-question h3 {
    color: #2E1F27;
    font-size: 1.2rem;
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    flex: 1;
}

.faq-toggle {
    position: relative;
    width: 24px;
    height: 24px;
    display: inline-block;
    flex-shrink: 0;
    cursor: pointer;
}
.faq-toggle::before,
.faq-toggle::after {
    content: '';
    position: absolute;
    background-color: #64161D;
    transition: transform 0.3s ease;
}
.faq-toggle::before {
    top: 11px;
    left: 4px;
    width: 16px;
    height: 2px;
}
.faq-toggle::after {
    top: 4px;
    left: 11px;
    width: 2px;
    height: 16px;
}

.faq-answer {
    padding: 0 2rem;
    max-height: 0;
    transition: all 0.3s ease;
}

.faq-answer p, .faq-answer ul {
    margin: 0;
    padding: 1.5rem 0;
    line-height: 1.6;
    color: #2E1F27;
}

.faq-answer ul {
    padding-left: 1.5rem;
    margin-top: 1rem;
}

.faq-item.active .faq-answer {
    max-height: 1000px;
}

/* При открытом ответе – вертикальная черта исчезает (минус) */
.faq-item.active .faq-toggle::after {
    transform: scaleY(0);
}

/* Форма поддержки */
.contact-form-section {
    background: none;
    padding: 2.5rem;
    border-radius: 45px;
    border: 1.5px solid #65160B;
}

.contact-form-section h3 {
    color: #2E1F27;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.contact-form-section p {
    color: #2E1F27;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.support-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: #2E1F27;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    background: #fff;
    color: #2E1F27;
    font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #64161D;
    box-shadow: 0 0 0 2px rgba(100,22,29,0.2);
}

.submit-btn {
    padding: 1.2rem 2.5rem;
    background: #64161D;
    color: #F3F7F0;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1.1rem;
    font-family: 'Montserrat';
    transition: all 0.3s ease;
    align-self: flex-start;
    margin-top: 1rem;
}

.submit-btn:hover {
    background: #2E1F27;
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    color: #F3F7F0;
}

/* Адаптивность */
@media (max-width: 992px) {
    .history-content {
        flex-direction: column;
        text-align: center;
    }
    .history-photo {
        max-width: 80%;
    }
    .history-text h3 {
        margin-top: 20px;
    }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }
    .history-container {
        padding: 48px 20px;
    }
    .history-photo {
       flex: 1;
    max-width: 45%; 
    display: flex;
    justify-content: center;
    }

.history-photo img {
    width: 100%;
    height: auto;
    max-height: 60vh; /* Картинка не будет выше экрана */
    object-fit: cover;
    border-radius: 25px;
}

    .catalog-layout {
        flex-direction: column;
        gap: 2rem;
        height: auto;
    }
    #threejs-scene, .toys-container {
        width: 80vw;
        height: 50vh;
    }
    .toys-container {
        height: auto;
        min-height: 50vh;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding-top: 70px;
    }
    .history-title {
        font-size: 2rem;
    }
    .toys-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}



/* Контейнер для верхних кнопок */
.top-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

/* Кнопка корзины */
.cart-button {
    border: 1px solid #64161D;
    padding: 10px 15px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
    position: relative; /* для всплывающей панели */
    color: #64161D;
}

.cart-icon {
    width: 28px;
    height: 28px;
    stroke: black;
    stroke-width: 1px;
}

.cart-button:hover {
    background: #64161D;
    color: #F3F7F0;
    stroke: #F3F7F0;
}
.cart-count {
    padding: 2px 8px;
    font-size: 1rem;
    font-weight: 600;
}

.cart-panel {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: white;
    color: #2E1F27;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    margin-top: 10px;
    display: none;
    z-index: 200;
    overflow: hidden;
    font-size: 0.9rem;
    font-weight: 400;
}
.cart-button:hover .cart-panel {
    display: block;
}

.cart-items-list {
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}
.cart-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-bottom: 1px solid #eee;
}
.cart-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}
.cart-item-info {
    flex: 1;
}
.cart-item-name {
    font-weight: 400;
    color: #2E1F27;
}
.cart-item-price {
    font-size: 0.8rem;
    font-weight: 400;
    color: #888;
}
.cart-item-count {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 20px;
}
.cart-total {
    padding: 12px;
    background: #f9f9f9;
    font-weight: bold;
    text-align: right;
    border-top: 1px solid #ddd;
}

/* Кнопка сброса (иконка) */
.reset-btn {
    border: 1px solid #64161D;
    background: #f9f9f9;
    color: #64161D;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.reset-btn:hover {
    background: #64161D;
    transform: rotate(90deg);
    color: #f9f9f9;
}

/* Нижние кнопки (оставляем одну) */
.scene-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 0 1rem;
}
.control-btn {
    padding: 0.8rem 2rem;
    background: #64161D;
    border: none;
    color: #F3F7F0;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}

/* Плавное появление блоков в каталоге */
.scene-container, .toys-container {
    opacity: 0;
    transform: translateY(20px); /* Немного опущены вниз */
    animation: slideUpFade 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Делаем так, чтобы панель с игрушками появлялась чуть-чуть позже ёлки (каскадный эффект) */
.toys-container {
    animation-delay: 0.15s; 
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}