/**
 * Trendo Product Reviews
 *
 * Colours fall back to sensible neutrals but prefer the theme palette, so the
 * section follows Blocksy's colour settings without being re-styled by hand.
 */

.trv {
	/**
	 * Deliberately NOT bound to --theme-palette-color-N: those slots carry no
	 * fixed meaning, and in Blocksy's default palette colour 5 is a near-white
	 * border tone, which rendered the stars invisible. Only the two theme
	 * variables with a semantic name are used, and both have a fallback.
	 * Overridable from WooCommerce -> Настройки -> Продукти -> Отзиви.
	 */
	--trv-star-color: #f0b429;
	--trv-star-empty: #e3e3e3;
	--trv-bar-track: #ececec;
	--trv-bar-fill: #8d8d8d;
	--trv-border: var(--theme-border-color, #e6e6e6);
	--trv-text: var(--theme-text-color, #2c2c2c);
	--trv-solid-bg: #1b1b1b;
	--trv-solid-text: #fff;

	/* Raised at runtime to clear a sticky header (see reviews.js). */
	--trv-scroll-offset: 24px;

	padding-top: clamp(36px, 5vw, 72px);
	color: var(--trv-text);
	scroll-margin-top: var(--trv-scroll-offset);
}

/**
 * The `woocommerce-Reviews` class brings Blocksy's styling with it - including
 * a multi-column grid on the reviews container, which squeezed the list into
 * one narrow column. We want their look for the pieces inside, not their page
 * layout, so the container is pinned back to one full-width column. The ID in
 * the selector is there to outrank the theme's own `#reviews` rules.
 */
#reviews.trv {
	display: block;
	grid-template-columns: 1fr;
}

#reviews.trv > * {
	grid-column: 1 / -1;
	max-width: none;
}

/* ------------------------------------------------------------------ Stars */

.trv-stars {
	position: relative;
	display: inline-flex;
	line-height: 0;
	vertical-align: middle;
}

.trv-stars__row {
	display: flex;
	flex-wrap: nowrap;
	gap: 2px;
}

.trv-stars__row svg {
	flex: 0 0 auto;
	width: var(--trv-star-size, 18px);
	height: var(--trv-star-size, 18px);
	fill: currentColor;
}

.trv-stars__row--bg {
	color: var(--trv-star-empty);
}

.trv-stars__row--fg {
	position: absolute;
	inset: 0;
	width: var(--trv-star-fill, 0%);
	overflow: hidden;
	color: var(--trv-star-color);
}

.trv-stars__inner {
	display: flex;
	flex-wrap: nowrap;
	gap: 2px;
	width: calc(var(--trv-star-size, 18px) * 5 + 8px);
}

/* ---------------------------------------------------------------- Summary */

.trv-summary {
	padding-bottom: 30px;
	border-bottom: 1px solid var(--trv-border);
}

.trv-summary__title {
	margin: 0 0 28px;
	font-size: 22px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-align: center;
	text-transform: uppercase;
}

.trv-summary__grid {
	display: grid;
	grid-template-columns: 1fr 1.1fr 1fr;
	align-items: center;
	gap: 30px;
}

.trv-summary__average {
	text-align: center;
}

.trv-summary__score {
	margin: 10px 0 4px;
	font-size: 15px;
}

