/*
 * The windows a button grows into (js/components/pop.js), the backdrop behind them, and toasts.
 * One look for all four kinds: a raised card at height 3 (a dialog at 4), 18 px corners.
 */

.win {
	--win-radius: var(--radius-card);
	position: fixed;
	z-index: 100;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--border);
	border-top-color: var(--edge-top);
	border-radius: var(--win-radius);
	background: var(--surface);
	box-shadow: var(--window-shadow);
	transform-origin: 0 0;
}

.win--dialog {
	box-shadow: var(--edge-light), var(--elev-4);
}

.win-body {
	flex: 1;
	min-height: 0;
	overflow: auto;
	overscroll-behavior: contain;
}

.win--menu .win-body {
	padding: 6px;
}

.win--dialog .win-body {
	padding: 18px 20px 16px;
}

.win--card .win-body,
.win--wide .win-body {
	padding: 4px 16px 16px;
}

.win-head {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 12px 8px 18px;
}

.win-title,
.modal-title {
	font-size: calc(15px * var(--ui-scale));
	font-weight: 600;
	color: var(--text-strong);
}

.win-text,
.modal-body,
.modal-hint {
	margin: 6px 0 0;
	color: var(--muted);
}

.win--dialog .field {
	margin-top: 12px;
}

.win-actions,
.modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 18px;
}

.btn--danger-solid {
	border-color: var(--danger);
	background: var(--face-solid), var(--danger);
	color: #fff;
}

.btn--danger-solid:hover {
	background: var(--face-solid), var(--danger);
	filter: brightness(1.08);
}

.win-sep {
	height: 1px;
	margin: 5px 6px;
	background: var(--border);
}

.win-hint {
	padding: 6px 10px 4px;
	font-size: calc(12px * var(--ui-scale));
	color: var(--muted);
}

/* the programs' names for a window's parts (.modal-title …, their modal.js): the same look; a solid button among the
   actions is as wide as its words */
.modal-title {
	margin: 0;
}

.modal-hint {
	font-size: calc(12px * var(--ui-scale));
}

:is(.win-actions, .modal-actions) .btn-primary {
	width: auto;
}

.win .form {
	gap: 12px;
}

/* a choice that is the one picked: a tick at the far end */
.flat-check {
	display: inline-flex;
	margin-left: auto;
	color: var(--text-strong);
}

.win-check,
.modal-check {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 14px;
	color: var(--text);
	cursor: pointer;
}

/* one of a few choices in a dialog (a radio and its words) */
.modal-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.modal-option {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	color: var(--text);
	cursor: pointer;
}

.modal-option input {
	margin-top: 3px;
}

.win .flat.is-danger,
.win .flat.is-danger svg {
	color: var(--danger);
}

/* the side card on wide screens is part of the work area (it made room for it): a card like the sidebar's */
.win--card.is-docked {
	background: var(--card-bg);
	box-shadow: var(--card-shadow);
}

/* the button stands in the window while it is open */
.is-away {
	visibility: hidden;
}

/* ---- the backdrop (html[data-backdrop]: none, dim (also when unset), blur) ---- */

.veil {
	position: fixed;
	inset: 0;
	z-index: 99;
	background: var(--veil-dim);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--dur) var(--ease);
}

.veil.is-on {
	opacity: 1;
	pointer-events: auto;
}

:root[data-backdrop="none"] .veil {
	background: transparent;
}

/* blur: a light dim with it, so the window still stands out on a busy page */
:root[data-backdrop="blur"] .veil {
	background: rgb(0 0 0 / 0.08);
	backdrop-filter: blur(var(--veil-blur));
	-webkit-backdrop-filter: blur(var(--veil-blur));
}

/* ---- toasts ---- */

.toasts {
	position: fixed;
	left: 50%;
	bottom: 20px;
	z-index: 200;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	transform: translateX(-50%);
	pointer-events: none;
}

.toast {
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: min(440px, calc(100vw - 32px));
	padding: 9px 16px 9px 12px;
	border: 1px solid var(--border);
	border-top-color: var(--edge-top);
	border-radius: 999px;
	background: var(--surface);
	color: var(--text-strong);
	box-shadow: var(--window-shadow);
	opacity: 0;
	transform: translateY(16px) scale(0.96);
	pointer-events: auto;
	cursor: pointer;
	transition:
		opacity var(--dur) var(--ease-out),
		transform var(--dur) var(--ease-out);
}

.toast.is-on {
	opacity: 1;
	transform: none;
}

.toast svg {
	flex: none;
	color: var(--ok);
}

.toast.is-error svg {
	color: var(--danger);
}
