// When color definition differs for dark and light variant
// it gets @if ed depending on $variant

// Some named colors from _defaults.scss
$window_bg_color: gtkcolor(window_bg_color);
$window_fg_color: gtkcolor(window_fg_color);
$view_bg_color: gtkcolor(view_bg_color);
$view_fg_color: gtkcolor(view_fg_color);
$accent_bg_color: gtkcolor(accent_bg_color);
$accent_fg_color: gtkcolor(accent_fg_color);
$accent_color: gtkcolor(accent_color);
$headerbar_bg_color: gtkcolor(headerbar_bg_color);
$headerbar_fg_color: gtkcolor(headerbar_fg_color);
$headerbar_border_color: gtkalpha(gtkcolor(headerbar_border_color), .15);
$headerbar_backdrop_color: gtkcolor(headerbar_backdrop_color);
$headerbar_shade_color: gtkcolor(headerbar_shade_color);
$headerbar_darker_shade_color: gtkcolor(headerbar_darker_shade_color);
$card_bg_color: gtkcolor(card_bg_color);
$card_fg_color: gtkcolor(card_fg_color);
$card_shade_color: gtkcolor(card_shade_color);
$popover_bg_color: gtkcolor(popover_bg_color);
$popover_fg_color: gtkcolor(popover_fg_color);
$popover_shade_color: gtkcolor(popover_shade_color);
$dialog_bg_color: gtkcolor(dialog_bg_color);
$dialog_fg_color: gtkcolor(dialog_fg_color);
$warning_bg_color: gtkcolor(warning_bg_color);
$warning_fg_color: gtkcolor(warning_fg_color);
$warning_color: gtkcolor(warning_color);
$error_bg_color: gtkcolor(error_bg_color);
$error_fg_color: gtkcolor(error_fg_color);
$error_color: gtkcolor(error_color);
$success_bg_color: gtkcolor(success_bg_color);
$success_fg_color: gtkcolor(success_fg_color);
$success_color: gtkcolor(success_color);
$destructive_bg_color: gtkcolor(destructive_bg_color);
$destructive_fg_color: gtkcolor(destructive_fg_color);
$destructive_color: gtkcolor(destructive_color);
$sidebar_bg_color: gtkcolor(sidebar_bg_color);
$sidebar_fg_color: gtkcolor(sidebar_fg_color);
$sidebar_backdrop_color: gtkcolor(sidebar_backdrop_color);
$sidebar_border_color: gtkcolor(sidebar_border_color);
$sidebar_shade_color: gtkcolor(sidebar_shade_color);

$base_color: $view_bg_color;
$text_color: $view_fg_color;
$caret_color: if($variant == 'light', gtkshade($text_color, 1.05), gtkshade($text_color, 0.97));
$bg_color: $window_bg_color;
$fg_color: $window_fg_color;

$selected_fg_color: $accent_fg_color;
$selected_bg_color: $accent_bg_color;
$selected_borders_color: if($variant== 'light', gtkmix(black, $selected_bg_color, 15%), gtkmix(black, $selected_bg_color, 30%));
$borders_color: if($variant == 'light', gtkmix(currentColor, $bg_color, 14.7%), gtkmix(currentColor, $bg_color, 15%));
$alt_borders_color: if($variant == 'light', gtkmix(black, $bg_color, 24%), gtkmix(black, $bg_color, 18%));
$spinbutton_borders_color: gtkalpha(currentColor, 0.15);
$borders_edge: if($variant == 'light', gtkalpha(white, 0.5), gtkalpha($fg_color, 0.07));
$link_color: $accent_color;
$link_visited_color: gtkmix($accent_color, $view_fg_color, 80%);
$top_hilight: $borders_edge;
$dark_fill: gtkmix($borders_color, $bg_color, 50%);
$popover_hover_color: gtkalpha(currentColor, .07);
$menu_color: $popover_bg_color;

$scrollbar_bg_color: $base_color;
$scrollbar_slider_color: gtkalpha(currentColor, .2);
$scrollbar_slider_hover_color: gtkalpha(currentColor, .4);
$scrollbar_slider_active_color: gtkalpha(currentColor, .6);

$osd_fg_color: transparentize(white, .1);
$osd_text_color: white;
$osd_bg_color: transparentize(black, 0.3);
$osd_insensitive_bg_color: transparentize(black, 0.35);
$osd_insensitive_fg_color: gtkmix($osd_fg_color, opacify($osd_bg_color, 1), 50%);
$osd_borders_color: transparentize(black, 0.1);

$tooltip_borders_color: transparentize(white, 0.9);
$shadow_color: transparentize(black, 0.9);

$drop_target_color: $selected_bg_color;

//insensitive state derived colors
$insensitive_fg_color: gtkmix($fg_color, $bg_color, 50%);
$insensitive_bg_color: gtkmix($bg_color, $base_color, 60%);
$insensitive_borders_color: $borders_color;

