/* ============================================================
   Puratek Testimonial Plugin — Front-End Styles v2.0.0
   ============================================================ */

:root {
	--puratek-white:        #ffffff;
	--puratek-navy:         #1A2340;
	--puratek-charcoal:     #2C3E5D;
	--puratek-text-muted:   #6B7A99;
	--puratek-gold:         #F5A623;
	--puratek-border:       #E8ECF0;
	--puratek-divider:      #EEF1F5;
	--puratek-quote-color:  #F0F2F5;
	--puratek-dot-inactive: #D5DCE8;
	--puratek-arrow-bg:     rgba(255,255,255,0.95);
	--puratek-arrow-color:  #1A2340;
	--puratek-radius:       18px;
	--puratek-transition:   0.6s cubic-bezier(0.4, 0, 0.2, 1);

	/* Card background — kept in sync by the live settings CSS (used by the scroll fade) */
	--puratek-card-bg:      #ffffff;

	/* Reading window, in lines of text: compact by default, slightly taller once expanded */
	--puratek-content-lines:          6;
	--puratek-content-lines-expanded: 9;
	--puratek-content-line-height:    1.7;

	--puratek-scroll-track:       rgba(26,35,64,0.07);
	--puratek-scroll-thumb:       rgba(26,35,64,0.24);
	--puratek-scroll-thumb-hover: rgba(26,35,64,0.40);
}

/* ── Section wrapper ─────────────────────────────────────── */
.puratek-testimonial-section {
	position: relative;
	width: 100%;
	box-sizing: border-box;
}

/* ── Viewport + track ────────────────────────────────────── */
.puratek-carousel-viewport {
	overflow: hidden;
	width: 100%;
}

.puratek-carousel-track {
	display: flex;
	align-items: stretch;
	gap: 0;
	transition: transform var(--puratek-transition);
	will-change: transform;
}

/* ── Card ────────────────────────────────────────────────── */
.puratek-testimonial-card {
	position: relative;
	flex: 0 0 auto;
	background: var(--puratek-white);
	border: 1px solid var(--puratek-border);
	border-style: solid;
	border-radius: var(--puratek-radius);
	padding: 32px;
	transition: transform 0.3s ease, border-color 0.3s ease;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	margin: 8px 12px;
}

/* Flat cards — the lift and a slightly firmer border carry the hover state */
.puratek-testimonial-card:hover {
	transform: translateY(-4px);
	border-color: #D9E0EA;
}

/* ── Quote icon ──────────────────────────────────────────── */
.puratek-quote-icon {
	position: absolute;
	top: 20px;
	right: 24px;
	font-size: 80px;
	line-height: 1;
	color: var(--puratek-quote-color);
	font-family: Georgia, serif;
	pointer-events: none;
	user-select: none;
	z-index: 0;
}

/* ── Stars ───────────────────────────────────────────────── */
.puratek-stars { display: flex; gap: 3px; margin-bottom: 10px; position: relative; z-index: 1; }
.puratek-star { font-size: 18px; line-height: 1; }
.puratek-star--filled { color: var(--puratek-gold); }
.puratek-star--empty  { color: var(--puratek-border); }

/* ── Gold accent line ────────────────────────────────────── */
.puratek-star-divider {
	width: 36px; height: 2px;
	background-color: var(--puratek-gold);
	border-radius: 2px;
	margin-bottom: 18px;
	position: relative; z-index: 1;
}

/* ── Body ────────────────────────────────────────────────── */
.puratek-testimonial-body { flex: 1; position: relative; z-index: 1; margin-bottom: 0; }

/* Positioning context for the bottom fade */
.puratek-testimonial-scrollarea { position: relative; }

.puratek-testimonial-content {
	color: var(--puratek-charcoal);
	font-size: 15px;
	line-height: var(--puratek-content-line-height);
	margin: 0;
	max-height: calc(var(--puratek-content-lines) * var(--puratek-content-line-height) * 1em);
	overflow: hidden;
	overscroll-behavior: contain;
	/* Room for the rail, reserved in both states so the text never reflows */
	padding-right: 16px;
	transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed: clamp to exactly the height of the reading window, with an ellipsis */
.puratek-testimonial-body:not(.is-expanded) .puratek-testimonial-content {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--puratek-content-lines);
	line-clamp: var(--puratek-content-lines);
}

