
/* 2.0.10 structural reaction-strip ownership.
   The wrapper is a normal-flow sibling immediately before the post action row.
   No negative margins or transforms are used, so theme footer/button rules
   cannot visually push React below Quote/Edit/More/Bookmark/Organise. */
.pao-post-ratings {
	display: block;
	clear: both;
	margin: .45rem 0 .35rem;
	transform: none;
}
.pao-post-ratings > .apr-reactions {
	margin: 0;
}
/* Awesome Post Ratings — modern reaction interface */
.apr-reactions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.55rem 0.8rem;
	margin: 0.75rem 0 0.25rem;
	position: relative;
}

.apr-summary[hidden],
.apr-picker[hidden] {
	display: none !important;
}

.apr-summary {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--apr-icon-spacing, 8px);
	min-width: 0;
}

.apr-summary-chip,
.apr-summary-total {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	min-height: 30px;
	box-sizing: border-box;
	border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
	border-radius: 999px;
	background: color-mix(in srgb, currentColor 5%, transparent);
	color: inherit;
	text-decoration: none;
	padding: 0.2rem 0.55rem;
	line-height: 1;
	transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.apr-summary-chip:hover,
.apr-summary-chip:focus-visible,
.apr-summary-total:hover,
.apr-summary-total:focus-visible {
	background: color-mix(in srgb, currentColor 9%, transparent);
	border-color: color-mix(in srgb, currentColor 30%, transparent);
	text-decoration: none;
	transform: translateY(-1px);
}

.apr-summary-chip.is-selected {
	border-color: var(--primary-color, #557ea0);
	box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary-color, #557ea0) 30%, transparent);
}

.apr-summary-chip img {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.apr-summary-chip strong,
.apr-summary-total {
	font-weight: 700;
}

.apr-summary-name {
	font-size: 0.9em;
}

.apr-control {
	position: relative;
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.apr-trigger {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	gap: 0.38rem;
	min-height: 34px;
	border-radius: 999px !important;
	white-space: nowrap;
}

.apr-trigger img {
	width: 20px;
	height: 20px;
	object-fit: contain;
}

.apr-trigger.is-selected {
	font-weight: 700;
}

.apr-trigger-arrow {
	width: 0;
	height: 0;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	transition: transform 140ms ease;
}

.apr-control.is-open .apr-trigger-arrow {
	transform: rotate(180deg);
}

.apr-picker {
	position: absolute;
	right: 0;
	bottom: calc(100% + 9px);
	z-index: 110;
	width: min(390px, calc(100vw - 32px));
	box-sizing: border-box;
	padding: 0.55rem;
	border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	border-radius: 14px;
	background: var(--windowbg, var(--background-color, Canvas));
	color: inherit;
	box-shadow: 0 12px 38px rgba(0, 0, 0, 0.2);
	transform-origin: right bottom;
	animation: apr-picker-in 130ms ease-out;
}

.apr-picker::after {
	content: '';
	position: absolute;
	right: 24px;
	top: 100%;
	width: 11px;
	height: 11px;
	background: inherit;
	border-right: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	border-bottom: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	transform: translateY(-6px) rotate(45deg);
}

@keyframes apr-picker-in {
	from { opacity: 0; transform: translateY(5px) scale(0.98); }
	to { opacity: 1; transform: translateY(0) scale(1); }
}

.apr-picker-grid {
	display: grid;
	grid-template-columns: repeat(6, minmax(44px, 1fr));
	gap: 0.25rem;
}

.apr-option {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0.35rem;
	border: 1px solid transparent;
	border-radius: 10px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.apr-option:hover,
.apr-option:focus-visible {
	background: color-mix(in srgb, currentColor 8%, transparent);
	border-color: color-mix(in srgb, currentColor 16%, transparent);
	outline: none;
	transform: translateY(-2px) scale(1.06);
}

.apr-option.is-selected {
	background: color-mix(in srgb, var(--primary-color, #557ea0) 14%, transparent);
	border-color: var(--primary-color, #557ea0);
}

.apr-option img {
	width: 29px;
	height: 29px;
	object-fit: contain;
	pointer-events: none;
}

.apr-option::after {
	content: attr(data-title);
	position: absolute;
	left: 50%;
	bottom: calc(100% + 7px);
	z-index: 2;
	max-width: 150px;
	padding: 0.3rem 0.48rem;
	border-radius: 6px;
	background: #20242a;
	color: #fff;
	font-size: 0.75rem;
	line-height: 1.2;
	white-space: nowrap;
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 3px);
	transition: opacity 100ms ease, transform 100ms ease, visibility 100ms ease;
	pointer-events: none;
}

.apr-option:hover::after,
.apr-option:focus-visible::after {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

.apr-control[aria-busy='true'] {
	opacity: 0.7;
	pointer-events: none;
}

.apr-status {
	font-size: 0.86em;
}

.apr-status.is-error {
	color: #b42318;
}

.apr-visually-hidden {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	padding: 0 !important;
	margin: -1px !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Reaction details modal */
.apr-modal-backdrop {
	position: fixed;
	inset: 0;
	z-index: 9999;
	display: grid;
	place-items: center;
	padding: 1rem;
	background: rgba(0, 0, 0, 0.55);
}

.apr-modal {
	width: min(620px, 100%);
	max-height: min(760px, calc(100vh - 2rem));
	display: flex;
	flex-direction: column;
	border-radius: 16px;
	background: var(--windowbg, var(--background-color, Canvas));
	color: inherit;
	box-shadow: 0 22px 70px rgba(0, 0, 0, 0.35);
	overflow: hidden;
}

.apr-modal-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.9rem 1rem;
	border-bottom: 1px solid color-mix(in srgb, currentColor 14%, transparent);
}

.apr-modal-header h3 {
	margin: 0;
}

.apr-modal-close {
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: color-mix(in srgb, currentColor 8%, transparent);
	color: inherit;
	font-size: 1.35rem;
	cursor: pointer;
}

.apr-modal-body {
	overflow: auto;
	padding: 0.9rem 1rem 1rem;
}

.apr-details-filters {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	overflow-x: auto;
	padding-bottom: 0.7rem;
	margin-bottom: 0.2rem;
}

.apr-filter {
	display: inline-flex;
	align-items: center;
	gap: 0.28rem;
	min-height: 34px;
	padding: 0.3rem 0.6rem;
	border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
	border-radius: 999px;
	background: transparent;
	color: inherit;
	white-space: nowrap;
	cursor: pointer;
}

.apr-filter.is-active {
	border-color: var(--primary-color, #557ea0);
	background: color-mix(in srgb, var(--primary-color, #557ea0) 14%, transparent);
}

.apr-filter img {
	width: 19px;
	height: 19px;
	object-fit: contain;
}

.apr-details-row {
	display: grid;
	grid-template-columns: 42px minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.7rem;
	padding: 0.72rem 0;
	border-top: 1px solid color-mix(in srgb, currentColor 10%, transparent);
}

.apr-details-row[hidden] {
	display: none;
}

.apr-details-avatar,
.apr-details-avatar img,
.apr-avatar-fallback {
	width: 42px;
	height: 42px;
	border-radius: 50%;
}

.apr-details-avatar img {
	object-fit: cover;
}

.apr-avatar-fallback {
	display: grid;
	place-items: center;
	background: color-mix(in srgb, currentColor 10%, transparent);
	font-weight: 700;
}

.apr-details-member {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.apr-details-member time {
	font-size: 0.82em;
	opacity: 0.72;
}

.apr-details-reaction {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.apr-details-reaction img {
	width: 24px;
	height: 24px;
	object-fit: contain;
}

.apr-details-empty,
.apr-modal-loading {
	padding: 2rem 1rem;
	text-align: center;
	opacity: 0.78;
}

/* Profile summary only exists when the member has received reactions. */
.apr-profile-summary {
	margin-top: 1rem;
}

.apr-profile-summary .catbg {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.apr-profile-total {
	display: inline-grid;
	place-items: center;
	min-width: 30px;
	height: 30px;
	padding: 0 0.45rem;
	border-radius: 999px;
	background: color-mix(in srgb, currentColor 14%, transparent);
	font-size: 0.85em;
}

.apr-profile-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
	gap: 0.55rem;
	padding: 0.85rem;
}

.apr-profile-item {
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr) auto;
	align-items: center;
	gap: 0.55rem;
	padding: 0.6rem 0.7rem;
	border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	border-radius: 10px;
	background: color-mix(in srgb, currentColor 4%, transparent);
}

.apr-profile-item img {
	width: 28px;
	height: 28px;
	object-fit: contain;
}

@media (max-width: 600px) {
	.apr-reactions {
		align-items: flex-start;
	}

	.apr-summary {
		width: 100%;
	}

	.apr-summary-name {
		display: none;
	}

	.apr-picker {
		position: fixed;
		left: 12px;
		right: 12px;
		bottom: 12px;
		width: auto;
		transform-origin: center bottom;
	}

	.apr-picker::after {
		display: none;
	}

	.apr-picker-grid {
		grid-template-columns: repeat(5, minmax(44px, 1fr));
	}

	.apr-option {
		min-height: 50px;
	}

	.apr-details-row {
		grid-template-columns: 38px minmax(0, 1fr);
	}

	.apr-details-reaction {
		grid-column: 2;
		justify-self: start;
	}

	.apr-filter-title {
		display: none;
	}
}

/* Phase 7: resilient placement across custom SMF themes. */
.apr-control.apr-open-below .apr-picker {
	top: calc(100% + 9px);
	bottom: auto;
	transform-origin: right top;
}

.apr-control.apr-open-below .apr-picker::after {
	top: auto;
	bottom: 100%;
	border: 0;
	border-left: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	border-top: 1px solid color-mix(in srgb, currentColor 20%, transparent);
	transform: translateY(6px) rotate(45deg);
}

.apr-control.apr-align-left .apr-picker {
	left: 0;
	right: auto;
	transform-origin: left bottom;
}

.apr-control.apr-align-left .apr-picker::after {
	left: 24px;
	right: auto;
}

.apr-control.apr-align-left.apr-open-below .apr-picker {
	transform-origin: left top;
}

/* Explicit fallbacks for themes and browsers without color-mix support. */
@supports not (background: color-mix(in srgb, black 10%, transparent)) {
	.apr-summary-chip,
	.apr-summary-total,
	.apr-option:hover,
	.apr-option:focus-visible,
	.apr-modal-close,
	.apr-avatar-fallback,
	.apr-profile-item {
		background: rgba(127, 127, 127, 0.10);
	}

	.apr-summary-chip,
	.apr-summary-total,
	.apr-picker,
	.apr-filter,
	.apr-profile-item {
		border-color: rgba(127, 127, 127, 0.28);
	}
}

@media (prefers-reduced-motion: reduce) {
	.apr-picker,
	.apr-summary-chip,
	.apr-summary-total,
	.apr-option,
	.apr-trigger-arrow {
		animation: none !important;
		transition: none !important;
	}
}

@media (forced-colors: active) {
	.apr-picker,
	.apr-modal,
	.apr-summary-chip,
	.apr-summary-total,
	.apr-option,
	.apr-filter,
	.apr-profile-item {
		border: 1px solid CanvasText;
	}

	.apr-option.is-selected,
	.apr-summary-chip.is-selected,
	.apr-filter.is-active {
		outline: 2px solid Highlight;
		outline-offset: 2px;
	}
}

@media (max-width: 600px) {
	.apr-control.apr-open-below .apr-picker,
	.apr-control.apr-align-left .apr-picker,
	.apr-control.apr-align-left.apr-open-below .apr-picker {
		position: fixed;
		left: 12px;
		right: 12px;
		top: auto;
		bottom: 12px;
		width: auto;
		transform-origin: center bottom;
	}
}
