/* Envoi. Override any --envoi-* property from your theme. */
.envoi {
	--envoi-size: 24px;
	--envoi-fg: currentColor;
	--envoi-bg: transparent;
	--envoi-ring: currentColor;
	--envoi-hover-opacity: 0.7;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: calc(var(--envoi-size) / 2);
	margin: 1em 0;
}

.envoi--justify-center { justify-content: center; }
.envoi--justify-right { justify-content: flex-end; }
.envoi--justify-space-between { justify-content: space-between; }

/* Inside the block, spacing comes from the block's own margin settings. */
.wp-block-envoi-share > .envoi {
	margin: 0;
}

.envoi__label {
	font-weight: 600;
}

/* Element + class selectors win over typical theme rules like ".entry-content a". */
.envoi a.envoi__btn,
.envoi button.envoi__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: content-box;
	min-width: 24px; /* WCAG 2.2 target size, even for small icons */
	min-height: 24px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--envoi-bg);
	box-shadow: none;
	color: var(--envoi-fg);
	font: inherit;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	transition: color 0.15s, background-color 0.15s, opacity 0.15s;
}

.envoi a.envoi__btn:hover,
.envoi button.envoi__btn:hover,
.envoi a.envoi__btn:focus-visible,
.envoi button.envoi__btn:focus-visible {
	/* Hover vars are unset by default so they fall back per button (e.g. to its brand colour). */
	background: var(--envoi-bg-hover, var(--envoi-bg));
	color: var(--envoi-fg-hover, var(--envoi-fg));
	opacity: var(--envoi-hover-opacity);
}

.envoi .envoi__btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.envoi:not(.envoi--plain) a.envoi__btn,
.envoi:not(.envoi--plain) button.envoi__btn {
	padding: calc(var(--envoi-size) * 0.4);
	box-shadow: inset 0 0 0 1.5px var(--envoi-ring);
}

.envoi.envoi--circle .envoi__btn.envoi__btn {
	border-radius: 50%;
}

.envoi.envoi--rounded .envoi__btn.envoi__btn {
	border-radius: 25%;
}

.envoi__icon {
	display: block;
	width: var(--envoi-size);
	height: var(--envoi-size);
}

.envoi__icon--fill {
	fill: currentColor;
}

.envoi__icon--line {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.envoi__status {
	font-size: 0.875em;
}

/* Brand colours: Simple Icons 16.30.0 hex values; LinkedIn from its brand guidelines;
   Fediverse from the Eukombos logo; neutral grey for device actions. */
.envoi__btn--share,
.envoi__btn--copy,
.envoi__btn--email,
.envoi__btn--sms,
.envoi__btn--print { --envoi-brand: #555; }
.envoi__btn--fediverse { --envoi-brand: #a730b8; }
.envoi__btn--mastodon { --envoi-brand: #6364ff; }
.envoi__btn--misskey { --envoi-brand: #a1ca03; }
.envoi__btn--lemmy { --envoi-brand: #000; }
.envoi__btn--bluesky { --envoi-brand: #1185fe; }
.envoi__btn--microblog { --envoi-brand: #f80; }
.envoi__btn--signal { --envoi-brand: #3b45fd; }
.envoi__btn--threema { --envoi-brand: #3fe669; }
.envoi__btn--telegram { --envoi-brand: #26a5e4; }
.envoi__btn--whatsapp { --envoi-brand: #25d366; }
.envoi__btn--threads { --envoi-brand: #000; }
.envoi__btn--facebook { --envoi-brand: #0866ff; }
.envoi__btn--x { --envoi-brand: #000; }
.envoi__btn--linkedin { --envoi-brand: #0a66c2; }
.envoi__btn--reddit { --envoi-brand: #ff4500; }
.envoi__btn--pinterest { --envoi-brand: #bd081c; }
.envoi__btn--tumblr { --envoi-brand: #36465d; }
.envoi__btn--hackernews { --envoi-brand: #f0652f; }

/* Icon only: brand-coloured icon. Shapes: brand fill, white icon (e.g. Facebook blue and white). */
.envoi.envoi--brand .envoi__btn {
	--envoi-fg: var(--envoi-brand);
}

.envoi.envoi--brand:not(.envoi--plain) .envoi__btn {
	--envoi-fg: #fff;
	--envoi-bg: var(--envoi-brand);
	--envoi-ring: transparent;
}

/* Server dialog */
.envoi-dialog {
	box-sizing: border-box;
	width: min(28rem, calc(100% - 2rem));
	padding: 1.5rem;
	border: 0;
	border-radius: 8px;
	background: #fff;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
	color: #1e1e1e;
	font: inherit;
}

.envoi-dialog::backdrop {
	background: rgba(0, 0, 0, 0.45);
}

.envoi-dialog .envoi-dialog__title {
	margin: 0 0 1rem;
	font-size: 1.25rem;
	line-height: 1.3;
}

.envoi-dialog .envoi-dialog__label {
	display: block;
	margin-bottom: 0.25rem;
	font-weight: 600;
}

.envoi-dialog .envoi-dialog__input {
	box-sizing: border-box;
	width: 100%;
	padding: 0.5rem 0.75rem;
	border: 1px solid #757575;
	border-radius: 4px;
	font: inherit;
}

.envoi-dialog .envoi-dialog__hint,
.envoi-dialog .envoi-dialog__error {
	margin: 0.5rem 0 0;
	font-size: 0.875em;
	color: #555;
}

.envoi-dialog .envoi-dialog__error {
	color: #b32d2e;
}

.envoi-dialog .envoi-dialog__actions {
	display: flex;
	justify-content: flex-end;
	gap: 0.5rem;
	margin-top: 1.25rem;
}

.envoi-dialog .envoi-dialog__actions button {
	padding: 0.5rem 1rem;
	border: 1px solid #1e1e1e;
	border-radius: 4px;
	background: transparent;
	color: #1e1e1e;
	font: inherit;
	cursor: pointer;
}

.envoi-dialog .envoi-dialog__actions .envoi-dialog__submit {
	background: #1e1e1e;
	color: #fff;
}

@media (prefers-reduced-motion: reduce) {
	.envoi .envoi__btn {
		transition: none;
	}
}

@media print {
	.envoi {
		display: none;
	}
}
