/**
 * FTB Header Navigation — Pure CSS
 * Мобільне меню:   checkbox hack
 * Lang switcher:   <details>/<summary>
 * Підменю:         :hover + :focus-within
 */

/* ── Змінні ────────────────────────────────────────────────────────────────── */
:root {
    --ftb-hdr-height: 90px;
    --ftb-hdr-bg: #ffffff;
    --ftb-hdr-shadow: 0 2px 16px rgba(0,0,0,.08);
    --ftb-hdr-z: 9000;
    --ftb-color-dark: #121217;
    --ftb-color-blue: #3e3ed3;
    --ftb-font: "Montserrat", sans-serif;
}

/* ── Checkbox toggle — схований ────────────────────────────────────────────── */
.ftb-menu-toggle {
    display: none;
    position: absolute;
}

/* ── Хедер ─────────────────────────────────────────────────────────────────── */
.ftb-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: var(--ftb-hdr-z);
    background: var(--ftb-hdr-bg);
    box-shadow: var(--ftb-hdr-shadow);
    transition: transform .3s ease;
}

.ftb-header.ftb-header--hidden {
    transform: translateY(-100%);
}

.ftb-header__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    margin: 0 auto;
    padding: 0 0 0 24px;
    height: var(--ftb-hdr-height);
}

/* ── Логотип ───────────────────────────────────────────────────────────────── */
.ftb-header__logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    flex-shrink: 0;
}

.ftb-header__logo img {
    max-height: 50px;
    width: auto;
    display: block;
}

.ftb-header__logo-text {
    font-weight: 700;
    font-size: 18px;
    color: var(--ftb-color-dark);
}

/* ── Десктоп навігація ─────────────────────────────────────────────────────── */
.ftb-header__nav {
    display: flex;
    align-items: center;
}

.ftb-nav__list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 1-й рівень */
.ftb-nav__list > li {
    position: relative;
}

.ftb-nav__list > li > a {
    display: flex;
    align-items: center;
    padding: 0 20px;
    height: var(--ftb-hdr-height);
    color: var(--ftb-color-dark);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: color .2s ease;
}

@media (max-width: 1280px) {
    .ftb-nav__list > li > a {
        padding-inline: 10px;
    }
}

.ftb-nav__list > li > a span { pointer-events: none; }

.ftb-nav__list > li > a:hover,
.ftb-nav__list > li.current-menu-item > a,
.ftb-nav__list > li.current-menu-ancestor > a {
    color: var(--ftb-color-blue);
}

/* ── Загальний стиль підменю (2-й і 3-й рівні) ─────────────────────────────── */
.ftb-nav__list .sub-menu {
    list-style: none;
    margin: 0;
    min-width: 250px;
    padding: 8px 0;
    background: #0c1220;
    color: #FFF;
    box-shadow: 0 8px 32px rgba(0,0,0,.13);

    /* схований за замовчуванням */
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
    z-index: 1;
}

/* 2-й рівень — розкривається вниз */
.ftb-nav__list > li > .sub-menu {
    top: 100%;
    left: 0;
    transform: translateY(6px);
}

/* Показати 2-й рівень */
.ftb-nav__list > li:hover > .sub-menu,
.ftb-nav__list > li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

/* Посилання 2-го рівня */
.ftb-nav__list .sub-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    text-decoration: none;
    transition: color .2s, background .2s;
}

.ftb-nav__list .sub-menu a:hover {
    color: #f9ad3d;
}

/* ── Стрілка для пунктів з дітьми (2-й рівень) ─────────────────────────────── */
.ftb-nav__list .sub-menu li.menu-item-has-children > a::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    margin-left: auto;
    padding-left: 16px;
    flex-shrink: 0;
    opacity: .55;
    box-sizing: content-box;
}

/* ── 3-й рівень — розкривається праворуч ──────────────────────────────────── */
.ftb-nav__list .sub-menu li {
    position: relative;
}

.ftb-nav__list .sub-menu .sub-menu {
    top: -8px;         /* вирівнювання з першим пунктом батька */
    left: 100%;
    transform: translateX(6px);
    z-index: 2;
}

/* Показати 3-й рівень */
.ftb-nav__list .sub-menu li:hover > .sub-menu,
.ftb-nav__list .sub-menu li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    width: 100%;
    transform: translateX(0);
    display: flex;
    flex-direction: column;
}

