/* Випадаюче меню «Послуги» (десктоп) і акордеон у мобільному меню. Розмітка: inc/mega-menu.php. */

/* ---- Desktop panel ---- */
.header__nav-item.has-mega { display: flex; align-items: center; }
.header__nav-link--mega { display: inline-flex; align-items: center; gap: 7px; }
.mega__chev { transition: transform 0.25s ease; opacity: 0.7; margin-top: 1px; }
.has-mega:hover .mega__chev,
.has-mega:focus-within .mega__chev,
.has-mega.is-open .mega__chev { transform: rotate(180deg); opacity: 1; }
.has-mega:hover .header__nav-link::after,
.has-mega.is-open .header__nav-link::after { width: 100%; visibility: visible; opacity: 1; }

.mega {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 60;
    background: #15101b;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 28px 60px rgba(10, 4, 14, 0.45);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0s linear 0.22s;
    overflow: hidden;
}
.mega::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(60% 140% at 100% 0%, rgba(212, 26, 69, 0.2) 0%, rgba(212, 26, 69, 0) 60%);
    pointer-events: none;
}
/* невидимий місток між пунктом і панеллю, щоб hover не рвався */
.mega::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -28px;
    height: 28px;
}
.has-mega:hover .mega,
.has-mega:focus-within .mega,
.has-mega.is-open .mega {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition-delay: 0s;
}
.has-mega:not(:hover):not(:focus-within):not(.is-open) .mega { transition-delay: 0.12s, 0.12s, 0.34s; }
/* Після кліку по пункту/кнопці всередині панелі (напр. «Обговорити задачу» відкриває форму) панель одразу ховаємо,
   навіть якщо курсор ще над нею або фокус лишився на кнопці. Знімається, коли курсор покидає пункт меню. */
.has-mega.is-closed .mega { opacity: 0 !important; visibility: hidden !important; pointer-events: none !important; transition-delay: 0s !important; }
.has-mega.is-closed .mega__chev { transform: none; }


.mega .container { position: relative; z-index: 1; padding-top: 34px; padding-bottom: 26px; }
.mega__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.mega__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.mega__icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: rgba(212, 26, 69, 0.16);
    color: #ff5577;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.mega__icon-svg { width: 20px; height: 20px; }
.mega__title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.25;
}
.mega__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.mega__list a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    margin: 0 -10px;
    border-radius: 9px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}
.mega__list .dot,
.mobile-mnu__group .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #d41a45;
    flex: none;
    transition: transform 0.18s ease;
}
.mega__list a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.mega__list a:hover .dot { transform: scale(1.5); }

.mega__cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-top: 26px;
    padding: 18px 22px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
}
.mega__cta-text { display: flex; flex-direction: column; gap: 3px; }
.mega__cta-text strong { font-size: 15px; font-weight: 700; color: #fff; }
.mega__cta-text span { font-size: 13px; color: rgba(255, 255, 255, 0.6); }
.mega__cta-btn {
    flex: none;
    padding: 11px 26px;
    border-radius: 25px;
    background: #d41a45;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.mega__cta-btn:hover { background: #e8344f; color: #fff; box-shadow: 0 8px 22px rgba(212, 26, 69, 0.35); }

@media (max-width: 1199px) {
    .mega__grid { gap: 20px; }
    .mega__title { letter-spacing: 0.06em; }
}
@media (max-width: 991px) {
    .mega { display: none; }
}

/* ---- Mobile accordion ---- */
.mobile-mnu { overflow-y: auto; }
.mobile-mnu__row { display: flex; align-items: center; gap: 12px; }
.mobile-mnu__toggle {
    width: 34px;
    height: 34px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.25s ease, background 0.2s ease;
}
.has-sub.is-open .mobile-mnu__toggle { transform: rotate(180deg); background: rgba(255, 255, 255, 0.14); }
.mobile-mnu__sub { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.3s ease; }
.has-sub.is-open .mobile-mnu__sub { grid-template-rows: 1fr; }
.mobile-mnu__sub-inner { overflow: hidden; min-height: 0; }
.mobile-mnu__group { padding: 6px 0 10px 4px; }
.mobile-mnu__group-title {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    margin: 8px 0 8px;
}
.mobile-mnu__group ul { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mobile-mnu__group a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}
.mobile-mnu__item { list-style: none; }

/* ---- Mobile menu: актуальні кольори, менший кегль, шапка кейсів не просвічує ---- */
@media (max-width: 991px) {
    /* Відкрите меню: шапка прозора й без власного фону/накладки сторінки (у кожного кейсу своя), щоб було видно градієнт меню. */
    body:has(.mobile-mnu.active) .header {
        background: transparent !important;
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    body:has(.mobile-mnu.active) .header::before { display: none !important; }

    .mobile-mnu {
        padding: 96px 24px 28px;
        background:
            radial-gradient(90% 45% at 100% 100%, rgba(238, 57, 96, 0.32), transparent 65%),
            linear-gradient(160deg, #2b0a30 0%, #4a0a36 55%, #6e0e3c 100%);
    }
    .mobile-mnu__list { width: 100%; }
    .mobile-mnu__list > li { border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
    .mobile-mnu__list > li:last-child { border-bottom: 0; }
    .mobile-mnu__list-link {
        display: block;
        font-size: 19px;
        font-weight: 600;
        line-height: 1.3;
        margin: 0;
        padding: 14px 0;
    }
    .mobile-mnu__list-link::after { display: none; }
    .mobile-mnu__row { justify-content: space-between; }
    .mobile-mnu__row .mobile-mnu__list-link { flex: 1; }
    .mobile-mnu__toggle { width: 30px; height: 30px; margin-bottom: 0; }
    .mobile-mnu__group { padding: 2px 0 12px; }
    .mobile-mnu__group-title { font-size: 11px; margin: 10px 0 6px; }
    .mobile-mnu__group a { font-size: 15px; font-weight: 500; padding: 7px 0; }
    .mobile-mnu .btn-callback {
        min-height: 44px;
        min-width: 0;
        padding: 0 26px;
        background: #d41a45;
        border-color: #d41a45;
        font-size: 15px;
        box-shadow: 0 10px 26px -10px rgba(212, 26, 69, 0.7);
    }
}
