/* =============================================================================
   Custom Menu
   ============================================================================= */

/* Reset */
.custom-menu,
.custom-menu *,
.custom-menu *::before,
.custom-menu *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.custom-menu {
    width: 100%;
}

/* -----------------------------------------------------------------------------
   List
   ----------------------------------------------------------------------------- */

.custom-menu__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0;
    margin: 0;
}

/* -----------------------------------------------------------------------------
   Item & Link
   ----------------------------------------------------------------------------- */

.custom-menu__item {
    max-width: 270px;
    width: 100%;
}

.custom-menu__link {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    height: 45px;
    padding: 0 12px;
    border-radius: 22px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.2;
    color: #0E4466;
    opacity: 0.8;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

/* -----------------------------------------------------------------------------
   Icons
   ----------------------------------------------------------------------------- */

.custom-menu__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
}

.custom-menu__icon img {
    width: auto;
    max-height: 40px;
}

.custom-menu__icon--active {
    display: none;
}

/* -----------------------------------------------------------------------------
   Hover state
   ----------------------------------------------------------------------------- */

.custom-menu__link:hover {
    background-color: white;
    color: #003578;
    opacity: 1;
    text-decoration: none;
}

.custom-menu__link:hover .custom-menu__icon--default {
    display: none;
}

.custom-menu__link:hover .custom-menu__icon--active {
    display: block;
}

/* -----------------------------------------------------------------------------
   Active state (current page)
   ----------------------------------------------------------------------------- */

.custom-menu__item--active .custom-menu__link {
    background-color: white;
    color: #003578;
    opacity: 1;
}

.custom-menu__item--active .custom-menu__icon--default {
    display: none;
}

.custom-menu__item--active .custom-menu__icon--active {
    display: block;
}

/* -----------------------------------------------------------------------------
   Mobile: Toggle & Close buttons — hidden by default
   ----------------------------------------------------------------------------- */

.custom-menu__toggle,
.custom-menu__close {
    display: none;
}

.custom-menu__overlay {
    display: none;
}

/* =============================================================================
   Desktop (min-width: 1151px) — sidebar, no hamburger
   ============================================================================= */

@media (min-width: 1151px) {
    .custom-menu__panel {
        display: block;
        position: static;
        width: 100%;
    }

    .custom-menu__toggle,
    .custom-menu__close,
    .custom-menu__overlay {
        display: none !important;
    }
}

/* =============================================================================
   Mobile (max-width: 1150px) — hamburger + overlay
   ============================================================================= */

@media (max-width: 1150px) {
    /* --- Ukryj lewą kolumnę ale zachowaj hamburger --- */
    .wp-block-columns > .wp-block-column:first-child:has(.custom-menu) {
        flex-basis: 0 !important;
        min-width: 0 !important;
        width: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }

    /* --- Logo - miejsce na hamburger --- */
    .header .wp-block-site-logo {
        margin-left: 42px;
    }

    /* --- Poprawka układu nagłówka --- */
    .header.wp-block-group.is-layout-flex {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .header .custom-logo-link img {
        width: auto;
        max-width: 180px;
        height: auto;
    }

    /* --- Hamburger toggle --- */
    .custom-menu__toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        position: fixed;
        top: 12px;
        left: 18px;
        width: 30px;
        height: 30px;
        z-index: 100000;
        padding: 0;
        background: none;
        border: 0;
        box-shadow: none;
        cursor: pointer;
    }

    .custom-menu__toggle svg {
        width: 40px;
        height: 26px;
        fill: currentColor;
    }

    /* --- Panel — hidden by default, slides from left --- */
    .custom-menu__panel {
        position: fixed;
        inset: 0;
        z-index: 100002;
        background: #f4faf8;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .custom-menu__panel.is-open {
        transform: translateX(0);
    }

    .custom-menu__panel-inner {
        padding: 64px 20px 40px;
    }

    /* --- Close button --- */
    .custom-menu__close {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 16px;
        width: 36px;
        height: 36px;
        background: none;
        border: none;
        cursor: pointer;
        z-index: 1;
    }

    .custom-menu__close svg {
        width: 24px;
        height: 24px;
    }

    /* --- Overlay --- */
    .custom-menu__overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 100001;
    }

    .custom-menu__overlay.is-visible {
        display: block;
    }

    /* --- Full width items on mobile --- */
    .custom-menu__item {
        max-width: 100%;
    }
}