.trv-summary__score-value {
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.trv-summary__count {
	margin: 0;
	font-size: 14px;
	opacity: 0.75;
}

/* The vertical rules between the three columns. */
.trv-summary__dist {
	padding: 0 30px;
	border-left: 1px solid var(--trv-border);
	border-right: 1px solid var(--trv-border);
}

.trv-dist__row {
	display: grid;
	grid-template-columns: auto 1fr 34px;
	align-items: center;
	gap: 12px;
	padding: 3px 0;
}

.trv-bar {
	display: block;
	height: 11px;
	background: var(--trv-bar-track);
	overflow: hidden;
}

.trv-bar__fill {
	display: block;
	height: 100%;
	min-width: 2px;
	background: var(--trv-bar-fill);
}

.trv-dist__count {
	font-size: 14px;
	text-align: right;
	opacity: 0.8;
	font-variant-numeric: tabular-nums;
}

.trv-summary__actions {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
}

/* --------------------------------------------------------------- Buttons */

.trv-btn {
	display: inline-block;
	min-width: 240px;
	padding: 13px 26px;
	border: 1px solid var(--trv-solid-bg);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.trv-btn--solid {
	background: var(--trv-solid-bg);
	color: var(--trv-solid-text);
}

.trv-btn--outline {
	background: transparent;
	color: var(--trv-solid-bg);
	text-transform: uppercase;
	letter-spacing: 0.06em;
	font-weight: 500;
}

/* Hover stays within each button's own look - it must never make one button
   read as the other one's resting state. */
.trv-btn--solid:hover {
	opacity: 0.85;
}

.trv-btn--outline:hover {
	background: rgba(0, 0, 0, 0.06);
	background: color-mix(in srgb, var(--trv-solid-bg) 8%, transparent);
}

/**
 * While a panel is open the active button is the only dark one: the other drops
 * to the outline look whatever its resting style was. That way "dark" always
 * means "this is the panel you are looking at".
 */
.trv-btn[aria-expanded="true"] {
	background: var(--trv-solid-bg);
	color: var(--trv-solid-text);
	opacity: 1;
}

.trv.is-open .trv-btn:not([aria-expanded="true"]) {
	background: transparent;
	color: var(--trv-solid-bg);
}

.trv.is-open .trv-btn:not([aria-expanded="true"]):hover {
	background: rgba(0, 0, 0, 0.06);
	background: color-mix(in srgb, var(--trv-solid-bg) 8%, transparent);
	opacity: 1;
}

/* ---------------------------------------------------------------- Panels */

.trv-panel {
	border-bottom: 1px solid var(--trv-border);
	scroll-margin-top: var(--trv-scroll-offset);
}

.trv-panel__inner {
	max-width: 780px;
	margin: 0 auto;
	padding: 34px 0 40px;
}

.trv-panel__title {
	margin: 0 0 20px;
	font-size: 18px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.trv-panel .comment-reply-title {
	display: block;
}

.trv-notice {
	margin: 0;
	padding: 18px 0;
	font-size: 15px;
	opacity: 0.8;
}

/* ------------------------------------------------------------ The form */

/**
 * WordPress prints the author and email fields BEFORE the comment field, and
 * any field a theme adds (Blocksy's photo upload, for one) lands wherever it
 * was hooked. Grid plus `order` puts them in the intended reading order
 * without touching anyone else's markup: rating, name, email, review, then
 * whatever else was added, then the submit button.
 */
.trv-form__form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 20px;
}

.trv-form__form > * {
	grid-column: 1 / -1;
	order: 6;
	margin: 0 0 18px;
}

.trv-form__identity {
	order: 0;
	font-size: 14px;
	opacity: 0.8;
}

.trv-form__rating {
	order: 1;
}

.trv-form__form .comment-form-author {
	order: 2;
	grid-column: 1;
}

.trv-form__form .comment-form-email {
	order: 3;
	grid-column: 2;
}

/* Blocksy's review title field, when that feature is on. */
.trv-form__form .comment-form-field-input-title {
	order: 4;
}

.trv-form__form .comment-form-comment,
.trv-form__form .comment-form-field-textarea {
	order: 5;
}

/* Blocksy's photo upload - it appends itself to the comment field. */
.trv-form__form .ct-review-upload-section {
	order: 7;
}

.trv-form__form .comment-form-cookies-consent {
	order: 8;
}

.trv-form__form .form-submit {
	order: 9;
	margin-bottom: 0;
}

/* Field labels only - not the star picker's labels, and not the upload tile,
   both of which are <label> elements with a job of their own. */
.trv-form__form > p > label,
.trv-form__form > label,
.trv-form__rating-label {
	display: block;
	margin-bottom: 6px;
	font-size: 13px;
	opacity: 0.85;
}

.trv-form__form input[type="text"],
.trv-form__form input[type="email"],
.trv-form__form input[type="url"],
.trv-form__form textarea {
	width: 100%;
	padding: 11px 13px;
	border: 1px solid var(--trv-border);
	border-radius: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 15px;
	box-sizing: border-box;
}

.trv-form__form textarea {
	min-height: 140px;
	resize: vertical;
}

.trv-form__form input:focus,
.trv-form__form textarea:focus {
	outline: 2px solid var(--trv-star-color);
	outline-offset: -1px;
	border-color: transparent;
}

.trv-form__form .form-submit input[type="submit"],
.trv-form__form .form-submit button {
	min-width: 240px;
	padding: 13px 26px;
	border: 1px solid var(--trv-solid-bg);
	border-radius: 0;
	background: var(--trv-solid-bg);
	color: var(--trv-solid-text);
	font-family: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: opacity 0.15s ease;
}

.trv-form__form .form-submit input[type="submit"]:hover,
.trv-form__form .form-submit button:hover {
	opacity: 0.85;
}

.trv-form__form .required {
	color: inherit;
	opacity: 0.6;
}

/**
 * Photo upload.
 *
 * The markup belongs to Blocksy's advanced reviews:
 *   <span class="ct-review-upload-actions ct-review-images">
 *     <label class="ct-upload-button" for="blc-review-images">+</label>
 *     <input type="file" name="blc-review-images[]" multiple>
 *   </span>
 * We only restyle it. Blocksy appends the chosen files as siblings of the
 * button inside the same span, so they are sized by the sibling rule below.
 */
.trv .trv-form__form .ct-review-upload-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	/* Same 6px that sits under every other label in this form. */
	margin: 6px 0 0;
}

.trv .trv-form__form > .ct-review-upload-section {
	margin-top: 0;
}

.trv .trv-form__form .ct-upload-button {
	position: relative;
	display: grid;
	place-items: center;
	width: 60px;
	height: 60px;
	margin: 0;
	border: 2px dashed var(--trv-border);
	border-radius: 2px;
	background: transparent;
	color: inherit;
	cursor: pointer;
	/* Only the colour changes on hover - the border keeps its dashed style, so
	   the tile does not appear to change shape under the cursor. */
	transition: border-color 0.15s ease, color 0.15s ease;
}

/* Blocksy's plus is a solid glyph and reads heavy at this size; two hairlines
   give the same sign at the weight of the rest of the form. */
.trv .trv-form__form .ct-upload-button svg {
	display: none;
}

.trv .trv-form__form .ct-upload-button::before,
.trv .trv-form__form .ct-upload-button::after {
	content: "";
	position: absolute;
	background: currentColor;
	opacity: 0.55;
	transition: opacity 0.15s ease;
}

.trv .trv-form__form .ct-upload-button::before {
	width: 14px;
	height: 2px;
}

.trv .trv-form__form .ct-upload-button::after {
	width: 2px;
	height: 14px;
}

.trv .trv-form__form .ct-upload-button:hover {
	border-color: var(--trv-star-color);
	color: var(--trv-star-color);
}

.trv .trv-form__form .ct-upload-button:hover::before,
.trv .trv-form__form .ct-upload-button:hover::after {
	opacity: 1;
}

/* The file input is keyboard-reachable, so the tile shows its focus. */
.trv-form__form .ct-review-upload-actions input[type="file"] {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	clip-path: inset(50%);
	overflow: hidden;
}

.trv-form__form .ct-review-upload-actions:focus-within .ct-upload-button {
	outline: 2px solid var(--trv-star-color);
	outline-offset: 2px;
	opacity: 1;
}

.trv-form__form .ct-review-upload-actions > *:not(.ct-upload-button):not(input) {
	width: 60px;
	height: 60px;
	overflow: hidden;
	border: 1px solid var(--trv-border);
}

.trv-form__form .ct-review-upload-actions img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Rating picker */

.trv-form__rating {
	margin: 0 0 18px;
}

/**
 * Label on its own line, stars on the next.
 *
 * Setting display:block on the label is not enough: Blocksy lays the comment
 * form out as a grid/flex, which makes the label and the star row siblings on
 * one line no matter what the label itself says. The container has to be told
 * to stack.
 */
.trv .trv-form__form .trv-form__rating {
	display: block;
}

.trv .trv-form__form .trv-form__rating .trv-form__rating-label {
	display: block;
	width: 100%;
	margin-bottom: 8px;
}

.trv .trv-form__form .trv-form__rating .trv-rating-input {
	display: inline-flex;
	vertical-align: top;
}

/**
 * Any consent row - box first, text beside it. Matched on "a row that contains
 * a checkbox" rather than on a class name, because the terms checkbox is not
 * ours: depending on the site it comes from WordPress, the theme or a privacy
 * plugin, each with its own wrapper class.
 */
.trv .trv-form__form > p:has(input[type="checkbox"]),
.trv .trv-form__form > div:has(input[type="checkbox"]) {
	display: flex;
	align-items: center;
	gap: 8px;
	order: 8;
}

/**
 * Themes style checkboxes in ways that survive `align-items: center` - a
 * margin, a relative `top`, a translate. All three are cancelled here, so the
 * box lines up with its text whatever the theme does with it.
 */
.trv .trv-form__form input[type="checkbox"] {
	flex: 0 0 auto;
	width: auto;
	margin: 0 !important;
	top: 0;
	transform: none;
	align-self: center;
	vertical-align: middle;
}

.trv .trv-form__form > p:has(input[type="checkbox"]) > *,
.trv .trv-form__form > div:has(input[type="checkbox"]) > * {
	align-self: center;
	margin-top: 0;
	margin-bottom: 0;
	line-height: 1.4;
}

.trv .trv-form__form > p:has(input[type="checkbox"]) > label,
.trv .trv-form__form > div:has(input[type="checkbox"]) > label {
	display: inline;
	flex: 1 1 auto;
	margin: 0;
	font-size: 13px;
}

.trv-form__rating-label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
}

