// Name:            Navbar
// Description:     Defines styles for the navigation bar
//
// Component:       `wk-navbar`
//
// Sub-objects:     `wk-navbar-nav`
//                  `wk-navbar-nav-subtitle`
//                  `wk-navbar-content`
//                  `wk-navbar-brand`
//                  `wk-navbar-toggle`
//                  `wk-navbar-toggle-alt`
//                  `wk-navbar-center`
//                  `wk-navbar-flip`
//
// Modifiers:       `wk-navbar-attached`
//
// States:          `wk-active`
//                  `wk-parent`
//                  `wk-open`
//
// Used by:         Dropdown
//
// Markup:
//
// <!-- wk-navbar -->
// <nav class="wk-navbar">
//     <ul class="wk-navbar-nav">
//         <li class="wk-active"><a href=""></a></li>
//         <li><a href=""></a></li>
//     </ul>
// </nav>
//
// ========================================================================


// Variables
// ========================================================================

@navbar-background:                             #eee;
@navbar-color:                                  #444;
@navbar-link-color:                             #07D;
@navbar-link-hover-color:                       #059;

@navbar-nav-height:                             40px;
@navbar-nav-line-height:                        @navbar-nav-height;
@navbar-nav-padding-horizontal:                 15px;
@navbar-nav-color:                              #444;
@navbar-nav-font-size:                          14px;
@navbar-nav-font-weight:                        normal;
@navbar-nav-font-family:                        "Helvetica Neue", Helvetica, Arial, sans-serif;
@navbar-nav-hover-background:                   #f5f5f5;
@navbar-nav-hover-color:                        #444;
@navbar-nav-onclick-background:                 #ddd;
@navbar-nav-onclick-color:                      #444;
@navbar-nav-active-background:                  #f5f5f5;
@navbar-nav-active-color:                       #444;
@navbar-nav-subtitle-font-size:                 10px;
@navbar-nav-subtitle-offset:                    2px;

@navbar-brand-font-size:                        18px;
@navbar-brand-color:                            #444;
@navbar-brand-hover-color:                      #444;

@navbar-toggle-font-size:                       18px;
@navbar-toggle-color:                           #444;
@navbar-toggle-hover-color:                     #444;
@navbar-toggle-icon:                            "\f0c9";
@navbar-toggle-icon-alt:                        "\f002";


/* ========================================================================
   Component: Navbar
 ========================================================================== */

.wk-navbar {
    background: @navbar-background;
    color: @navbar-color;
    .hook-navbar;
}

/*
 * Micro clearfix
 */

.wk-navbar:before,
.wk-navbar:after {
    content: "";
    display: table;
}

.wk-navbar:after { clear: both; }


/* Sub-object: `wk-navbar-nav`
 ========================================================================== */

.wk-navbar-nav {
    margin: 0;
    padding: 0;
    list-style: none;
    float: left;
}

/*
 * 1. Create position context for dropdowns
 */

.wk-navbar-nav > li {
    float: left;
    /* 1 */
    position: relative;
}

/*
 * 1. Dimensions
 * 2. Style
 */

.wk-navbar-nav > li > a {
    display: block;
    box-sizing: border-box;
    text-decoration: none;
    /* 1 */
    height: @navbar-nav-height;
    padding: 0 @navbar-nav-padding-horizontal;
    line-height: @navbar-nav-line-height;
    /* 2 */
    color: @navbar-nav-color;
    font-size: @navbar-nav-font-size;
    font-family: @navbar-nav-font-family;
    font-weight: @navbar-nav-font-weight;
    .hook-navbar-nav;
}

/* Appear not as link */
.wk-navbar-nav > li > a[href='#'] { cursor: text; }

/*
 * Hover
 * 1. Apply hover style also to focus state
 * 2. Also apply if dropdown is opened
 * 3. Remove default focus style
 */

.wk-navbar-nav > li:hover > a,
.wk-navbar-nav > li > a:focus, // 1
.wk-navbar-nav > li.wk-open > a { // 2
    background-color: @navbar-nav-hover-background;
    color: @navbar-nav-hover-color;
    /* 3 */
    outline: none;
    .hook-navbar-nav-hover;
}

