/**
 * YGT Reactions — mobile floating widget (F78).
 *
 * A collapsed FAB (bottom-right, stacked above the theme's .ygt-back-to-top)
 * that pops open a Messenger-style reaction tray. Mobile-only: everything is
 * gated to <=767px via the `.ygt-rxf-on` class (added to <html> by the JS only
 * when it builds the widget on a phone). On desktop the inline
 * .ygt-gc-reactions-bar is untouched and this widget never shows.
 *
 * Brand tokens are inlined (the plugin CSS must not depend on the theme's
 * :root vars — it also runs on subsites). Orange = YugaTech --ygt-primary.
 */

/* Hidden by default; only revealed on phones once JS has built it. */
.ygt-rxf { display: none; }

@media (max-width: 767px) {
	/* Float ON: show the widget, hide the inline reactions bar (kept in DOM as
	   the count source + no-JS fallback). The share bar stays inline. */
	.ygt-rxf-on .ygt-rxf { display: block; }
	.ygt-rxf-on .ygt-gc-reactions-bar { display: none !important; }
}

.ygt-rxf {
	--rxf-orange: #f97316;
	--rxf-orange-dark: #ea580c;
	--rxf-orange-light: #fb923c;
	--rxf-ink: #1a1a1a;
	--rxf-muted: #6b7280;
	--rxf-spring: cubic-bezier(.34, 1.56, .64, 1);

	position: fixed;
	right: 16px;
	/* stack above .ygt-back-to-top (40px tall @ bottom:16px) with a 12px gap */
	bottom: calc(68px + env(safe-area-inset-bottom, 0px));
	z-index: 998;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	-webkit-tap-highlight-color: transparent;
}

/* ---------------------------------------------------------------- tray */
.ygt-rxf__tray {
	position: absolute;
	right: 0;
	bottom: 72px;
	transform-origin: 88% 100%;
	background: rgba(255, 255, 255, .78);
	-webkit-backdrop-filter: blur(22px) saturate(180%);
	backdrop-filter: blur(22px) saturate(180%);
	border: 1px solid rgba(255, 255, 255, .7);
	border-radius: 22px;
	box-shadow: 0 18px 40px -16px rgba(20, 24, 40, .42), 0 2px 0 rgba(255, 255, 255, .6) inset;
	padding: 12px 12px 11px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(10px) scale(.7);
	transition: transform .34s var(--rxf-spring), opacity .22s ease, visibility .34s;
}
.ygt-rxf.is-open .ygt-rxf__tray {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
}
.ygt-rxf__tray-label {
	font-size: 10.5px;
	font-weight: 600;
	color: var(--rxf-muted);
	text-align: center;
	margin: 0 2px 9px;
}
.ygt-rxf__emojis {
	display: flex;
	gap: 2px;
}
.ygt-rxf__btn {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 3px;
	width: 46px;
	min-height: 44px;
	padding: 6px 0 5px;
	border: 0;
	background: transparent;
	border-radius: 14px;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	opacity: 0;
	transform: translateY(8px) scale(.6);
	transition: transform .15s var(--rxf-spring), background .15s ease;
}
.ygt-rxf.is-open .ygt-rxf__btn {
	opacity: 1;
	transform: translateY(0) scale(1);
	transition: opacity .26s var(--rxf-spring) calc(var(--i) * 42ms),
		transform .34s var(--rxf-spring) calc(var(--i) * 42ms),
		background .15s ease;
}
.ygt-rxf__emoji {
	font-size: 27px;
	line-height: 1;
	transition: transform .18s var(--rxf-spring);
	filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .12));
}
.ygt-rxf__count {
	font-size: 10px;
	font-weight: 700;
	color: var(--rxf-muted);
	min-height: 12px;
	letter-spacing: .01em;
}
.ygt-rxf__btn:hover { background: rgba(249, 115, 22, .08); }
.ygt-rxf__btn:hover .ygt-rxf__emoji,
.ygt-rxf__btn:active .ygt-rxf__emoji { transform: scale(1.32) translateY(-3px); }
.ygt-rxf__btn.is-active { background: #fff1e6; }
.ygt-rxf__btn.is-active .ygt-rxf__emoji { transform: scale(1.12); }
.ygt-rxf__btn.is-active .ygt-rxf__count { color: var(--rxf-orange-dark); }
.ygt-rxf__btn.is-active::after {
	content: "";
	position: absolute;
	inset: 0;
	border: 2px solid var(--rxf-orange);
	border-radius: 14px;
}
.ygt-rxf__btn:focus-visible {
	outline: 2px solid var(--rxf-orange-dark);
	outline-offset: 1px;
}

/* ----------------------------------------------------------------- FAB */
.ygt-rxf__fab {
	position: relative;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	border: 0;
	cursor: pointer;
	background: rgba(255, 255, 255, .82);
	-webkit-backdrop-filter: blur(18px) saturate(180%);
	backdrop-filter: blur(18px) saturate(180%);
	box-shadow: 0 10px 26px -8px rgba(249, 115, 22, .5),
		0 4px 10px -4px rgba(20, 24, 40, .28),
		0 0 0 1px rgba(255, 255, 255, .7) inset;
	display: grid;
	place-items: center;
	-webkit-appearance: none;
	appearance: none;
	transition: transform .3s var(--rxf-spring);
	animation: ygt-rxf-breathe 3.4s ease-in-out infinite;
}
.ygt-rxf__fab::before {
	content: "";
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: radial-gradient(120% 120% at 30% 20%, #ffffff 0%, #fff3e9 55%, #ffe2cc 100%);
	z-index: 0;
}
.ygt-rxf__face {
	position: relative;
	z-index: 1;
	font-size: 28px;
	line-height: 1;
	transition: transform .3s var(--rxf-spring);
}
.ygt-rxf.is-open .ygt-rxf__fab { transform: rotate(90deg) scale(.92); animation: none; }
.ygt-rxf.is-open .ygt-rxf__face { transform: rotate(-90deg); }
.ygt-rxf__fab:active { transform: scale(.9); }
.ygt-rxf__fab:focus-visible {
	outline: 2px solid var(--rxf-orange-dark);
	outline-offset: 3px;
}

.ygt-rxf__badge {
	position: absolute;
	z-index: 2;
	top: -3px;
	right: -3px;
	min-width: 21px;
	height: 21px;
	padding: 0 5px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--rxf-orange-light), var(--rxf-orange-dark));
	color: #fff;
	font-size: 10.5px;
	font-weight: 800;
	display: grid;
	place-items: center;
	border: 2px solid #fff;
	box-shadow: 0 3px 8px rgba(249, 115, 22, .5);
	transition: transform .3s var(--rxf-spring);
}
.ygt-rxf__badge:empty { display: none; }
.ygt-rxf__badge.is-pop { animation: ygt-rxf-badge-pop .42s var(--rxf-spring); }