/* Expanded: a slightly taller window that always carries its own scrollbar */
.puratek-testimonial-body.is-expanded .puratek-testimonial-content {
	display: block;
	overflow-y: scroll;
	max-height: calc(var(--puratek-content-lines-expanded) * var(--puratek-content-line-height) * 1em);
}

/* Off-screen measuring state used by the script to detect real overflow */
.puratek-testimonial-body.ptc-measuring .puratek-testimonial-content {
	display: block;
	-webkit-line-clamp: none;
	line-clamp: none;
}

/* `lh` matches the real computed line-height exactly (theme overrides included) */
@supports (max-height: 1lh) {
	.puratek-testimonial-content {
		max-height: calc(var(--puratek-content-lines) * 1lh);
	}
	.puratek-testimonial-body.is-expanded .puratek-testimonial-content {
		max-height: calc(var(--puratek-content-lines-expanded) * 1lh);
	}
}

/* ── Scrollbar ───────────────────────────────────────────── */
/* The native bar is hidden and replaced by the rail below: macOS, iOS and
   Android all use overlay scrollbars that fade out a moment after scrolling,
   and no amount of styling keeps those on screen. */
.puratek-testimonial-content {
	scrollbar-width: none;
	-ms-overflow-style: none;
}
.puratek-testimonial-content::-webkit-scrollbar { width: 0; height: 0; display: none; }

.puratek-scrollbar {
	position: absolute;
	top: 0; right: 0; bottom: 0;
	width: 6px;
	border-radius: 999px;
	background-color: var(--puratek-scroll-track);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}
.puratek-testimonial-body.is-expanded .puratek-scrollbar {
	opacity: 1;
	visibility: visible;
}

.puratek-scrollbar-thumb {
	position: absolute;
	left: 0; right: 0; top: 0;
	height: 0;
	min-height: 28px;
	border-radius: 999px;
	background-color: var(--puratek-scroll-thumb);
	cursor: grab;
	transition: background-color 0.2s ease;
}
.puratek-scrollbar-thumb:hover { background-color: var(--puratek-scroll-thumb-hover); }
.puratek-scrollbar.is-dragging .puratek-scrollbar-thumb {
	background-color: var(--puratek-scroll-thumb-hover);
	cursor: grabbing;
}

.puratek-testimonial-content:focus-visible {
	outline: 2px solid var(--puratek-gold);
	outline-offset: 4px;
	border-radius: 4px;
}

/* ── Bottom fade (only while more text is below) ─────────── */
.puratek-testimonial-scrollarea::after {
	content: "";
	position: absolute;
	left: 0; right: 14px; bottom: 0;
	height: 32px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.25s ease;
	background: linear-gradient(to bottom, transparent, var(--puratek-card-bg));
}
.puratek-testimonial-body.puratek-is-overflowing:not(.puratek-at-end) .puratek-testimonial-scrollarea::after { opacity: 1; }

/* ── Read More btn ───────────────────────────────────────── */
.puratek-read-more-btn {
	display: inline-flex;
	align-items: center;
	background: none; border: none;
	padding: 0;
	margin-top: 10px;
	max-height: 3em;
	overflow: hidden;
	white-space: nowrap;
	color: var(--puratek-gold);
	font: inherit; font-size: 14px; font-weight: 600;
	line-height: 1.4;
	cursor: pointer; letter-spacing: 0.02em;
	transition: opacity 0.2s ease, max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), margin-top 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}
.puratek-read-more-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 3px; }
.puratek-read-more-btn:hover { opacity: 0.75; }

/* Retiring the trigger: fades and gives its space back as the text area grows */
.puratek-read-more-btn--retiring {
	opacity: 0;
	max-height: 0;
	margin-top: 0;
	pointer-events: none;
}
.puratek-read-more-btn--hidden { display: none; }

