* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --dark-green: #1F3A32;
    --olive: #6B7C5C;
    --beige: #F5F0E8;
    --white: #ffffff;
}

body {
    font-family: 'Roboto', sans-serif;
    background: var(--beige);
    color: var(--dark-green);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* один flex-элемент на весь контент (шапка+контент) — внутри него всё остаётся
   обычным блочным потоком, поэтому центрирование секций не ломается;
   растягивается, если контента мало, и прижимает футер к низу экрана */
.page-wrap {
    flex: 1 0 auto;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

.btn {
    display: inline-block;
    padding: 13px 24px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    border-radius: 2px;
    transition: opacity .2s;
}
.btn:hover { opacity: .85; }
.btn-dark { background: var(--dark-green); color: white; }
.btn-olive { background: var(--olive); color: white; }

/* ─── HEADER ─── */
header {
    background: var(--beige);
    border-bottom: 1px solid #e0ddd5;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo { flex-shrink: 0; display: flex; align-items: center; }
.logo img { height: 40px; }

/* поиск скрыт на мобиле, показывается при открытии */
.search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid var(--dark-green);
    padding-bottom: 4px;
    overflow: hidden;
    max-width: 0;
    transition: max-width 0.3s ease, padding 0.3s ease;
    padding-right: 0;
}

.search-wrap.open {
    max-width: 100%;
    flex: 1;
    min-width: 0;
}

.search-wrap input {
    flex: 1;
    border: none;
    outline: none;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    background: transparent;
    min-width: 0;
    width: 100%;
}

/* кнопка лупы */
.search-toggle {
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.header-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    flex-shrink: 0;
    margin-left: auto;
}

.header-phone {
    font-size: 13px;
    font-weight: 900;
    color: var(--dark-green);
    white-space: nowrap;
}
.header-phone:hover { opacity: .8; }

.work-hours {
    display: block;
    font-size: 10px;
    line-height: 1.4;
    text-align: right;
}

.search-wrap.open ~ .header-info {
    display: none;
}

/* иконки корзина + аккаунт */
.header-icons {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.icon-btn {
    width: 38px;
    height: 38px;
    background: var(--dark-green);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.icon-btn svg { width: 18px; height: 18px; }

.cart-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 9px;
    background: #b23b3b;
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── NAV ─── */
nav {
    background: #5C6B4F;
}

/* кнопка "Категорії" — только мобайл */
.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 14px 16px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
}
.nav-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform .2s ease;
    flex-shrink: 0;
}
.nav-toggle.open svg { transform: rotate(180deg); }

.nav-links {
    display: flex;
    flex-direction: column;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
}
.nav-links.open { max-height: 500px; }

.nav-links a {
    display: block;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 12px 16px;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-top: 1px solid rgba(255,255,255,.15);
}

/* ─── FOOTER ─── */
footer {
    background: var(--olive);
    padding: 28px 20px;
    /* на мобайлі все йде суцільним стовпчиком — центруємо, щоб виглядало
       симетрично, а не притиснутим до лівого краю */
    text-align: center;
}

/* на мобайлі колонки йдуть одна під одною суцільним стовпчиком,
   тому тримаємо відступи компактними — інакше футер розтягується на весь екран */
.footer-col { margin-bottom: 20px; }
.footer-col:last-child { margin-bottom: 0; }

.footer-logo {
    display: flex;
    justify-content: center;
}
.footer-logo img { height: 56px; }

.footer-desc {
    font-size: 13px;
    color: rgba(255,255,255,.8);
    line-height: 1.5;
    margin-top: 10px;
}

.footer-heading {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255,255,255,.6);
    letter-spacing: .05em;
    margin-bottom: 8px;
}

/* на мобайлі посилання йдуть плиткою в кілька рядків замість довгого стовпчика */
.footer-links-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 18px;
    row-gap: 8px;
}
.footer-link {
    display: block;
    font-size: 14px;
    color: white;
}
.footer-link:hover { text-decoration: underline; }

.footer-social { display: flex; justify-content: center; gap: 10px; }
.footer-social-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease, border-color .15s ease;
}
.footer-social-btn:hover {
    background: rgba(255,255,255,.15);
    border-color: white;
}
.footer-social-btn svg { width: 18px; height: 18px; }

/* три групи (телефон / телеграм / графік) — в один ряд замість стовпчика,
   переносяться на другий рядок самі, якщо не влазять на вузькому екрані */
.footer-contacts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    column-gap: 28px;
    row-gap: 14px;
}

.footer-contacts p {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255,255,255,.6);
    letter-spacing: .05em;
    margin-bottom: 4px;
}

.footer-contacts a {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: white;
}

.footer-hours {
    display: block;
    font-size: 13px;
    color: rgba(255,255,255,.85);
    line-height: 1.5;
}

.footer-bottom {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,.6);
}
.footer-bottom .footer-link { font-size: 12px; color: rgba(255,255,255,.6); }
.footer-bottom .footer-link:hover { color: white; }

/* ─── CARD GRID (категорії/підкатегорії) ─── */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.cat-card {
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    height: 150px;
    cursor: pointer;
    display: block;
    box-shadow: 0 2px 10px rgba(31,58,50,.1);
    transition: box-shadow .2s ease;
}
.cat-card:hover {
    box-shadow: 0 8px 24px rgba(31,58,50,.2);
}

