/* ========== БАЗА ========== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Roboto', sans-serif;
    color: #222;
    background: #fff;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
}

.section {
    padding: 80px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 32px;
    font-weight: 700;
}

/* ========== HEADER ========== */

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 10px 20px;
    z-index: 1000;
    transition: 0.3s ease;
    background: transparent;
}

.header__inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.nav {
    justify-self: center;
}

.nav__list {
    display: flex;
    gap: 40px;
    list-style: none;
}

.nav__list a {
    color: #fff;
    font-weight: 500;
    transition: 0.2s;
}

.nav__list a:hover {
    opacity: 0.7;
}

.cta-desktop,
.nav__cta {
    padding: 5px 22px;
    border-radius: 6px;
    font-weight: 500;
    border: 2px solid #fff;
    color: #000;
    background: #fff;
    transition: 0.25s;
}

.cta-desktop:hover,
.nav__cta:hover {
    background: transparent;
    color: #fff;
}

/* ========== BURGER ========== */

.burger {
    display: none;   /* Скрыт на десктопе по умолчанию */
    width: 28px;
    height: 20px;
    border: none;
    background: none;
    position: relative;
    cursor: pointer;
    padding: 0;
}

.burger span,
.burger::before,
.burger::after {
    content: "";
    position: absolute;
    width: 100%;
    height: 3px;
    background: #000000;
    left: 0;
    transition: 0.3s;
    border-radius: 3px;
}

.burger::before { 
    top: 0; 
}

.burger::after { 
    bottom: 0; 
}

.burger span {
    top: 50%;
    transform: translateY(-50%);
}

/* Анимация бургера при открытии */
.burger.active::before {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.burger.active::after {
    bottom: 50%;
    transform: translateY(50%) rotate(-45deg);
}

.burger.active span {
    opacity: 0;
    transform: scale(0);
}

/* ========== HERO ========== */

.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;

    background:
        linear-gradient(
            to top,
            rgba(255,255,255,1) 0%,
            rgba(0,0,0,0.55) 100%
        ),
        url('../images/fon.jpg') no-repeat center/cover;
}

/* Плавное появление hero при загрузке */
.hero--animated {
    opacity: 0;
    transform: translateY(20px);
    animation: heroFadeIn 0.9s ease-out forwards;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero__content {
    color: #fff;
    max-width: 800px;
}

.hero h1 {
    font-size: 44px;
    margin-bottom: 20px;
}

.hero p {
    font-size: 20px;
    margin-bottom: 30px;
}

.hero__buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    width: 100%;
}

.hero__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background-color: white;
    color: black;
    border: 2px solid white;
    cursor: pointer;
    transition: 0.3s;
    border-radius: 5px;
    justify-content: center;
    text-decoration: none;
    font-weight: 500;
    min-width: 140px; /* Минимальная ширина для всех кнопок */
    flex: 1; /* Равномерное распределение */
    max-width: 200px; /* Максимальная ширина */
    text-align: center;
    box-sizing: border-box; /* Чтобы padding не влиял на размер */
}

.hero__link:hover {
    background-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.25);
}

.social-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Чуть крупнее логотип MAX, чтобы визуально совпадал с остальными */
.social-icon--max {
    width: 24px;
    height: 24px;
}

/* Анимация появления секций при прокрутке */
.reveal {
    opacity: 1;              /* По умолчанию всё видно, чтобы не пропадали блоки */
    transform: translateY(0);
}

.reveal--visible {
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    opacity: 1;
    transform: translateY(0);
}

/* ========== PRODUCTS ========== */

.products {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 30px;
}

/* карточки будут из JS, но стиль готов */
.products > div {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
    transition: 0.2s;
}

.products > div:hover {
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    transform: translateY(-5px);
}

.products img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
}

.products > div {
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 15px;
    transition: 0.2s;
    background: #fff;
}

/* ========== CONTACTS ========== */

.contacts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

.contacts-grid img {
    width: 100%;
    border-radius: 12px;
}

/* ========== REVIEWS ========== */