/* ── Divider ─────────────────────────────────────────────── */
.puratek-card-divider {
	width: 100%; height: 1px;
	background-color: var(--puratek-divider);
	margin: 20px 0; position: relative; z-index: 1;
}

/* ── Customer info ───────────────────────────────────────── */
.puratek-customer-info { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }

.puratek-customer-photo { flex-shrink: 0; }
.puratek-customer-photo img {
	width: 52px; height: 52px;
	border-radius: 50%; object-fit: cover;
	display: block; border: 2px solid var(--puratek-border);
}
.puratek-customer-photo-placeholder {
	width: 52px; height: 52px; border-radius: 50%;
	background: linear-gradient(135deg, #E8ECF0 0%, #D0D9E8 100%);
	display: flex; align-items: center; justify-content: center;
	font-size: 20px; font-weight: 700;
	color: var(--puratek-text-muted); text-transform: uppercase;
}

.puratek-customer-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.puratek-customer-name    { font-size: 15px; font-weight: 700; color: var(--puratek-navy); display: block; line-height: 1.3; }
.puratek-customer-company { font-size: 12px; color: var(--puratek-text-muted); display: block; font-style: italic; line-height: 1.3; }

/* ── Arrow buttons ───────────────────────────────────────── */
.puratek-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 10;
	background: var(--puratek-arrow-bg);
	border: 1px solid var(--puratek-border);
	border-radius: 50%;
	width: 44px; height: 44px;
	font-size: 24px; line-height: 1;
	color: var(--puratek-arrow-color);
	cursor: pointer;
	display: flex; align-items: center; justify-content: center;
	box-shadow: 0 2px 8px rgba(0,0,0,0.1);
	transition: background 0.2s, box-shadow 0.2s;
}
.puratek-arrow:hover {
	background: var(--puratek-gold);
	color: #fff;
	border-color: var(--puratek-gold);
	box-shadow: 0 4px 16px rgba(245,166,35,0.3);
}
.puratek-arrow--prev { left: -22px; }
.puratek-arrow--next { right: -22px; }
.puratek-arrow.puratek-arrow--hidden { display: none; }

/* ── Dots ────────────────────────────────────────────────── */
.puratek-carousel-dots {
	display: flex; justify-content: center;
	align-items: center; gap: 8px; margin-top: 28px;
}
.puratek-dot {
	width: 10px; height: 10px; border-radius: 50%;
	border: none; background-color: var(--puratek-dot-inactive);
	cursor: pointer; padding: 0;
	transition: background-color 0.3s, width 0.3s;
}
.puratek-dot--active {
	background-color: var(--puratek-gold);
	width: 28px; border-radius: 5px;
}

/* ── No results ──────────────────────────────────────────── */
.puratek-no-testimonials { text-align: center; color: var(--puratek-text-muted); font-size: 15px; padding: 40px 0; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1023px) {
	.puratek-testimonial-card { padding: 26px; }
	.puratek-quote-icon { font-size: 64px; }
}
@media (max-width: 767px) {
	.puratek-testimonial-card { padding: 24px 20px; }
	.puratek-quote-icon { font-size: 56px; top: 14px; right: 16px; }
	.puratek-carousel-dots { margin-top: 20px; }
	.puratek-arrow--prev { left: -10px; }
	.puratek-arrow--next { right: -10px; }
	.puratek-testimonial-section {
		--puratek-content-lines: 5;
		--puratek-content-lines-expanded: 8;
	}
	.puratek-testimonial-scrollarea::after { height: 26px; }
}

/* Touch devices: a slightly wider rail so the thumb is grabbable */
@media (hover: none) {
	.puratek-scrollbar { width: 8px; }
	.puratek-scrollbar-thumb { background-color: var(--puratek-scroll-thumb-hover); }
}

@media (prefers-reduced-motion: reduce) {
	.puratek-testimonial-card,
	.puratek-carousel-track,
	.puratek-dot,
	.puratek-arrow,
	.puratek-testimonial-scrollarea::after,
	.puratek-testimonial-content,
	.puratek-scrollbar,
	.puratek-read-more-btn { transition: none; }
	.puratek-testimonial-content { scroll-behavior: auto; }
}