/* OnClick */
.wk-navbar-nav > li > a:active {
    background-color: @navbar-nav-onclick-background;
    color: @navbar-nav-onclick-color;
    .hook-navbar-nav-onclick;
}

/* Active */
.wk-navbar-nav > li.wk-active > a {
    background-color: @navbar-nav-active-background;
    color: @navbar-nav-active-color;
    .hook-navbar-nav-active;
}


/* Sub-objects: `wk-navbar-nav-subtitle`
 ========================================================================== */

.wk-navbar-nav .wk-navbar-nav-subtitle { line-height: @navbar-nav-line-height - @navbar-nav-subtitle-font-size - @navbar-nav-subtitle-offset; }

.wk-navbar-nav-subtitle > div {
    margin-top: ((@navbar-nav-line-height - @navbar-nav-subtitle-font-size - @navbar-nav-font-size) / -2) + @navbar-nav-subtitle-offset;
    font-size: @navbar-nav-subtitle-font-size;
    line-height: @navbar-nav-subtitle-font-size + @navbar-nav-subtitle-offset;
}


/* Sub-objects: `wk-navbar-content`, `wk-navbar-brand`, `wk-navbar-toggle`
 ========================================================================== */

/*
 * Imitate navbar items
 */

.wk-navbar-content,
.wk-navbar-brand,
.wk-navbar-toggle {
    box-sizing: border-box;
    display: block;
    height: @navbar-nav-height;
    padding: 0 @navbar-nav-padding-horizontal;
    float: left;
    .hook-navbar-content;
}

/*
 * Helper to center all child elements vertically
 */

.wk-navbar-content:before,
.wk-navbar-brand:before,
.wk-navbar-toggle:before {
    content: '';
    display: inline-block;
    height: 100%;
    vertical-align: middle;
}


/* Sub-objects: `wk-navbar-content`
 ========================================================================== */

/*
 * Better sibling spacing
 */

.wk-navbar-content + .wk-navbar-content:not(.wk-navbar-center) { padding-left: 0; }

/*
 * Link colors
 */

.wk-navbar-content > a:not([class]) { color: @navbar-link-color; }
.wk-navbar-content > a:not([class]):hover { color: @navbar-link-hover-color; }


/* Sub-objects: `wk-navbar-brand`
 ========================================================================== */

.wk-navbar-brand {
    font-size: @navbar-brand-font-size;
    color: @navbar-brand-color;
    text-decoration: none;
}

/*
 * 1. Apply hover style also to focus state
 * 2. Remove default focus style
 */

.wk-navbar-brand:hover,
.wk-navbar-brand:focus { // 1
    color: @navbar-brand-hover-color;
    text-decoration: none;
    /* 2 */
    outline: none;
}


/* Sub-object: `wk-navbar-toggle`
 ========================================================================== */

.wk-navbar-toggle {
    font-size: @navbar-toggle-font-size;
    color: @navbar-toggle-color;
    text-decoration: none;
}

/*
 * 1. Apply hover style also to focus state
 * 2. Remove default focus style
 */

.wk-navbar-toggle:hover,
.wk-navbar-toggle:focus { // 1
    color: @navbar-toggle-hover-color;
    text-decoration: none;
    /* 2 */
    outline: none;
}

/*
 * 1. Center icon vertically
 */

.wk-navbar-toggle:after {
    content: @navbar-toggle-icon;
    font-family: FontAwesome;
    /* 1 */
    vertical-align: middle;
}

.wk-navbar-toggle-alt:after { content: @navbar-toggle-icon-alt; }


/* Sub-object: `wk-navbar-center`
 ========================================================================== */

/*
 * The element with this class needs to be last child in the navbar
 * 1. This hack is needed because other float elements shift centered text
 */

.wk-navbar-center {
    float: none;
    text-align: center;
    /* 1 */
    max-width: 50%;
    margin-left: auto;
    margin-right: auto;
}


/* Sub-object: `wk-navbar-flip`
 ========================================================================== */

.wk-navbar-flip { float: right; }


// Hooks
// ========================================================================

.hook-navbar-misc;

.hook-navbar() {}
.hook-navbar-nav() {}
.hook-navbar-nav-hover() {}
.hook-navbar-nav-onclick() {}
.hook-navbar-nav-active() {}
.hook-navbar-content() {}
.hook-navbar-misc() {}