/* =========================================================================
 * Google Reviews Carousel — structural styles (loaded once)
 * Per-instance colors/fonts are injected as CSS variables by the module.
 * ====================================================================== */

.ail-reviews {
	/* Fallback defaults so the widget still looks right if variables are missing */
	--green: #097641;
	--gold: #F5B301;
	--ink: #23282B;
	--muted: #6B7280;
	--card: #ffffff;
	--avatar: #9BC4A8;
	--ring: #097641;
	--radius: 28px;
	--heading-font: 'Roboto';
	--heading-weight: 700;
	--heading-transform: none;
	--body-font: 'Nunito';
	--body-weight: 400;

	position: relative;
	width: 100%;
	box-sizing: border-box;
	padding: 20px 0;
	overflow: visible;
	font-family: var(--body-font), system-ui, sans-serif;
}

.ail-reviews *,
#ail-lightbox * { box-sizing: border-box; }

/* overflow-x: clip contains the peeking neighbor slides (which extend past the
 * viewport) so the page never gets a horizontal scrollbar; overflow-y stays
 * visible so card shadows / focus outlines are never clipped. */
.ail-reviews .window { overflow-x: hidden; overflow-x: clip; overflow-y: visible; width: 100%; padding: 30px 0; }
/* Older Safari (iOS < 16) ignores overflow-x: clip, and "hidden" on one axis
 * forces the other to scroll — clip both so the page never gets wider than the
 * phone (which made other sections look off-centre on older iPhones). */
@supports not (overflow-x: clip) {
	.ail-reviews .window { overflow: hidden; }
}

.ail-reviews .track {
	display: flex;
	align-items: stretch;
	transition: transform .55s cubic-bezier(.4, 0, .2, 1);
	will-change: transform;
}

/* ---- slide / card ---- */
.ail-reviews .slide {
	flex: 0 0 76%;
	margin: 0 14px;
	transform: scale(.9);
	opacity: .5;
	filter: blur(var(--ail-side-blur, 0));
	transition: transform .45s ease, opacity .45s ease, filter .45s ease;
	display: flex;
	position: relative;
	z-index: 1;
}
.ail-reviews .slide.active { transform: scale(1); opacity: 1; filter: blur(0); z-index: 2; }
/* Safety net: until the carousel JS has initialized, never blur/fade cards. */
.ail-reviews:not([data-ail-ready]) .slide { transform: none; opacity: 1; filter: none; }

.ail-reviews .card {
	background: var(--card);
	border-radius: var(--radius);
	box-shadow: 0 30px 70px rgba(9, 40, 24, .16);
	padding: 44px;
	width: 100%;
	display: grid;
	grid-template-columns: minmax(0, 380px) 1fr;
	gap: 40px;
	align-items: center;
}
.ail-reviews .card.no-media {
	grid-template-columns: 1fr;
	gap: 22px;
	padding: 52px;
}

