/**
 * Bamboo Manchester Testimonials styling.
 *
 * Override the variables below in the theme to change colours and timing.
 *
 * @package BambooManchesterTestimonials
 */

.bamboo-testimonial-form,
.bamboo-testimonials {
	--bamboo-testimonials-star-color: #f5a623;
	--bamboo-testimonials-star-off-color: #d3d6dc;
	--bamboo-testimonials-star-size: 28px;
	--bamboo-testimonials-fade: 1s;
	--bamboo-testimonials-error-color: #b3261e;
}


/* Form */

/* Field labels follow the text colour of the block the form sits in, so the form works on light and dark backgrounds. */
#bamboo-testimonial-form > label,
#bamboo-testimonial-form legend {
	color: var(--bamboo-testimonials-label-color, inherit);
	font-size: var(--bamboo-testimonials-font-size, 16px);
}

#bamboo-testimonial-form input,
#bamboo-testimonial-form textarea {
	font-size: var(--bamboo-testimonials-font-size, 16px);
}

.bamboo-testimonial-form .bamboo-testimonial-rating {
	border: none;
	padding: 0;
	margin: 0 0 20px 0;
	min-width: 0;
}

.bamboo-testimonial-form .bamboo-testimonial-rating legend {
	padding: 0;
	margin-bottom: 5px;
	font-weight: 600;
}

.bamboo-testimonial-form .bamboo-testimonial-stars {
	display: inline-flex;
}

.bamboo-testimonial-form .bamboo-testimonial-stars label {
	display: block;
	position: relative;
	margin: 0;
	padding: 0 6px 0 0;
	line-height: 0;
	cursor: pointer;
	color: var(--bamboo-testimonials-star-off-color);
	transition: color 0.15s;
}

.bamboo-testimonial-form .bamboo-testimonial-stars svg {
	width: calc(var(--bamboo-testimonials-star-size) * 1.4);
	height: calc(var(--bamboo-testimonials-star-size) * 1.4);
}

/* Keep the radio buttons and their text available to keyboards and screen readers. */
.bamboo-testimonial-form .bamboo-testimonial-stars input,
.bamboo-testimonial-form .bamboo-testimonial-stars b {
	position: absolute;
	width: 1px !important;
	height: 1px !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	opacity: 0;
}

/* Fill the chosen star and every star before it. */
.bamboo-testimonial-form .bamboo-testimonial-stars label:has(input:checked),
.bamboo-testimonial-form .bamboo-testimonial-stars label:has(~ label input:checked) {
	color: var(--bamboo-testimonials-star-color);
}

/* Preview the rating on hover. */
.bamboo-testimonial-form .bamboo-testimonial-stars:hover label {
	color: var(--bamboo-testimonials-star-color);
}

.bamboo-testimonial-form .bamboo-testimonial-stars:hover label:hover ~ label {
	color: var(--bamboo-testimonials-star-off-color);
}

.bamboo-testimonial-form .bamboo-testimonial-stars label:has(input:focus-visible) {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.bamboo-testimonial-form .bamboo-testimonial-confirm {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.bamboo-testimonial-errors {
	list-style: none;
	margin: 0 0 20px 0;
	padding: 12px 16px;
	border-left: 4px solid var(--bamboo-testimonials-error-color);
	color: var(--bamboo-testimonials-error-color);
	background-color: #fff;
}

.bamboo-testimonial-message {
	scroll-margin-top: 140px;
}

.bamboo-testimonial-form {
	scroll-margin-top: 140px;
}


/* Carousel */

.bamboo-testimonials {
	text-align: center;
}

/* Stack every testimonial in the same cell so the carousel is as tall as the longest one. */
.bamboo-testimonials-slides {
	display: grid;
}

.bamboo-testimonial {
	grid-area: 1 / 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	margin: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--bamboo-testimonials-fade) ease, visibility 0s linear var(--bamboo-testimonials-fade);
}

.bamboo-testimonial.active {
	opacity: 1;
	visibility: visible;
	transition: opacity var(--bamboo-testimonials-fade) ease, visibility 0s;
}

.bamboo-testimonial-stars-display {
	display: inline-flex;
	gap: 4px;
	margin-bottom: 20px;
	line-height: 0;
}

.bamboo-testimonial-stars-display span {
	width: var(--bamboo-testimonials-star-size);
	height: var(--bamboo-testimonials-star-size);
}

.bamboo-testimonial-stars-display svg {
	width: 100%;
	height: 100%;
}

.bamboo-testimonial-stars-display .on {
	color: var(--bamboo-testimonials-star-color);
}

.bamboo-testimonial-stars-display .off {
	color: var(--bamboo-testimonials-star-off-color);
}

.bamboo-testimonial-text {
	max-width: 860px;
	font-size: 1.25em;
	line-height: 1.5;
}

.bamboo-testimonial-text p {
	margin: 0 0 0.75em 0;
}

.bamboo-testimonial figcaption {
	margin-top: 12px;
}

.bamboo-testimonial-name {
	display: block;
	font-weight: 700;
}

.bamboo-testimonial-details {
	display: block;
	font-size: 0.9em;
	opacity: 0.8;
}

.bamboo-testimonials-dots {
	display: flex;
	justify-content: center;
	gap: 10px;
	margin-top: 28px;
}

.bamboo-testimonials-dots button {
	width: 12px;
	height: 12px;
	min-width: 0;
	padding: 0;
	border: none;
	border-radius: 50%;
	background-color: currentColor;
	opacity: 0.25;
	cursor: pointer;
	transition: opacity 0.3s;
}

.bamboo-testimonials-dots button:hover,
.bamboo-testimonials-dots button.active {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.bamboo-testimonial,
	.bamboo-testimonial.active {
		transition: none;
	}
}