.trv-rating-input {
	display: inline-flex;
	flex-direction: row-reverse;
	justify-content: flex-end;
	gap: 4px;
}

.trv-rating-input input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	overflow: hidden;
	white-space: nowrap;
}

.trv-rating-input label {
	line-height: 0;
	color: var(--trv-star-empty);
	cursor: pointer;
	transition: color 0.1s ease;
}

.trv-rating-input label svg {
	width: 26px;
	height: 26px;
	fill: currentColor;
}

.trv-rating-input input:checked ~ label,
.trv-rating-input label:hover,
.trv-rating-input label:hover ~ label {
	color: var(--trv-star-color);
}

.trv-rating-input input:focus-visible + label {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* ----------------------------------------------------------------- List */

.trv-results {
	position: relative;
	transition: opacity 0.15s ease;
}

.trv-results[aria-busy="true"] {
	opacity: 0.45;
}

.trv-list,
.trv-review__replies {
	margin: 0;
	padding: 0;
	list-style: none;
}

.trv-review {
	padding: 26px 0;
	border-bottom: 1px solid var(--trv-border);
}

.trv-review__body {
	display: flex;
	gap: 18px;
}

/**
 * Avatars come back at whatever size the source hands over - Gravatar, a local
 * fallback, a retina copy - so the size is pinned here rather than trusted from
 * the width/height attributes.
 */
.trv-review__avatar {
	flex: 0 0 auto;
}

.trv-review__avatar img {
	display: block;
	width: 46px;
	height: 46px;
	border-radius: 50% !important;
	object-fit: cover;
}

.trv-review__replies .trv-review__avatar img {
	width: 36px;
	height: 36px;
}

/* A review title (Blocksy's advanced reviews add one) must not outshout the
   author's name. */
.trv-review__content h2,
.trv-review__content h3,
.trv-review__content h4 {
	margin: 10px 0 0;
	font-size: 1rem;
	line-height: 1.4;
}

.trv-review__content {
	flex: 1 1 auto;
	min-width: 0;
}

.trv-review__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-bottom: 0;
}

