/* ==========================================================================
   Internal Reviews — Frontend Styles
   Text domain: internal-reviews
   ========================================================================== */

/* ── Grid wrapper ─────────────────────────────────────────────────────────── */
.internal-reviews-wrapper {
	display: grid;
	gap: 1.5em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.internal-reviews-wrapper[data-columns="1"] { grid-template-columns: 1fr; }
.internal-reviews-wrapper[data-columns="2"] { grid-template-columns: repeat( 2, 1fr ); }
.internal-reviews-wrapper[data-columns="3"] { grid-template-columns: repeat( 3, 1fr ); }
.internal-reviews-wrapper[data-columns="4"] { grid-template-columns: repeat( 4, 1fr ); }

@media ( max-width: 900px ) {
	.internal-reviews-wrapper[data-columns="3"],
	.internal-reviews-wrapper[data-columns="4"] {
		grid-template-columns: repeat( 2, 1fr );
	}
}

@media ( max-width: 560px ) {
	.internal-reviews-wrapper {
		grid-template-columns: 1fr !important;
	}
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.internal-reviews-card {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	background: #ffffff;
	border-radius: 8px;
	padding: 1.5em;
	box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.08 );
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.internal-reviews-wrapper--new .internal-reviews-card {
	cursor: default;
}

.internal-reviews-wrapper--new .internal-reviews-card[tabindex] {
	cursor: pointer;
}

.internal-reviews-wrapper--new .internal-reviews-card:hover,
.internal-reviews-wrapper--new .internal-reviews-card:focus {
	box-shadow: 0 6px 20px rgba( 0, 0, 0, 0.13 );
	transform: translateY( -2px );
	outline: none;
}

.internal-reviews-wrapper--new .internal-reviews-card:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* ── Card text section ────────────────────────────────────────────────────── */
.internal-reviews-card__text {
	flex: 1;
	margin-bottom: 1.2em;
}

.internal-reviews-card__heading {
	display: block;
	font-weight: 700;
	font-size: 1em;
	line-height: 1.4;
	margin-bottom: 0.6em;
}

.internal-reviews-card__excerpt,
.internal-reviews-card__excerpt p {
	font-size: 0.93em;
	line-height: 1.65;
	color: #555555;
	margin: 0;
}

.internal-reviews-card__content p {
	font-size: 0.93em;
	line-height: 1.65;
}

/* ── Reviewer section ─────────────────────────────────────────────────────── */
.internal-reviews-card__reviewer {
	border-top: 1px solid #eeeeee;
	padding-top: 1em;
	margin-top: auto;
}

.internal-reviews-card__reviewer-name {
	display: block;
	font-weight: 600;
	font-size: 0.92em;
}

.internal-reviews-card__reviewer-detail {
	display: block;
	font-size: 0.84em;
	color: #888888;
	margin-bottom: 0.5em;
}

/* ── Meta row (stars + source) ────────────────────────────────────────────── */
.internal-reviews-card__meta {
	display: flex;
	align-items: center;
	gap: 0.6em;
	flex-wrap: wrap;
	margin-top: 0.4em;
}

.internal-reviews-card__stars {
	display: flex;
	gap: 2px;
	line-height: 1;
}

/* Star SVG fill colours */
.internal-reviews-star path {
	fill: #dddddd;
}

.internal-reviews-star--filled path {
	fill: #f5a623;
}

.internal-reviews-card__source {
	display: inline-block;
	font-size: 0.78em;
	color: #777777;
	background: #f4f4f4;
	border-radius: 4px;
	padding: 2px 8px;
	line-height: 1.6;
}

/* ── Popup overlay ─────────────────────────────────────────────────────────── */
.internal-reviews-popup {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba( 0, 0, 0, 0.52 );
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1em;
}

.internal-reviews-popup__inner {
	position: relative;
	background: #ffffff;
	border-radius: 10px;
	padding: 2em 2em 1.75em;
	max-width: 620px;
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.25 );
}

/* A span, as with the slider controls — see the note in the slider section.
   Fixed px, so a theme's font size cannot inflate the close target. */
.internal-reviews-popup__close {
	position: absolute;
	top: 14px;
	right: 14px;
	box-sizing: border-box;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	color: #444444;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	transition: background 0.15s ease;
	margin: 0;
	padding: 0;
	text-decoration: none;
	-webkit-user-select: none;
	user-select: none;
}

.internal-reviews-popup__close:hover {
	background: #f0f0f0;
}

.internal-reviews-popup__close:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.internal-reviews-popup__heading {
	display: block;
	font-weight: 700;
	font-size: 1.15em;
	line-height: 1.4;
	margin-bottom: 1em;
	padding-right: 2.5em;
}

.internal-reviews-popup__content {
	font-size: 0.95em;
	line-height: 1.75;
	margin-bottom: 1.5em;
}

.internal-reviews-popup__content p:last-child {
	margin-bottom: 0;
}

.internal-reviews-popup__reviewer {
	border-top: 1px solid #eeeeee;
	padding-top: 1em;
}

/* ── Slider ───────────────────────────────────────────────────────────────── */
/*
 * Layout is driven entirely by the --ir-slides custom property, so the
 * breakpoints below are the single source of truth for how many cards are
 * visible. The script reads the same property back out instead of hard-coding
 * its own breakpoints.
 */
/* Holds the track and the arrows, so the arrows centre on the cards rather
   than on the cards plus the bullet row below them. */
.internal-reviews-slider__viewport {
	position: relative;
}

.internal-reviews-wrapper--slider {
	--ir-slides: 3;
	--ir-gap: 1.5em;
	position: relative; /* offsetParent for the cards' offsetLeft. */
	display: flex;
	gap: var( --ir-gap );
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	-webkit-overflow-scrolling: touch;
	/*
	 * A scroll container clips at its padding box, so without room inside it
	 * the cards' drop shadow and their hover lift are sliced off — vertically
	 * (overflow-x forces overflow-y to compute to auto) and at the left and
	 * right edges of the track.
	 *
	 * The horizontal room is then cancelled by an equal negative margin, so the
	 * content box still spans the full container: the first and last card line
	 * up with the grid's columns exactly, and a slide stays the same width as a
	 * grid column. It is a fixed 16px rather than an em, because that bleed sits
	 * outside the container and needs to stay small enough for any theme to
	 * absorb.
	 */
	padding: 1.5em 16px;
	margin: 0 -16px;
	/*
	 * Insets the snap positions to match the padding, so a card the visitor
	 * swipes to rests with the same 16px of shadow room as the first one.
	 */
	scroll-padding: 0 16px;
}

.internal-reviews-wrapper--slider[data-columns="1"] { --ir-slides: 1; }
.internal-reviews-wrapper--slider[data-columns="2"] { --ir-slides: 2; }
.internal-reviews-wrapper--slider[data-columns="3"] { --ir-slides: 3; }
.internal-reviews-wrapper--slider[data-columns="4"] { --ir-slides: 4; }

.internal-reviews-wrapper--slider .internal-reviews-card {
	/*
	 * border-box is what makes a slide exactly as wide as a grid column: the
	 * card's 1.5em padding has to count inside the basis. Under content-box the
	 * padding is added on top, so every card overflows its share of the track
	 * and the last one visible gets clipped.
	 */
	box-sizing: border-box;
	flex: 0 0 calc( ( 100% - ( var( --ir-slides ) - 1 ) * var( --ir-gap ) ) / var( --ir-slides ) );
	/* Keeps a long unbroken word from pushing the card past its basis. */
	min-width: 0;
	scroll-snap-align: start;
}

.internal-reviews-wrapper--slider:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 4px;
}

