@import '~@style/_config/app-bootstrap-bulma'

$color-navigation-overlay = rgba($color-dark, .95)
$color-navigation-root-background = $color-heading-dark
$color-navigation-root-text = #bbb
$color-navigation-prefix-style-light = #e0e0e0
$color-navigation-prefix-style-dark = #727272
$color-navigation-contact = $color-gray-light

$animation-speed-links-open = .2s
$animation-speed-menu-open = .4s
$animation-speed-menu-item-hover = .15s

$qty-share-links = 4
$animation-speed-share-links = .25s
$share-button-icon-height = 48px

.page-navigation
    position fixed
    left 0
    top 0
    width 100%
    user-select none
    z-index 9999
    +tablet()
        width auto
        height 100%

    &__overlay
        position fixed
        top 0
        left 0
        width 100%
        height 100%
        background $color-navigation-overlay
        opacity 0
        visibility hidden
        transition: opacity $animation-speed-menu-open ease-in-out,
            visibility 0s $animation-speed-menu-open

    &_opened &__overlay
        opacity 1
        visibility visible
        transition opacity $animation-speed-menu-open ease-in-out

    &__root
        position absolute
        display flex
        justify-content space-between
        align-items center
        left 0
        top 0
        width 100%
        background $color-navigation-root-background
        z-index 3
        +tablet()
            display flex
            justify-content space-between
            flex-direction column-reverse
            width $page-navigation-width
            height 100%
            padding 16px 0
            border-right 1px solid $color-dark

    &__logo
        padding 0 24px
        +tablet()
            display none

    &__back-button
        display flex
        justify-content flex-start
        flex-shrink 0
        align-items center
        width 100%
        padding 16px 24px
        color $color-white
        font-family $font-lora
        font-size 16px
        font-weight 700
        letter-spacing 1px
        line-height 1.5
        background rgba($color-brand, 0)
        border none
        border-radius 0
        transition background $animation-speed-menu-item-hover
        +hover()
            &:hover
                background $color-brand
        +tablet()
            display none

        &-icon-holder
            margin 0 15px 0 0

        svg
            color $color-white
            font-size 11px

    &__menu-button,
    &__share-button,
    &__copyrights
        color $color-navigation-root-text
        font-size 11px
        font-weight 500
        line-height 2
        letter-spacing 2px
        text-transform uppercase

    &__menu-button,
    &__share
        padding 21px 24px
        background transparent
        border none
        transition color $animation-speed-menu-item-hover

        &:hover
            color $color-brand

        &:hover, &:focus
            outline none

        +tablet()
            padding 25px 12px

    &__share,
    &__copyrights
        +mobile()
            display none

    &__menu-button
        display flex
        align-items center
        backface-visibility hidden
        perspective 1px
        +tablet()
            align-self flex-start
            transform translateX(-100%) rotate(-90deg)
            transform-origin right top

    &_opened &__menu-button
        color $color-brand

    &_opened &__menu-button &__menu-toggle-icon-line,
    &__menu-button:hover &__menu-toggle-icon-line
        background $color-brand

    .touch-support &:not(&_opened) &__menu-button
        color $color-navigation-root-text

        &:hover .page-navigation__menu-toggle-icon-line
            background $color-navigation-root-text

    &_opened &__menu-toggle-icon-line
        &:nth-child(1)
            width 21px
            transform translate(-1px, 8px) rotate(45deg)

        &:nth-child(2)
            width 0
            opacity 0

        &:nth-child(3)
            width 21px
            transform translate(-1px, -8px) rotate(-45deg)

    &__menu-toggle-icon
        display flex
        flex-direction column
        justify-content space-between
        align-items center
        margin -2px 0 0 17px
        width 24px
        height 18px
        +tablet()
            margin -2px 0 0 21px
            transform rotate(90deg)

    &__menu-toggle-icon-line
        height 2px
        width 100%
        background $color-white
        opacity 1
        transform-origin center center
        transition $animation-speed-menu-item-hover ease-in-out

    &__share
        position relative
        line-height 1
        +tablet()
            align-self flex-end
            transform translateX(100%) rotate(-90deg)
            transform-origin left bottom
            z-index 2

    &__share-button
        display flex
        justify-content space-between
        align-items center
        background transparent
        border none
        transition color $animation-speed-menu-item-hover

        &:hover
            color $color-brand

        &:hover, &:focus
            outline none

    &__share-button-icon
        margin 0 10px 0 0
        font-size 10px
        transition transform ($qty-share-links + 1) * ($animation-speed-share-links / 2)

    &__share-button-hint
        opacity 1
        transition opacity $animation-speed-share-links $qty-share-links * ($animation-speed-share-links / 2)

    &__share-link
        position absolute
        display flex
        justify-content center
        align-items center
        top 0
        width 50px
        height $page-navigation-width
        color $color-white
        opacity 0
        transform translateY(-100%)

        &:hover
            color $color-brand

        &_facebook
            background $social-brand-color-facebook

        &_twitter
            background $social-brand-color-twitter

        &_vk
            background $social-brand-color-vk

        &_ok
            background $social-brand-color-ok

        .page-navigation__share-icon
            margin 0
            font-size 26px
            transform rotate(90deg)

        for i in (2..($qty-share-links + 1))
            &:nth-child({i})
                left ($qty-share-links + 1 - i) * 50px + $share-button-icon-height
                transition: transform $animation-speed-share-links (i - 2) * ($animation-speed-share-links / 2),
                    opacity $animation-speed-share-links (i - 2) * ($animation-speed-share-links / 2),
                    color $animation-speed-share-links

    &__share_opened &
        &__share-button-icon
            transform rotate(225deg)

        &__share-button-hint
            opacity 0
            transition opacity $animation-speed-share-links

        &__share-link
            opacity 1
            transform translateY(0)

    &__copyrights
        color $color-gray-light

        @media screen and (max-height: 620px)
            display none

        +tablet()
            align-self center
            transform rotate(-90deg)
            transform-origin center
            white-space nowrap
            z-index 1

    &__links-overlay
        position fixed
        left 0
        top $page-navigation-height
        width 100%
        height "calc(100% - %s)" % $page-navigation-height
        background $color-dark
        transform translateX(-100%)
        transition transform $animation-speed-menu-open ease-in-out
        z-index 5

        &_visible
            transform translateX(0)
        +tablet()
            top 0
            left 100%
            width "calc(100% - 340px - %s)" % $page-navigation-width
            height 100%
            transform translateX(0)
            transition transform $animation-speed-section-open-tablet ease-in-out
            &_visible
                transform translateX(-100%)

    &__main-menu
        position fixed
        display flex
        flex-direction column
        justify-content space-between
        top 0
        height 100%
        width 100%
        max-width 340px
        padding 0 0 40px
        background $color-dark
        transform translateX(-100%)
        transition transform $animation-speed-menu-open ease-in-out
        z-index 2
        +tablet()
            left $page-navigation-width
            background $color-navigation-root-background

    &_auth &__main-menu
        max-width 420px

    &_opened &__main-menu
        transform translateX(0)

    &__links-overlay_visible ~ &__links
        z-index 5

    &__links
        position fixed
        display flex
        flex-direction column
        align-items flex-start
        left 0
        top $page-navigation-height
        width 100%
        height "calc(100% - %s)" % $page-navigation-height
        padding 0 0 24px
        opacity 0
        overflow-y auto
        visibility hidden
        transition: opacity $animation-speed-links-open ease-in-out,
            visibility 0s $animation-speed-links-open
        z-index 1
        overflow-touch()

        &_opened
            opacity 1
            visibility visible
            transition opacity $animation-speed-links-open ease-in-out
            z-index 6 !important
        +tablet()
            top 0
            left "calc(340px + %s)" % $page-navigation-width
            width "calc(100% - 340px - %s)" % $page-navigation-width
            height 100%
            padding 24px 0 40px

    &__links-row
        display flex
        justify-content flex-start
        align-items flex-start
        flex-wrap wrap
        flex-shrink 0
        width 100%

    &__links-group
        display flex
        flex-direction column
        align-items flex-start
        justify-content flex-start
        flex-shrink 0
        width 100%
        margin-top 24px
        +desktop()
            margin-top 32px
            width 50%
        +widescreen()
            width 33.333333%

        &.page-navigation__links-group_card
            flex-direction row
            flex-wrap wrap
            width 100%
            padding 8px 24px
            +from(480px)
                padding 8px 8px
            +tablet()
                padding 16px 48px
            +desktop()
                padding 16px 32px

            .link-card
                width 100%
                margin 0 0 16px
                +from(480px)
                    width calc(50% - 16px)
                    margin 0 8px 16px
                +tablet()
                    width 100%
                +desktop()
                    width calc(50% - 32px)
                    margin 0 16px 32px
                    max-width 320px

        &.page-navigation__links-group_wide
            +desktop()
                width 100%
                max-width 600px

    &__links-columns
        width 100%
        display flex
        justify-content flex-start
        align-items flex-start
        flex-direction column
        flex-wrap wrap
        +desktop()
            flex-direction row

    &__links-columns &__link
        +desktop()
            width 50%

    &__links-group-title
        max-width 100%
        margin-bottom 8px
        padding 8px 24px
        color rgba($color-white, .5)
        font-family $font-lora
        font-size 17px
        font-weight 700
        letter-spacing 1px
        line-height 24px
        +tablet()
            margin-bottom 0
            padding 16px 48px
            line-height 32px

    &__link
        position relative
        max-width 100%
        padding 8px 24px
        color $color-white
        font-size 14px
        line-height 24px
        letter-spacing .2px
        transition color $animation-speed-menu-item-hover
        +tablet()
            padding 16px 48px
            font-size 16px
            line-height 32px

        &:hover
            color $color-brand

        &_lead
            display flex
            justify-content flex-start
            align-items center
            margin 16px 0 4px
            padding-left 80px
            font-family $font-lora
            font-size 15px
            font-weight 700
            line-height 24px
            +tablet()
                margin-top 0
                padding-left 104px
                font-size 16px
                line-height 32px

        &_lead &-icon
            position absolute
            top 50%
            left 24px
            color $color-brand
            font-size 26px
            transform translateY(-50%)
            +tablet()
                left 48px

    &__link-footer
        position absolute
        display flex
        justify-content space-between
        align-items flex-end
        left 0
        bottom 0
        width 100%
        padding 32px 24px
        color $color-white
        font-size 16px
        font-weight 500
        line-height 1.5

    &__links-group_compact &__link
        +tablet()
            padding 4px 48px
            line-height 24px

    &_auth &__sections-list,
    &__auth-panel
        display none

    &__sections-list,
    &_auth &__auth-panel
        display block

    &__sections-list,
    &__auth-panel
        position relative
        margin $page-navigation-height 0 auto
        padding 0
        overflow-y auto
        z-index 4
        +tablet()
            margin 0 0 auto
            padding 24px 0 0

    &__section
        display flex
        justify-content space-between
        align-items center
        padding 16px 24px
        font-family $font-lora
        font-size 16px
        font-weight 700
        letter-spacing 1px
        line-height 1.5
        cursor pointer
        background rgba($color-brand, 0)
        transition background $animation-speed-menu-item-hover
        +tablet()
            padding 16px 48px
            font-size 17px
            line-height 32px

        &_opened, &:hover
            background rgba($color-brand, 1)

            .page-navigation__section-name,
            .page-navigation__section-icon
                color $color-white

        &_profile
            display none
        &_auth
            display flex

        .touch-support &:not(&_opened):hover
            background rgba($color-brand, 0)

            .page-navigation__section-icon
                color $color-brand

    &_authorized &__section_profile
        display flex
    &_authorized &__section_auth
        display none

    &__section-name,
    &__section-icon
        flex 1
        color rgba($color-white, .7)
        transition background $animation-speed-menu-item-hover, color $animation-speed-menu-item-hover

    &__section:hover &__section-name,
    &__section:hover &__section-icon
        color $color-white

    &__section-icon-holder
        margin 0 0 0 15px

    &__section-icon
        font-size 11px

    &__contacts
        position relative
        padding 24px 24px 0
        z-index 4
        +tablet()
            padding 24px 48px 0

    &__contact + &__contact
        margin-top 16px
        +tablet()
            margin-top 40px

    &__contact
        &_phone
            font-size 14px
            line-height 24px
            +tablet()
                line-height 17px

        &_email
            font-size 15px
            line-height 24px
            +tablet()
                line-height 18px

    &__contact_phone &__contact-icon
        margin-top -2px
        font-size 16px

    &__contact_email &__contact-icon
        margin-top -4px
        font-size 14px

    &__contact-icon
        margin-right 20px
        color $color-navigation-contact
        vertical-align middle

    &__contact-link
        color rgba($color-white, .7)
        transition color $animation-speed-menu-item-hover

        &:hover
            color $color-white
            text-decoration underline

    &__social
        position relative
        display flex
        justify-content flex-start
        margin 32px 0 12px
        padding 0 24px
        z-index 4
        +tablet()
            margin 48px 0 0
            padding 0 48px

    &__social-link
        position relative
        width 40px
        height @width
        color $color-navigation-contact
        font-size 18px
        line-height 40px
        border 1px solid rgba($color-white, .5)
        border-radius 4px
        transition color $animation-speed-menu-item-hover, border-color $animation-speed-menu-item-hover
        text-align center

        &:hover
            color $color-white
            border-color $color-white

        & + &
            margin-left 16px

    &__social-icon
        position absolute
        left 50%
        top 50%
        transform translate(-50%, -50%)

    &__terms
        position relative
        margin 32px 0 12px
        padding 0 24px
        z-index 4
        +tablet()
            margin 48px 0 0
            padding 0 48px

    &__terms-link
        color rgba($color-white, .7)
        transition color $animation-speed-menu-item-hover

        &:hover
            color $color-white
            text-decoration underline