/* 3-й рівень — менший шрифт */
.ftb-nav__list .sub-menu .sub-menu a {
    font-size: 13px;
    color: #FFF;
    padding: 9px 18px;
}
/* 3-й рівень — менший шрифт */
.ftb-nav__list .sub-menu .sub-menu a:hover {
    color: #f9ad3d;
}

/* Якщо 3-й рівень виходить за правий край екрана */
@media (max-width: 1400px) {
    .ftb-nav__list .sub-menu li:last-child > .sub-menu,
    .ftb-nav__list .sub-menu:last-child .sub-menu {
        left: 100%;
        transform: translateX(-6px);
    }
    .ftb-nav__list .sub-menu li:last-child:hover > .sub-menu,
    .ftb-nav__list .sub-menu li:last-child:focus-within > .sub-menu {
        transform: translateX(0);
    }
}

/* ── Права панель ──────────────────────────────────────────────────────────── */
.ftb-header__actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 100%;
    justify-content: flex-end;
}

/* ── Телефони ──────────────────────────────────────────────────────────────── */
.ftb-header__phones {
    display: flex;
    flex-direction: column;
    gap: 5px;
    justify-content: space-evenly;
    padding-right: 16px;
    border-right: 1px solid rgba(0,0,0,.08);
    height: 100%;
}

.ftb-phone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 13px;
    line-height: 18px;
    font-weight: 500;
    white-space: nowrap;
}

.ftb-phone a {
    color: var(--ftb-color-dark);
    text-decoration: none;
    transition: color .2s;
}

.ftb-phone a:hover {
    color: var(--ftb-color-blue);
    text-decoration: none;
}

.ftb-phone__flag {
    display: inline-block;
    width: 20px;
    height: 14px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
    border-radius: 2px;
}

.ftb-phone__flag--ua {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 14'%3E%3Crect width='22' height='7' fill='%23338AF3'/%3E%3Crect y='7' width='22' height='7' fill='%23FFDA45'/%3E%3C/svg%3E");
}

.ftb-phone__flag--eu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 14'%3E%3Crect width='22' height='14' fill='%230053B5'/%3E%3Ctext x='11' y='10' text-anchor='middle' font-size='8' fill='%23FFD649'%3E%E2%98%85%3C/text%3E%3C/svg%3E");
}

@media (max-width: 1280px) {
    .ftb-header__phones { display: none; }
}

/* ── Language switcher dropdown ────────────────────────────────────────────── */
.ftb-lang-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
}

.ftb-lang-switcher:hover {
    .ftb-lang-switcher__dropdown {
        visibility: visible;
    }
}

/* Прибираємо стандартний маркер <details> */
.ftb-lang-switcher > summary {
    list-style: none;
}
.ftb-lang-switcher > summary::-webkit-details-marker { display: none; }

.ftb-lang-switcher__current {
    height: 100%;
    line-height: 85px;
    padding: 0 2.5em;
    text-transform: none;
    font-size: 17px;
    letter-spacing: 0.3px;
    font-weight: 300;
    background-color: #64c9f8 !important;
    display: inline-flex;
    align-items: center;
    color: var(--ftb-color-dark);
    cursor: pointer;
    transition: background .2s, border-color .2s;
    white-space: nowrap;
}

.ftb-lang-switcher__current:hover {
    background: #e4e4f8;
    border-color: var(--ftb-color-blue);
    color: var(--ftb-color-blue);
}

.ftb-lang-switcher__chevron {
    transition: transform .2s ease;
    flex-shrink: 0;
}

.ftb-lang-switcher[open] .ftb-lang-switcher__chevron {
    transform: rotate(180deg);
}

.ftb-lang-switcher__dropdown {
    position: absolute;
    min-width: 100%;
    visibility: hidden;
    top: 100%;
    left: 0;
    display: flex;
    flex-direction: column;
    background-color: #64c9f8;
    z-index: 999;
}

.ftb-lang-switcher__option {
    font-size: 17px;
    letter-spacing: 0.3px;
    font-weight: 300;
    height: var(--ftb-hdr-height);
    text-transform: uppercase;
    color: var(--ftb-color-dark);
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
    text-align: center;
    align-content: center;
}

.ftb-lang-switcher__option + .ftb-lang-switcher__option {
    border-top: 1px solid #ebebf5;
}

.ftb-lang-switcher__option:hover {
    background: #f0f0fb;
    color: var(--ftb-color-blue);
    text-decoration: none;
}