/* Mirrors the grid breakpoints above so both layouts agree. */
@media ( max-width: 900px ) {
	.internal-reviews-wrapper--slider[data-columns="3"],
	.internal-reviews-wrapper--slider[data-columns="4"] {
		--ir-slides: 2;
	}
}

@media ( max-width: 560px ) {
	.internal-reviews-wrapper--slider {
		--ir-slides: 1;
	}
}

/*
 * The scrollbar is hidden only once the script has added is-enhanced — without
 * JavaScript the bullets never render, and the native scrollbar stays as the
 * only cue that the track scrolls.
 */
.internal-reviews-slider.is-enhanced .internal-reviews-wrapper--slider {
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.internal-reviews-slider.is-enhanced .internal-reviews-wrapper--slider::-webkit-scrollbar {
	display: none;
}

/* ── Slider arrows ────────────────────────────────────────────────────────── */
/*
 * A span with role="button", not a <button>, so theme and page-builder button
 * styling cannot reach it. That means no UA defaults to lean on: border-box and
 * the reset declarations below have to be explicit.
 *
 * Sized in px, not em: an em-based control grows with the theme's body text and
 * quickly reads as oversized next to the cards.
 */
.internal-reviews-slider__arrow {
	display: none;
	box-sizing: border-box;
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 2;
	width: 34px;
	height: 34px;
	margin: 0;
	padding: 0;
	border: 1px solid #e5e5e5;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 2px 8px rgba( 0, 0, 0, 0.12 );
	color: #333333;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
}

.internal-reviews-slider.is-enhanced .internal-reviews-slider__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Hidden when every card already fits — nothing to advance to. */
.internal-reviews-slider.is-static .internal-reviews-slider__arrow,
.internal-reviews-slider.is-static .internal-reviews-dots {
	display: none;
}

.internal-reviews-slider__chevron {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	display: block;
}

.internal-reviews-slider__arrow:hover,
.internal-reviews-slider__arrow:focus-visible {
	background: #f6f6f6;
}

.internal-reviews-slider__arrow:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.internal-reviews-slider__arrow--prev { left: -46px; }
.internal-reviews-slider__arrow--next { right: -46px; }

/*
 * The arrows sit outside the track, which needs room beside it. Narrower
 * layouts are usually full-bleed with little or no outer margin, and an
 * absolutely positioned arrow hanging past the container would add horizontal
 * page scroll. Below this breakpoint the bullets and native swiping carry the
 * interaction instead.
 */
@media ( max-width: 900px ) {
	.internal-reviews-slider.is-enhanced .internal-reviews-slider__arrow {
		display: none;
	}
}

/* ── Slider bullets ───────────────────────────────────────────────────────── */
.internal-reviews-dots {
	display: flex;
	justify-content: center;
	gap: 0.5em;
	/* The track carries 1.5em of shadow padding below the cards already. */
	margin-top: 0.25em;
}

/* A span, as with the arrows — see the note there. Sized in px for the same
   reason: as an em, a dot would track the theme's body text size. */
.internal-reviews-dots__dot {
	display: block;
	box-sizing: border-box;
	width: 9px;
	height: 9px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #cccccc;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.internal-reviews-dots__dot:hover {
	background: #999999;
}

.internal-reviews-dots__dot:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
}

.internal-reviews-dots__dot[aria-current="true"] {
	background: #333333;
	transform: scale( 1.25 );
}

@media ( prefers-reduced-motion: reduce ) {
	.internal-reviews-dots__dot {
		transition: none;
	}
}
