/**
 * Guest reviews — home page section.
 *
 * White cards on the cream ground, so the section lifts off the sand teaser
 * above it without introducing another background colour. Depends on the tokens
 * in assets/css/style.css, which is enqueued first.
 *
 * 1. Head
 * 2. Card
 * 3. Stars
 * 4. Quotation
 * 5. Attribution
 * 6. Button
 * 7. Editor-only empty state
 * 8. Responsive
 * 9. Reduced motion
 */

/* ==========================================================================
   1. Head
   ========================================================================== */

.bf-reviews__lead {
	margin-bottom: 0;
}

/* ==========================================================================
   1b. Slider
   ========================================================================== */

/*
 * The arrows sit outside the track, so the wrapper is the thing they are
 * positioned against.
 */
.bf-reviews__slider {
	position: relative;
	margin-top: 3rem;
}

/*
 * The track. overflow-x with scroll snapping, not a carousel: this way it shows
 * however many cards happen to fit, snaps to the next one, and swipes natively on
 * touch. With JavaScript off it stays a scrollable row rather than a dead widget.
 *
 * padding-bottom leaves room for the cards' shadow, which overflow: hidden on the
 * x-axis would otherwise clip along the bottom edge too.
 */
.bf-reviews__track {
	display: flex;
	gap: 1.5rem;
	overflow-x: auto;
	padding-bottom: 0.5rem;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	/* Firefox; the WebKit equivalent is the ::-webkit-scrollbar rule below. */
	scrollbar-width: none;
}

.bf-reviews__track::-webkit-scrollbar {
	display: none;
}

/*
 * Focusable, because a scrollable region has to be reachable by keyboard. The
 * ring goes outside the track so it is never clipped by the scroll box.
 */
.bf-reviews__track:focus-visible {
	outline: 2px solid var(--bf-green-dark);
	outline-offset: 4px;
}

/*
 * One card at a time on a phone, two from 576px, three from 992px. The gap is
 * shared out so the cards line up with the container edges rather than drifting.
 */
.bf-reviews__slide {
	flex: 0 0 auto;
	width: 100%;
	scroll-snap-align: start;
}

@media (min-width: 576px) {

	.bf-reviews__slide {
		width: calc((100% - 1.5rem) / 2);
	}
}

@media (min-width: 992px) {

	.bf-reviews__slide {
		width: calc((100% - 3rem) / 3);
	}
}

/* Centred under the track, so they never need room outside the container. */
.bf-reviews__nav-row {
	display: flex;
	justify-content: center;
	gap: 0.75rem;
	margin-top: 1.75rem;
}

/* The class rule above would otherwise defeat the hidden attribute. */
.bf-reviews__nav-row[hidden] {
	display: none;
}

.bf-reviews__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--bf-line);
	border-radius: 50%;
	background-color: var(--bf-white);
	color: var(--bf-green-dark);
	font-size: 1.15rem;
	line-height: 1;
	box-shadow: var(--bf-shadow-sm);
	cursor: pointer;
	transition: background-color var(--bf-transition), color var(--bf-transition),
		border-color var(--bf-transition), opacity var(--bf-transition);
}

.bf-reviews__nav:hover:not(:disabled),
.bf-reviews__nav:focus-visible {
	border-color: var(--bf-amber);
	background-color: var(--bf-amber);
	color: var(--bf-charcoal);
}

.bf-reviews__nav:focus-visible {
	outline: 2px solid var(--bf-green-dark);
	outline-offset: 2px;
}

/*
 * Dimmed rather than removed at either end of the track: a control that vanishes
 * shifts the one beside it, and the arrow is still a useful landmark even when it
 * has nowhere left to go.
 */
.bf-reviews__nav:disabled {
	opacity: 0.35;
	cursor: default;
}

/* ==========================================================================
   2. Card
   ========================================================================== */

/*
 * A figure, so it arrives with default margins of its own that have to be
 * cleared before the column can control the spacing.
 */
.bf-reviews__card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	margin: 0;
	padding: 2.5rem 1.75rem 1.75rem;
	background: var(--bf-white);
	border: 1px solid var(--bf-line);
	border-radius: var(--bf-radius);
	box-shadow: var(--bf-shadow-sm);
	transition: transform var(--bf-transition), box-shadow var(--bf-transition),
		border-color var(--bf-transition);
}

/*
 * Nothing in the card is clickable, so this is not a hover affordance — it is
 * only the same gentle lift the activity cards use, to keep the page consistent.
 */
.bf-reviews__card:hover {
	transform: translateY(-4px);
	border-color: rgba(47, 107, 58, 0.25);
	box-shadow: var(--bf-shadow);
}

/*
 * The oversized quote glyph, sunk to a low opacity so it reads as a watermark and
 * never competes with the words. aria-hidden in the markup — a screen reader
 * already gets <blockquote>.
 *
 * Top RIGHT, not left: the stars are left-aligned and start 2.5rem down, which
 * put two or three of them over the glyph and gave the amber a green cast. The
 * right corner is empty on every card.
 */
