/* Wspolna nawigacja mobilna - ladowana jako ostatni arkusz stron publicznych. */

.mobile-nav-toggle {
    display: none;
}

@media (max-width: 820px) {
    .header.nav-enhanced {
        position: sticky !important;
        top: 0;
        z-index: 2500;
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: auto auto;
        align-items: center;
        justify-content: initial;
        gap: 0 10px;
        width: 100%;
        min-height: 62px;
        padding: 7px 11px !important;
        background: rgba(4, 9, 17, .98);
        border-bottom: 1px solid rgba(112, 168, 239, .16);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
    }

    .header.nav-enhanced .logo {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        margin: 0;
    }

    .header.nav-enhanced .logo h1 {
        left: auto;
        margin: 0;
    }

    .header.nav-enhanced .logo .after {
        position: static;
        width: auto;
        height: auto;
        margin: 0;
        padding: 0;
        transform: none;
    }

    .header.nav-enhanced .logo .after img {
        display: block;
        width: auto;
        height: 43px;
        object-fit: contain;
    }

    .header.nav-enhanced > .avatar-container,
    .header.nav-enhanced > .login-link {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        margin: 0;
    }

    .header.nav-enhanced > .login-link {
        width: auto;
        min-width: 0;
        max-width: 150px;
        height: 38px;
        padding: 0 11px;
        overflow: hidden;
        font-size: .72rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header.nav-enhanced .avatar {
        width: 40px;
        height: 40px;
    }

    .header.nav-enhanced .avatar-menu {
        top: 48px;
        right: 0;
        width: min(250px, calc(100vw - 24px));
    }

    .header.nav-enhanced .status-pill {
        display: none !important;
    }

    .mobile-nav-toggle {
        grid-column: 3;
        grid-row: 1;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        width: 40px;
        height: 40px;
        margin: 0;
        padding: 0;
        color: #dce9f7;
        background: rgba(29, 52, 82, .55);
        border: 1px solid rgba(111, 173, 244, .2);
        border-radius: 10px;
        cursor: pointer;
    }

    .mobile-nav-toggle span {
        display: block;
        width: 18px;
        height: 2px;
        background: currentColor;
        border-radius: 999px;
        transition: transform .2s ease, opacity .2s ease;
    }

    .mobile-nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .mobile-nav-toggle.is-open span:nth-child(2) { opacity: 0; }
    .mobile-nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    .header.nav-enhanced nav {
        grid-column: 1 / -1;
        grid-row: 2;
        order: initial;
        width: 100%;
        max-height: 0;
        min-width: 0;
        margin: 0;
        padding: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height .24s ease, opacity .18s ease, padding .24s ease;
    }

    .header.nav-enhanced nav.is-open {
        max-height: calc(100dvh - 70px);
        padding: 9px 0 4px;
        overflow-y: auto;
        opacity: 1;
    }

    .header.nav-enhanced .index-ul {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
        width: 100% !important;
        min-width: 0 !important;
        margin: 0;
        padding: 0;
    }

    .header.nav-enhanced .index-ul li {
        display: block;
        width: 100%;
        margin: 0;
        transform: none;
    }

    .header.nav-enhanced .index-ul li a {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100% !important;
        min-height: 39px;
        height: auto !important;
        margin: 0;
        padding: 8px 9px !important;
        color: #b9c9da;
        background: rgba(255, 255, 255, .025);
        border: 1px solid rgba(126, 175, 235, .08);
        border-radius: 9px !important;
        font-size: .76rem !important;
        line-height: 1.25;
        text-align: center;
        transform: none;
    }

    .header.nav-enhanced .index-ul li a.is-active,
    .header.nav-enhanced .index-ul li a[aria-current="page"] {
        color: #fff;
        background: rgba(42, 145, 255, .13);
        border-color: rgba(63, 172, 255, .2);
    }

    .footer .links {
        flex-wrap: wrap;
        gap: 8px 14px;
    }

    .footer .links a {
        font-size: .76rem;
    }
}

@media (max-width: 410px) {
    .header.nav-enhanced > .login-link {
        max-width: 118px;
        padding: 0 8px;
        font-size: .66rem;
    }

    .header.nav-enhanced .index-ul {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .header.nav-enhanced nav,
    .mobile-nav-toggle span {
        transition: none;
    }
}