/* hint tooltip (shown once per session at ~scroll 45%) */
.ygt-rxf__hint {
	position: absolute;
	right: 72px;
	bottom: 16px;
	white-space: nowrap;
	background: var(--rxf-ink);
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	padding: 6px 11px;
	border-radius: 10px;
	opacity: 0;
	transform: translateX(6px);
	transition: opacity .25s, transform .25s;
	pointer-events: none;
}
.ygt-rxf__hint::after {
	content: "";
	position: absolute;
	right: -5px;
	bottom: 13px;
	border: 5px solid transparent;
	border-left-color: var(--rxf-ink);
}
.ygt-rxf.is-hint .ygt-rxf__hint { opacity: 1; transform: translateX(0); }
.ygt-rxf.is-peek .ygt-rxf__fab { animation: ygt-rxf-wiggle .8s ease; }

/* burst particles (added/removed by JS) */
.ygt-rxf__burst {
	position: absolute;
	z-index: 3;
	pointer-events: none;
	font-size: 22px;
	transform: translate(-50%, -50%);
	will-change: transform, opacity;
	animation: ygt-rxf-burst ease-out forwards;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .18));
}

@keyframes ygt-rxf-breathe {
	0%, 100% { box-shadow: 0 10px 26px -8px rgba(249, 115, 22, .42), 0 4px 10px -4px rgba(20, 24, 40, .26), 0 0 0 1px rgba(255, 255, 255, .7) inset; }
	50% { box-shadow: 0 14px 34px -8px rgba(249, 115, 22, .62), 0 4px 10px -4px rgba(20, 24, 40, .28), 0 0 0 1px rgba(255, 255, 255, .8) inset; }
}
@keyframes ygt-rxf-wiggle {
	0%, 100% { transform: rotate(0); }
	20% { transform: rotate(-11deg); }
	40% { transform: rotate(9deg); }
	60% { transform: rotate(-6deg); }
	80% { transform: rotate(3deg); }
}
@keyframes ygt-rxf-badge-pop {
	0% { transform: scale(1); }
	45% { transform: scale(1.45); }
	100% { transform: scale(1); }
}
@keyframes ygt-rxf-burst {
	0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
	14% { opacity: 1; }
	100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% - 138px)) scale(var(--scale)) rotate(var(--rot)); }
}

@media (prefers-reduced-motion: reduce) {
	.ygt-rxf__fab { animation: none; }
	.ygt-rxf__tray,
	.ygt-rxf__btn,
	.ygt-rxf__fab,
	.ygt-rxf__face,
	.ygt-rxf__badge { transition: opacity .12s ease; }
	.ygt-rxf.is-peek .ygt-rxf__fab { animation: none; }
	.ygt-rxf__burst { display: none; }
}
