/* HAVA — dynamiczne mega menu usług, etap 28 */
.hava-has-mega-menu {
    position: relative;
}

.hava-has-mega-menu > .sub-menu {
    display: none !important;
}

.hava-has-mega-menu > a {
    padding-right: 29px !important;
}

.hava-mega-root-toggle {
    position: absolute;
    z-index: 5;
    top: 50%;
    right: 8px;
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0 !important;
    border-radius: 999px !important;
    color: inherit !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: pointer;
    transform: translateY(-50%);
}

.hava-mega-root-toggle:hover,
.hava-mega-root-toggle:focus,
.hava-mega-root-toggle:focus-visible,
.hava-mega-root-toggle:active {
    color: inherit !important;
    background: transparent !important;
    box-shadow: none !important;
}

.hava-mega-root-chevron {
    display: block;
    width: 7px;
    height: 7px;
    margin-top: -4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform .18s ease, margin .18s ease;
}

.hava-has-mega-menu.is-hover-open > .hava-mega-root-toggle .hava-mega-root-chevron,
.hava-has-mega-menu.is-open > .hava-mega-root-toggle .hava-mega-root-chevron,
.hava-has-mega-menu:focus-within > .hava-mega-root-toggle .hava-mega-root-chevron {
    margin-top: 3px;
    transform: rotate(225deg);
}

.hava-mega-menu {
    --hava-mega-bg: #EEEEF6;
    --hava-mega-category-color: #21234A;
    --hava-mega-service-color: #59677D;
    --hava-mega-service-hover: #21234A;
    --hava-mega-cta-bg: #21234A;
    --hava-mega-cta-hover: #3B3E70;
    --hava-mega-cta-color: #FFFFFF;
    --hava-mega-cols: 6;
    --hava-mega-menu-width: 1180px;
    --hava-mega-col-width: 176px;
    --hava-mega-gap: 16px;
    --hava-mega-padding: 20px;
    --hava-mega-radius: 16px;
    --hava-mega-image-ratio: 6 / 5;
    --hava-mega-image-radius: 10px;
    --hava-mega-category-size: 13px;
    --hava-mega-service-size: 14px;
    --hava-mega-mobile-category-size: 15px;
    --hava-mega-mobile-service-size: 14px;

    position: fixed;
    z-index: 999999;
    top: var(--hava-mega-menu-top, 84px);
    left: 50%;
    width: min(var(--hava-mega-menu-width), calc(100vw - 28px));
    max-height: calc(100vh - var(--hava-mega-menu-top, 84px) - 18px);
    overflow: auto;
    border: 1px solid rgba(33, 35, 74, .08);
    border-radius: var(--hava-mega-radius);
    background: var(--hava-mega-bg);
    box-shadow: 0 20px 46px rgba(33, 35, 74, .15);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 7px);
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.hava-has-mega-menu.is-hover-open > .hava-mega-menu,
.hava-has-mega-menu:focus-within > .hava-mega-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.hava-mega-menu__inner {
    padding: var(--hava-mega-padding);
}

.hava-mega-menu__grid {
    display: grid;
    grid-template-columns: repeat(var(--hava-mega-cols), minmax(0, var(--hava-mega-col-width)));
    gap: var(--hava-mega-gap);
    align-items: start;
}

.hava-mega-category {
    min-width: 0;
}

.hava-mega-category__image-wrap {
    width: 100%;
    aspect-ratio: var(--hava-mega-image-ratio);
    margin-bottom: 12px;
    overflow: hidden;
    border-radius: var(--hava-mega-image-radius);
    background: rgba(187, 203, 215, .34);
}

.hava-mega-menu--no-images .hava-mega-category__image-wrap {
    display: none;
}

.hava-mega-category__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hava-mega-category__heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.hava-mega-category__link,
.hava-mega-category__link:link,
.hava-mega-category__link:visited {
    display: inline;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--hava-mega-category-color) !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: var(--hava-mega-category-size) !important;
    font-weight: 700 !important;
    line-height: 1.22 !important;
    text-decoration: none !important;
    text-transform: uppercase;
}

.hava-mega-category__link:hover,
.hava-mega-category__link:focus-visible {
    color: var(--hava-mega-category-color) !important;
    background: transparent !important;
    box-shadow: none !important;
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 3px;
}

.hava-mega-category__link--static {
    cursor: default;
}

.hava-mega-category__toggle {
    display: none;
}

.hava-mega-category__services {
    display: grid;
    gap: 7px;
    margin-top: 9px;
}

.hava-mega-category__services a,
.hava-mega-category__services a:link,
.hava-mega-category__services a:visited {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    color: var(--hava-mega-service-color) !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: var(--hava-mega-service-size) !important;
    font-weight: 400 !important;
    line-height: 1.35 !important;
    text-decoration: none !important;
    transition: color .15s ease, transform .15s ease;
}