//colors for the backdrop state, derived from the main colors.
$backdrop_base_color: $bg_color;
$backdrop_text_color: gtkmix($text_color, $backdrop_base_color, 50%);
$backdrop_bg_color: $bg_color;
$backdrop_fg_color: gtkmix($fg_color, $backdrop_bg_color, 50%);
$backdrop_insensitive_color: gtkmix($backdrop_fg_color, $backdrop_bg_color, 50%);
$backdrop_selected_fg_color: if($variant == 'light', $backdrop_base_color, $backdrop_text_color);
$backdrop_borders_color: if($variant == 'light', gtkmix(currentColor, $bg_color, 19%), gtkmix(currentColor, $bg_color, 27%));
$backdrop_dark_fill: gtkmix($backdrop_borders_color, $backdrop_bg_color, 70%);

$backdrop_scrollbar_bg_color: $backdrop_bg_color;
$backdrop_scrollbar_slider_color: $scrollbar_slider_color;

$backdrop_menu_color: if($variant == 'light', $backdrop_base_color, gtkmix($backdrop_bg_color, $backdrop_base_color, 20%));

//special cased widget colors
$suggested_bg_color: $selected_bg_color;
$suggested_border_color: $selected_borders_color;
$progress_bg_color: $selected_bg_color;
$progress_border_color: $selected_borders_color;
$checkradio_bg_color: $selected_bg_color;
$checkradio_fg_color: $selected_fg_color;
$checkradio_borders_color: if($variant == 'light', gtkmix(black,$checkradio_bg_color,20%), gtkmix(black,$checkradio_bg_color,40%));

// Custom colors
$disabled_headerbar_fg: gtkmix($headerbar_fg_color, $headerbar_bg_color, 50%);
$backdrop_headerbar_fg: gtkmix($headerbar_fg_color, $headerbar_backdrop_color, 50%);
$disabled_card_fg: gtkmix($card_fg_color, $card_bg_color, 50%);
$disabled_popover_fg: gtkmix($popover_fg_color, $popover_bg_color, 50%);
$incognito_bg_color: gtkcolor(incognito_bg_color); // adw-gtk3 specific: gtk3 gnome web
$new_title_bg_color: gtkcolor(new_title_bg_color); // adw-gtk3 specific for a few selected apps

// titlebuttons
$titlebutton_normal: gtkalpha(currentColor, .1);
$titlebutton_normal_hover: gtkalpha(currentColor, .15);
$titlebutton_normal_active: gtkalpha(currentColor, .3);
$titlebutton_backdrop: gtkalpha(currentColor, .1);
$titlebutton_backdrop_hover: gtkalpha(currentColor, .15);

// Other colors from libadwaita
$focus_border_opacity: 0.5;
$focus_border_color: gtkalpha($accent_color, $focus_border_opacity);
$border_color: gtkalpha(currentColor, .15); // not the same as borderS-color

$hover_color: gtkalpha(currentColor, .07);
$active_color: gtkalpha(currentColor, .16);
$selected_color: gtkalpha(currentColor, .1);
$selected_hover_color: gtkalpha(currentColor, .13);
$selected_active_color: gtkalpha(currentColor, .19);

$view_hover_color: gtkalpha(currentColor, .04);
$view_active_color: gtkalpha(currentColor, .08);
$view_selected_color: gtkalpha($accent_bg_color, .25);
$view_selected_hover_color: gtkalpha($accent_bg_color, .32);
$view_selected_active_color: gtkalpha($accent_bg_color, .39);

$trough_color: gtkalpha(currentColor, .15);
$trough_hover_color: gtkalpha(currentColor, .2);
$trough_active_color: gtkalpha(currentColor, .25);

$switch_color: gtkalpha(currentColor, .15);
$switch_hover_color: gtkalpha(currentColor, .2);

$slider_color: gtkmix(white, $base_color, 80%);
$slider_hover_color: white;

$fill_color: $selected_bg_color;
$fill_text_color: $selected_fg_color;

// Notebook and tabs
$notebook_color: $base_color;
$tab_color: if($variant == 'light', gtkmix(currentColor, $bg_color, 12%), gtkmix(currentColor, $bg_color, 1%));
$tab_color_hover: if($variant == 'light', gtkmix(currentColor, $bg_color, 14.7%), gtkmix(currentColor, $bg_color, 3.7%));
$tab_color_active: if($variant == 'light', gtkmix(currentColor, $bg_color, 7.7%), gtkmix(currentColor, $bg_color, 5.7%));
$tab_color_active_hover: if($variant == 'light', gtkshade($tab_color_active, 0.971), gtkshade($tab_color_active, 1.11));
$tab_color_backdrop: if($variant == 'light', gtkmix(currentColor, $bg_color, 10%), gtkmix(currentColor, $bg_color, -7%));
$tab_color_backdrop_hover: if($variant == 'light', gtkmix(currentColor, $bg_color, 16%), gtkmix(currentColor, $bg_color, -1.7%));
$tab_color_backdrop_active: $bg_color;
