@import url('../../media.css');

.header-wrapper {
    position: sticky;
    top: 0;
    z-index: var(--header-z-index);
    background-color: var(--white);
    box-shadow: var(--cv-box-shadow);

    &.contribution-page-active {
        @media (--xl-up) {
            height: 130px;
        }

        header {
            @media (--lg-up) {
                height: 80px;
                padding-bottom: 0;
            }
        }
    }

    & .secondary-nav {
        @media (--xl-up) {
            background: var(--grey);
        }

        margin: 0 auto;
        height: 52px;

        @media (--lg-down) {
            display: flex;
            flex-direction: row;
            height: var(--header-height);
            align-items: center;
            padding-inline-start: var(--page-margin);
        }

        & .menu-icon {
            @media (--xl-up) {
                display: none;
            }

            @media (--lg-down) {
                margin-inline-end: var(--page-margin);
            }
        }

        & .options {
            display: flex;
            margin: 0 auto;
            max-width: var(--desktop-width);
            padding: 0 4rem;
            overflow-x: auto;
            height: 100%;

            @media (--sm-down) {
                padding: 0;
            }

            & .edit-icon {
                path {
                    fill: var(--blue);
                }
            }

            & .review-icon {
                path {
                    fill: var(--light-purple);
                }
            }

            @media (--lg-down) {
                margin: 0;
                width: 100%;
                background: var(--grey);
                padding-inline-start: 0px;
                height: 100%;
                align-items: center;
            }

            & .secondary-nav-option {
                display: flex;
                justify-content: center;
                height: 100%;
                flex-direction: column;
                padding: 0px 12px;
                text-decoration: none;

                &.selected-option {
                    background: var(--desert-storm);
                    color: var(--anchor-text-blue);

                    & path,
                    g {
                        fill: var(--anchor-text-blue);
                    }

                    div {
                        border-bottom: 1px solid var(--blue);
                    }
                }

                & div {
                    display: flex;
                    justify-content: center;
                    -moz-box-align: center;
                    align-items: center;
                    padding: 0px;
                    -moz-box-flex: 0;
                    box-sizing: border-box;
                }
            }

            & svg {
                width: 16px;
                height: 16px;
                margin-inline-end: 8px;
            }

            & div {
                display: flex;

                @media (--sm-down) {
                    padding: 4px;
                }
            }

            & div:last-child {
                margin-right: 0;
            }
        }
    }
}

header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    height: var(--header-height);
    transition: background-color var(--transition-duration) linear,
        box-shadow var(--transition-duration) linear;
    padding: var(--page-margin);
    background: var(--white);
    z-index: var(--header-z-index);

    @media (--md-down) {
        overflow-x: hidden;
    }

    & .Logo {
        @media (--md-up) {
            height: auto;
        }
    }

    @media (--lg-up) {
        position: relative;
        margin: 0 auto;
        background: none;
        max-width: var(--desktop-width);
        height: 77px;
        padding-block: 0;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        pointer-events: none;
    }

    & .menu-icon {
        margin-inline-end: 35px;
        cursor: pointer;
    }

    & .menu-icon.desktop-menu-icon {
        @media (--lg-down) {
            display: none;
        }
    }

    & .menu-icon.mobile-menu-icon {
        @media (--xl-up) {
            display: none;
        }
    }

    & .menu-icon.expanded {
        display: block;
        pointer-events: all;
        transition-duration: var(--transition-duration-slow);
        visibility: visible;
    }

    &.active {
        box-shadow: var(--nav-shadow-overhang);

        @media (--lg-up) {
            box-shadow: none;
        }
    }

    & .Logo {
        margin-bottom: -3px;
    }

    & > * {
        display: flex;
        width: 100%;
        height: 100%;

        &:first-child {
            justify-content: flex-start;
            align-items: center;
        }

        &:last-child {
            justify-content: flex-end;
            align-items: center;
        }
    }

    & .nav-links a,
    .nav-links .nav-link-item {
        justify-content: space-evenly;
        font-family: var(--base-font-family);
        font-size: var(--font-size-sm);
        text-transform: uppercase;
        font-weight: 600;
        white-space: nowrap;
        margin-inline-end: 8px;
        max-width: 155px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    & .user-menu {
        @media (--md-down) {
            display: none;
        }
    }

    & .localization-select {
        display: none;

        @media (--lg-up) {
            display: initial;
        }
    }

    .button.outline.login {
        border: 1px solid var(--black);
    }

    & .login {
        margin: 0 20px;
        min-width: auto;
        text-transform: uppercase;

        max-width: 250px;
        width: max-content;
        text-overflow: ellipsis;
        overflow: hidden;
        display: inline-block;
        white-space: nowrap;

        @media (--md-up) {
            height: 2.5rem;
        }

        @media (--md-down) {
            display: none;
        }

        &::after {
            content: '';
            display: block;
        }
    }
}

@media (--lg-up) {
    header > * {
        pointer-events: auto;
    }
}

