/* The Commix modal — the header band (the icon logo and the word logo, as on the Commix admin pages), the title,
   the content, tips, news (always on), the actions (Cancel last). In the active Style's colours (--primary,
   --primary-foreground, --foreground, --card, --border set on .commix-modal). assets/js/modal.js builds it. */
.commix-modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 1000000;
	display: grid;
	place-items: center;
	padding: 16px;
	background: rgba(10, 12, 18, 0.45);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.commix-modal-backdrop.commix-modal-open {
	opacity: 1;
}

.commix-modal {
	--commix-modal-accent: var(--primary, #2271b1);
	position: relative;
	width: 100%;
	max-width: 500px;
	max-height: calc(100vh - 32px);
	overflow: auto;
	box-sizing: border-box;
	border-radius: 18px;
	background: var(--card, #ffffff);
	color: var(--foreground, #1e1e1e);
	border: 1px solid var(--border, rgba(0, 0, 0, 0.08));
	border-top: 3px solid var(--commix-modal-accent);
	box-shadow: 0 24px 60px -16px rgba(0, 0, 0, 0.35), 0 4px 12px rgba(0, 0, 0, 0.08);
	font-size: 14px;
	line-height: 1.5;
	transform: translateY(14px) scale(0.98);
	transition: transform 0.32s cubic-bezier(0.21, 1.02, 0.73, 1);
}

.commix-modal-open .commix-modal {
	transform: none;
}

/* One Commix modal, always in the active Style: a modal's kind (info, warning, danger) changes no colour. */

.commix-modal-header {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 12px 12px 18px;
	background: linear-gradient(100deg, color-mix(in srgb, var(--commix-modal-accent) 12%, var(--card, #ffffff)) 0%, var(--card, #ffffff) 85%);
	border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.08));
}

.commix-modal-brand {
	flex: 1;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.commix-modal-logo {
	flex: none;
	width: 32px;
	height: 32px;
}

/* The word logo — as the admin pages' (Michroma, the Style's primary into its text colour). */
.commix-modal-wordmark {
	font-family: 'Michroma', sans-serif;
	font-size: 17px;
	letter-spacing: 0.02em;
	line-height: 1;
	background-image: linear-gradient(96deg, var(--primary, #2271b1) 0%, var(--foreground, #1e1e1e) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.commix-modal-logo svg {
	display: block;
	width: 100%;
	height: 100%;
}

.commix-modal-title {
	margin: 0;
	padding: 18px 20px 4px;
	text-align: center;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	color: inherit;
}

.commix-modal-close {
	flex: none;
	width: 30px;
	height: 30px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: inherit;
	opacity: 0.5;
	font-size: 20px;
	line-height: 30px;
	cursor: pointer;
}

.commix-modal-close:hover,
.commix-modal-close:focus-visible {
	opacity: 0.9;
	background: rgba(0, 0, 0, 0.06);
}

.commix-modal-timer {
	display: block;
	height: 2px;
	margin: 0;
	background: var(--commix-modal-accent);
	opacity: 0.6;
	transform-origin: left center;
}

.commix-modal-content {
	padding: 6px 20px 4px;
	text-align: center;
	transition: opacity 0.18s ease;
}

/* An update's fade: the old message and loader out, the new ones in (assets/js/modal.js). */
.commix-modal-content.commix-modal-fading {
	opacity: 0;
}

.commix-modal-content p {
	margin: 0 0 10px;
}

.commix-modal-tips,
.commix-modal-news {
	margin: 8px 20px 0;
	padding: 10px 12px;
	border-radius: 10px;
	font-size: 13px;
}

.commix-modal-tips {
	background: color-mix(in srgb, var(--commix-modal-accent) 10%, transparent);
}

.commix-modal-news {
	background: color-mix(in srgb, var(--foreground, #1e1e1e) 4%, transparent);
	color: color-mix(in srgb, var(--foreground, #1e1e1e) 85%, transparent);
}

.commix-modal-tips p,
.commix-modal-news p {
	margin: 2px 0 0;
}

.commix-modal-news a {
	color: var(--commix-modal-accent);
}

.commix-modal-section-label {
	display: block;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	opacity: 0.7;
}

.commix-modal-actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-start;
	gap: 8px;
	padding: 18px 20px 20px;
}

/* Cancel — the last action — stands apart, at the end. */
.commix-modal-actions .commix-modal-button:last-child:not(:first-child) {
	margin-left: auto;
}

/* actionsAlign: 'center' — the actions in the middle. */
.commix-modal-actions-center {
	justify-content: center;
}

.commix-modal-actions-center .commix-modal-button:last-child:not(:first-child) {
	margin-left: 0;
}

.commix-modal-button {
	margin: 0;
	padding: 8px 16px;
	border: 1px solid transparent;
	border-radius: 9px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: filter 0.15s ease, background 0.15s ease;
}

.commix-modal-button-secondary {
	background: transparent;
	color: inherit;
	border-color: rgba(0, 0, 0, 0.15);
}

.commix-modal-button-secondary:hover {
	background: rgba(0, 0, 0, 0.05);
}

.commix-modal-button-primary {
	background: var(--primary, #2271b1);
	color: var(--primary-foreground, #ffffff);
}

.commix-modal-button-danger {
	background: var(--primary, #2271b1);
	color: var(--primary-foreground, #ffffff);
}

.commix-modal-button-primary:hover,
.commix-modal-button-danger:hover {
	filter: brightness(1.08);
}

.commix-modal-button:focus-visible,
.commix-modal-close:focus-visible {
	outline: 2px solid var(--commix-modal-accent);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.commix-modal,
	.commix-modal-open .commix-modal {
		transform: none;
		transition: none;
	}
}

.commix-modal-button:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	filter: none;
}

/* The Commix loader, in the Style's colours. */
.commix-modal-loader {
	display: flex;
	justify-content: center;
	padding: 10px 0 6px;
	--cx-ink: color-mix(in srgb, var(--foreground, #1e1e1e) 22%, transparent);
	--cx-a: var(--primary, #2271b1);
	--cx-mid: color-mix(in srgb, var(--primary, #2271b1) 60%, var(--foreground, #1e1e1e));
	--cx-b: var(--primary, #2271b1);
}

.commix-modal-loader svg {
	display: block;
	width: 150px;
	max-width: 60%;
	height: auto;
}

/* A message that came back with an update (an answer) — more dominant than the one before it. */
.commix-modal-content.commix-modal-answer p {
	font-weight: 600;
}
