/**
 * Copyright 2020-2026 | Fabrice Creuzot (luigifab) <code~luigifab~fr>
 * https://github.com/luigifab/human-theme
 *
 * Forked from
 *  Copyright 2020 | Mike Kazantsev (mk-fg) <mk~fraggod~gmail~com>
 *  https://github.com/mk-fg/clearlooks-phenix-humanity
 *
 * Forked from
 *  Copyright 2011-2014 | Jean-Philippe Fleury
 *  Copyright 2013-2014 | Andrew Shadura
 *  https://github.com/jpfleury/clearlooks-phenix
 *
 * This program is free software, you can redistribute it or modify
 * it under the terms of the GNU General Public License (GPL) as published
 * by the free software foundation, either version 3 of the license, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but without any warranty, without even the implied warranty of
 * merchantability or fitness for a particular purpose. See the
 * GNU General Public License (GPL) for more details.
 */

/* --- window (title & border) -- (solid-csd without compositor, csd with compositor, ssd with muffin/mutter) --- */
/* window or dialog / with or without compositor / .titlebutton.icon .titlebutton.appmenu */
/* solid-csd + ssd + csd because headerbar can also be used with window decorator */

.background.dialog {
	padding: 12px 12px 13px;
}

.background.dialog.csd,
.background.dialog.solid-csd,
.background.dialog.ssd {
	padding: 3px;
}

.background.dialog.csd .dialog-vbox,
.background.dialog.solid-csd .dialog-vbox,
.background.dialog.ssd .dialog-vbox {
	padding: 10px 12px 13px;
}

.background.dialog .dialog-action-area {
	padding-top: 13px;
}

.background.dialog .dialog-action-area button {
	margin: 0 1px 0 7px;
	padding: 4px 8px 3px 8px;
}

.background.dialog .dialog-action-area:dir(rtl) button {
	margin: 0 7px 0 1px;
}

.background.csd,
.background.csd headerbar,
.background.ssd,
.background.ssd headerbar {
	border-radius: 7px 7px 0 0;
}

.background.csd,
.background.ssd,
.background.solid-csd {
	padding: 3px;
	border: 1px solid #6F6358; /* @todo metacity */
	border-top: 0;
	/* border-radius: 8px 8px 0 0; */
	background-color: @theme_bg;
	/* BEVEL FOCUSED / 3d beveled frame */
	box-shadow:
		inset 1px 0 shade(@theme_bg, 1.2),   /* left */
		inset -1px 0 shade(@theme_bg, 0.88), /* right */
		inset 0 -1px shade(@theme_bg, 0.88); /* bottom */
}

.background.csd.popup,
.background.ssd.popup {
	/* menu */
	padding: 0;
	border: 0;
	border-radius: 0;
	background-color: transparent;
	box-shadow: none;
}

.background.csd headerbar,
.background.ssd headerbar,
.background.solid-csd headerbar {
	margin: -3px -4px 0;
	padding: 0;
	min-height: 22px;
	/* border-radius: 8px 8px 0 0; */
	color: @theme_selected_fg;
	/* <draw_ops name="bevel"> titlebar outline */
	border: 1px solid shade(@theme_selected_bg, 0.7);
	/* <draw_ops name="bevel"> fancy gradient */
	background: linear-gradient(to bottom,
		shade(@theme_selected_bg, 1.08),
		shade(@theme_selected_bg, 1.02) 50%,
		shade(@theme_selected_bg, 1.0) 50%,
		shade(@theme_selected_bg, 0.94));
}

.background.csd headerbar image,
.background.ssd headerbar image,
.background.solid-csd headerbar image {
	/* -gtk-icon-transform: scale(0.75); */
	-gtk-icon-style: symbolic;
}

.background.csd headerbar entry,
.background.ssd headerbar entry,
.background.solid-csd headerbar entry {
	/* @todo */
	margin: 4px 0;
	padding: 1px 3px 2px;
	font-size: 85%;
	border: 0;
	box-shadow: none;
}

.background.csd headerbar label.title,
.background.ssd headerbar label.title,
.background.solid-csd headerbar label.title {
	padding-top: 2px;
	font-weight: bold;
}

