/* Tratto Recensioni – stile frontend.
   Tutto passa da variabili CSS: la scheda "Stile", il blocco e il widget Elementor le sovrascrivono. */

.tr-reviews {
	--tr-font: inherit;
	--tr-size: 15px;
	--tr-bg: #fff;
	--tr-text: #1f2328;
	--tr-name: #111;
	--tr-meta: #6b7280;
	--tr-star: #fbbc04;
	--tr-star-empty: #d9dce1;
	--tr-accent: #111;
	--tr-border: #e5e7eb;
	--tr-radius: 14px;
	--tr-pad: 24px;
	--tr-gap: 20px;
	--tr-shadow: 0 4px 18px rgba(0, 0, 0, .06);
	--tr-cols: 3;
	--tr-cols-t: 2;
	--tr-cols-m: 1;
	--tr-c: var(--tr-cols);

	font-family: var(--tr-font);
	font-size: var(--tr-size);
	line-height: 1.6;
	color: var(--tr-text);
	position: relative;
	box-sizing: border-box;
}

.tr-reviews *,
.tr-reviews *::before,
.tr-reviews *::after {
	box-sizing: border-box;
}

/* Modalità "eredita dal tema": niente colori o font imposti. */
.tr-reviews.tr-style-theme {
	--tr-font: inherit;
	--tr-size: inherit;
	--tr-bg: transparent;
	--tr-text: inherit;
	--tr-name: inherit;
	--tr-meta: currentColor;
	--tr-accent: currentColor;
	--tr-border: currentColor;
	--tr-shadow: none;
}
.tr-reviews.tr-style-theme .tr-card,
.tr-reviews.tr-style-theme .tr-badge {
	border-color: color-mix(in srgb, currentColor 18%, transparent);
}
.tr-reviews.tr-style-theme .tr-date,
.tr-reviews.tr-style-theme .tr-summary-count {
	opacity: .7;
}

@media (max-width: 1024px) {
	.tr-reviews { --tr-c: var(--tr-cols-t); }
}
@media (max-width: 640px) {
	.tr-reviews { --tr-c: var(--tr-cols-m); }
}

/* ---------------------------------------------------------------- Stelle */
.tr-stars {
	position: relative;
	display: inline-block;
	font-size: 1.05em;
	line-height: 1;
	letter-spacing: .08em;
	color: var(--tr-star-empty);
	white-space: nowrap;
	vertical-align: middle;
}
.tr-stars::before {
	content: "★★★★★";
}
.tr-stars-fill {
	position: absolute;
	inset: 0 auto 0 0;
	width: calc(var(--tr-rating, 5) / 5 * 100%);
	overflow: hidden;
	color: var(--tr-star);
}
.tr-stars-fill::before {
	content: "★★★★★";
}

/* --------------------------------------------------------------- Header */
.tr-header {
	display: flex;
	flex-wrap: wrap;
	gap: 12px var(--tr-gap);
	margin-bottom: var(--tr-gap);
}
.tr-summary {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px 16px;
	flex: 1 1 320px;
}
.tr-summary-logo svg {
	width: 36px;
	height: 36px;
	display: block;
}
.tr-summary-body {
	flex: 1 1 auto;
}
.tr-summary-label {
	display: block;
	font-size: 1.15em;
	color: var(--tr-head, var(--tr-name));
}
.tr-summary-line {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 8px;
}
.tr-summary-score {
	font-weight: 700;
	color: var(--tr-head, var(--tr-name));
}
.tr-summary-count {
	color: var(--tr-head-meta, var(--tr-head, var(--tr-meta)));
	font-size: .9em;
}

.tr-btn {
	display: inline-block;
	padding: .6em 1.2em;
	border-radius: 999px;
	background: var(--tr-accent);
	color: var(--tr-bg) !important;
	text-decoration: none !important;
	font-weight: 600;
	font-size: .9em;
	transition: opacity .2s;
}
.tr-style-theme .tr-btn {
	background: transparent;
	color: inherit !important;
	border: 1px solid currentColor;
}
.tr-btn:hover {
	opacity: .85;
}

/* ----------------------------------------------------------------- Card */
.tr-card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: var(--tr-pad);
	background: var(--tr-bg);
	border: 1px solid var(--tr-border);
	border-radius: var(--tr-radius);
	box-shadow: var(--tr-shadow);
	min-width: 0;
}
.tr-card-head {
	display: flex;
	align-items: center;
	gap: 12px;
}
.tr-avatar {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	object-fit: cover;
	flex: 0 0 44px;
}
.tr-avatar-initials {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--tr-accent);
	color: var(--tr-bg);
	font-weight: 700;
	font-size: .95em;
}
.tr-style-theme .tr-avatar-initials {
	background: color-mix(in srgb, currentColor 12%, transparent);
	color: inherit;
}
.tr-author {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 1 1 auto;
	line-height: 1.3;
}
.tr-name {
	font-weight: 600;
	color: var(--tr-name);
	text-decoration: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
a.tr-name:hover {
	text-decoration: underline;
}
.tr-date {
	font-size: .85em;
	color: var(--tr-meta);
}
.tr-source {
	flex: 0 0 auto;
	display: inline-flex;
}
.tr-source svg {
	width: 22px;
	height: 22px;
}
.tr-title {
	margin: 0;
	font-size: 1.05em;
	line-height: 1.35;
	color: var(--tr-name);
}
.tr-text p {
	margin: 0;
}
.tr-more {
	margin-top: 6px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--tr-accent);
	font: inherit;
	font-size: .9em;
	font-weight: 600;
	cursor: pointer;
	text-decoration: underline;
}
.tr-reply {
	margin-top: 4px;
	padding: 12px 14px;
	border-left: 3px solid var(--tr-accent);
	background: color-mix(in srgb, var(--tr-accent) 5%, transparent);
	border-radius: 0 8px 8px 0;
	font-size: .92em;
}
.tr-reply p {
	margin: 4px 0 0;
}

