/* Groovy Share */

.gsb {
	--gsb-size: 40px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 1.5em 0;
}

.gsb__label {
	font-weight: 600;
	margin-right: 4px;
}

/* Post buttons: label stacked on top, everything centered. */
.gsb--inline {
	justify-content: center;
}

.gsb--inline .gsb__label {
	flex-basis: 100%;
	margin-right: 0;
	text-align: center;
}

.gsb .gsb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: var(--gsb-size);
	height: var(--gsb-size);
	padding: 0;
	border: 0;
	border-radius: 6px;
	background: var(--gsb-color, #555);
	color: #fff;
	text-decoration: none;
	box-shadow: none;
	line-height: 1;
	transition: filter .15s ease, transform .15s ease, width .15s ease;
}

.gsb .gsb-btn:hover,
.gsb .gsb-btn:focus-visible {
	color: #fff;
	filter: brightness(1.15);
	transform: translateY(-1px);
}

.gsb .gsb-btn:focus-visible {
	outline: 2px solid #111;
	outline-offset: 2px;
}

.gsb .gsb-btn svg {
	display: block;
	width: 50%;
	height: 50%;
	fill: currentColor;
}

/* Brand colors */
.gsb-btn--email     { --gsb-color: #d32f2f; }
.gsb-btn--x         { --gsb-color: #000000; }
.gsb-btn--bluesky   { --gsb-color: #1185fe; }
.gsb-btn--linkedin  { --gsb-color: #0a66c2; }
.gsb-btn--facebook  { --gsb-color: #1877f2; }
.gsb-btn--messenger { --gsb-color: #0084ff; }
.gsb-btn--reddit    { --gsb-color: #ff4500; }

/* Messenger: app link on touch devices, web dialog on desktop. */
.gsb .gsb-btn.gsb-touch-only { display: none; }

@media (hover: none) and (pointer: coarse) {
	.gsb .gsb-btn.gsb-touch-only { display: inline-flex; }
	.gsb .gsb-btn.gsb-desktop-only { display: none; }
}

/* ------------------------------------------------------------------ */
/* Floating bar — vertical, left center (desktop)                     */
/* ------------------------------------------------------------------ */

.gsb--floating {
	--gsb-size: 48px;
	position: fixed;
	top: 50%;
	left: 0;
	z-index: 9990;
	flex-direction: column;
	flex-wrap: nowrap;
	align-items: flex-start;
	gap: 0;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transform: translate(-100%, -50%);
	transition: transform .3s ease, opacity .3s ease, visibility 0s linear .3s;
}

.gsb--floating.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translate(0, -50%);
	transition: transform .3s ease, opacity .3s ease;
}

.gsb--floating .gsb-btn {
	border-radius: 0;
}

.gsb--floating .gsb-btn:first-of-type { border-top-right-radius: 6px; }
.gsb--floating .gsb-btn:last-of-type  { border-bottom-right-radius: 6px; }

/* The message only shows above the mobile bottom bar. */
.gsb--floating .gsb__label {
	display: none;
}

.gsb--floating .gsb-btn:hover,
.gsb--floating .gsb-btn:focus-visible {
	transform: none;
	width: calc(var(--gsb-size) + 8px);
}

/* ------------------------------------------------------------------ */
/* Floating bar — bottom overlay (mobile)                             */
/* ------------------------------------------------------------------ */

@media (max-width: 767px) {
	.gsb--floating {
		top: auto;
		right: 0;
		bottom: 0;
		flex-direction: row;
		flex-wrap: wrap;
		align-items: stretch;
		padding-bottom: env(safe-area-inset-bottom);
		background: #111;
		box-shadow: 0 -2px 10px rgba(0, 0, 0, .15);
		transform: translateY(100%);
	}

	.gsb--floating.is-visible {
		transform: translateY(0);
	}

	.gsb--floating .gsb-btn,
	.gsb--floating .gsb-btn:hover,
	.gsb--floating .gsb-btn:focus-visible {
		flex: 1 1 0;
		width: auto;
		min-width: 44px; /* also forces the buttons onto a row below the message */
		border-radius: 0 !important;
	}

	.gsb--floating .gsb__label {
		display: block;
		flex: 0 0 100%;
		box-sizing: border-box;
		height: 32px;
		margin: 0;
		padding: 0 12px;
		overflow: hidden;
		background: #fff;
		color: #000;
		font-size: 14px;
		line-height: 32px;
		text-align: center;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.gsb--floating .gsb-btn:focus-visible {
		outline-offset: -3px;
		outline-color: #fff;
	}

	/* Keep the bottom bar from covering the end of the page. */
	body.gsb-has-floating {
		padding-bottom: calc(48px + env(safe-area-inset-bottom));
	}

	body.gsb-has-floating-label {
		padding-bottom: calc(80px + env(safe-area-inset-bottom));
	}
}

@media (prefers-reduced-motion: reduce) {
	.gsb .gsb-btn,
	.gsb--floating,
	.gsb--floating.is-visible {
		transition: none;
	}
}

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