/**
 * Post votes — like/dislike circular buttons with click ripple.
 *
 * Per Figma 512:19703:
 *   - Title above: "הכתבה עניינה אותך?" 16px Pompei Light #050d2c.
 *   - Buttons row centered with 20px gap.
 *   - Positive (right in RTL): 120×120 circle, 50×50 icon, larger.
 *   - Negative (left  in RTL):  85×85 circle, 35×35 icon, smaller.
 *   - Both: 2px solid #050d2c border. Default bg transparent.
 *   - Active state: #e8f5ff fill (animated grow-from-center on click).
 *   - Percentage badge above each circle: #F3F3F3 bg, 16px Pompei Light text,
 *     centered horizontally over the button, sitting at the top with the
 *     circle slightly overlapping its lower edge.
 *
 * @package Hamechadesh
 */

.hm-post-votes {
	--hm-vote-fg: #050d2c;
	--hm-vote-active-bg: #e8f5ff;
	--hm-vote-pct-bg: #F3F3F3;

	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	margin-block: var(--hm-space-lg, 24px);
	font-family: var(--hm-font-primary);
	color: var(--hm-vote-fg);
}

.hm-post-votes__title {
	margin: 0;
	font-size: 16px;
	font-weight: 300;
	line-height: 22.115px;
	color: var(--hm-vote-fg);
	text-align: center;
}

.hm-post-votes__row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
}

.hm-post-votes__item {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-top: 11px; /* leaves room for the badge to peek above the circle */
}

.hm-post-votes__pct {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	z-index: 2;
	min-width: 38px;
	padding: 2px;
	background-color: var(--hm-vote-pct-bg);
	font-family: var(--hm-font-primary);
	font-size: 16px;
	font-weight: 300;
	line-height: 22.115px;
	color: var(--hm-vote-fg);
	text-align: center;
	pointer-events: none;
}

.hm-post-votes__btn {
	position: relative;
	isolation: isolate;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 2px solid var(--hm-vote-fg);
	border-radius: 50%;
	background-color: transparent;
	color: var(--hm-vote-fg);
	cursor: pointer;
	overflow: hidden;
	transition: transform var(--hm-transition-fast, 150ms ease);
	-webkit-tap-highlight-color: transparent;
	padding: 0;
}

.hm-post-votes__btn--up {
	width: 120px;
	height: 120px;
}

.hm-post-votes__btn--down {
	width: 85px;
	height: 85px;
}

.hm-post-votes__btn:focus-visible {
	outline: 2px solid var(--hm-vote-fg);
	outline-offset: 4px;
}

/* Blue ripple — pseudo-element scales from 0 (center) to 1 (full circle). */
.hm-post-votes__btn::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: 50%;
	background-color: var(--hm-vote-active-bg);
	transform: scale(0);
	transform-origin: center;
	z-index: -1;
	pointer-events: none;
}

/* Activate transitions only after the initial render so prior-vote state
   doesn't animate on page load. */
.hm-post-votes--ready .hm-post-votes__btn::before {
	transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.hm-post-votes--voted-up .hm-post-votes__btn--up::before,
.hm-post-votes--voted-down .hm-post-votes__btn--down::before {
	transform: scale(1);
}

.hm-post-votes__icon-wrap {
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.hm-post-votes__btn--up .hm-post-votes__icon {
	width: 50px;
	height: 50px;
}

.hm-post-votes__btn--down .hm-post-votes__icon {
	width: 35.417px;
	height: 35.417px;
}

/* Locked state during in-flight AJAX. */
.hm-post-votes--locked .hm-post-votes__btn {
	pointer-events: none;
}

@media (max-width: 480px) {
	.hm-post-votes__btn--up {
		width: 104px;
		height: 104px;
	}

	.hm-post-votes__btn--down {
		width: 76px;
		height: 76px;
	}

	.hm-post-votes__btn--up .hm-post-votes__icon {
		width: 44px;
		height: 44px;
	}

	.hm-post-votes__btn--down .hm-post-votes__icon {
		width: 32px;
		height: 32px;
	}
}