.bf-reviews__mark {
	position: absolute;
	top: 0.35rem;
	right: 1.15rem;
	color: var(--bf-green);
	font-size: 3.5rem;
	line-height: 1;
	opacity: 0.13;
	pointer-events: none;
}

/* ==========================================================================
   3. Stars
   ========================================================================== */

/*
 * align-self, not display: inline-flex. The card is itself a column flex
 * container, so this row is a flex item and any inline display value is
 * blockified straight back to flex — leaving it stretched the full card width and
 * running under the watermark in the opposite corner. Overriding the stretch is
 * what actually makes the box hug the five glyphs.
 */
.bf-reviews__stars {
	position: relative;
	display: flex;
	align-self: flex-start;
	gap: 0.2rem;
	margin: 0 0 1rem;
	color: var(--bf-amber);
	font-size: 0.95rem;
	line-height: 1;
}

/* Hollow stars keep the same colour, so an unearned star reads as absent. */
.bf-reviews__stars .fa-star-half-stroke {
	opacity: 0.4;
}

/* ==========================================================================
   4. Quotation
   ========================================================================== */

/*
 * flex: 1 is what keeps the attribution pinned to the foot of every card in a
 * row: the quotation takes all the leftover height, so a short review and a long
 * one still line their names up.
 */
.bf-reviews__text {
	position: relative;
	flex: 1 1 auto;
	margin: 0 0 1.5rem;
	padding: 0;
	border: 0;
	color: var(--bf-ink);
	font-size: 1.02rem;
	line-height: 1.75;
}

.bf-reviews__text p {
	margin: 0 0 0.85rem;
}

.bf-reviews__text p:last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   5. Attribution
   ========================================================================== */

.bf-reviews__by {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--bf-line);
	text-align: left;
}

.bf-reviews__avatar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 50%;
	background: var(--bf-sand);
}

.bf-reviews__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* The initial shown when no photograph was uploaded. */
.bf-reviews__initial {
	color: var(--bf-green-dark);
	font-family: var(--bf-font-display);
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1;
	text-transform: uppercase;
}

/* min-width: 0 lets a long single-word city ellipsise instead of pushing out. */
.bf-reviews__who {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 0.1rem;
}

.bf-reviews__name {
	color: var(--bf-green-dark);
	font-weight: 600;
	letter-spacing: 0.01em;
}

.bf-reviews__meta {
	color: var(--bf-muted);
	font-size: 0.85rem;
}

/*
 * "via Google" — deliberately quiet. It is a provenance note for anyone who
 * wants to go and check the review, not a badge to be shown off.
 */
.bf-reviews__source {
	color: var(--bf-muted);
	font-size: 0.78rem;
	font-style: italic;
	opacity: 0.8;
}

/* ==========================================================================
   6. Button
   ========================================================================== */

.bf-reviews__actions {
	margin-top: 3rem;
	text-align: center;
}

/* ==========================================================================
   7. Editor-only empty state
   ========================================================================== */

/*
 * Never seen by a visitor — the section returns before this markup is printed
 * unless the viewer can edit posts. Dashed, so it reads as scaffolding rather
 * than as part of the finished design.
 */
.bf-reviews__notice {
	max-width: 640px;
	margin: 0 auto;
	padding: 3rem 2rem;
	border: 2px dashed rgba(47, 107, 58, 0.3);
	border-radius: var(--bf-radius-lg);
	background: rgba(255, 255, 255, 0.6);
	text-align: center;
}

.bf-reviews__notice .bi {
	color: var(--bf-green);
	font-size: 2.5rem;
	opacity: 0.7;
}

.bf-reviews__notice-title {
	margin: 0.75rem 0;
	color: var(--bf-green-dark);
	font-family: var(--bf-font-display);
	font-size: 1.6rem;
}

.bf-reviews__notice p {
	max-width: 48ch;
	margin: 0 auto 1rem;
	color: var(--bf-ink);
}

.bf-reviews__notice-you {
	font-size: 0.85rem;
	font-style: italic;
	opacity: 0.7;
}

/* ==========================================================================
   8. Responsive
   ========================================================================== */

@media (max-width: 575.98px) {

	.bf-reviews__card {
		padding: 2.25rem 1.35rem 1.5rem;
	}

	.bf-reviews__text {
		font-size: 0.98rem;
	}

	.bf-reviews__notice {
		padding: 2.25rem 1.25rem;
	}
}

/* ==========================================================================
   9. Reduced motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {

	.bf-reviews__card,
	.bf-reviews__nav {
		transition: none;
	}

	.bf-reviews__card:hover {
		transform: none;
	}

	/* Jump straight to the next card instead of gliding to it. */
	.bf-reviews__track {
		scroll-behavior: auto;
	}
}