.nav-list {
    min-height: 100%;

    &,
    & .nav-links {
        display: flex;
        font-family: var(--strong-font-family);

        @media (--xl-up) {
            height: 100%;
        }

        & .contribute-menu {
            padding: 0 1rem;
            display: block;
        }

        & a {
            padding: 0 1rem;
            display: block;
        }

        & .contribute-wrapper {
            align-content: center;
            height: 100%;
            @media (--lg-down) {
                margin-top: 20px;
            }

            &.datasets {
                @media (width > 576px) and (width < 1200px) {
                    margin-block-start: 0;
                }

                a {
                    @media (--lg-down) {
                        margin-inline-start: 30px;
                    }
                }
            }
        }

        & .fade-in {
            display: flex;
            opacity: 1;
            transition: visibility 1s, opacity 1s;
            visibility: visible;

            @media (--xl-up) {
                align-items: center;
            }

            @media (--lg-down) {
                flex-direction: column;
            }
        }

        & .fade-out {
            display: flex;
            align-items: center;
            opacity: 0;
            transition: visibility 0.25s, opacity 0.25s;
            visibility: hidden;
        }

        & .track-fs-download {
            margin-block-end: 8px;

            @media (width > 576px) and (width < 1200px) {
                margin-block-end: 0;
            }
        }
    }
}

#hamburger-menu {
    width: 120px;
    border: none;
    padding: 0;

    &.logged-in {
        width: 80px;
    }

    @media (--lg-up) {
        display: none;
    }

    &:hover {
        background-color: transparent;
    }

    & a.button {
        text-transform: uppercase;
        min-width: 100px;
        padding: 15px;
        display: inline-block;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    & a.button.avatar {
        background: none;
        border: none;
    }
}

#contribute-btn-wrapper {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding-inline: 30px;
    justify-content: space-between;

    @media (--xl-up) {
        display: none;
    }

    & svg {
        transition: transform var(--easing) var(--transition-duration);
    }

    & .rotate-180 {
        transform: rotate(180deg);
    }
}

#main-nav {
    display: none;

    @media (--xl-up) {
        display: flex;
        align-items: center;
        height: 100%;
    }
}

#navigation-modal {
    background-color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--top-z-index);
    padding: var(--header-height) 0 0;
    pointer-events: none;
    transform: translateY(-100vh);
    transition: all var(--transition-duration-slow) var(--easing);
    visibility: hidden;
    overflow: auto;

    &.active {
        display: block;
        transform: translateY(0);
        pointer-events: all;
        transition-duration: var(--transition-duration-slow);
        visibility: visible;

        @media (--xl-up) {
            display: none;
        }

        & .contribute-menu {
            padding-bottom: 15px;
            width: 100%;
        }

        & .contribute-menu.contribution-page-active {
            padding-bottom: 0px;
        }
    }

    & .nav-list,
    & .nav-links {
        flex-direction: column;

        & .divider {
            border-bottom: 1px solid color-mod(var(--black) alpha(10%));
            margin: 0 30px;

            @media (--xl-up) {
                display: none;
            }
        }

        & .divider:last-child {
            border-bottom: none;
        }
    }

    & .contribute-menu {
        margin: 0;
        padding: 15px 0px;
        padding-bottom: 0px;
        line-height: 1.17;
        font-family: var(--base-font-family);
        font-size: var(--font-size-sm);
        font-weight: 600;
        text-transform: uppercase;
        border-bottom: none;

        @media (--lg-down) {
            padding-top: 0;
        }

        .contribute-link,
        .coming-soon-text {
            width: 100%;
            max-width: 250px;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
            text-align: left;
            padding: 0;
            font-family: var(--base-font-family);
            font-size: var(--font-size);
            font-weight: 400;
            text-transform: capitalize;
            border-bottom: none;
            align-items: center;
        }

        .contribute-link {
            display: flex;
            gap: 10px;
            margin-left: 0;
        }

        .coming-soon-text {
            margin-inline-start: 8px;
            color: var(--warm-grey);
            cursor: default;

            span {
                font-size: var(--font-size-xs);
            }
        }

        .coming-soon-text {
            color: var(--warm-grey);
            cursor: default;

            span {
                font-size: var(--font-size-xs);
            }
        }
    }

    & .contribute-menu.contribution-page-active {
        background: var(--desert-storm);
    }

    & .contribute-menu.mobile-menu-active {
        padding-bottom: 0;
    }

    & .contribute-menu.active-page {
        background: var(--desert-storm);
    }

    & .nav-links a {
        padding: 0 0 10px;
        line-height: 1.17;
        font-family: var(--base-font-family);
        font-size: var(--font-size-sm);
        font-weight: 600;
        text-transform: uppercase;

        .contribute-link {
            margin-left: 8px;
            padding: 20px 0 0;
            font-family: var(--base-font-family);
            font-size: var(--font-size);
            font-weight: 400;
            text-transform: capitalize;
        }

        @media (--sm-up) {
            padding: 20px 0;
        }
    }

    & .user-nav {
        padding: 30px;
        background-image: linear-gradient(
            359deg,
            var(--white),
            var(--light-grey)
        );

        & .user-nav-link {
            padding: 15px 0;
            display: flex;
            flex-direction: row;
            align-items: center;
            font-family: var(--base-font-family);
            color: var(--near-black);

            & svg {
                margin-inline-end: 20px;
            }

            & path {
                fill: var(--warm-grey);
            }

            &.active {
                color: var(--red);
            }
        }

        & .auth-button {
            margin-top: 15px;
            display: flex;
            background: var(--black);
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            display: inline-block;
            align-content: center;
        }

        & .donate-btn-container {
            display: flex;
            justify-content: center;
            margin-block-start: 16px;
        }
    }

    & a {
        &:last-child {
            border-bottom: 0;
        }
    }

    & .nav-link-item {
        margin-right: 8px;
    }

    & .contribute-btn {
        font-family: var(--base-font-family);
        font-size: var(--font-size-sm);
        font-weight: 600;
        text-transform: uppercase;
        margin-inline-end: 8px;
        color: var(--black);
        flex: 1;
        text-align: left;
        max-width: 345px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}