.hava-mega-category__services a:hover,
.hava-mega-category__services a:focus-visible {
    color: var(--hava-mega-service-hover) !important;
    background: transparent !important;
    box-shadow: none !important;
}

.hava-mega-menu--hover-underline .hava-mega-category__services a:hover,
.hava-mega-menu--hover-underline .hava-mega-category__services a:focus-visible {
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 3px;
}

.hava-mega-menu--hover-shift .hava-mega-category__services a:hover,
.hava-mega-menu--hover-shift .hava-mega-category__services a:focus-visible {
    transform: translateX(3px);
}

.hava-mega-menu__footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(33, 35, 74, .09);
}

.hava-mega-menu__problems,
.hava-mega-menu__problems:link,
.hava-mega-menu__problems:visited {
    display: inline-flex;
    width: auto;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 0 14px;
    border: 0;
    border-radius: 10px;
    color: var(--hava-mega-cta-color) !important;
    background: var(--hava-mega-cta-bg) !important;
    box-shadow: none;
    font-size: 11px;
    line-height: 1;
    text-decoration: none !important;
    white-space: nowrap;
}

.hava-mega-menu__problems:hover,
.hava-mega-menu__problems:focus-visible {
    color: var(--hava-mega-cta-color) !important;
    background: var(--hava-mega-cta-hover) !important;
}

@media (max-width: 1024px) {
    .hava-has-mega-menu > a {
        width: 100%;
        padding-right: 44px !important;
    }

    .hava-mega-root-toggle {
        z-index: 1000001;
        right: 12px;
        width: 34px;
        height: 34px;
        touch-action: manipulation;
    }

    .hava-mega-root-chevron {
        width: 8px;
        height: 8px;
    }

    .hava-mega-menu {
        position: static;
        display: none;
        width: 100% !important;
        max-height: none;
        margin: 0;
        overflow: visible;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        transition: none;
    }

    .hava-has-mega-menu.is-open > .hava-mega-menu {
        display: block;
    }

    .hava-mega-menu__inner {
        padding: 4px 0 10px 12px;
    }

    .hava-mega-menu__grid {
        display: block;
    }

    .hava-mega-category {
        border-bottom: 1px solid rgba(33, 35, 74, .10);
    }

    .hava-mega-category__image-wrap,
    .hava-mega-menu__footer {
        display: none !important;
    }

    .hava-mega-category__heading {
        min-height: 46px;
        align-items: center;
        gap: 8px;
        padding-right: 4px;
    }

    .hava-mega-category__link,
    .hava-mega-category__link:link,
    .hava-mega-category__link:visited {
        flex: 1 1 auto;
        padding: 10px 0 !important;
        font-size: var(--hava-mega-mobile-category-size) !important;
        line-height: 1.25 !important;
        text-transform: none;
    }

    .hava-mega-category__toggle,
    .hava-mega-category__toggle:hover,
    .hava-mega-category__toggle:focus,
    .hava-mega-category__toggle:focus-visible,
    .hava-mega-category__toggle:active {
        display: inline-flex;
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
        align-items: center;
        justify-content: center;
        margin: 0;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 999px !important;
        color: var(--hava-mega-category-color) !important;
        background: transparent !important;
        box-shadow: none !important;
        cursor: pointer;
        transform: none !important;
        touch-action: manipulation;
    }

    .hava-mega-category__chevron {
        position: relative;
        display: block;
        width: 12px;
        height: 12px;
    }

    .hava-mega-category__chevron::before,
    .hava-mega-category__chevron::after {
        position: absolute;
        top: 50%;
        left: 50%;
        width: 9px;
        height: 1px;
        background: currentColor;
        content: "";
        transform: translate(-50%, -50%);
    }

    .hava-mega-category__chevron::after {
        transform: translate(-50%, -50%) rotate(90deg);
    }

    .hava-mega-category.is-category-open .hava-mega-category__chevron::after {
        transform: translate(-50%, -50%) rotate(0);
    }

    .hava-mega-category__services {
        display: none;
        gap: 0;
        margin: 0 0 10px;
        padding: 0 0 0 12px;
    }

    .hava-mega-category.is-category-open .hava-mega-category__services {
        display: grid;
    }

    .hava-mega-category__services a,
    .hava-mega-category__services a:link,
    .hava-mega-category__services a:visited {
        display: block;
        width: 100%;
        padding: 8px 0 !important;
        font-size: var(--hava-mega-mobile-service-size) !important;
        text-decoration: none !important;
        transform: none !important;
    }
}


/* === Etap 29 — strzałka głównej pozycji Usługi === */