.reviews {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.review-item {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reviews img {
    width: 100%;
    border-radius: 10px;
    transition: 0.2s;
}

.reviews img:hover {
    transform: scale(1.03);
}

.review-item p {
    margin: 0;
    line-height: 1.4;
    text-align: left; /* или left, по вашему вкусу */
}

/* ========== ABOUT ========== */

.about p {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

/* ========== FOOTER ========== */

.footer {
    display: flex;
    justify-content: center;
    padding: 30px 20px;
    background: #111;
    color: #fff;
}

.footer p {
    margin: 0;
}

.footer-about {
    font-size: 16px;
    opacity: 0.88;
    margin-top: 10px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.4;
}

.nav__cta {
    display: none;
}

.header.scrolled {
    background: #ffffff;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.header.scrolled .logo,
.header.scrolled .nav__list a {
    color: #000000;
}

.header.scrolled .cta-desktop {
    border: 2px solid #000;
    background: #000;
    color: #fff;
}

.header.scrolled .cta-desktop:hover {
    background: transparent;
    color: #000;
}

.products-search {
    max-width: 800px;
    margin: 20px auto;
    display: flex;
    gap: 10px;
}

.products-search input {
    flex: 1;
    padding: 14px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

.products-search button {
    padding: 14px 22px;
    border: none;
    background: #222;
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.products-search button:hover {
    background: #444;
}

.products-search button:active {
    transform: scale(0.98);
}

/* Сообщение «Ничего не найдено» */
.no-products {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    color: #666;
    font-size: 17px;
    line-height: 1.5;
}

.products-lead {
    text-align: center;
    color: #555;
    font-size: 16px;
    max-width: 560px;
    margin: -8px auto 24px;
    line-height: 1.5;
}

/* Блок «Начните с поиска» — показывается до ввода запроса */
.products-invite {
    text-align: center;
    padding: 48px 24px 40px;
    margin-bottom: 24px;
    background: linear-gradient(180deg, #f8f9fa 0%, #fff 100%);
    border-radius: 16px;
    border: 1px solid #eee;
}

.products-invite-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.9;
}

.products-invite-title {
    font-size: 20px;
    font-weight: 600;
    color: #222;
    margin: 0 0 8px 0;
}

.products-invite-text {
    font-size: 15px;
    color: #666;
    margin: 0 0 20px 0;
}

.products-invite-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.products-invite-chip {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

.products-invite-chip:hover {
    background: #222;
    color: #fff;
    border-color: #222;
    transform: translateY(-1px);
}

.product-card {
    display: flex;
    flex-direction: column; /* вертикальный блок */
    justify-content: space-between; /* чтобы кнопка прижалась вниз */
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    background: #fff;
    height: auto;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

.product-card img {
    width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 10px;
}

.product-info {
    align-items: center;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* занимает всё пространство между картинкой и кнопкой */
    min-height: 0; /* критично для flex */
}

.product-title {
    flex-grow: 1; /* растягивается, но не ломает кнопку */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3; /* максимум 3 строки */
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
}

.product-price {
    font-weight: 700;
    margin-bottom: 6px;
}

.product-btn {
    flex-shrink: 0; /* кнопка не сжимается */
    padding: 8px 14px;
    background: #25D366;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
}

/* ========== MODAL ========== */
.messenger-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.messenger-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modalFade 0.3s ease;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    margin-bottom: 25px;
    color: #222;
    font-size: 24px;
}

.modal-content a {
    display: block;
    margin: 15px 0;
    padding: 15px 20px;
    background: #222;
    color: white;
    border-radius: 10px;
    font-weight: 500;
    transition: 0.3s;
    text-decoration: none;
    font-size: 18px;
}

.modal-content a:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.modal-content a:first-of-type {
    background: #0088cc; /* Telegram цвет */
}

.modal-content a:last-of-type {
    background: #25D366; /* MAX цвет */
}

@keyframes modalFade {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== PRODUCT MODAL (карточка товара) ========== */
.product-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9998;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    padding: 20px;
    box-sizing: border-box;
}

.product-modal.active {
    display: flex;
}

.product-modal-content {
    background: #fff;
    border-radius: 12px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    animation: modalFade 0.3s ease;
    position: relative;
}

.product-modal-close {
    position: absolute;
    right: 12px;
    top: 12px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #555;
    z-index: 2;
    transition: background 0.2s, color 0.2s, transform 0.2s;
}

.product-modal-close:hover {
    background: #e0e0e0;
    color: #222;
    transform: scale(1.05);
}

.product-modal-body {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
}

.product-modal-image-wrap {
    position: relative;
    width: 100%;
    min-height: 260px;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    cursor: pointer;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.product-modal-image-wrap:hover {
    background: #eee;
}

.product-modal-image-wrap:hover .product-modal-image-zoom-hint {
    opacity: 1;
}

.product-modal-image-wrap:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

.product-modal-image {
    max-width: 100%;
    max-height: 280px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.product-modal-image-zoom-hint {
    position: absolute;
    bottom: 12px;
    right: 12px;
    font-size: 13px;
    color: #555;
    background: rgba(255, 255, 255, 0.95);
    padding: 6px 10px;
    border-radius: 6px;
    pointer-events: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: opacity 0.2s;
}

@media (hover: hover) {
    .product-modal-image-zoom-hint {
        opacity: 0.85;
    }
}

.product-modal-info {
    min-width: 0;
    padding: 20px 24px 24px;
    border-top: 1px solid #eee;
}

.product-modal-description {
    font-size: 14px;
    line-height: 1.55;
    color: #333;
    margin-bottom: 16px;
    max-height: 40vh;
    overflow-y: auto;
    padding-right: 4px;
}

.product-modal-description::-webkit-scrollbar {
    width: 6px;
}

.product-modal-description::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.product-modal-description::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}

.product-modal-description::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.product-modal-description p {
    margin: 0 0 8px 0;
}

.product-modal-description ul {
    margin: 8px 0;
    padding-left: 20px;
}

.product-modal-description li {
    margin-bottom: 4px;
}

.product-modal-price-wrap {
    margin-bottom: 16px;
}

.product-modal-price {
    font-size: 22px;
    font-weight: 700;
    color: #222;
}

.product-modal-price--on-request {
    font-size: 16px;
    font-weight: 600;
    color: #666;
}

.product-modal-write-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #25D366;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}

.product-modal-write-btn:hover {
    background: #20bd5a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.product-modal-write-btn:active {
    transform: translateY(0);
}

/* Лайтбокс: полноэкранный просмотр фото */
.image-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.image-lightbox.active {
    display: flex;
    animation: lightboxFadeIn 0.2s ease;
}

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.image-lightbox.active .image-lightbox-img {
    animation: lightboxZoomIn 0.25s ease;
}

@keyframes lightboxZoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.image-lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    border-radius: 50%;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s, transform 0.2s;
}

.image-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.image-lightbox-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
}

/* ========== ADAPTIVE ========== */

@media (max-width: 1024px) {
    .nav__cta {
        grid-column: 3;
        justify-self: end;
    }
}

@media (max-width: 768px) {
    .product-modal-image-wrap {
        min-height: 220px;
        padding: 16px;
    }

    .product-modal-image {
        max-height: 240px;
    }

    .product-modal-info {
        padding: 16px 20px 20px;
    }

    .product-modal-image-zoom-hint {
        font-size: 12px;
        padding: 4px 8px;
    }

    .image-lightbox-close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        font-size: 24px;
    }

    .products-invite {
        padding: 32px 16px 28px;
    }

    .products-invite-title {
        font-size: 18px;
    }

    .products-invite-chip {
        padding: 8px 14px;
        font-size: 13px;
    }

    /* Убираем логотип и навигацию на мобильных */
    .logo,
    .nav,
    .cta-desktop {
        display: none;
    }

    /* Показываем бургер и располагаем его справа */
    .burger {
        display: block;
        justify-self: end; /* Располагаем справа */
        grid-column: 3; /* Помещаем в третью колонку grid */
    }

    /* Изменяем структуру header на мобильных */
    .header__inner {
        grid-template-columns: 1fr auto; /* 2 колонки вместо 3 */
    }

    /* Стили для мобильного меню — эффект стекла */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        max-width: 300px;
        height: 100vh;
        padding: 60px 20px 24px;
        transition: right 0.3s ease;
        flex-direction: column;
        display: flex;
        z-index: 999;
        border: none;
        border-radius: 0;
        /* Эффект стекла (glassmorphism) */
        background: rgba(255, 255, 255, 0.18);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(20px);
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.08);
    }

    .nav.active {
        right: 0;
    }

    .nav__list {
        flex-direction: column;
        gap: 10px;
    }

    .nav__list a {
        color: #111;
        font-size: 20px;
        display: block;
        padding: 12px 0;
    }

    .nav__cta {
        margin-top: 20px;
        text-align: center;
        background: rgba(0, 0, 0, 0.75);
        color: #fff;
        border: none;
    }

    .nav__cta:hover {
        background: #222;
        color: #fff;
    }

    .contacts-grid {
        grid-template-columns: 1fr;
    }

    .hero h1 {
        font-size: 30px;
    }
}