/**
 * CleanShare – front-end styles.
 *
 * Customize through CSS custom properties on .cleanshare (set from the
 * settings screen, or override them in your theme):
 *   --cs-size, --cs-w, --cs-h, --cs-gap, --cs-radius, --cs-border-w,
 *   --cs-icon, --cs-icon-h, --cs-bg, --cs-bg-h, --cs-border, --cs-border-h,
 *   --cs-top, --cs-offset
 * Each button also gets --cs-brand (its network color).
 */

.cleanshare {
	--cs-size: 32px;
	--cs-w: 70px;
	--cs-h: 35px;
	--cs-gap: 4px;
	--cs-radius: 0px;
	--cs-border-w: 0px;
	--cs-icon: #fff;
	--cs-top: 100px;
	--cs-offset: 0px;

	box-sizing: border-box;
	margin: 1em 0;
}

.cleanshare *,
.cleanshare *::before,
.cleanshare *::after {
	box-sizing: inherit;
}

.cleanshare__title {
	margin: 0 0 0.5em;
	font-weight: 600;
}

.cleanshare__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--cs-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.cleanshare__item {
	margin: 0;
	padding: 0;
}

.cleanshare__item::before,
.cleanshare__item::marker {
	content: none;
}

.cleanshare__item[hidden] {
	display: none;
}

/* Button (shared by <a> and <button>). */
.cleanshare__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--cs-size);
	height: var(--cs-size);
	margin: 0;
	padding: 0;
	border: var(--cs-border-w) solid var(--cs-border, transparent);
	border-radius: var(--cs-radius);
	background: var(--cs-bg, var(--cs-brand, #555));
	color: var(--cs-icon);
	font: inherit;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	box-shadow: none;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, filter 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.cleanshare__btn:hover,
.cleanshare__btn:focus-visible {
	background: var(--cs-bg-h, var(--cs-bg, var(--cs-brand, #555)));
	color: var(--cs-icon-h, var(--cs-icon));
	border-color: var(--cs-border-h, var(--cs-border, transparent));
	text-decoration: none;
}

/* Brand mode: subtle darken on hover when no hover background is set. */
.cleanshare--colors-brand .cleanshare__btn:hover {
	filter: brightness(0.92);
}

.cleanshare__btn:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	position: relative;
	z-index: 1;
}

.cleanshare__icon {
	display: block;
	width: 70%;
	height: 70%;
	pointer-events: none;
}

/* Shapes. */
.cleanshare--shape-round .cleanshare__btn {
	border-radius: 50%;
}

.cleanshare--shape-rectangle .cleanshare__btn {
	width: var(--cs-w);
	height: var(--cs-h);
}

.cleanshare--shape-rectangle .cleanshare__icon {
	width: auto;
}

/* Copy feedback. */
.cleanshare__btn.is-copied {
	position: relative;
}

.cleanshare__btn.is-copied::after {
	content: attr(data-cleanshare-feedback);
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	padding: 4px 8px;
	border-radius: 3px;
	background: #1e1e1e;
	color: #fff;
	font-size: 12px;
	line-height: 1.3;
	white-space: nowrap;
	pointer-events: none;
}

/* Alignment (inline buttons). */
.cleanshare--align-center {
	text-align: center;
}

.cleanshare--align-center .cleanshare__list {
	justify-content: center;
}

.cleanshare--align-right {
	text-align: right;
}

.cleanshare--align-right .cleanshare__list {
	justify-content: flex-end;
}

/* Joined buttons (spacing 0): collapse adjacent borders. */
.cleanshare--joined .cleanshare__item + .cleanshare__item {
	margin-left: calc(-1 * var(--cs-border-w));
}

/* Floating bar. */
.cleanshare--floating {
	position: fixed;
	top: var(--cs-top);
	z-index: 9999;
	margin: 0;
}

.cleanshare--floating.cleanshare--side-left {
	left: var(--cs-offset);
}

.cleanshare--floating.cleanshare--side-right {
	right: var(--cs-offset);
}

.cleanshare--floating .cleanshare__list {
	flex-direction: column;
	flex-wrap: nowrap;
}

.cleanshare--floating.cleanshare--joined .cleanshare__item + .cleanshare__item {
	margin-top: calc(-1 * var(--cs-border-w));
	margin-left: 0;
}

/* Screen-reader text (in case the theme does not provide it). */
.cleanshare .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

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

@media print {
	.cleanshare {
		display: none !important;
	}
}