/* --------------------------------------------------------------- Layout */
.tr-layout-grid .tr-track {
	display: grid;
	grid-template-columns: repeat(var(--tr-c), minmax(0, 1fr));
	gap: var(--tr-gap);
	align-items: start;
}

.tr-layout-list .tr-track {
	display: flex;
	flex-direction: column;
	gap: var(--tr-gap);
}

/* Il margine negativo + padding lascia spazio alle ombre delle card senza tagliarle. */
.tr-layout-carousel .tr-viewport {
	margin: -12px;
}
.tr-layout-carousel .tr-track {
	display: flex;
	gap: var(--tr-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding: 12px;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
	padding: 12px;
}
.tr-layout-carousel .tr-track::-webkit-scrollbar {
	display: none;
}
.tr-layout-carousel .tr-card {
	flex: 0 0 calc((100% - (var(--tr-c) - 1) * var(--tr-gap)) / var(--tr-c));
	scroll-snap-align: start;
}

.tr-nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	margin-top: calc(var(--tr-gap) + 4px);
}
.tr-nav button.tr-prev,
.tr-nav button.tr-next {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border-radius: 50%;
	border: 1px solid var(--tr-border);
	background: var(--tr-bg);
	color: var(--tr-accent);
	cursor: pointer;
	transition: background .2s, color .2s;
}
.tr-nav button.tr-prev:hover,
.tr-nav button.tr-next:hover {
	background: var(--tr-accent);
	color: var(--tr-bg);
}
.tr-nav button:disabled {
	opacity: .35;
	cursor: default;
}
.tr-dots {
	display: flex;
	gap: 6px;
}
.tr-dots button {
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--tr-accent);
	opacity: .25;
	cursor: pointer;
	transition: width .25s, opacity .25s;
}
.tr-dots button[aria-current="true"] {
	width: 22px;
	opacity: 1;
}
.tr-nav.tr-nav-hidden {
	display: none;
}

/* ---------------------------------------------------------------- Badge */
.tr-layout-badge {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
.tr-badge {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 12px 18px 12px 14px;
	background: var(--tr-bg);
	border: 1px solid var(--tr-border);
	border-radius: var(--tr-radius);
	box-shadow: var(--tr-shadow);
	color: var(--tr-text);
	text-decoration: none !important;
	line-height: 1.25;
	transition: transform .2s;
}
a.tr-badge:hover {
	transform: translateY(-2px);
}
.tr-badge-logo svg {
	width: 32px;
	height: 32px;
	display: block;
}
.tr-badge-body {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.tr-badge-title {
	font-size: .8em;
	font-weight: 600;
	color: var(--tr-meta);
	text-transform: uppercase;
	letter-spacing: .04em;
}
.tr-badge-line {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--tr-name);
}
.tr-badge-line strong {
	font-size: 1.2em;
}
.tr-badge-count {
	font-size: .8em;
	color: var(--tr-meta);
}

.tr-floating {
	position: fixed;
	bottom: 20px;
	z-index: 9990;
	flex-direction: column;
}
.tr-floating-left {
	left: 20px;
}
.tr-floating-right {
	right: 20px;
}
.tr-floating .tr-badge {
	--tr-shadow: 0 8px 28px rgba(0, 0, 0, .16);
}

.tr-empty,
.tr-notice {
	padding: 16px;
	border: 1px dashed var(--tr-border, #ccc);
	border-radius: 8px;
	text-align: center;
	opacity: .8;
}

@media (prefers-reduced-motion: reduce) {
	.tr-layout-carousel .tr-track {
		scroll-behavior: auto;
	}
}

/* ------------------------------------------- Sezione con sfondo scuro
   sfondo="scuro" (o "Sfondo scuro" nelle impostazioni): i testi e i comandi
   FUORI dalle card diventano chiari. Le card restano come impostate. */
.tr-on-dark {
	--tr-head: #fff;
	--tr-head-meta: color-mix(in srgb, var(--tr-head) 78%, transparent);
}
.tr-on-dark .tr-header .tr-stars {
	--tr-star-empty: rgba(255, 255, 255, .3);
}
.tr-on-dark .tr-header .tr-btn {
	background: var(--tr-head);
	color: #111 !important;
	border: 0;
}
.tr-on-dark .tr-nav button.tr-prev,
.tr-on-dark .tr-nav button.tr-next {
	background: transparent;
	border-color: color-mix(in srgb, var(--tr-head) 55%, transparent);
	color: var(--tr-head);
}
.tr-on-dark .tr-nav button.tr-prev:hover,
.tr-on-dark .tr-nav button.tr-next:hover {
	background: var(--tr-head);
	color: #111;
}
.tr-on-dark .tr-dots button {
	background: var(--tr-head);
}
.tr-on-dark .tr-empty,
.tr-on-dark > .tr-notice {
	color: var(--tr-head);
	border-color: color-mix(in srgb, var(--tr-head) 40%, transparent);
}