/* ---- gallery ---- */
.ail-reviews .gallery { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ail-reviews .main-wrap {
	position: relative;
	border-radius: 18px;
	overflow: hidden;
	cursor: zoom-in;
	background: #eef1ef;
}
.ail-reviews .main {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	display: block;
	transition: transform .4s ease;
}
.ail-reviews .main-wrap:hover .main { transform: scale(1.03); }
.ail-reviews .zoom-hint {
	position: absolute; right: 12px; bottom: 12px;
	background: rgba(9, 30, 20, .62); color: #fff;
	font-size: 12px; font-weight: 500; letter-spacing: .02em;
	padding: 6px 10px; border-radius: 999px;
	display: flex; align-items: center; gap: 6px;
	pointer-events: none;
}

.ail-reviews .thumbs {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}
.ail-reviews .thumb {
	position: relative;
	aspect-ratio: 1 / 1;
	border-radius: 12px;
	overflow: hidden;
	cursor: pointer;
	padding: 0;
	border: 2px solid transparent;
	background: none;
	transition: border-color .2s ease, transform .2s ease;
}
.ail-reviews .thumb:hover { transform: translateY(-2px); }
.ail-reviews .thumb.active { border-color: var(--ring); }
.ail-reviews .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ail-reviews .thumb .more {
	position: absolute; top: 0; right: 0; bottom: 0; left: 0; inset: 0;
	background: rgba(9, 30, 20, .6);
	color: #fff; font-family: var(--heading-font), 'Roboto', sans-serif;
	font-size: 20px; font-weight: 600;
	display: flex; align-items: center; justify-content: center;
}
.ail-reviews .thumb:focus-visible,
.ail-reviews .nav:focus-visible,
.ail-reviews .dots .dot:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---- content ---- */
.ail-reviews .content { min-width: 0; }
.ail-reviews .stars { color: var(--gold); font-size: 24px; letter-spacing: 4px; line-height: 1; }
.ail-reviews .headline {
	font-family: var(--heading-font), 'Roboto', sans-serif;
	color: var(--green);
	font-weight: var(--heading-weight);
	text-transform: var(--heading-transform);
	line-height: 1.04;
	letter-spacing: .005em;
	font-size: clamp(26px, 2.5vw, 40px);
	margin: 18px 0 18px;
	overflow-wrap: normal;
	word-break: normal;
	hyphens: none;
}
.ail-reviews .body {
	color: var(--ink);
	font-size: clamp(15.5px, 1.1vw, 19px);
	line-height: 1.62;
	margin: 0 0 30px;
	font-weight: var(--body-weight);
}
.ail-reviews .no-media .body { max-width: 60ch; }

.ail-reviews .foot { display: flex; align-items: center; gap: 15px; }
.ail-reviews .avatar {
	width: 54px; height: 54px; border-radius: 50%;
	background: var(--avatar); color: #fff;
	display: flex; align-items: center; justify-content: center;
	font-family: var(--heading-font), 'Roboto', sans-serif; font-weight: 600; font-size: 21px;
	flex: 0 0 auto;
	overflow: hidden;
}
.ail-reviews .avatar.has-img { background: none; }
.ail-reviews .avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ail-reviews .who { display: flex; flex-direction: column; gap: 2px; }
.ail-reviews .who .name { font-weight: 600; color: var(--ink); font-size: 17px; line-height: 1.2; }
.ail-reviews .who .ail-date { color: var(--muted); font-size: 13.5px; line-height: 1.2; }
.ail-reviews .glogo { margin-left: auto; width: 32px; height: 32px; flex: 0 0 auto; }

/* ---- nav + dots ---- */
/* Arrow + dot colors/sizes come from the "Arrows & Dots" style controls
 * (CSS variables); the fallbacks below keep the original look. Rules are
 * written with an extra class so theme button styles (e.g. Hello Elementor's
 * pink button:hover) can't override them. */
.ail-reviews .nav {
	position: absolute; top: 50%; transform: translateY(-50%);
	width: var(--ail-arrow-size, 48px); height: var(--ail-arrow-size, 48px);
	min-width: 0; min-height: 0; margin: 0; padding: 0; line-height: 1;
	border-radius: 50%;
	border: none;
	background: var(--ail-arrow-bg, #fff);
	color: var(--ail-arrow, var(--green));
	font-size: calc(var(--ail-arrow-size, 48px) * .375);
	cursor: pointer; z-index: 5;
	box-shadow: 0 6px 18px rgba(9, 40, 24, .2);
	display: flex; align-items: center; justify-content: center;
	transition: transform .2s ease, background-color .2s ease, color .2s ease;
	-webkit-tap-highlight-color: transparent;
}
.ail-reviews .nav:hover,
.ail-reviews .nav:focus {
	transform: translateY(-50%) scale(1.08);
	background: var(--ail-arrow-bg-hover, var(--ail-arrow-bg, #fff));
	color: var(--ail-arrow-hover, var(--ail-arrow, var(--green)));
}
.ail-reviews .prev { left: 14px; }
.ail-reviews .next { right: 14px; }

.ail-reviews .dots { display: flex; justify-content: center; align-items: center; gap: var(--ail-dot-gap, 9px); margin-top: 28px; }
.ail-reviews .dots .dot {
	width: var(--ail-dot-size, 9px); height: var(--ail-dot-size, 9px);
	min-width: 0; min-height: 0; margin: 0; padding: 0;
	border-radius: 999px; border: none; box-shadow: none;
	/* inactive: the chosen Dot Color, or a faded Primary color */
	background: var(--ail-dot, var(--green));
	opacity: var(--ail-dot-opacity, .3);
	cursor: pointer;
	flex: 0 0 auto;
	transition: width .25s ease, background-color .25s ease, opacity .25s ease;
	-webkit-tap-highlight-color: transparent;
}
.ail-reviews .dots .dot:hover,
.ail-reviews .dots .dot:focus {
	background: var(--ail-dot-hover, var(--ail-dot, var(--green)));
	opacity: var(--ail-dot-hover-opacity, .55);
}
.ail-reviews .dots .dot.active {
	width: var(--ail-dot-active-w, 26px);
	background: var(--ail-dot-active, var(--green));
	opacity: 1;
}

/* ---- builder empty state ---- */
.ail-reviews-empty {
	padding: 28px; text-align: center; color: #6B7280;
	border: 1px dashed #cfd6d2; border-radius: 16px;
	font-family: var(--body-font, 'Nunito'), system-ui, sans-serif;
}

/* =========================================================================
 * Lightbox (single shared instance, appended to <body>)
 * ====================================================================== */
#ail-lightbox {
	--ail-lb-accent: #097641;
	--ail-lb-gold: #F5B301;
	position: fixed; top: 0; right: 0; bottom: 0; left: 0; inset: 0; z-index: 99999;
	background: rgba(8, 20, 14, .92);
	display: none; align-items: center; justify-content: center;
	flex-direction: column; gap: 16px; padding: 24px;
	font-family: 'Nunito', system-ui, sans-serif;
}
#ail-lightbox.open { display: flex; }
#ail-lightbox .lb-stage {
	position: relative; max-width: 900px; width: 100%;
	display: flex; align-items: center; justify-content: center;
}
#ail-lightbox .lb-img {
	max-width: 100%; max-height: 70vh; border-radius: 14px;
	object-fit: contain; display: block;
}
#ail-lightbox .lb-nav {
	position: absolute; top: 50%; transform: translateY(-50%);
	width: 50px; height: 50px; border-radius: 50%;
	border: none; background: rgba(255, 255, 255, .92); color: var(--ail-lb-accent);
	font-size: 20px; cursor: pointer;
	display: flex; align-items: center; justify-content: center;
}
#ail-lightbox .lb-prev { left: -8px; }
#ail-lightbox .lb-next { right: -8px; }
#ail-lightbox .lb-close {
	position: absolute; top: 18px; right: 22px;
	width: 44px; height: 44px; border-radius: 50%;
	border: none; background: rgba(255, 255, 255, .14); color: #fff;
	font-size: 22px; cursor: pointer;
}
#ail-lightbox .lb-count { color: rgba(255, 255, 255, .8); font-size: 14px; }
#ail-lightbox .lb-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 900px; }
#ail-lightbox .lb-strip button {
	width: 60px; height: 60px; border-radius: 8px; overflow: hidden;
	border: 2px solid transparent; padding: 0; cursor: pointer; background: none;
}
#ail-lightbox .lb-strip button.active { border-color: #fff; }
#ail-lightbox .lb-strip img { width: 100%; height: 100%; object-fit: cover; display: block; }
#ail-lightbox .lb-nav:focus-visible,
#ail-lightbox .lb-close:focus-visible,
#ail-lightbox .lb-strip button:focus-visible { outline: 3px solid var(--ail-lb-gold); outline-offset: 2px; }