.cat-placeholder {
    width: 100%;
    height: 100%;
    background: var(--olive);
}

.cat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .3s ease;
}
.cat-card:hover img {
    transform: scale(1.06);
}

.cat-label {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(31,58,50,.9), rgba(31,58,50,0));
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 28px 10px 10px;
    letter-spacing: .03em;
}

/* ─── PAGE HEAD (breadcrumbs + заголовок сторінки) ─── */
.page-head {
    background: var(--beige);
    padding: 24px 16px 8px;
}
.breadcrumbs {
    font-size: 12px;
    color: #777;
    margin-bottom: 10px;
}
.breadcrumbs a:hover { color: var(--dark-green); }
.breadcrumbs .sep { margin: 0 6px; }
.page-head h1 {
    font-size: 22px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* ════════════════════════════════
   TABLET  >= 640px
════════════════════════════════ */
@media (min-width: 640px) {
    header { padding: 12px 24px; }
    .search-wrap.open { max-width: 400px; }

    .page-head { padding: 32px 24px 12px; }

    .categories-grid { grid-template-columns: repeat(3, 1fr); }
    .cat-card { height: 170px; }

    /* Nav — на планшете/десктопе категорії видно всегда */
    .nav-toggle { display: none; }
    .nav-links {
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        overflow: visible;
    }
    .nav-links a {
        flex: 1 1 0;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 14px 10px;
        min-height: 54px;
        border-top: none;
        border-right: 1px solid rgba(255,255,255,.15);
    }
    .nav-links a:first-child { border-left: 1px solid rgba(255,255,255,.15); }

    footer { padding: 40px 24px; text-align: left; }
    .footer-inner {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .footer-col { margin-bottom: 0; }
    .footer-links { padding-left: 20px; }

    /* повертаємо простіший вигляд колонки — на планшеті/десктопі кожна
       колонка й так компактна, вертикальний список читається природніше плитки */
    .footer-logo { justify-content: flex-start; }
    .footer-logo img { height: 84px; }
    .footer-heading { margin-bottom: 12px; }
    .footer-links-list { display: block; justify-content: flex-start; }
    .footer-link { margin-bottom: 10px; }
    .footer-social { justify-content: flex-start; }

    .footer-contacts { display: block; }
    .footer-contact-group { margin-top: 12px; }
    .footer-contact-group:first-child { margin-top: 0; }

    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* ════════════════════════════════
   DESKTOP  >= 1024px
════════════════════════════════ */
@media (min-width: 1024px) {
    .page-head { padding: 40px 40px 16px; max-width: 1200px; margin: 0 auto; }
    .page-head h1 { font-size: 28px; }

    /* Header — на десктопе поиск всегда виден */
    header {
        padding: 14px 40px;
        max-width: 1200px;
        margin: 0 auto;
        gap: 20px;
    }
    .search-wrap {
        max-width: 100%;
        flex: 1;
        overflow: visible;
    }
    .search-toggle { display: none; }
    .header-phone { font-size: 16px; }
    .work-hours { font-size: 12px; line-height: 1.5; }
    .header-icons { margin-left: 0; }

    /* Nav */
    .nav-links a { font-size: 13px; padding: 14px 18px; }

    .cat-card { height: 200px; }

    /* Footer */
    footer { padding: 40px 40px; }
    .footer-inner {
        grid-template-columns: 1.4fr 1fr 1fr 1fr;
        max-width: 1200px;
        margin: 0 auto;
    }
    .footer-links { padding-left: 24px; }
    .footer-bottom { max-width: 1200px; margin: 24px auto 0; }
}

/* ─── CONSULTATION MODAL ─── */
.consult-float-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--dark-green);
    color: white;
    border: 3px solid var(--beige);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,.35);
    z-index: 150;
}
.consult-float-btn:hover { opacity: .9; }
.consult-float-btn svg { width: 26px; height: 26px; }

.consult-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(31,58,50,0);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 16px;
    visibility: hidden;
    pointer-events: none;
    transition: background .35s ease, visibility .35s ease;
}
.consult-overlay.open {
    background: rgba(31,58,50,.55);
    visibility: visible;
    pointer-events: auto;
}

.consult-modal {
    background: white;
    border-radius: 10px;
    max-width: 380px;
    width: 100%;
    padding: 32px 28px;
    position: relative;
    text-align: center;
    box-shadow: 0 20px 60px rgba(31,58,50,.25);
    transform: translateY(14px) scale(.95);
    opacity: 0;
    transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .3s ease;
}
.consult-overlay.open .consult-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.consult-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--olive);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.consult-icon svg { width: 24px; height: 24px; }

.consult-modal h3 {
    font-size: 18px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-bottom: 10px;
}
.consult-modal p {
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 20px;
}

.consult-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: #bbb;
    padding: 4px;
    line-height: 1;
    font-size: 22px;
    transition: color .15s ease;
}
.consult-close:hover { color: var(--dark-green); }

.consult-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d8d4cb;
    border-radius: 4px;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    outline: none;
    margin-bottom: 12px;
    text-align: center;
    transition: border-color .15s ease;
}
.consult-form input:focus { border-color: var(--dark-green); }

.consult-form .btn { width: 100%; }

.consult-error {
    color: #b23b3b;
    font-size: 12px;
    margin-bottom: 10px;
}

.consult-success {
    display: none;
    font-size: 14px;
    color: var(--olive);
    font-weight: 700;
}
