@import 'nord';
$variant: 'dark';
$accent: 'blue';

// Main definitions
$base_color: $nord0;
$text_color: $nord4;
$bg_color: $nord1;
$fg_color: $nord4;

$main_dark_color: darken($nord0, 2%);

// Primary colors
$lime: $nord7;
$red: $nord11;
$orange: $nord12;
$yellow: $nord13;
$purple: $nord15;
$darkpurple: #7b7bbd;
$blue: $nord10;
$cyan: $nord10;
$slider: #7b7bbd;
$teal: $nord14;

$selected_fg_color: $nord4;
$selected_bg_color: if($accent == 'blue', $nord9, $nord7);
$selected_borders_color: darken($selected_bg_color, 10%);
$borders_color: darken($main_dark_color, 5%);
$headerbar_color: mix($base_color, darken($bg_color, 8%), 30%);
$headerbar_fg_color: $text_color;
$menu_color: $main_dark_color;
$popover_bg_color: $main_dark_color;
$popover_hover_color: darken($bg_color, 2%);

$sidebar_bg_color: $main_dark_color;$base_hover_color: transparentize($fg_color, 0.95);

// 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_sidebar_bg_color: mix($backdrop_bg_color, $backdrop_base_color, 50%);


@namespace xul url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");

/* Variables that start with --nordic- are added by me and are assigned
 * to elements somewhere in this code. The rest of the variables are
 * built-in in Firefox, so you need to add an !important if you wanna
 * override them. */
 @media (prefers-color-scheme: dark) { 
	 
 
	:root {
		/* Browser area before a page starts loading */
		--nordic-browser-before-load-background: #{"" +$bg_color};

		/* Toolbars */
		--nordic-toolbar-background: #{"" +darken($base_color, 5%)};	
		--nordic-toolbar-color: #{"" +$fg_color};
		--nordic-toolbar-border-color: #{"" +$borders_color};
		--nordic-inactive-toolbar-background: #{"" +$backdrop_bg_color};	
		--nordic-inactive-toolbar-border-color: #{"" +$borders_color};

		/* Sidebar */
		--nordic-sidebar-background: #{"" +$sidebar_bg_color};
		--nordic-inactive-sidebar-background: #{"" +$backdrop_sidebar_bg_color};

		/* Popups */
		--nordic-menu-background: #{"" +$menu_color};
		--nordic-menu-border-color: #{"" +$borders_color};
		--nordic-popover-background: #{"" +$popover_bg_color};
		--nordic-popover-border-color: #{"" +$borders_color};
		--nordic-popover-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
		--nordic-popover-button-hover-background: #{"" +$popover_hover_color};
		--nordic-popover-separator-color: rgba(0, 0, 0, 0.1);
		--nordic-popover-color: #{"" +$fg_color};

		/* Header bar */
		--nordic-headerbar-background: #{"" +$headerbar_color};
		--nordic-headerbar-border-color: #{"" +$borders_color};
		--nordic-headerbar-box-shadow: inset 0 1px #{""+ $borders_color};
		--nordic-inactive-headerbar-background: #{"" +$backdrop_headerbar_bg_color};
		--nordic-inactive-headerbar-border-color: #{"" +$borders_color};
		--nordic-inactive-headerbar-box-shadow: inset 0 1px rgba(238, 238, 236, 0.07);

		/* Buttons */	
		--nordic-button-background: #{"" +darken($main_dark_color, 3%)};
		--nordic-button-border-color: #{"" +$borders_color};
		--nordic-button-border-accent-color: #{"" +$borders_color};	
		--nordic-button-box-shadow: transparent;	
		--nordic-button-hover-background: #{"" +transparentize($selected_bg_color, 0.3)};	
		--nordic-button-active-background: #{"" +transparentize($selected_bg_color, 0.3)};
		--nordic-button-active-border-color: #{"" +$borders_color};
		--nordic-button-active-border-accent-color: #{"" +$borders_color};
		--nordic-button-active-box-shadow: inset 0 1px rgba(224, 0, 0, 0);	
		--nordic-button-disabled-background: #{"" +$insensitive_bg_color};
		--nordic-button-disabled-border-color: #{"" +$insensitive_borders_color};
		--nordic-button-disabled-box-shadow: inset 0 1px rgba(255, 255, 255, 0);
		--nordic-inactive-button-background:#{"" +$main_dark_color};
		--nordic-inactive-button-border-color: #{"" +$borders_color};
		--nordic-inactive-button-box-shadow: inset 0 1px rgba(255, 255, 255, 0);
		--nordic-button-suggested-action-background: #{"" +$cyan};
		--nordic-button-suggested-action-border-color: #{"" +$cyan};
		--nordic-button-suggested-action-border-accent-color: #{"" +$borders_color};
		--nordic-button-suggested-action-box-shadow: inset 0 1px rgba(255, 255, 255, 0.02), 0 1px 2px rgba(0, 0, 0, 0.07);
		--nordic-button-suggested-action-hover-background: #{"" +lighten($cyan, 5%)};
		--nordic-button-suggested-action-active-background: #{"" +lighten($cyan, 5%)};
		--nordic-button-suggested-action-active-border-color: #{"" +$borders_color};
		--nordic-button-suggested-action-active-box-shadow: inset 0 1px rgba(255, 255, 255, 0);	
		--nordic-button-destructive-action-background: #{"" +$red};
		--nordic-button-destructive-action-border-color: #{"" +$red};
		--nordic-button-destructive-action-border-accent-color: #{"" +$borders_color};
		--nordic-button-destructive-action-box-shadow: inset 0 1px rgba(255, 255, 255, 0.02), 0 1px 2px rgba(0, 0, 0, 0.07);
		--nordic-button-destructive-action-hover-background: #{"" +lighten($red, 5%)};
		--nordic-button-destructive-action-active-background: #{"" +lighten($red, 5%)};
		--nordic-button-destructive-action-active-border-color: #{"" +lighten($red, 5%)};
		--nordic-button-destructive-action-active-box-shadow: inset 0 1px rgba(255, 255, 255, 0);

		/* URL bar */
		--nordic-urlbar-background: #{"" +darken($main_dark_color, 3%)};
		--nordic-urlbar-border-color: #{"" +$borders_color};
		--nordic-urlbar-box-shadow: inset 0 0 0 1px rgba(21, 83, 158, 0);
		--nordic-urlbar-color: #{"" +$fg_color};
		--nordic-inactive-urlbar-background: #{"" +$main_dark_color};
		--nordic-inactive-urlbar-border-color: #{"" +$borders_color};
		--nordic-inactive-urlbar-box-shadow: none;
		--nordic-inactive-urlbar-color: #d6d6d6;
		--nordic-focused-urlbar-border-color: #{"" +$selected_bg_color};
		--nordic-private-urlbar-background: #25003e;

		/* Tabs */
		--nordic-tabbar-tab-color: #{"" +$fg_color};
		--nordic-tabbar-tab-hover-background: #{"" +$base_color};
		--nordic-tabbar-tab-hover-border-bottom-color: #{"" +$borders_color};
		--nordic-tabbar-tab-hover-color: rgb(200, 200, 200);
		--nordic-tabbar-tab-active-background: #{"" +$base_color};
		--nordic-tabbar-tab-active-border-bottom-color: #{"" +$selected_bg_color};
		--nordic-tabbar-tab-active-color: #{"" +$fg_color};
		--nordic-tabbar-tab-active-hover-background: #{"" +$base_color};
		--nordic-inactive-tabbar-tab-color: #{"" +$fg_color};
		--nordic-inactive-tabbar-tab-active-background: #{"" +$backdrop_base_color};
		--nordic-inactive-tabbar-tab-active-border-bottom-color: #{"" +$backdrop_selected_bg_color};
		--nordic-inactive-tabbar-tab-active-color: #{"" +$fg_color};  

		/* Switch */
		--nordic-switch-active-background: #{"" +$selected_bg_color};

		--nordic-accent: #{"" +$selected_bg_color};
	}

 }