/* ---- responsive ---- */
@media (max-width: 900px) {
	.ail-reviews { padding: 4px 0 12px; }
	/* window hugs the active card (height set by JS) and animates between reviews */
	.ail-reviews .window { overflow: hidden; padding: 14px 0 26px; transition: height .35s ease; }
	.ail-reviews .track { align-items: flex-start; }
	.ail-reviews .slide { flex: 0 0 calc(100% - 24px); margin: 0 12px; }
	/* one focused card at a time — no blurred slivers on narrow screens */
	.ail-reviews[data-ail-ready] .slide:not(.active) { opacity: 0; pointer-events: none; }
	.ail-reviews .card {
		grid-template-columns: 1fr; gap: 18px; padding: 22px; align-items: start;
		box-shadow: 0 12px 30px rgba(9, 40, 24, .10);
	}
	.ail-reviews .card.no-media { padding: 22px; }
	.ail-reviews .headline { margin: 10px 0 10px; }
	.ail-reviews .body { margin-bottom: 16px; }

	/* bottom control bar:  ‹  • • •  ›  — arrows never cover the review text */
	.ail-reviews .nav {
		top: auto; bottom: 12px; transform: none;
		width: var(--ail-arrow-size, 40px); height: var(--ail-arrow-size, 40px);
		font-size: calc(var(--ail-arrow-size, 40px) * .375);
		box-shadow: 0 4px 12px rgba(9, 40, 24, .16);
	}
	.ail-reviews .nav:hover,
	.ail-reviews .nav:focus { transform: scale(1.06); }
	.ail-reviews .prev { left: 12px; }
	.ail-reviews .next { right: 12px; }
	/* dots sit on the same row as the arrows, centred between them */
	.ail-reviews .dots {
		margin-top: 0; height: var(--ail-arrow-size, 40px); align-items: center; flex-wrap: wrap;
		padding: 0 calc(var(--ail-arrow-size, 40px) + 24px);
	}
	.ail-reviews[data-arrows="0"] .dots { padding: 0 12px; }
	.ail-reviews[data-dots="0"] { padding-bottom: 60px; } /* room for arrows when dots are hidden */

	#ail-lightbox .lb-prev { left: 4px; }
	#ail-lightbox .lb-next { right: 4px; }
	#ail-lightbox .lb-img { max-height: 60vh; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
	.ail-reviews .window { transition: none; }
}
@media (max-width: 520px) {
	.ail-reviews .thumbs { grid-template-columns: repeat(4, 1fr); gap: 8px; }
	.ail-reviews .foot { gap: 12px; }
	.ail-reviews .avatar { width: 46px; height: 46px; font-size: 18px; }
	#ail-lightbox .lb-strip button { width: 46px; height: 46px; }
}
@media (prefers-reduced-motion: reduce) {
	.ail-reviews .track,
	.ail-reviews .slide,
	.ail-reviews .main,
	.ail-reviews .nav,
	.ail-reviews .dot { transition: none; }
}

/* Overflow safety: let the widget shrink inside row-direction flex containers */
.elementor-widget-ail_google_reviews { min-width: 0; max-width: 100%; }