.trv-review__author {
	font-weight: 600;
}

.trv-review__date {
	font-size: 13px;
	opacity: 0.6;
}

.trv-review__verified {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: #2e7d32;
}

.trv-review__verified svg {
	width: 15px;
	height: 15px;
	fill: currentColor;
}

.trv-review__text {
	margin-top: 8px;
	line-height: 1.7;
}

/* Woo wraps the body in .description, so match on descendants. */
.trv-review__text p:last-child {
	margin-bottom: 0;
}

.trv-review__text img {
	max-width: 100%;
	height: auto;
}

/**
 * Photos attached to a review: <div class="ct-review-images"> holding one
 * <figure class="ct-media-container"> per photo. Blocksy's own stylesheet now
 * sizes these (the section carries the woocommerce-Reviews class), and the
 * values below mirror it so the layout holds even if that stylesheet is not
 * loaded - for instance with the advanced reviews feature switched off.
 */
.trv-review__text .ct-review-images {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 15px;
}

.trv-review__text .ct-review-images .ct-media-container {
	width: 60px;
	height: 60px;
	margin: 0;
	border-radius: 2px;
	overflow: hidden;
}

.trv-review__text .ct-review-images img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/**
 * Helpful votes. Blocksy hides the tally with visibility:hidden while nobody
 * has voted, which still reserves the space - collapse it instead, so the two
 * thumbs sit on their own until the first vote arrives.
 */
.trv-review .ct-review-votes [data-count="0"] {
	display: none;
}