/* ── CTA кнопка ────────────────────────────────────────────────────────────── */
.ftb-header__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 0 2.5em;
    background: radial-gradient(50% 50% at 50% 50%, rgba(255,138,0,.4) 0%, rgba(153,83,0,0) 100%),
                linear-gradient(180deg, #F4A53A 0%, #FF9A1F 60%, #FF7A00 100%);
    box-shadow: 0 0 40px 0 rgba(255,138,0,.35),
                0 12px 24px 0 rgba(0,0,0,.12),
                0 1px 0 0 rgba(255,255,255,.3) inset;
    backdrop-filter: blur(90px);
    color: #0C0C0C;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    text-decoration: none;
    white-space: nowrap;
    transition: box-shadow .3s ease, background .3s ease-in-out;
}

.ftb-header__cta:hover {
    box-shadow: 0 0 20px 0 rgba(255,138,0,.2),
                0 4px 12px 0 rgba(0,0,0,.18),
                0 1px 0 0 rgba(255,255,255,.3) inset;
    background: linear-gradient(180deg, #E8921F 0%, #FF7A00 60%, #E86500 100%);
    color: #0C0C0C;
    text-decoration: none;
}

/* ── Бургер (label) ────────────────────────────────────────────────────────── */
.ftb-header__burger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background .2s;
}

.ftb-header__burger:hover { background: #f0f0fb; }

.ftb-header__burger-line {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--ftb-color-dark);
    border-radius: 2px;
    transition: transform .25s ease, opacity .2s ease;
    transform-origin: center;
    pointer-events: none;
}

/* Бургер → X коли checkbox checked */
.ftb-menu-toggle:checked ~ .ftb-header__inner .ftb-header__burger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.ftb-menu-toggle:checked ~ .ftb-header__inner .ftb-header__burger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}
.ftb-menu-toggle:checked ~ .ftb-header__inner .ftb-header__burger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ── Мобільний drawer ──────────────────────────────────────────────────────── */
.ftb-mobile-drawer {
    position: fixed;
    top: var(--ftb-hdr-height);   /* починається під хедером */
    left: 0;
    right: 0;
    bottom: 0;
    z-index: calc(var(--ftb-hdr-z) - 1);
    background: #F8FAFC;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s ease, visibility .3s;
}

.ftb-menu-toggle:checked ~ .ftb-mobile-drawer {
    transform: translateX(0);
    visibility: visible;
}

/* Топ-бар */
.ftb-mobile-drawer__topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #F6F6F8;
    border-bottom: 1px solid rgba(64,83,181,.1);
    flex-shrink: 0;
}

.ftb-mobile-drawer__logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.ftb-mobile-drawer__logo img {
    height: 36px;
    width: auto;
    display: block;
}

.ftb-mobile-drawer__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: var(--ftb-color-dark);
    border-radius: 6px;
    transition: background .2s;
    flex-shrink: 0;
}

.ftb-mobile-drawer__close:hover { background: #e8e8f0; }

/* Мови — inline, центровані */
.ftb-mobile-drawer__langs {
    display: flex;
    justify-content: center;
    padding: 18px 20px;
    background: #F6F6F8;
    border-bottom: 1px solid rgba(64,83,181,.1);
    flex-shrink: 0;
}

.ftb-mobile-drawer__lang {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--ftb-font);
    color: #888;
    text-decoration: none;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: color .2s;
    border-right: 1px solid #d0d0e0;
}

.ftb-mobile-drawer__lang:last-child { border-right: none; }
.ftb-mobile-drawer__lang:hover { color: var(--ftb-color-dark); }
.ftb-mobile-drawer__lang.is-active { color: var(--ftb-color-blue); font-weight: 700; }

/* Навігаційний список */
.ftb-mobile-drawer__nav { flex: 1; }

.ftb-mobile-drawer__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Схований checkbox-toggle підменю */
.ftb-sub-toggle {
    display: none;
    position: absolute;
}

/* Рядок з підменю: посилання + шеврон */
.ftb-mobile-item-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid rgba(64,83,181,.08);
}

.ftb-mobile-item-row > a {
    flex: 1;
    display: block;
    padding: 20px;
    font-size: 16px;
    font-weight: 500;
    font-family: var(--ftb-font);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--ftb-color-dark);
    text-decoration: none;
    transition: color .2s;
}

.ftb-mobile-item-row > a:hover { color: var(--ftb-color-blue); }

