@charset "UTF-8";

/***************
 * Header bars *
 ***************/

%titlebar,
headerbar {
	padding: 0px 6px;
	border-width: 0px 0px 1px 0px;
	border-radius: $window-border-radius $window-border-radius 0px 0px;
	border-style: solid;
	border-color: gtk("@borders");
	color: gtk("@theme_titlebar_foreground");
	background-image: none;
	background-color: gtk("@theme_titlebar_background");
	border-top: 1px solid lighter(gtk("@theme_titlebar_background"));

	&:backdrop {
		background-image: none;
		background-color: gtk(
			"@theme_titlebar_background_backdrop"
		);
		color: gtk("@theme_titlebar_foreground_backdrop");
		border-top: 1px solid lighter(gtk("@theme_titlebar_background_backdrop"));
		box-shadow: none;
	}
	label {
		font-weight: normal;
		&:backdrop {
			color: gtk("@theme_titlebar_foreground_backdrop");
		}
	}
	.path-bar button {
		color: gtk("@theme_titlebar_foreground");
		font-weight: normal;
		&:backdrop {
			color: gtk("@theme_titlebar_foreground_backdrop");
		}
	}
	.linked button {
		@include neobutton(normal);
	}
	button {
		@include neobutton(toolbutton);

		//ensure we don't have a shadow on headerbar buttons at all
		box-shadow: none;
		color: gtk("@theme_titlebar_foreground");

		&:hover {
			color: gtk("@theme_titlebar_foreground");
		}

		&:backdrop {
			background-image: none;
			background-color: gtk(
				"@theme_titlebar_background_backdrop"
			);
			color: gtk("@theme_titlebar_foreground_backdrop");
		}

		&.flat:backdrop,
		&.flat:backdrop:disabled,
		&:disabled:backdrop {
			background-image: none;
			background-color: gtk(
				"@theme_titlebar_background_backdrop"
			);
			color: gtk("@theme_titlebar_foreground_backdrop");
			border-color: transparent;
		}
		&.flat:disabled {
			@extend %undecorated_button;
			color: gtk("@theme_titlebar_foreground_insensitive");
		}
		&:disabled {
			background-color: transparent;
			background-image: none;
			border-color: transparent;
			color: gtk("@theme_titlebar_foreground_insensitive");
		}
	}

	.title {
		font-weight: normal;
		padding: 0px 12px;
		&:backdrop {
			color: gtk("@theme_titlebar_foreground_backdrop");
		}
	}

	.subtitle {
		font-size: smaller;
		padding: 0 12px;
		@extend .dim-label;
		&:backdrop {
			color: gtk("@theme_titlebar_foreground_backdrop");
		}
	}

	separator {
		border-width: 0px;
		background-color: transparent;
		background-image: none;
		border-color: transparent;
	}

	&.selection-mode,
	&.selection-mode headerbar {
		background-color: gtkmix(
			"@theme_titlebar_background",
			"@theme_button_decoration_focus",
			0.5
		);
		separator {
			background-color: gtk(
				"@theme_button_decoration_focus"
			);
		}
		button:not(.titlebutton) {
			background-color: gtkalpha(
				gtk("@theme_button_decoration_focus"),
				0.5
			);
			&:active,
			&:focus {
				background-color: gtk(
					"@theme_button_decoration_focus"
				);
			}
		}

		.subtitle:link {
			@extend %link, :selected;
		}

		.selection-menu {
			padding: 4px 6px;

			GtkArrow {
				-GtkArrow-arrow-scaling: 1;
			}

			.arrow {
				-gtk-icon-source: -gtk-icontheme($arrow_down);
				-gtk-icon-shadow: none;
			}
		}
	}

	.tiled &,
	.maximized & {
		border-radius: 0; // squared corners when the window is max'd or tiled
	}
}

headerbar {
	// add vertical margins to headerbar entries, buttons and separators to avoid them spanning the whole height
	entry,
	spinbutton,
	separator,
	button {
		margin-top: 8px;
		margin-bottom: 8px;
	}
}
