// Role assignments for the Darkmatter palette.
//
// Ported from Nordic's _colors.scss and kept variable-for-variable compatible,
// so every widget partial compiles unchanged. Where a derivation is inherited
// it is left alone; where Nordic's base was mid-dark and Darkmatter's is
// near-black, a darken() would bottom out at black — those few are noted and
// resolved against a palette step instead.

// Main definitions
$base_color: $dm_base;
$text_color: $dm_fg;
$bg_color: $dm_bg;
$fg_color: $dm_fg;
$switch_bg: if($variant == 'light', #ffffff, transparentize(black,1));

$main_dark_color: $dm_dark;
$_sidebar_color: $dm_dark;

// Primary colors
// The scheme carries no green, blue or purple. Rather than import colors from
// outside it, the roles that Nordic spread across six hues collapse onto the
// three the scheme does have.
$lime: $dm_teal;
$red: $dm_red;
$orange: $dm_orange;
$yellow: $dm_cream;
$purple: $dm_cream;
$darkpurple: $dm_teal;
$blue: $dm_teal;
$cyan: $dm_orange;      // drives suggested-action buttons; must match selection
$slider: $dm_orange;
$teal: $dm_teal;

$selected_fg_color: $dm_bg;
$selected_bg_color: $dm_orange;
$selected_borders_color: darken($selected_bg_color, 10%);
$borders_color: $dm_border;                  // Nordic darkens the dark color; here that is black
$borders_edge: if($variant == 'light', transparentize(white, 0.8), transparentize(white, 0.9));
$link_color: $dm_orange;
$link_visited_color: transparentize($link_color, 0.5);
$top_highlight: if($variant == 'light', transparentize(white, 0.8), transparentize(white, 0.9));
$bottom_highlight: if($variant == 'light', transparentize(black, 0.8), transparentize(black, 0.9));
$dark_fill: mix($borders_color, $bg_color, 35%);
$headerbar_color: $dm_dark;
$headerbar_fg_color: $text_color;
$menu_color: if($variant == 'light', $base_color, mix($bg_color, $base_color, 20%));
$popover_bg_color: $base_color;
$popover_hover_color: $dm_hover;             // Nordic darkens; on near-black hover must go lighter

$scrollbar_bg_color: mix($base_color, $bg_color, 50%);
$scrollbar_slider_color: $dm_dim;            // Nordic's fg/bg mix lands near-white here; too loud
$scrollbar_slider_hover_color: $dm_subtle;
$scrollbar_slider_active_color: $dm_orange;

$warning_color: $dm_cream;
$error_color: $dm_red;
$success_color: $dm_teal;
$destructive_color: $dm_red;
$suggested_color: $dm_orange;

$osd_fg_color: $fg_color;
$osd_text_color: $text_color;
$osd_bg_color: transparentize($dm_dark, 0.07);
$osd_insensitive_bg_color: transparentize(mix($osd_fg_color, opacify($osd_bg_color, 1), 10%), 0.5);
$osd_insensitive_fg_color: mix($osd_fg_color, opacify($osd_bg_color, 1), 50%);
$osd_borders_color: $borders_color;

$sidebar_bg_color: mix($bg_color, $base_color, 50%);
$base_hover_color: transparentize($fg_color, 0.95);

$tooltip_borders_color: $borders_color;
// Deeper than Nordic's 0.9: on near-black surfaces a 10% shadow is invisible,
// and popovers need to separate from the window behind them.
$shadow_color: transparentize(black, 0.75);

$text_shadow_color: if($variant == 'dark', $shadow_color, transparentize(white, 0.9));
$icon_shadow_color: $text_shadow_color;

$drop_target_color: $dm_orange;

// Infobar colors
$info_color: $dm_teal;
$question_color: $dm_teal;

// Panel colors
$panel_bg_color: transparentize($main_dark_color, 0);
$panel_fg_color: $fg_color;
$panel_borders_color: transparentize($main_dark_color, 0.8);

// Disabled state colors
$insensitive_fg_color: mix($fg_color, $bg_color, 50%);
$insensitive_bg_color: mix($bg_color, $base_color, 60%);
$insensitive_base_color: darken($base_color, 5%);
$insensitive_borders_color: transparentize($borders_color, 0.7);

// Backdrop state colors
$backdrop_base_color: if($variant == 'light', darken($base_color, 1%), lighten($base_color, 1%));
$backdrop_text_color: mix($text_color, $backdrop_base_color, 80%);
$backdrop_bg_color: $bg_color;
$backdrop_headerbar_bg_color: $headerbar_color;
$backdrop_headerbar_fg_color: if($variant == 'light', transparentize($headerbar_fg_color, 0.5), transparentize($headerbar_fg_color, 0.2));
$backdrop_fg_color: mix($fg_color, $backdrop_bg_color, 50%);
$backdrop_insensitive_color: if($variant == 'light', darken($backdrop_bg_color, 15%), lighten($backdrop_bg_color, 15%));
$backdrop_selected_bg_color: transparentize($selected_bg_color, 0.4);
$backdrop_selected_fg_color: if($variant == 'light', $selected_fg_color, transparentize($selected_fg_color, 0.5));
$backdrop_borders_color: mix($borders_color, $bg_color, 90%);
$backdrop_dark_fill: mix($backdrop_borders_color, $backdrop_bg_color, 35%);
$backdrop_sidebar_bg_color: mix($backdrop_bg_color, $backdrop_base_color, 50%);

$backdrop_scrollbar_bg_color: darken($backdrop_bg_color, 3%);
$backdrop_scrollbar_slider_color: mix($backdrop_fg_color, $backdrop_bg_color, 40%);

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

$scale_bg: if($variant == 'light', transparentize(black, 0.86), transparentize(white, 0.86));
$scale_disabled_bg: if($variant == 'light', transparentize(black, 0.94), transparentize(white, 0.94));
$suggested_bg_color: linear-gradient(to right, $dm_orange 0%, $dm_orange 100%);
$destructive_bg_color: linear-gradient(to right, $red, $red);
$menu_shadow_color: if($variant == 'light', transparentize(rgb(122, 122, 122), 0.6), $borders_color);
