//
// Window decorations styles
//

decoration
{
    border-radius: $window_radius $window_radius 0 0;
    
    // Lamefun trick to get rounded borders regardless of CSD use
    //
    border-width: 0px;
    
    // This needs to be transparent (see bug #722563)
    //
    $_wm_border:          if($variant == 'light', transparentize(black, 0.77), transparentize(black, 0.25));
    $_wm_border_backdrop: if($variant == 'light', transparentize(black, 0.82), transparentize(black, 0.25));
    
    // Doing borders with box-shadow
    //
    box-shadow: 0 3px 9px 1px transparentize(black, 0.5),
                0 0   0   1px $_wm_border;

    // FIXME: Rationalize shadows

    // This is used for the resize cursor area
    //
    margin: 10px;
    
    &:backdrop
    {
        // The transparent shadow here is to enforce that the shadow extents don't
        // change when we go to backdrop, to prevent jumping windows.
        // The biggest shadow should be in the same order then in the active state
        // or the jumping will happen during the transition.
        //
        box-shadow: 0 3px 9px 1px transparent,
                    0 2px 6px 2px transparentize(black, 0.8),
                    0 0 0 1px $_wm_border_backdrop;
        transition: $backdrop_transition;
    }
    
    .maximized &,
    .fullscreen &
    {
        border-radius: 0;
        box-shadow:    none;
    }
    
    .tiled        &,
    .tiled-top    &,
    .tiled-right  &,
    .tiled-bottom &,
    .tiled-left   &
    {
        border-radius: 0;
        box-shadow:    0 0 0 1px  $_wm_border_backdrop,
                       0 0 0 20px transparent; //transparent control workaround -- #3670

        &:backdrop
        {
            box-shadow: 0 0 0 1px  $_wm_border_backdrop,
                        0 0 0 20px transparent; // #3670
        }
    }
    
    .popup &
    {
        box-shadow: none;
    }
    
    // Server-side decorations as used by mutter
    // Just doing borders, wm draws actual shadows
    //
    .ssd &          { box-shadow: 0 0 0 1px $_wm_border;          }
    .ssd &:backdrop { box-shadow: 0 0 0 1px $_wm_border_backdrop; }
    
    .csd.popup &
    {
        border-radius: $menu_radius;
        box-shadow:    0 1px 2px transparentize(#000000,     0.8),
                       0 0 0 1px transparentize($_wm_border, 0.1);
    }
    
    tooltip.csd &
    {
        border-radius: 5px;
        box-shadow:    none;
    }
    
    messagedialog.csd &
    {
        border-radius: $window_radius;
        box-shadow:    0 1px 2px transparentize(#000000,     0.8),
                       0 0 0 1px transparentize($_wm_border, 0.1);
    }
    
    .solid-csd &
    {
        background-color: $borders_color;
        border:           solid 1px $borders_color;
        border-radius:    0;
        box-shadow:       inset 0 0 0 3px $headerbar_color,
                          inset 0 1px     $top_hilight;
        margin:           0;
        padding:          4px;
        
        &:backdrop
        {
            box-shadow: inset 0 0 0 3px $backdrop_bg_color,
                        inset 0 1px     $top_hilight;
        }
    }
}

// Window close button
//
button.titlebutton
{
    @extend %button_basic;
    
    @extend %button_basic_flat;
    
    @include _button_text_shadow;
    
    &:not(.appmenu)
    {
        border-radius: 9999px;
        padding:       $_hb_btn_pad;
        margin:        0 2px;
        min-height:    0;
        min-width:     0;
    }
    
    .selection-mode &
    {
        @extend %selection_mode_button_flat;
        
        @extend %nobg_selected_items;
    }
    
    &:backdrop
    {
        -gtk-icon-shadow: none;
    }
}

.selection-mode headerbar button.titlebutton,
.selection-mode .titlebar button.titlebutton,
headerbar.selection-mode button.titlebutton,
.titlebar.selection-mode button.titlebutton
{
    @include _button_text_shadow(white, $suggested_bg_color);
    
    &:backdrop
    {
        -gtk-icon-shadow: none;
    }
}


// Catch all extend
//
%selected_items
{
    background-color: $selected_bg_color;
    
    @at-root %nobg_selected_items,
    &
    {
        color: $selected_fg_color;
        
        @at-root %selected_items_disabled,
        &:disabled
        {
            color: mix($selected_fg_color, $selected_bg_color, 50%);
        }
        
        @at-root %selected_items_backdrop,
        &:backdrop
        {
            color: $backdrop_selected_fg_color;
            
            &:disabled
            {
                color: mix($backdrop_selected_fg_color, $selected_bg_color, 30%);
            }
        }
    }
}

.monospace
{
    font-family: monospace;
}
