/*
    Main CSS file for MDN.  Holds the site structure and key styles.
*/

/*
    Classes which should be mirror extensions and mixins - mixins.styl
    These classes are used within wiki content so we must have them available as classes as well
*/
@import '../includes/vars';
@import '../includes/mixins';

.offscreen {
    offscreen();
}

.clear {
    clearfix();
}

.title {
    title-header();
}

.smaller {
    set-smaller-font-size();
}

.larger {
    set-larger-font-size();
}

.grid-padding {
    padding: $grid-spacing;
}

.heading-link {
    font-style: italic;
    set-font-size($base-font-size);
    font-weight: normal;
    display: inline-block;
    margin-left: ($grid-spacing * 2);
}

/* grid setup for direct class uses */
draw-grid();

/* centers pieces of the page, mostly the header, footer, and main elements */
.center {
    margin: 0 auto;
    position: relative;
    max-width: $max-width-default;
    add-center-spacing();
}

/* global notices (via soapbox) */
.global-notice {
    background: $light-background-color;

    .wrap {
        @extend .center;
        set-smaller-font-size();
        padding: 10px 24px;
        max-width: $max-width-default;

        prevent-last-child-spacing(p, margin-bottom);
    }
}

/* header */
#main-header {
    clearfix();
    border-color: transparent;
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-top: 2px solid #fff;

    /* margin-top will be added to small-mobile media query to ensure oauth widget doesn't overly */
    .logo {
        bidi-value(float, left, right);
        width: 205px;
        height: 40px;
        margin-top: 7px;
        background-image: url($logo-sprite-url);
        background-position: 0 0;
        background-repeat: no-repeat;
        background-size:100% auto;
        display: block;
        text-indent: -9999px;
        overflow: hidden;
    }
}

#tabzilla {
    bidi-value(float, right, left);
}

#nav-access {
    width: 100%;
    position: absolute;
    top: -20em;
    z-index: 1001;

    a {
        background: rgba(255, 255, 255, 0.9);
        padding: 12px 10px;
        position: absolute;
        left: 0;
        right: 0;
        font-weight: bold;
        text-align: center;

        &:hover, &:focus {
            box-shadow: 3px 3px 5px #aaa;
            top: 20em;
            text-decoration: none;
        }
    }
}

#main-nav {
    > ul {
        bidi-value(float, right, left);
        margin-top: 20px;
        margin-bottom: $grid-spacing;

        > li {
            bidi-style(margin-left, 31px, margin-right, 0);
            position: relative;
            opacity: 1;
            max-width: 1000px;
            display: inline-block;
            vendorize(transition-property, width);
            vendorize(transition-duration, $default-animation-duration);
            vendorize(transition-delay, $default-animation-duration);
            bidi-value(text-align, left, right);

            &:first-child {
                margin-left: 0;
            }

            > a i {
                opacity: 0.85;
            }

            > a, .search-trigger {
                text-transform: uppercase;
                font-weight: bold;
            }

            > a {
                &:link, &:visited, &:hover, &:active {
                    color: $menu-link-color;
                    text-decoration: none;
                }
            }

            > a, .search-wrap {
                padding: 4px 8px;
            }
        }
    }

    .submenu {
        $menu-border-color = $text-color;
        $menu-border-width = 5px;
        $menu-arrow-top = -19px;
        component-submenu(380px, 2, #fff, $menu-border-color);

        top: 40px;
        left: -136px;
        border-top: $menu-border-width solid $menu-border-color;

        .submenu-column {
            min-height: 90px;
        }

        &:before, &:after {
            top: $menu-arrow-top;
            bidi-style(left, 190px, right, auto);
        }

        &:after {
            top: ($menu-arrow-top - $menu-border-width);
        }
    }

    .submenu-single {
        width: 180px;
        left: -74px;

        &:before, &:after {
            bidi-style(left, 98px, right, auto);
        }
    }

    &.expand {
        .search-wrap {
            width: 500px;
        }

        > ul > li:not(:last-child) {
            opacity: 0;
            width: 0;
            max-width: 0;
            overflow: hidden;
            padding: 0;
            vendorize(transition-delay, 0);
        }
    }
}