.trv-review__pending {
	margin: 6px 0 0;
	font-size: 13px;
	font-style: italic;
	opacity: 0.7;
}

.trv-review__replies {
	margin: 20px 0 0 74px;
	border-left: 2px solid var(--trv-border);
	padding-left: 20px;
}

.trv-review__replies .trv-review {
	padding: 14px 0;
	border-bottom: 0;
}

.trv-empty {
	padding: 34px 0;
	text-align: center;
	opacity: 0.75;
}

/* ----------------------------------------------------------------- Tabs */

.trv-tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 28px;
	padding: 22px 0 0;
	border-bottom: 1px solid var(--trv-border);
}

/* Phones only - on a narrow screen a centred pair of tabs reads as floating,
   and the left edge gives them something to sit against. Tablets keep the
   centred version. */
@media (max-width: 600px) {
	.trv-tabs {
		justify-content: flex-start;
		gap: 20px;
	}
}

.trv-tab {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 0 0 14px;
	border-bottom: 2px solid transparent;
	color: inherit;
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	opacity: 0.6;
	transition: opacity 0.15s ease, border-color 0.15s ease;
}

.trv-tab:hover {
	opacity: 1;
}

.trv-tab.is-active {
	opacity: 1;
	border-bottom-color: var(--trv-solid-bg);
}

.trv-tab__count {
	padding: 1px 8px;
	background: var(--trv-bar-track);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.trv-tab.is-active .trv-tab__count {
	background: var(--trv-solid-bg);
	color: var(--trv-solid-text);
}

/* ------------------------------------------------------------ Questions */

.trv-question__text {
	margin-top: 8px;
	line-height: 1.7;
	max-width: 68ch;
}

.trv-question__text p:last-child {
	margin-bottom: 0;
}

/* The indent alone carries the hierarchy - a rule down the side reads as a
   quote, not as an answer. */
/**
 * The indent alone carries the hierarchy - a rule down the side reads as a
 * quote, not as an answer.
 *
 * Written with the ID and a logical property on purpose: this is an <ol>, and
 * themes reset list padding with selectors like `.entry-content ol`, which
 * outranks a single class and quietly flattens the indent.
 */
#reviews.trv .trv-question__answers {
	margin: 16px 0 0;
	padding-inline-start: 2rem;
	padding-inline-end: 0;
	list-style: none;
}

@media (max-width: 600px) {
	#reviews.trv .trv-question__answers {
		padding-inline-start: 1.25rem;
	}
}

.trv-answer + .trv-answer {
	margin-top: 14px;
}

.trv-answer__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

.trv-answer__badge {
	padding: 2px 8px;
	background: var(--trv-solid-bg);
	color: var(--trv-solid-text);
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.trv-answer__text {
	margin-top: 6px;
	line-height: 1.7;
}

.trv-answer__text p:last-child {
	margin-bottom: 0;
}

/* ----------------------------------------------------------- Pagination */

.trv-pagination {
	padding: 26px 0 4px;
}

.trv-pagination__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.trv-pagination a,
.trv-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	height: 38px;
	padding: 0 10px;
	border: 1px solid var(--trv-border);
	font-size: 14px;
	text-decoration: none;
	color: inherit;
}

.trv-pagination a:hover {
	border-color: var(--trv-solid-bg);
}

.trv-pagination .current {
	background: var(--trv-solid-bg);
	border-color: var(--trv-solid-bg);
	color: var(--trv-solid-text);
}

.trv-pagination .dots {
	border-color: transparent;
}

/* --------------------------------------------------------------- Mobile */

@media (max-width: 900px) {
	.trv-summary__grid {
		grid-template-columns: 1fr;
		gap: 24px;
	}

	.trv-summary__dist {
		padding: 24px 0;
		border-left: 0;
		border-right: 0;
		border-top: 1px solid var(--trv-border);
		border-bottom: 1px solid var(--trv-border);
	}

	.trv-summary__actions {
		align-items: stretch;
	}

	.trv-btn {
		min-width: 0;
		width: 100%;
	}

	.trv-form__form .comment-form-author,
	.trv-form__form .comment-form-email {
		grid-column: 1 / -1;
	}

	.trv-form__form .form-submit input[type="submit"],
	.trv-form__form .form-submit button {
		width: 100%;
		min-width: 0;
	}

	.trv-review__body {
		gap: 12px;
	}

	.trv-review__replies {
		margin-left: 20px;
		padding-left: 14px;
	}
}