.ftb-mobile-drawer__list > li.current-menu-item > .ftb-mobile-item-row > a,
.ftb-mobile-drawer__list > li.current-menu-ancestor > .ftb-mobile-item-row > a {
    color: var(--ftb-color-blue);
}

/* Кнопка шеврон */
.ftb-sub-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    min-height: 58px;
    cursor: pointer;
    color: #999;
    flex-shrink: 0;
    border-left: 1px solid rgba(64,83,181,.08);
    transition: background .2s, color .2s;
}

.ftb-sub-toggle-btn:hover { background: #f0f0fb; color: var(--ftb-color-blue); }

.ftb-sub-chevron {
    transition: transform .25s ease;
    pointer-events: none;
}

.ftb-sub-toggle:checked ~ .ftb-mobile-item-row .ftb-sub-chevron {
    transform: rotate(180deg);
}

.ftb-sub-toggle:checked ~ .ftb-mobile-item-row .ftb-sub-toggle-btn {
    color: var(--ftb-color-blue);
}

/* 1-й рівень без підменю */
.ftb-mobile-drawer__list > li > a {
    display: block;
    padding: 20px;
    font-size: 16px;
    font-weight: 500;
    font-family: var(--ftb-font);
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--ftb-color-dark);
    text-decoration: none;
    border-bottom: 1px solid rgba(64,83,181,.08);
    transition: color .2s;
}

.ftb-mobile-drawer__list > li > a:hover,
.ftb-mobile-drawer__list > li.current-menu-item > a {
    color: var(--ftb-color-blue);
}

/* 2-й рівень */
.ftb-mobile-drawer__list .sub-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f0f0f8;
    display: none;
}

.ftb-sub-toggle:checked ~ .sub-menu { display: block; }

.ftb-mobile-drawer__list .sub-menu > li > a,
.ftb-mobile-drawer__list .sub-menu .ftb-mobile-item-row > a {
    display: block;
    padding: 15px 20px 15px 36px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--ftb-font);
    letter-spacing: .5px;
    text-transform: none;
    color: #444;
    text-decoration: none;
    border-bottom: 1px solid rgba(64,83,181,.05);
    transition: color .2s;
}

.ftb-mobile-drawer__list .sub-menu > li > a:hover,
.ftb-mobile-drawer__list .sub-menu .ftb-mobile-item-row > a:hover {
    color: var(--ftb-color-blue);
}

/* 3-й рівень */
.ftb-mobile-drawer__list .sub-menu .sub-menu {
    background: #e8e8f5;
}

.ftb-mobile-drawer__list .sub-menu .sub-menu > li > a,
.ftb-mobile-drawer__list .sub-menu .sub-menu .ftb-mobile-item-row > a {
    padding-left: 52px;
    font-size: 13px;
    color: #555;
}

/* Темно-синій блок контактів */
.ftb-mobile-drawer__contacts {
    background: #06224D;
    flex-shrink: 0;
    padding: 24px 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: auto;
}

.ftb-mobile-drawer__contacts-heading {
    color: rgba(245,245,245,.7);
    font-family: var(--ftb-font);
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    margin: 0 0 4px;
}

.ftb-mobile-drawer__contacts .ftb-phone { font-size: 14px; gap: 8px; }

.ftb-mobile-drawer__contacts .ftb-phone a {
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.ftb-mobile-drawer__contacts .ftb-phone a:hover { color: #F4A53A; }

.ftb-mobile-drawer__contacts-email {
    margin: 0;
    font-family: var(--ftb-font);
    font-size: 13px;
    line-height: 1.6;
    color: rgba(245,245,245,.7);
}

.ftb-mobile-drawer__contacts-email a { color: #fff; text-decoration: none; }
.ftb-mobile-drawer__contacts-email a:hover { color: #F4A53A; }

/* ── Overlay ───────────────────────────────────────────────────────────────── */
.ftb-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.32);
    z-index: calc(var(--ftb-hdr-z) - 2);
    cursor: pointer;
}

.ftb-menu-toggle:checked ~ .ftb-menu-overlay { display: block; }

/* ── Адаптив ───────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .ftb-header__nav    { display: none; }
    .ftb-lang-switcher  { display: none; }
    .ftb-header__cta    { display: none; }
    .ftb-header__burger { display: flex; }
}

@media (max-width: 480px) {
    .ftb-header__inner { padding: 0 16px; }
}