a.persona-button, a.github-button {
    border-radius: 3px;
    z-index: 2;
    display: inline-block;
    font-weight: bold;

    &:focus{
        span{
            text-decoration: underline;
        }
    }

    span {
        text-decoration: none;
        outline: none;
        display: block;
        float: left;
        set-font-size($base-font-size);
        line-height: 24px;
        color: white;
        padding: 0 10px 0 20px;
        position: relative;

        &:after {
            content: '';
            position: absolute;
            top: 0;
            right: -12px;
            width: 24px;
            height: 24px;
            z-index: 1;
            vendorize(transform, scale(0.707) rotate(45deg));
            border-radius: 0 3px 0 50px;
        }

        &.persona-icon, &.github-icon {
            padding-left: 3px;
            border-radius: 3px 0 0 3px;
            create-gradient(#43a6e2, #287cc2);
            height: 24px;

            &:after {
                create-gradient(#43a6e2, #287cc2, left top);
            }

            i {
                position: relative;
                top: 2px;
                left: 5px;
                width: 15px;
                height: 15px;
                display: inline-block;
            }
        }

        &.signin {
            text-shadow: 0px 1.5px 1px rgba(0, 0, 0, 0.35);
            line-height: 23px;
            padding-bottom 1px;

            &:after {
                z-index: 2;
                create-gradient(#56565a, #3a3a3a, top left);
            }

            & {
                create-gradient(#56565a, #3a3a3a);
            }
        }
    }
}

a.persona-button {
    i {
        background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAQAAAD9CzEMAAABjElEQVR4Ae3WQYQbURjA8ccwhBCGYU+5LiGUEkoJPZUQQk5LWJawLMuSUyhLCTnlVIZSQk6llKGUEIZSQsg1hBCWZZnTEMK/KqqyMcn7Zubd9vddh7+5fN9TenC54wchOws86iid0fmoQJ+IQ3NqWQRKLIg3wEoXKBNy3Hes5AGXFaf1kgdG6KkkC7xii54gWeAL+l7LAxZP6OvJA1UkZvLADRJbbGmgh0xRFrBZIfNBFqgjtZQFOsjZksAlUqHsD1wiZD7LAooWEksK8lUxRF8l2bLTNUm6rsfoqUsC8oUdpDmZA06JKKcJ2PziuFbaV8UZc+J1s3gXObGJDkoSkB//tyheApwziD3/U67IJw04NBmy5rSAe95IAmW6jJF6ZEQT53ggT5816Ux4Hxdo8kA2fNzDwDs2ZOc3uf1AiZBsfdsP+GSv9j9QxYQZ1r/AT8xo7AJFTPF3gQ6mbHH+BgLMuVDkiDDHU1Qwaa64xqSN4hNGKXzTgQZtPuLhETB9Nmv0TA/mKx4et7T/AHu690RA5bMsAAAAAElFTkSuQmCC') 0 0 no-repeat;
        background-size: cover;
    }
}

a.github-button {
    span.github-icon {
        create-gradient(#5d649a, #63397b);

        &:after {
            create-gradient(#5d649a, #63397b, left top);
        }

        {$selector-icon} {
            margin-left: 0;
            top: 0;
            left: 8px;
        }
    }
}

/* Login widget and profile (logged in) links */
.header-login {
    bidi-style(right, 200px, left, auto);
    position: absolute;
    top: 12px;
    set-font-size($small-bump-font-size);
    z-index: 3;
}

.user-state {
    bidi-value(float, none, left);

    ul, > {$selector-icon} {
        bidi-value(float, left, right);

        /* Keep the line height equal to make the icon appear as though it is on
           the same line. */
        line-height: 20px;
    }

    > {$selector-icon} {
        bidi-style(margin-right, 10px, margin-left, 10px);
        set-font-size($small-bump-font-size + 20%);
    }

    li {
        display: inline;
        bidi-value(text-align, right, left);

        & + li {
            border-left: 1px solid #bbb;
            margin-left: 8px;
            padding-left: @margin-left + 2;
            bidi-style(border-left, 1px solid #bbb, border-right, 0);
            bidi-style(padding-right, 10px, padding-left, 10px);
            bidi-style(margin-right, 8px, margin-left, 6px);
        }
    }

    a, a:hover, a:focus, a:visited {
        color: $link-color;
    }
}

.oauth-login-container {
    border-radius: 8px;
    border: 1px solid transparent;
    display: inline-block;

    {$selector-icon} {
        margin-left: 0;

        &:before {
            cursor: pointer;
        }
    }
}

.oauth-login-options {
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    cursor: default;
    position: relative;

    &.active {
        border-color: rgba(255, 255, 255, 0.3);
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;

        .submenu-close {
            color: inherit;
            position: absolute;
            top: 4px;
            bidi-style(left, -6px, right, auto);
        }

        .oauth-login-picker {
            display: block;
        }
    }
}

.oauth-icon {
    border-radius: 4px;
    text-align: center;
    padding: 0px 7px;
    font-size: $base-bump-font-size;
    bidi-style(margin-left, 4px, margin-right, 0);
    color: #fff;
    display: inline-block;
    create-gradient(#43a6e2, #287cc2);
    cursor: pointer;

    {$selector-icon} {
    	bidi-style(margin-left, 0, margin-right, 0);
    }
}

.oauth-github {
    create-gradient(#5d649a, #63397b);
}

.oauth-login-picker {
    component-submenu-close();
    display: none;
    background: #fff;
    position: relative;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    overflow: hidden;

    a {
        display: block;
        padding: 6px 8px;
        position: relative;

        &:hover, &:active, &:focus {
            background: rgba($link-color, 0.1);
        }
    }

    {$selector-icon} {
        background: none;
        bidi-style(margin-right, $icon-margin, margin-left, 0);
    }

    .submenu-close {
        display: none;
    }
}


.search-wrap {
    background: transparent;
    padding: 4px 8px;
    border-radius: 3px;
    position: relative;
    vendorize(transition-property, width);
    vendorize(transition-duration, $default-animation-duration);
    width: 60px;
    background-color: rgba(255, 255, 255, 0.9);

    &.expanded {
        background: #fff;
    }

    input {
        background: transparent;
        border: 0;
        color: $menu-link-color;
        font-weight: bold;
        width: 20px;
        overflow: hidden;
        padding: 0;
        vendorize(transition-property, width);
        vendorize(transition-duration, $default-animation-duration);
        position: absolute;
        left: 8px;
        width: 90%;
        z-index: 2;
        cursor: pointer;

        set-placeholder-style(color, $text-color);
        set-placeholder-style(text-transform, uppercase);
    }

    .search-trigger {
        position: absolute;
        bidi-style(right, 12px, left, auto);
        z-index: 1;
        cursor: pointer;
    }
}

main {
    background: #fff;
    min-height: 200px;

    > .center {
        padding-top: $first-content-top-padding;
    }
}

/* footer */
footer {
    set-smaller-font-size();
    background: #fff;
    padding:  $first-content-top-padding 0 0 0;

    p, label {
        font-style: italic;
    }

    p {
        bidi-style(padding-left, 92px, padding-right, 0, true);
        padding-top: 10px;
        padding-bottom: 0;
        position: relative;
        min-height: 62px;

        &:after {
            bidi-style(left, 0, right, 0);
            content: '';
            display: block;
            width: 65px;
            height: 60px
            background-image: url($logo-sprite-url);
            background-position: 0px -83px;
            background-size: 205px auto;
            background-repeat: no-repeat;
            position: absolute;
            top: 0;
        }
    }

    .column-strip {
        padding-top: 10px;
    }

    label {
        padding-right: 4px;
    }
}

/* feature testing */
#feature-test-element {
    position: absolute;
    left: 0;
    top: -999999px;
    width: 0;
    height: 0;
    overflow: hidden;
    z-index: 1;

    @media $media-query-small-desktop { z-index: 2; }
    @media $media-query-tablet { z-index: 3; }
    @media $media-query-mobile { z-index: 4; }
}

/* simple hiding of elements */
.hidden {
    display: none;
}

/* disabling of elements */
.disabled, [disabled] {
    pointer-events: none;
    cursor: default;
}

/* tablet updates */
@media $media-query-tablet {

    /* make submenus full width */
    #main-nav {
        .submenu {
            left: 0;
            right: 0;

            &:before, &:after {
                bidi-style(left, 10px, right, auto);
            }
        }
    }

    #main-nav {
        > ul {
            > li {
                bidi-style(margin-left, 21px, margin-right, 0);

                > a {
                    i {
                        set-larger-font-size();
                    }
                }
            }
        }
    }

    .active .oauth-login-options-text {
        visibility: hidden;
    }

    .oauth-icon {
        pointer-events: none;
    }
}

/* custom nav menu movement */
@media $media-query-navigation-break {

    #main-header {
        .logo {
            margin-top: -33px;
        }
    }

    #main-nav {
        > ul {
            text-align: right;
            width: 100%;
            clear: both;

            > li {
                vendorize(transition-property, none);

                &:first-child {
                    margin-left: 0;
                }
            }
        }
    }
}

/* break nav into blocks (own line) */
@media $media-query-navigation-block {

    #main-nav {
        > ul {
            float: none;
            text-align: left;

            > li {
                margin: 10px 10px 10px 0;
            }
        }
    }
}


@media $media-query-mobile {

    .center {
        add-center-spacing(15px);
    }

    #tabzilla {
        display: none;
    }

    .header-clear {
        display: none;
    }

    #main-header {
        .logo {
            margin: ($grid-spacing / 2) 0;
            width: 140px;
            height: 40px;
            background-size: auto;
        }
    }

    .header-login {
        bidi-style(right, $gutter-width, left, auto);
    }

    .user-state {
        li {
            display: block;

            & + li {
                padding-left: 0;
                bidi-style(border-left, none, border-right, none);
                bidi-style(padding-right, 0, padding-left, 0);
                bidi-style(margin-right, 0, margin-left, 0);
            }
        }
    }

    /* move the search box under the nav */
    #main-header {
        .main-nav-search {
            display: block;
            padding: 0px;
            margin-top: 10px;
            width: auto;

            .search-wrap {
                width: auto;
            }
        }

        &.expand {
            ul {
                > li:not(:last-child) {
                    width: auto;
                    max-width: none;
                    vendorize(transition-property, none);
                    overflow: visible;
                }
            }
        }
    }

    /* add bottom spacing to the footer */
    footer {
        padding-bottom: $grid-spacing;
    }
}