.background.csd headerbar button:not(.minimize):not(.maximize):not(.close),
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):active,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):focus,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:focus,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):active:focus,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:focus,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close),
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):active,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):focus,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:focus,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):active:focus,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:focus,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close),
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):active,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):focus,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:focus,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):active:focus,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:focus {
	/* ChatGPT made the list */
	color: @theme_selected_fg;
	border: 1px solid transparent;
	background: transparent;
	box-shadow: none;
	outline: 0;
}

.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):active:checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):focus:checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:focus:checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):active:focus:checked,
.background.csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:focus:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):active:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):focus:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:focus:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):active:focus:checked,
.background.ssd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:focus:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):active:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):focus:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:focus:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):active:focus:checked,
.background.solid-csd headerbar button:not(.minimize):not(.maximize):not(.close):hover:active:focus:checked {
	/* ChatGPT made the list */
	color: @theme_selected_fg;
	border-color: @slider_border;
	background: darker(@theme_selected_bg);
	box-shadow: none;
	outline: 0;
}

.background.csd headerbar button,
.background.csd headerbar button.toggle,
.background.ssd headerbar button,
.background.ssd headerbar button.toggle,
.background.solid-csd headerbar button,
.background.solid-csd headerbar button.toggle {
	margin: 1px 3px;
	padding: 0 3px;
	border-radius: 3px;
}

.background.csd headerbar button label,
.background.ssd headerbar button label,
.background.solid-csd headerbar button label {
	margin: 1px 0 -1px;
	padding: 0;
}

.background.csd headerbar image.app-icon,
.background.ssd headerbar image.app-icon,
.background.solid-csd headerbar image.app-icon {
	margin: 0 6px; /* with gtk4-classic (appearance_appicon_headerbar.patch) */
}

.background.csd headerbar windowcontrols,
.background.ssd headerbar windowcontrols,
.background.solid-csd headerbar windowcontrols {
	margin: 2px 3px;
}

.background.csd headerbar windowcontrols button,
.background.ssd headerbar windowcontrols button,
.background.solid-csd headerbar windowcontrols button {
	margin: 0 2px;
	padding: 0;
	color: shade(@theme_base, 0.95);
	/* <draw_ops name="button_bg"> border outline */
	border: 1px solid shade(@theme_selected_bg, 0.6);
	/* <draw_ops name="button_bg"> fill gradient */
	background: linear-gradient(to bottom,
		shade(@theme_selected_bg, 1.1),
		shade(@theme_selected_bg, 1.02) 50%,
		shade(@theme_selected_bg, 1.0) 50%,
		shade(@theme_selected_bg, 0.92));
	/* <draw_ops name="button_bg" inside highlight, inside shadow, bottom border smooth effect */
	box-shadow:
		inset 0 1px shade(@theme_selected_bg, 1.18),  /* top */
		inset 1px 0 shade(@theme_selected_bg, 1.1),   /* left */
		inset -1px 0 shade(@theme_selected_bg, 1),    /* right */
		inset 0 -1px shade(@theme_selected_bg, 0.92), /* bottom (0.84+0.92) */
		1px 0 shade(@theme_selected_bg, 1.005),       /* right gradient (0.96>1.05) */
		-1px 0 shade(@theme_selected_bg, 1.005),      /* left gradient (0.96>1.05) */
		0 1px shade(@theme_selected_bg, 1.06);        /* bottom */
}

.background.csd headerbar windowcontrols button:hover,
.background.ssd headerbar windowcontrols button:hover,
.background.solid-csd headerbar windowcontrols button:hover {
	/* <draw_ops name="button_bg_prelight"> */
	border: 1px solid shade(@theme_selected_bg, 0.6);
	background: shade(@theme_selected_bg, 1.15);
}

.background.csd headerbar windowcontrols button:active,
.background.ssd headerbar windowcontrols button:active,
.background.solid-csd headerbar windowcontrols button:active {
	/* <draw_ops name="button_bg_pressed"> border outline */
	border: 1px solid shade(@theme_selected_bg, 0.7);
	/* <draw_ops name="button_bg_pressed"> fill gradient */
	background: linear-gradient(to bottom,
		shade(@theme_selected_bg, 0.95),
		shade(@theme_selected_bg, 0.9));
}

/* --- window (title & border) backdrop --- */

