/*----------------------------------------------------------------------------*\
    HEADER
\*----------------------------------------------------------------------------*/

/*  Variables
\*----------------------------------------------------------------------------*/

// height for header counts for header, col-xs-12, a.main-a
$header-height: 7.2rem;
// mobile header height
$header-mobile-height:7.2rem;

/*  Component
\*----------------------------------------------------------------------------*/

.header {
    width: 100%;
    height: $header-mobile-height;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 8999;

    .container {
        position: relative;

        @media screen and (max-width: 992px) {
            width: 100%;
            max-width: 100%;
            padding: 0;
            margin: 0;
        }

    }

    @include media-query(lg) {
        height: $header-height;
    }

    .header__wrapper {
        display: flex;
        background-color: color(brand-sec);
        height: $header-height;
        -webkit-box-shadow: 0px 0px 20px 10px rgba(color(brand),0.05);
        box-shadow: 0px 0px 20px 10px rgba(color(brand),0.05);
    }

    // Header logo
    .header__logo {
        position: relative;
        display: flex;
        flex-shrink: 0;
        align-items: center;
        height: 3.6rem;
        width: auto;
        margin-left: 2rem;
        margin-right: 2rem;
        float: left;
        top: 50%;
        transform: translateY(-40%);

        @include media-query(lg) {
            transform: translateY(-50%);
            height: $header-height;
            margin-left: 3rem;
            margin-right: 3rem;
        }

        @include media-query(xl) {
            margin-left: 5rem;
            margin-right: 5rem;
        }

        img {
            width: 8rem;
            height: auto;
        }
    }

    // Header navicon
    .header__navicon {
        position: absolute;
        right: 0;
        z-index: 2;
        align-items:center;
        width: $header-mobile-height;
        height: $header-mobile-height;
        background: color(green);

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

        .hamburger {
            position: absolute;
            top: 50%;
            left: 50%;
            -webkit-transform: translateX(-50%) translateY(-50%);
            transform: translateX(-50%) translateY(-50%);
            width: 2rem;
            height: 1.5rem;
            transition: 0.3s ease;

            .hamburger__line {
                height: 0.3rem;
                width: 2rem;
                display: block;
                background-color: color(brand-sec);
                transition: 0.3s ease;
                position: absolute;

                &:nth-child(1) {
                    transform: translateY(0);
                }

                &:nth-child(2) {
                    transform: translateY(0.6rem);

                }

                &:nth-child(3) {
                    transform: translateY(1.2rem);
                }
            }
        }

        .hamburger--active {
            margin-top: 0.5rem;

            .hamburger__line {
                &:nth-child(1) {
                    transform: rotate(-45deg) translateY(0) !important;
                }

                &:nth-child(2) {
                    opacity: 0;
                }

                &:nth-child(3) {
                    transform: rotate(45deg) translateY(0);
                }
            }
        }

        span {
            text-align: center;
            line-height: 1;
            display: inline-block;
            color: color(brand);
            font-size: 1.6rem;
        }
    }

    // Header navigation
    .header__navigation {
        position: fixed;
        top: $header-mobile-height;
        background-color: #fff;
        left: 0;
        right: 0;
        height: calc(100vh - #{$header-mobile-height});
        -webkit-overflow-scrolling: touch;
        overflow-y: scroll;
        padding-bottom: 20rem;
        width: 100%;
        transform: translateX(100%);
        opacity: 0;
        visibility: hidden;
        transition: all .3s;
        -ms-overflow-style: none;
        &::-webkit-scrollbar {display: none;}

        @include media-query(sm) {
            max-width: 300px;
            left: inherit;
            right: 0;
        }

        @include media-query(lg) {
            position: static;
            height: auto;
            width: auto;
            float: left;
            max-width: 100%;
            width: 100%;
            opacity: 1;
            visibility: visible;
            overflow-y: auto;
            transform: none;
            background: transparent;
            padding: 0;
            display: flex;
            align-items: center;
            overflow: visible;
        }

        // In view
        &.header__navigation--active {
            opacity: 1;
            visibility: visible;
            transform: translateX(0);
        }

        // Back
        .header__navigation__back {
            visibility: hidden;
            transform: translateY(-100%);
            transition: all .3s;
            height: 0;
            display: inline-block;
            width: 100%;
            font-size: 1.6rem;
            font-weight: 400;
            text-decoration: none;
            color: #000;
            border-bottom: 0.1rem solid rgba(#000000, 0.1);
            padding: 1.5rem 2rem;
            padding-left: 5rem;
            font-weight: 700;
            position: absolute;

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

            // Arrow
            &:after {
                width: 1.5rem;
                height: 1rem;
                position: absolute;
                top: 0;
                bottom: 0;
                left: 2rem;
                margin: auto 0;
                content: '';
                background-image: url('../img/icons/arrow-down.svg');
                background-position: center center;
                background-repeat: no-repeat;
                -webkit-background-size: 100% 100%;
                background-size: 100% 100%;
                transform: rotate(90deg);
            }

            &.header__navigation__back--active {
                visibility: visible;
                transform: translateY(0);
                height: auto;
                position: relative;
            }
        }

        // Navigation
        ul.navigation {
            list-style-type: none;
            padding: 0;
            margin: 0;
            transition: all .3s;
            -ms-overflow-style: none;
            &::-webkit-scrollbar {display: none;}

            @include media-query(lg) {
                display: inline-block;
                height: $header-height;
                line-height: $header-height;
            }

            // Hide
            &.navigation--hide {
                position: relative;
                -webkit-transform: translateX(-100%);
                -moz-transform: translateX(-100%);
                -ms-transform: translateX(-100%);
                -o-transform: translateX(-100%);
                transform: translateX(-100%);
            }

            // List item
            .navigation__li {
                position: relative;
                display: inline-block;
                width: 100%;
                height: auto;
                padding: 0 1.2rem;

                &:before {
                    content: "";
                    position: absolute;
                    width: 0;
                    height: 0.3rem;
                    background: rgba(color(brand), 0.2);
                    bottom: 0;
                    left: 50%;
                    -webkit-transition: all 500ms cubic-bezier(0.77, 0, 0.175, 1);
                    transition: all 500ms cubic-bezier(0.77, 0, 0.175, 1);
                }

                &:hover {
                    &:before {
                        width: 100%;
                        left: 0;
                    }
                }

                &:last-child {

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


                &.is-active {
                    background: color(grey);

                    &:before {
                        content: "";
                        position: absolute;
                        width: 100%;
                        height: 0.3rem;
                        background: color(green);
                        bottom: 0;
                        left: 0;
                    }
                }

                @include media-query(lg) {
                    width: auto;
                    padding: 0 1rem;
                    position: relative;

                    &:last-of-type {margin-right: 0;}
                }

                // Main link
                .navigation__link {
                    display: inline-block;
                    width: 100%;
                    height: auto;
                    font-size: 1.6rem;
                    font-weight: 400;
                    text-decoration: none;
                    color: #000;
                    padding: 1.5rem 2rem;

                    @include media-query(lg) {
                        border-bottom: 0;
                        padding: 0;
                    }

                    // Has sub
                    &.has-sub {
                        position: relative;

                        @include media-query(lg) {
                            padding-right: 3rem;
                        }

                        // Arrow
                        &:after {
                            width: 1.5rem;
                            height: 1rem;
                            position: absolute;
                            top: 0;
                            bottom: 0;
                            right: 2rem;
                            margin: auto 0;
                            content: '';
                            background-image: url('../img/icons/arrow-down.svg');
                            background-position: center center;
                            background-repeat: no-repeat;
                            -webkit-background-size: 100% 100%;
                            background-size: 100% 100%;
                            transform: rotate(-90deg);

                            @include media-query(lg) {
                                transform: rotate(0);
                                right: 0;
                            }
                        }
                    }
                }
            }
        }

        // Sub navigation
        ul.navigation__sub {
            list-style-type: none;
            padding: 0;
            margin: 0;
            position: fixed;
            top: 0;
            z-index: 99999;
            background-color: #fff;
            width: 100%;
            max-width: 100%;
            right: 0;
            bottom: 0;
            height: calc(100vh - 15rem);
            -webkit-transition: all 0.3s;
            -moz-transition: all 0.3s;
            -ms-transition: all 0.3s;
            -o-transition: all 0.3s;
            transition: all 0.3s;
            -webkit-transform: translateX(200%);
            -moz-transform: translateX(200%);
            -ms-transform: translateX(200%);
            -o-transform: translateX(200%);
            transform: translateX(200%);
            display: none;
            -ms-overflow-style: none;
            &::-webkit-scrollbar {display: none;}

            @include media-query(lg) {
                display: inline-block;
                opacity: 0;
                visibility: hidden;
                position: absolute;
                transform: none;
                top: 105%;
                height: auto;
                line-height: 1;
                left: 0;
                right: inherit;
                bottom: inherit;
                width: 200px;
                max-width: 1000%;
            }

            // Active
            &.navigation__sub--active {
                -webkit-transform: translateX(100%);
                -moz-transform: translateX(100%);
                -ms-transform: translateX(100%);
                -o-transform: translateX(100%);
                transform: translateX(100%);
                display: block;

                @include media-query(lg) {
                    opacity: 1;
                    visibility: visible;
                    transform: none;
                    top: 100%;
                }
            }

            // List item
            .navigation__li {
                margin: 0;
                display: inline-block;
                width: 100%;

                // Link
                .navigation__link {
                    display: inline-block;
                    width: 100%;
                    padding: 1.5rem 2rem;
                    border-bottom: 1px solid rgba(#000000,0.1);

                    @include media-query(lg) {
                        padding: 1.5rem 2rem;
                        border-bottom: 1px solid rgba(#000000,0.1);
                    }
                }
            }
        }
    }

    .header__members {
        position: absolute;
        width: 2rem;
        height: 2rem;
        background: url('/igolf/img/icon-login.svg') no-repeat center center;
        background-size: 2rem 2rem;
        top: 50%;
        right: 10rem;
        -webkit-transform: translateY(-50%);
        transform: translateY(-50%);
        border: 0;
        opacity: 0.5;

        @include media-query(lg) {
            right: 15rem;
        }

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

    // Header meta navigation
    .header__metanavigation {
        right: 4rem;
        top: $header-height;
        position: absolute;
        background: color(grey);
        padding: 1rem 2.5rem;
        visibility: hidden;
        opacity: 0;
        -webkit-transition: all 0.3s ease;
        transition: all 0.3s ease;
        -webkit-box-shadow: 0px 0px 10px 5px rgba(color(brand),0.15);
        box-shadow: 0px 0px 10px 5px rgba(color(brand),0.15);
        flex-shrink: 0;

        &:before {
            content: "";
            position: absolute;
            width: 0;
            height: 0;
            border-left: 9px solid transparent;
            border-right: 9px solid transparent;
            border-bottom: 9px solid color(grey);
            top: -0.9rem;
            left: 50%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);

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

        &.toggle {
            visibility: visible;
            opacity: 1;
        }

        @include media-query(lg) {
            right: 8rem;
        }

        @include media-query(xl) {
            visibility: visible;
            opacity: 1;
            top: auto;
            right: auto;
            position: relative;
            padding: 0 2rem;
            -webkit-box-shadow: none;
            box-shadow: none;
            background: transparent;
        }

        ul {
            display: inline-block;
            list-style: none;
            padding: 0;
            margin: 0;

            @include media-query(xl) {
                height: $header-height;
                line-height: $header-height;
            }

            .metanavigation__li {
                float: left;
                clear: left;

                @include media-query(xl) {
                    display: inline-block;
                    clear: none;
                    height: $header-height;
                }

                a {
                    display: inline-block;
                    height: auto;
                    text-decoration: none;
                    font-size: 1.6rem;
                    -webkit-transition: color 0.3s ease;
                    transition: color 0.3s ease;

                    &:hover {
                        color: color(green);
                    }
                }

                &:first-child {
                    margin-right: 2rem;

                    a {
                        @include media-query(xl) {
                            color: rgba(color(brand), 0.5);

                            &:hover {
                                color: color(green);
                            }
                        }

                        @include media-query(xl) {
                            &:before {
                                content: "";
                                display: inline-block;
                                width: 1.2rem;
                                height: 1.2rem;
                                margin-right: 0.5rem;
                                background: url('/igolf/img/icon-login.svg');
                                background-size: 1.2rem 1.2rem;
                                opacity: 0.5;
                            }
                        }
                    }
                }
            }
        }
    }

    .book {
        display: none;

        @include media-query(lg) {
            position: relative;
            display: inline-block;
            background: color(green);
            color: color(brand-sec) !important;
            text-decoration: none;
            padding: 0 1.5rem;
            margin-left: auto;
            line-height: $header-height;
        }

        span {
            position: relative;
            z-index: 2;
        }

        &:before {
            -webkit-transition: all 500ms cubic-bezier(0.77, 0, 0.175, 1);
            transition: all 500ms cubic-bezier(0.77, 0, 0.175, 1);

            @include media-query(lg) {
                content: "";
                position: absolute;
                width: 0;
                height: 100%;
                left: 50%;
                top: 0;
                background: color(blue);
                z-index: 1;
            }
        }

        &:after {
            -webkit-transition: all 500ms cubic-bezier(0.77, 0, 0.175, 1);
            transition: all 500ms cubic-bezier(0.77, 0, 0.175, 1);

            @include media-query(lg) {
                content: "";
                position: absolute;
                width: 0;
                height: 100%;
                right: 50%;
                top: 0;
                background: color(blue);
                z-index: 1;
            }
        }

        &:hover {
            &:before {
                @include media-query(lg) {
                    width: 50%;
                    left: 0;
                }
            }
            &:after {
                @include media-query(lg) {
                    width: 50%;
                    right: 0;
                }
            }
        }
    }

}