/**
 * Social Share Buttons
 *
 * Styles of the share bar shown on a collection ( share url buttons, share via
 * email, copy link and the device share sheet ).
 *
 * The rules are scoped to .woocl-social-buttons and every property which the
 * layout depends on is declared, so the buttons keep their shape on the themes
 * which reset links, buttons or inline svg icons.
 *
 * Override this stylesheet by copying it to
 * yourtheme/woocommerce/woocommerce-collections/css/woo-cl-social-share.css
 *
 * @package WPWeb WooCommerce Collections
 * @since 1.0.8
 */

/* ------------------------------------------------------------------------- *
 * Share bar
 * ------------------------------------------------------------------------- */
.woocl-social-buttons {
	display: block;
	width: 100%;
	clear: both;
	margin: 0 0 15px;
}
.woocl-social-buttons .woocl-social-sub-btn {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	justify-content: flex-end;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* every button sits in the flex row, the legacy float is not used any more */
.woocl-social-buttons .woocl-share-button,
.woocl-social-buttons .woocl-email,
.woocl-social-buttons .woocl-email-button {
	display: flex;
	float: none;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	line-height: normal;
}
.woocl-social-buttons .woocl-email-button {
	width: 100%;
}

/* ------------------------------------------------------------------------- *
 * Button
 * ------------------------------------------------------------------------- */
.woocl-social-buttons a.woocl-share-link,
.woocl-social-buttons .woocl-share-button a.woocl-share-link,
.woocl-social-buttons .woocl-email-button a.woocl-share-link {
	--woocl-share-color: #5f6b7a;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	box-sizing: border-box;
	width: 100%;
	min-height: 36px;
	margin: 0;
	padding: 7px 12px;
	border: 1px solid rgba( 0, 0, 0, .12 );
	border-radius: 4px;
	background: #fff;
	color: #3c434a;
	font-family: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.woocl-social-buttons a.woocl-share-link:hover,
.woocl-social-buttons a.woocl-share-link:focus,
.woocl-social-buttons a.woocl-share-link.woocl-share-copied {
	background: var( --woocl-share-color );
	border-color: var( --woocl-share-color );
	color: #fff;
	text-decoration: none;
	box-shadow: none;
}
.woocl-social-buttons a.woocl-share-link:focus-visible {
	outline: 2px solid var( --woocl-share-color );
	outline-offset: 2px;
}

/* the icons are inline svg, so the size is pinned against the theme resets */
.woocl-social-buttons a.woocl-share-link .woocl-share-icon,
.woocl-social-buttons svg.woocl-share-icon {
	display: block;
	width: 16px;
	height: 16px;
	min-width: 16px;
	max-width: 16px;
	flex: 0 0 16px;
	color: var( --woocl-share-color );
	vertical-align: middle;
	transition: color .15s ease;
}
.woocl-social-buttons a.woocl-share-link:hover .woocl-share-icon,
.woocl-social-buttons a.woocl-share-link:focus .woocl-share-icon,
.woocl-social-buttons a.woocl-share-link.woocl-share-copied .woocl-share-icon {
	color: #fff;
}
.woocl-social-buttons .woocl-btn-label {
	display: inline-block;
	font: inherit;
	color: inherit;
}

/* ------------------------------------------------------------------------- *
 * QR code panel ( WeChat )
 * ------------------------------------------------------------------------- */
.woocl-social-buttons .woocl-share-qr {
	position: relative;
}
.woocl-social-buttons .woocl-qr-panel {
	position: absolute;
	z-index: 99;
	right: 0;
	bottom: calc( 100% + 8px );
	box-sizing: border-box;
	width: 220px;
	padding: 14px;
	border: 1px solid rgba( 0, 0, 0, .12 );
	border-radius: 6px;
	background: #fff;
	box-shadow: 0 6px 18px rgba( 0, 0, 0, .12 );
	text-align: center;
}
.woocl-social-buttons .woocl-qr-panel[hidden] {
	display: none;
}
.woocl-social-buttons .woocl-qr-image {
	display: block;
	width: 180px;
	height: 180px;
	max-width: 100%;
	margin: 0 auto 8px;
	border: 0;
	border-radius: 0;
	box-shadow: none;
}
.woocl-social-buttons .woocl-qr-hint {
	margin: 0 0 6px;
	color: #3c434a;
	font-size: 12px;
	line-height: 1.4;
}
.woocl-social-buttons .woocl-qr-url {
	display: block;
	color: #5f6b7a;
	font-size: 11px;
	line-height: 1.4;
	word-break: break-all;
}

/* ------------------------------------------------------------------------- *
 * Device share sheet
 *
 * The button is hidden by default ( inline in the template as well, so it stays
 * hidden even when this stylesheet is not loaded ) and the script reveals it on
 * the touch devices which support the Web Share API.
 * ------------------------------------------------------------------------- */
.woocl-social-buttons .woocl-share-native,
.woocl-share-native[hidden] {
	display: none;
}
.woocl-social-buttons .woocl-share-native.woocl-native-share-ready {
	display: flex;
}

/**
 * Same handling for the networks which only exist as an app ( Viber ). A
 * desktop browser answers their url scheme with "no registered handler", so
 * the button waits for a touch device.
 */
.woocl-social-buttons .woocl-share-touch-only,
.woocl-share-touch-only[hidden] {
	display: none;
}
.woocl-social-buttons .woocl-share-touch-only.woocl-touch-ready {
	display: flex;
}

/* ------------------------------------------------------------------------- *
 * Tablet
 * ------------------------------------------------------------------------- */
@media screen and ( max-width: 991px ) {

	.woocl-social-buttons .woocl-social-sub-btn {
		justify-content: flex-start;
	}
}

/* ------------------------------------------------------------------------- *
 * Phone
 *
 * The labels stay in the markup for the screen readers, the buttons become
 * icon only so that a full share bar fits on a small screen without wrapping
 * into a stack of half empty rows.
 * ------------------------------------------------------------------------- */
@media screen and ( max-width: 600px ) {

	.woocl-social-buttons .woocl-social-sub-btn {
		gap: 10px;
	}
	.woocl-social-buttons a.woocl-share-link,
	.woocl-social-buttons .woocl-share-button a.woocl-share-link,
	.woocl-social-buttons .woocl-email-button a.woocl-share-link {
		width: 42px;
		min-width: 42px;
		height: 42px;
		min-height: 42px;
		padding: 0;
		border-radius: 50%;
		gap: 0;
	}
	.woocl-social-buttons a.woocl-share-link .woocl-share-icon,
	.woocl-social-buttons svg.woocl-share-icon {
		width: 18px;
		height: 18px;
		min-width: 18px;
		max-width: 18px;
		flex: 0 0 18px;
	}
	/* keep the label readable by assistive technology only */
	.woocl-social-buttons .woocl-btn-label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip: rect( 1px, 1px, 1px, 1px );
		clip-path: inset( 50% );
		white-space: nowrap;
		border: 0;
	}
	.woocl-social-buttons .woocl-email-button {
		width: auto;
	}
	/* the code is shown as a small centered dialog, it never runs off screen */
	.woocl-social-buttons .woocl-qr-panel {
		position: fixed;
		top: 50%;
		right: auto;
		bottom: auto;
		left: 50%;
		width: 240px;
		max-width: calc( 100vw - 32px );
		transform: translate( -50%, -50% );
	}
}

/* comfortable targets on the devices which are used with a finger */
@media ( pointer: coarse ) {

	.woocl-social-buttons a.woocl-share-link {
		min-height: 42px;
	}
}

@media ( prefers-reduced-motion: reduce ) {

	.woocl-social-buttons a.woocl-share-link,
	.woocl-social-buttons .woocl-share-icon {
		transition: none;
	}
}
