/* ==========================================================================
   Шапка сайту
   Десктоп: від 1200px. Нижче — верхня смуга: логотип, мова, телефон, бургер.
   Панель з меню випадає під шапкою.
   Шапка «липка»: при прокрутці лишається зверху екрана (і на ПК, і на мобільному).
   ========================================================================== */

/* Відступ для якорів (#services…): щоб липка шапка не закривала заголовок секції */
html {
    scroll-padding-top: 76px;
}

.header {
    /* Розміри логотипа: міняйте тут */
    --header-logo-h: 57px;
    --header-pad-y: 8px;

    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-dark);
    color: var(--color-light);
    font-size: 16px;
    line-height: 16px;
}

/* Залогінений адмін: липка шапка стоїть під адмін-панеллю WordPress */
.admin-bar .header {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar .header {
        top: 46px;
    }
}

.header a {
    transition: opacity .2s ease, color .2s ease;
}

.header a:hover {
    opacity: .75;
}

.header .btn--accent:hover {
    opacity: 1;
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    min-height: 72px;
    padding-block: var(--header-pad-y);
}

/* З JS панель меню випадає поверх сторінки, тож верхня смуга завжди в один ряд */
.has-js .header__inner {
    flex-wrap: nowrap;
    gap: 12px;
}

/* --- Логотип ------------------------------------------------------------ */
/* Логотип може стискатися, щоб мова, телефон і бургер не переносились на другий ряд */
.header__logo {
    display: flex;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
}

.header__logo-img {
    width: auto;
    max-width: min(200px, 100%);
    height: var(--header-logo-h);
    object-fit: contain;
}

.header__logo-name {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
}

/* --- Верхня смуга (мобільна версія): мова + телефон + бургер ----------- */
.header__actions {
    display: flex;
    flex: none;
    align-items: center;
    gap: 16px;
}

.header__call {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    color: var(--color-tile);
}

.header__call .icon {
    width: 30px;
    height: 30px;
}

.header__burger {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: var(--gradient-accent);
    box-shadow:
        0 2px 8px rgba(255, 255, 255, .32) inset,
        0 -2px 8px rgba(0, 0, 0, .24) inset,
        0 0 16px rgba(127, 242, 184, .35);
    color: var(--color-light);
    cursor: pointer;
}

.header__burger-line {
    display: block;
    width: 22px;
    height: 3px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .25s ease, opacity .2s ease;
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(2) {
    opacity: 0;
}

.header__burger[aria-expanded="true"] .header__burger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* --- Панель (мобільна версія) ------------------------------------------ */
.header__body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    padding-block: 8px 24px;
}

.has-js .header__body {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    width: auto;
    max-height: calc(100vh - 76px);
    max-height: calc(100dvh - 76px);
    padding: 8px var(--container-pad) 24px;
    overflow-y: auto;
    background: var(--color-dark);
    border-top: 1px solid rgba(255, 255, 255, .12);
}

.has-js .header.is-open .header__body {
    display: flex;
}

/* Порядок блоків у мобільній панелі: меню → кнопка → контакти → соцмережі */
.header__top,
.header__bottom {
    display: contents;
}

.header__nav { order: 1; }
.header__cta { order: 2; align-self: flex-start; }
.header__contacts { order: 3; }
.header__aside { order: 4; }