.background.csd:backdrop,
.background.ssd:backdrop,
.background.solid-csd:backdrop {
	border-color: shade(@theme_bg, 0.55);
	/* BEVEL UNFOCUSED / 3d beveled frame */
	box-shadow:
		inset 1px 0 shade(@theme_bg, 1.03),  /* left */
		inset -1px 0 shade(@theme_bg, 0.88), /* right */
		inset 0 -1px shade(@theme_bg, 0.88); /* bottom */
}

.background.csd:backdrop headerbar,
.background.ssd:backdrop headerbar,
.background.solid-csd:backdrop headerbar {
	color: mix(@theme_fg, @theme_bg, 0.45);
	/* <draw_ops name="bevel_unfocused"> rectangle */
	border: 1px solid shade(@theme_bg, 0.55);
	/* <draw_ops name="bevel_unfocused"> fancy gradient */
	background: linear-gradient(to bottom,
		shade(@theme_bg, 0.99),
		shade(@theme_bg, 0.95) 50%,
		shade(@theme_bg, 0.93) 50%,
		shade(@theme_bg, 0.89));
}

.background.csd:backdrop headerbar button:not(.minimize):not(.maximize):not(.close),
.background.ssd:backdrop headerbar button:not(.minimize):not(.maximize):not(.close),
.background.solid-csd:backdrop headerbar button:not(.minimize):not(.maximize):not(.close) {
	color: mix(@theme_fg, @theme_bg, 0.45);
}

.background.csd:backdrop headerbar button:not(.minimize):not(.maximize):not(.close):checked,
.background.ssd:backdrop headerbar button:not(.minimize):not(.maximize):not(.close):checked,
.background.solid-csd:backdrop headerbar button:not(.minimize):not(.maximize):not(.close):checked {
	/* same as close button */
	color: mix(@theme_fg, @theme_bg, 0.45);
	border-color: shade(@theme_bg, 0.6);
	background: linear-gradient(to bottom,
		shade(@theme_bg, 1.15),
		shade(@theme_bg, 1.07) 50%,
		shade(@theme_bg, 1.05) 50%,
		shade(@theme_bg, 0.97));
}

.background.csd:backdrop headerbar windowcontrols button,
.background.ssd:backdrop headerbar windowcontrols button,
.background.solid-csd:backdrop headerbar windowcontrols button {
	color: mix(@theme_fg, @theme_bg, 0.45);
	border: 1px solid shade(@theme_bg, 0.6);
	/* <draw_ops name="button_bg_unfocused"> fill gradient */
	background: linear-gradient(to bottom,
		shade(@theme_bg, 1.15),
		shade(@theme_bg, 1.07) 50%,
		shade(@theme_bg, 1.05) 50%,
		shade(@theme_bg, 0.97));
	/* <draw_ops name="button_bg" inside highlight, inside shadow, bottom border smooth effect */
	box-shadow:
		inset 0 1px shade(@theme_bg, 1.2),   /* top */
		inset 1px 0 shade(@theme_bg, 1.1),   /* left */
		inset -1px 0 shade(@theme_bg, 1.05), /* right */
		inset 0 -1px shade(@theme_bg, 0.89), /* bottom (0.89+0.97) */
		1px 0 shade(@theme_bg, 0.94),        /* right gradient (0.92>0.96) */
		-1px 0 shade(@theme_bg, 0.94),       /* left gradient (0.92>0.96) */
		0 1px shade(@theme_bg, 0.96);        /* bottom */
}

.background.csd:backdrop headerbar windowcontrols button:hover,
.background.ssd:backdrop headerbar windowcontrols button:hover,
.background.solid-csd:backdrop headerbar windowcontrols button:hover {
	/* @todo */
}

/* --- window (title & border) maximized --- */

.background.csd.maximized,
.background.ssd.maximized,
.background.solid-csd.maximized {
	padding: 0;
	border: 0;
	border-bottom: 1px solid #463731; /* @todo metacity */
	border-radius: 0;
	box-shadow: none;
}

.background.csd.maximized:backdrop,
.background.ssd.maximized:backdrop,
.background.solid-csd.maximized:backdrop {
	border-bottom-color: shade(@theme_bg, 0.55);
}

.background.csd.maximized headerbar,
.background.ssd.maximized headerbar,
.background.solid-csd.maximized headerbar {
	margin: 0 -3px 0;
	border-radius: 0;
}
