/**
 * decorations.scss - Theme Base Window Decoration Styles
 *
 * This source-code is part of Windows XP stuff for XFCE:
 * <<https://www.oddmatics.uk>>
 *
 * Author(s): Rory Fewell <roryf@oddmatics.uk>
 */

decoration
{
    // Lamefun trick to get rounded borders regardless of CSD use
    //
    border-width: 0px;
    
    // This needs to be transparent (see bug #722563)
    //
    $_wm_border:          transparentize(black, 0.77);
    $_wm_border_backdrop: transparentize(black, 0.82);

    // This is used for the resize cursor area
    //
    margin: 10px;

    .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
    }
    
    .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;          }
    
    .csd.popup &
    {
        border-radius: $menu_radius;
        box-shadow:    6px 6px 2px -3px rgba(0, 0, 0, 0.4);
    }
    
    tooltip.csd &
    {
        border-radius: 5px;
        box-shadow:    none;
    }
    
    messagedialog.csd &
    {
        box-shadow:    0 1px 2px transparentize(#000000,     0.8),
                       0 0 0 1px transparentize($_wm_border, 0.1);
    }
    
    .solid-csd &
    {
        background-color: blue;
        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;
    }
}

// Window close button
//
//button.titlebutton
//{
//    @extend %button_basic;
//    
//    @extend %button_basic_flat;
//    
//    @include _button_text_shadow;
//    
//    .selection-mode &
//    {
//        @extend %selection_mode_button_flat;
//        
//        @extend %nobg_selected_items;
//    }
//}

.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;
}

// CSD window borders
//
.csd:not(tooltip):not(.popup)
{
    @include __wintc_apply_props($csd_window_styles);

    $l_border_bottom: __wintc_get_prop($csd_window_styles, "border-bottom-width");
    $l_border_left:   __wintc_get_prop($csd_window_styles, "border-left-width");
    $l_border_right:  __wintc_get_prop($csd_window_styles, "border-right-width");
    $l_border_top:    __wintc_get_prop($csd_window_styles, "border-top-width");

    $l_bd_border_bottom: __wintc_get_prop($csd_window_backdrop_styles, "border-bottom-width");
    $l_bd_border_left:   __wintc_get_prop($csd_window_backdrop_styles, "border-left-width");
    $l_bd_border_right:  __wintc_get_prop($csd_window_backdrop_styles, "border-right-width");
    $l_bd_border_top:    __wintc_get_prop($csd_window_backdrop_styles, "border-top-width");


    &:backdrop
    {
        @include __wintc_apply_props($csd_window_backdrop_styles);
    }

    &.tiled,
    &.tiled-top,
    &.tiled-right,
    &.tiled-bottom,
    &.tiled-left,
    &.maximized,
    &.fullscreen
    {
        border: none;
    }

    // This padding pushes some dialog content inwards, to prevent overlapping with
    // the window border
    //
    .dialog-vbox
    {
        padding: 8px;
    }

    // Style revealers that are top-level in the CSD, otherwise they will be missing
    // borders on their sides
    //
    > box > searchbar > revealer > box
    {
        @include __wintc_apply_props_for_category($csd_window_styles, "borders");

        border-top: 0px;
        border-bottom: 0px;

        &:backdrop
        {
            @include __wintc_apply_props_for_category($csd_window_backdrop_styles, "borders");

            border-top: 0px;
            border-bottom: 0px;
        }
    }

    // This border-radius is necessary to fix rendering artifacts introduced in
    // GTK 3.24.24 / XFCE 4.16
    //
    decoration
    {
        @if $csd_window_hack_border_radius > 0px
        {
            border-radius: $csd_window_hack_border_radius;
        }
    }

    // FIXME: This bodge fixes GLADE, which uses a stack - padding to the window
    //        itself did not fix the issue so this was the next best thing
    //
    //        Not sure if it causes problems with other programs however...
    //
    > stack
    {
        padding: 0px $l_border_right $l_border_bottom $l_border_left;
    }

    &:backdrop > stack
    {
        padding: 0px $l_bd_border_right $l_bd_border_bottom $l_bd_border_left;
    }
}