@media $media-query-small-mobile {

    #main-header {
        .logo {
            width: 44px;
        }
    }
}


@media print {
    header, footer {
        display: none;
    }

    .center {
        remove-center-spacing();
    }
}

p.field-explanation {
    margin-bottom: 0;
}

label {$selector-icon} {
    $label-icon-margin = 10px;
    bidi-value(margin-left, 0, $label-icon-margin);
    bidi-value(margin-right, $label-icon-margin, 0);
}

for i in (2 3 4) {
    .cols-{i} {
        vendorize(column-count, i);
        vendorize(column-gap, ($grid-spacing / 2));
    }
}

#content-main.full {
    clear: both;
    float: none;
    width: 100%;
}

.main {
    float: left;
    width: 670px;
}

.global-notice {
    position: relative;
    margin: 0 0 -1px;
}

ol.pagination {
    margin: $grid-spacing 0;
    padding: $grid-spacing 0;

    li {
        bidi-value(float, left, right);
        padding: 0 2px;

        &.prev, &.prev a {
            bidi-style(padding-left, 0, padding-right, auto);
        }

        a {
            bidi-value(float, left, right);
            padding: 3px 8px 5px;

            &:hover {
                text-decoration: underline;
            }
        }

        &.selected a {
            background: #447bc4;
            color: #fff;
            border-radius: 5px;
        }
    }
}

.socialaccount_providers li {
    margin: 0 $grid-spacing 0 0;
    display: inline-block;

    span.signin {
        min-width: 140px;
    }
}