/* Desktop: strzałka ma własny, jawny kolor i pozycję niezależną od Kadence. */
@media (min-width: 1025px) {
    .hava-has-mega-menu > .hava-mega-root-toggle {
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        display: inline-flex !important;
        width: 20px !important;
        height: auto !important;
        color: #EEEEF6 !important;
        opacity: 1 !important;
        visibility: visible !important;
        pointer-events: auto !important;
        transform: none !important;
    }

    .hava-has-mega-menu > .hava-mega-root-toggle .hava-mega-root-chevron {
        width: 7px !important;
        height: 7px !important;
        margin-top: -4px !important;
        border-right-color: #EEEEF6 !important;
        border-bottom-color: #EEEEF6 !important;
        opacity: 1 !important;
    }

    .hava-has-mega-menu.is-hover-open > .hava-mega-root-toggle .hava-mega-root-chevron,
    .hava-has-mega-menu:focus-within > .hava-mega-root-toggle .hava-mega-root-chevron {
        margin-top: 3px !important;
    }

    .hava-has-mega-menu > a {
        padding-right: 25px !important;
    }
}

/* Mobile: submenu zwiększa wysokość <li>, dlatego nie centrujemy już
 * strzałki względem całego rozwiniętego elementu. Zostaje przypięta
 * do pierwszego wiersza „Usługi”. */
@media (max-width: 1024px) {
    .hava-has-mega-menu > .hava-mega-root-toggle {
        top: 0 !important;
        right: 6px !important;
        bottom: auto !important;
        display: inline-flex !important;
        width: 38px !important;
        height: 48px !important;
        color: rgba(255,255,255,.86) !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .hava-has-mega-menu > .hava-mega-root-toggle .hava-mega-root-chevron {
        border-right-color: currentColor !important;
        border-bottom-color: currentColor !important;
    }
}


/* === Etap 32 — białe nagłówki i linki w stopce === */
.site-footer h1,
.site-footer h2,
.site-footer h3,
.site-footer h4,
.site-footer h5,
.site-footer h6,
.site-footer .widget-title,
.site-footer .wp-block-heading,
.site-footer .footer-widget-area-inner h1,
.site-footer .footer-widget-area-inner h2,
.site-footer .footer-widget-area-inner h3,
.site-footer .footer-widget-area-inner h4,
.site-footer .footer-widget-area-inner h5,
.site-footer .footer-widget-area-inner h6 {
    color: #FFFFFF !important;
}

.site-footer a,
.site-footer .footer-navigation a,
.site-footer .widget_nav_menu a {
    color: #FFFFFF !important;
}

.site-footer a:hover,
.site-footer .footer-navigation a:hover,
.site-footer .widget_nav_menu a:hover {
    color: #BBCBD7 !important;
}


/* === Etap 33 — mobile mega menu: bez przesunięcia + normalna czcionka === */
@media (max-width: 1024px) {

    /*
     * Po kliknięciu strzałki przy „Usługi” przycisk zachowuje focus.
     * Starsza reguła :focus-within dodawała wtedy translate(-50%),
     * przez co całe rozwinięte menu uciekało w lewo.
     */
    .hava-has-mega-menu.is-open > .hava-mega-menu,
    .hava-has-mega-menu:focus-within > .hava-mega-menu,
    .hava-has-mega-menu.is-hover-open > .hava-mega-menu {
        left: auto !important;
        right: auto !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        transform: none !important;
    }

    /* Reset ewentualnych przesunięć dziedziczonych z mobilnego menu Kadence. */
    .hava-mega-menu__inner,
    .hava-mega-menu__grid,
    .hava-mega-category,
    .hava-mega-category__heading,
    .hava-mega-category__services {
        left: auto !important;
        right: auto !important;
        transform: none !important;
    }

    /* Kategorie i usługi — białe, zwykła grubość czcionki. */
    .hava-mega-menu {
        --hava-mega-category-color: #FFFFFF !important;
        --hava-mega-service-color: #FFFFFF !important;
        --hava-mega-service-hover: #FFFFFF !important;
    }

    .hava-mega-menu .hava-mega-category__link,
    .hava-mega-menu .hava-mega-category__link:link,
    .hava-mega-menu .hava-mega-category__link:visited,
    .hava-mega-menu .hava-mega-category__link:hover,
    .hava-mega-menu .hava-mega-category__link:focus {
        color: #FFFFFF !important;
        font-weight: 400 !important;
    }

    .hava-mega-menu .hava-mega-category__services a,
    .hava-mega-menu .hava-mega-category__services a:link,
    .hava-mega-menu .hava-mega-category__services a:visited,
    .hava-mega-menu .hava-mega-category__services a:hover,
    .hava-mega-menu .hava-mega-category__services a:focus {
        color: #FFFFFF !important;
        font-weight: 400 !important;
    }

    /* Plus / minus też białe. */
    .hava-mega-menu .hava-mega-category__toggle,
    .hava-mega-menu .hava-mega-category__toggle:hover,
    .hava-mega-menu .hava-mega-category__toggle:focus,
    .hava-mega-menu .hava-mega-category__toggle:active {
        color: #FFFFFF !important;
    }

    .hava-mega-menu .hava-mega-category__chevron::before,
    .hava-mega-menu .hava-mega-category__chevron::after {
        background: #FFFFFF !important;
    }
}