/* --- Меню --------------------------------------------------------------- */
.header__menu {
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.header__link {
    display: block;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.header__link[aria-current="page"] {
    color: var(--color-accent);
}

/* --- Контакти ----------------------------------------------------------- */
.header__contacts {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    font-size: 14px;
    line-height: 1.28;
}

.header__address,
.header__phone {
    display: flex;
    align-items: center;
    gap: 12px;
    font-style: normal;
}

/* --- Соцмережі ---------------------------------------------------------- */
.header__aside {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 24px;
}

.header__socials {
    display: flex;
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* --- Перемикач мов (випадний список) ------------------------------------ */
.header__lang {
    position: relative;
}

/* На мобільному мова стоїть у верхній смузі, у панелі її ховаємо */
.header__aside .header__lang {
    display: none;
}

.header__lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding-block: 4px;
    list-style: none;
    cursor: pointer;
    user-select: none;
}

.header__lang-toggle::-webkit-details-marker {
    display: none;
}

.header__lang-toggle .icon {
    width: 16px;
    height: 16px;
    transition: transform .2s ease;
}

.header__lang[open] .header__lang-toggle .icon {
    transform: rotate(180deg);
}

.header__lang-list {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
}

.header__lang-link {
    display: block;
    padding: 8px 0;
}

/* Варіант у верхній смузі: великий підпис і заповнений трикутник */
.header__lang--bar .header__lang-toggle {
    gap: 0;
    font-size: 20px;
    font-weight: 500;
    line-height: 1.2;
}

.header__lang--bar .header__lang-toggle .icon {
    width: 24px;
    height: 24px;
}

.header__lang--bar .header__lang-list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 5;
    min-width: 100%;
    margin: 6px 0 0;
    padding: 6px 14px;
    background: var(--color-dark);
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 8px;
}

.header__lang--bar .header__lang-link {
    padding: 6px 0;
}

/* ==========================================================================
   Вузькі екрани ≤ 400px (від 360px): все компактніше, щоб логотип, мова,
   телефон і бургер стояли в один ряд
   ========================================================================== */
@media (max-width: 400px) {
    .header {
        --header-logo-h: 49px;
    }

    .has-js .header__inner {
        gap: 8px;
    }

    .header__actions {
        gap: 10px;
    }

    .header__lang--bar .header__lang-toggle {
        font-size: 17px;
    }

    .header__lang--bar .header__lang-toggle .icon {
        width: 20px;
        height: 20px;
    }

    .header__call {
        width: 28px;
        height: 28px;
    }

    .header__call .icon {
        width: 26px;
        height: 26px;
    }

    .header__burger {
        width: 40px;
        height: 40px;
        gap: 4px;
    }

    .header__burger-line {
        width: 20px;
    }
}

/* ==========================================================================
   Десктоп ≥ 1200px
   Розмір логотипа росте разом з екраном (45 → 62 → 78px), а відступи між
   блоками стають більшими, щоб меню не виходило за межі екрана.
   Змінити розмір логотипа: --header-logo-h у кожному з трьох блоків нижче.
   ========================================================================== */
@media (min-width: 1200px) {
    html {
        scroll-padding-top: 110px;
    }

    .header {
        --header-logo-h: 45px;
        --header-pad-y: 8px;
    }

    .header__inner,
    .has-js .header__inner {
        flex-wrap: nowrap;
        justify-content: flex-start;
        gap: 32px;
        min-height: 84px;
        /* нижній відступ вдвічі менший за верхній */
        padding-bottom: calc(var(--header-pad-y) / 2);
    }

    .header__logo-img {
        /* ширина рахується від висоти, без обрізання */
        max-width: none;
        /* прибираємо прозорий край під зображенням логотипа */
        margin-bottom: calc(var(--header-logo-h) * -0.09);
    }

    .header__actions {
        display: none;
    }

    /* Тіло шапки: два ряди */
    .header__body,
    .has-js .header__body {
        position: static;
        display: flex;
        flex: 1;
        flex-direction: column;
        gap: 14px;
        width: auto;
        min-width: 0;
        max-height: none;
        padding: 6px 0 5px;
        overflow: visible;
        background: transparent;
        border-top: 0;
    }

    .header__top,
    .header__bottom {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 24px;
    }

    .header__nav,
    .header__cta,
    .header__contacts,
    .header__aside {
        order: 0;
    }

    .header__cta {
        align-self: auto;
    }

    .header__contacts {
        flex-direction: row;
        align-items: center;
        gap: 32px;
        margin-inline-start: 0;
    }

    .header__aside {
        justify-content: flex-end;
        gap: 32px;
    }

    .header__aside .header__lang {
        display: block;
    }

    .header__aside .header__lang-list {
        position: absolute;
        top: 100%;
        left: 0;
        min-width: 100%;
        margin: 6px 0 0;
        padding: 6px 14px;
        background: var(--color-dark);
        border: 1px solid rgba(255, 255, 255, .16);
        border-radius: 8px;
    }

    .header__aside .header__lang-link {
        padding: 6px 0;
    }

    .header__menu {
        flex-direction: row;
        align-items: center;
        gap: 20px;
    }

    .header__link {
        padding: 0;
        border-bottom: 0;
    }
}

/* Ноутбуки і ширше ≥ 1360px */
@media (min-width: 1360px) {
    .header {
        --header-logo-h: 62px;
    }

    .header__inner,
    .has-js .header__inner {
        gap: 48px;
        min-height: 104px;
    }

    .header__contacts,
    .header__aside {
        gap: 48px;
    }
}

/* Великі екрани ≥ 1600px: адреса й телефон в один рядок, зсунуті вліво до логотипа */
@media (min-width: 1600px) {
    html {
        scroll-padding-top: 117px;
    }

    .header {
        --header-logo-h: 78px;
    }

    .header__inner,
    .has-js .header__inner {
        gap: 64px;
        min-height: 117px;
    }

    .header__body,
    .has-js .header__body {
        gap: 21px;
    }

    .header__contacts {
        gap: 48px;
        margin-inline-start: 0;
    }

    .header__address-text,
    .header__contact-link {
        white-space: nowrap;
    }

    .header__aside {
        gap: 64px;
    }
}
