/**
 * The sitewide reviews tab and the panel behind it.
 *
 * Everything is scoped under .ffw-rv so the theme's own rules cannot reach in, and so these
 * rules cannot reach out - the single product page already owns .ffw-reviews-* for its own
 * review section, which is why this file uses the shorter .ffw-rv- prefix throughout.
 *
 * The theme paints every button and select on the site black, uppercase and 60px tall. That
 * is why the reset below, and the components that follow it, lean on !important: they are
 * not fighting each other, they are holding a line against rules written for the shop.
 */

.ffw-rv {
	--ffw-rv-ink: #171717;
	--ffw-rv-body: #4f4f4f;
	--ffw-rv-muted: #6f6f6f;
	--ffw-rv-line: #e6e3df;
	--ffw-rv-sand: #f5f3f0;
	--ffw-rv-white: #fff;
	--ffw-rv-link: #74441f;
	--ffw-rv-star: #e0a43a;
	--ffw-rv-star-off: #ddd8d1;
	--ffw-rv-shadow: 0 32px 80px rgba(23, 23, 23, .28);
}

.ffw-rv,
.ffw-rv *,
.ffw-rv *::before,
.ffw-rv *::after {
	box-sizing: border-box;
}

/* Strip the theme's button and select styling back to nothing. Each component below then
   states what it actually wants. Transform is left alone - the tab needs its own.
   :where() holds this at zero specificity, so every component class below outranks it while
   the !important flags still see off the theme. */
:where(.ffw-rv) :where(button, select) {
	width: auto !important;
	height: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	border-radius: 0 !important;
	background: none !important;
	color: inherit !important;
	font-family: inherit !important;
	font-size: inherit !important;
	font-weight: 400 !important;
	line-height: 1.4 !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	text-align: left !important;
	text-decoration: none !important;
	box-shadow: none !important;
	appearance: none;
	-webkit-appearance: none;
}

.ffw-rv .screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------------------------------------------------------------- the tab */

.ffw-rv-tab {
	position: fixed;
	top: 50%;
	right: 0;
	/* Deliberately near the top of the stack. Chat bubbles, cookie bars and Elementor
	   popups all reach for six and seven figure z-indexes; the tab cannot afford to lose
	   to one of them on a screen nobody here can see. */
	z-index: 2147483000;
	display: flex !important;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	padding: 15px 9px 16px !important;
	border-radius: 14px 0 0 14px !important;
	color: #fff !important;
	background: linear-gradient(165deg, #2b2b2b 0%, #131313 100%) !important;
	box-shadow: -4px 6px 22px rgba(23, 23, 23, .26) !important;
	cursor: pointer;
	transform: translateY(-50%);
	/* Hover only. NOTHING on this tab may depend on an animation or a transition running,
	   because an animation that never gets a frame leaves the tab invisible or parked off
	   the edge of the screen - and a button nobody can see or reach is the whole feature
	   gone. It is simply here, from the first paint. */
	transition: transform .28s cubic-bezier(.22, 1, .36, 1), box-shadow .28s ease;
}

.ffw-rv-tab:hover,
.ffw-rv-tab:focus-visible {
	transform: translateY(-50%) translateX(-4px);
	box-shadow: -8px 8px 28px rgba(23, 23, 23, .34) !important;
	outline: none;
}

.ffw-rv-tab-star {
	display: block;
	width: 15px;
	height: 15px;
	color: var(--ffw-rv-star);
}

.ffw-rv-tab-star svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.ffw-rv-tab-score {
	font-size: 12px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .02em;
}

.ffw-rv-tab-text {
	writing-mode: vertical-rl;
	padding-top: 8px;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .16em;
	text-transform: uppercase;
	/* A hairline above the word separates it from the score without drawing a border. */
	background: linear-gradient(currentColor, currentColor) top center / 12px 1px no-repeat;
	opacity: .92;
}

/* -------------------------------------------------------------- the shell */

.ffw-rv-modal {
	position: fixed;
	inset: 0;
	z-index: 2147483001;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 28px 22px;
}

/* The theme sets div display, which beats the browser's own [hidden] rule. */
.ffw-rv-modal[hidden] {
	display: none !important;
}

.ffw-rv-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(18, 16, 14, .55);
	-webkit-backdrop-filter: blur(5px);
	backdrop-filter: blur(5px);
}

.ffw-rv-panel {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 1180px;
	max-height: min(88vh, 940px);
	overflow: hidden;
	border-radius: 22px;
	color: var(--ffw-rv-ink);
	background: var(--ffw-rv-white);
	box-shadow: var(--ffw-rv-shadow);
}

/* ------------------------------------------------------------- the header */

/* Title and score share one line. The panel is for reading reviews, so the furniture above
   them earns as little height as it can. */
.ffw-rv-head {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 16px;
	padding: 15px 60px 14px 24px;
	border-bottom: 1px solid var(--ffw-rv-line);
	background: var(--ffw-rv-white);
}

.ffw-rv-title {
	margin: 0 !important;
	padding: 0 !important;
	color: var(--ffw-rv-ink) !important;
	font-size: 19px !important;
	font-weight: 600 !important;
	line-height: 1.25 !important;
	letter-spacing: -.012em !important;
	text-transform: none !important;
	white-space: nowrap;
}

.ffw-rv-score {
	display: flex;
	align-items: baseline;
	gap: 8px;
}

.ffw-rv-score-number {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -.02em;
}

.ffw-rv-score-count {
	color: var(--ffw-rv-muted);
	font-size: 12.5px;
	line-height: 1.25;
}

.ffw-rv-stars {
	display: inline-flex;
	gap: 2px;
	transform: translateY(2px);
}

.ffw-rv-star {
	display: block;
	width: 15px;
	height: 15px;
	color: var(--ffw-rv-star-off);
}

.ffw-rv-star.is-on {
	color: var(--ffw-rv-star);
}

.ffw-rv-star svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

/* ------------------------------------------------------------- the close */

.ffw-rv-close {
	position: absolute;
	top: 12px;
	right: 14px;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 34px !important;
	height: 34px !important;
	border: 1px solid var(--ffw-rv-line) !important;
	border-radius: 50% !important;
	background: var(--ffw-rv-white) !important;
	color: var(--ffw-rv-ink) !important;
	cursor: pointer;
	transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.ffw-rv-close:hover,
.ffw-rv-close:focus-visible {
	border-color: var(--ffw-rv-ink) !important;
	background: var(--ffw-rv-ink) !important;
	color: #fff !important;
	outline: none;
	transform: rotate(90deg);
}

.ffw-rv-close svg {
	width: 15px;
	height: 15px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
}

/* ------------------------------------------------------------ the toolbar */

.ffw-rv-tools {
	display: flex;
	gap: 14px;
	align-items: center;
	justify-content: space-between;
	padding: 10px 24px;
	border-bottom: 1px solid var(--ffw-rv-line);
	background: var(--ffw-rv-white);
}

.ffw-rv-chips {
	display: flex;
	gap: 7px;
	min-width: 0;
	overflow-x: auto;
	scrollbar-width: none;
	-ms-overflow-style: none;
}

.ffw-rv-chips::-webkit-scrollbar {
	display: none;
}

.ffw-rv-chip {
	flex: 0 0 auto;
	display: inline-flex !important;
	align-items: center;
	gap: 5px;
	padding: 7px 14px !important;
	border: 1px solid var(--ffw-rv-line) !important;
	border-radius: 99px !important;
	background: var(--ffw-rv-white) !important;
	color: var(--ffw-rv-body) !important;
	font-size: 12.5px !important;
	font-weight: 500 !important;
	line-height: 1.2 !important;
	white-space: nowrap;
	cursor: pointer;
	transition: border-color .18s ease, background .18s ease, color .18s ease;
}

.ffw-rv-chip:hover,
.ffw-rv-chip:focus-visible {
	border-color: #c9c3ba !important;
	outline: none;
}

.ffw-rv-chip.is-active {
	border-color: var(--ffw-rv-ink) !important;
	background: var(--ffw-rv-ink) !important;
	color: #fff !important;
}

.ffw-rv-chip-star {
	width: 11px;
	height: 11px;
	color: var(--ffw-rv-star);
}

.ffw-rv-chip.is-active .ffw-rv-chip-star {
	color: var(--ffw-rv-star);
}

.ffw-rv-chip-star svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: currentColor;
}

.ffw-rv-sort {
	position: relative;
	flex: 0 0 auto;
	display: block;
	margin: 0;
}

.ffw-rv-sort select {
	height: 35px !important;
	padding: 0 34px 0 14px !important;
	border: 1px solid var(--ffw-rv-line) !important;
	border-radius: 99px !important;
	background: var(--ffw-rv-white) !important;
	color: var(--ffw-rv-ink) !important;
	font-size: 12.5px !important;
	line-height: 33px !important;
	cursor: pointer;
}

.ffw-rv-sort select:focus-visible {
	border-color: var(--ffw-rv-ink) !important;
	outline: none;
}

.ffw-rv-sort svg {
	position: absolute;
	top: 50%;
	right: 13px;
	width: 13px;
	height: 13px;
	margin-top: -6px;
	fill: none;
	stroke: var(--ffw-rv-muted);
	stroke-width: 1.6;
	stroke-linecap: round;
	pointer-events: none;
}

/* --------------------------------------------------------------- the grid */

.ffw-rv-body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 16px 24px 24px;
	background: var(--ffw-rv-white);
	scrollbar-width: thin;
	scrollbar-color: #d4cec6 transparent;
}

.ffw-rv-body::-webkit-scrollbar {
	width: 10px;
}

.ffw-rv-body::-webkit-scrollbar-thumb {
	border: 3px solid transparent;
	border-radius: 99px;
	background: #d4cec6;
	background-clip: content-box;
}

.ffw-rv-body:focus {
	outline: none;
}

/* Real masonry, packed by the script rather than by the browser.
   CSS columns balance by height and leave the last column empty when one card is tall; a
   CSS grid works in rows, so a tall card stretches its whole row and the cards beside it
   sit above a hole. Neither wastes less space than simply putting each card in whichever
   column is currently shortest, which is what ffw-reviews.js does. The count lives here, in
   the media queries, and the script reads it. */
.ffw-rv-grid {
	--ffw-rv-cols: 4;
	display: flex;
	align-items: flex-start;
	gap: 16px;
}

.ffw-rv-col {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
}

.ffw-rv-empty {
	margin: 54px 0;
	color: var(--ffw-rv-muted);
	font-size: 14px;
	text-align: center;
}

.ffw-rv-empty[hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- a card */

.ffw-rv-card {
	display: block;
	margin: 0;
	padding: 14px 15px 13px;
	border: 1px solid var(--ffw-rv-line);
	border-radius: 16px;
	background: var(--ffw-rv-white);
	transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.ffw-rv-card:hover {
	border-color: #d6d0c8;
	box-shadow: 0 12px 28px rgba(23, 23, 23, .08);
	transform: translateY(-2px);
}

.ffw-rv-card-top {
	display: flex;
	gap: 10px;
	align-items: center;
}

.ffw-rv-avatar {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .02em;
	text-transform: uppercase;
}

.ffw-rv-avatar.t0 { color: #7a4a1e; background: #f4e6d6; }
.ffw-rv-avatar.t1 { color: #2f5d4a; background: #dfeee6; }
.ffw-rv-avatar.t2 { color: #4a4a7a; background: #e4e4f3; }
.ffw-rv-avatar.t3 { color: #7a2f4a; background: #f6e0e8; }
.ffw-rv-avatar.t4 { color: #5c5a2e; background: #eeedd8; }
.ffw-rv-avatar.t5 { color: #2e5a70; background: #dcecf4; }

/* The name holds its ground. It is who is speaking, so it is the last thing that should
   give way - the product beside it takes whatever is left over instead. */
.ffw-rv-who {
	flex: 0 0 auto;
	max-width: 52%;
	min-width: 0;
}

.ffw-rv-name {
	display: block;
	overflow: hidden;
	color: var(--ffw-rv-ink);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* A tick next to the name, not a badge on a line of its own. */
.ffw-rv-verified {
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-left: 5px;
	color: #2f7a55;
	vertical-align: -1px;
}

.ffw-rv-verified svg {
	display: block;
	width: 12px;
	height: 12px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.ffw-rv-card .ffw-rv-stars {
	margin: 9px 0 7px;
	transform: none;
}

/* A quiet footnote at the bottom of the card, after the photo and after "Show more". */
.ffw-rv-date {
	display: block;
	margin-top: 11px;
	color: var(--ffw-rv-muted);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
}

/* Two lines, then "Show more". A wall of text in every card makes the grid unreadable and
   buries the reviews further down. */
.ffw-rv-text {
	display: -webkit-box;
	overflow: hidden;
	margin: 0;
	color: var(--ffw-rv-body);
	font-size: 14px;
	line-height: 1.62;
	overflow-wrap: anywhere;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.ffw-rv-text.is-open {
	display: block;
	-webkit-line-clamp: unset;
}

.ffw-rv-more {
	display: inline-flex !important;
	align-items: center;
	gap: 4px;
	margin-top: 6px !important;
	padding: 0 !important;
	color: var(--ffw-rv-link) !important;
	font-size: 12.5px !important;
	font-weight: 600 !important;
	line-height: 1.3 !important;
	cursor: pointer;
	transition: color .16s ease;
}

.ffw-rv-more::after {
	content: "";
	width: 0;
	height: 0;
	border: 3.5px solid transparent;
	border-top-color: currentColor;
	transform: translateY(2px);
	transition: transform .18s ease;
}

.ffw-rv-more.is-open::after {
	transform: translateY(-1px) rotate(180deg);
}

.ffw-rv-more:hover,
.ffw-rv-more:focus-visible {
	color: var(--ffw-rv-ink) !important;
	outline: none;
	text-decoration: underline !important;
}

.ffw-rv-photo {
	display: block !important;
	width: 100% !important;
	margin-top: 14px !important;
	overflow: hidden;
	border-radius: 12px !important;
	background: var(--ffw-rv-sand) !important;
	line-height: 0 !important;
	cursor: zoom-in;
}

/* Capped. A tall portrait photo was making its card several times the height of its
   neighbours; this shows the same picture without letting one review own the grid. Click
   opens it full size. */
.ffw-rv-photo img {
	display: block;
	width: 100%;
	height: 150px;
	border-radius: 12px;
	object-fit: cover;
	transition: transform .4s cubic-bezier(.22, 1, .36, 1);
}

.ffw-rv-photo:hover img {
	transform: scale(1.03);
}

/* Right of the name, in the space the date used to occupy. */
.ffw-rv-product {
	flex: 1 1 auto;
	display: flex;
	gap: 6px;
	align-items: center;
	justify-content: flex-end;
	min-width: 0;
	color: var(--ffw-rv-muted);
	text-decoration: none;
	transition: color .16s ease;
}

.ffw-rv-product:hover,
.ffw-rv-product:focus-visible {
	color: var(--ffw-rv-link);
	outline: none;
}

.ffw-rv-product img {
	flex: 0 0 auto;
	width: 18px;
	height: 18px;
	border-radius: 4px;
	object-fit: cover;
	background: var(--ffw-rv-sand);
}

.ffw-rv-product-name {
	overflow: hidden;
	font-size: 11.5px;
	font-weight: 500;
	line-height: 1.3;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ------------------------------------------------------------ the lightbox */

.ffw-rv-lightbox {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 36px;
	background: rgba(12, 11, 10, .93);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	cursor: zoom-out;
}

.ffw-rv-lightbox[hidden] {
	display: none !important;
}

.ffw-rv-lightbox img {
	max-width: 100%;
	max-height: 100%;
	border-radius: 12px;
	object-fit: contain;
	box-shadow: 0 30px 70px rgba(0, 0, 0, .5);
}

.ffw-rv-lightbox-close {
	position: absolute;
	top: 20px;
	right: 20px;
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 40px !important;
	height: 40px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, .15) !important;
	color: #fff !important;
	cursor: pointer;
	transition: background .18s ease;
}

.ffw-rv-lightbox-close:hover,
.ffw-rv-lightbox-close:focus-visible {
	background: rgba(255, 255, 255, .3) !important;
	outline: none;
}

.ffw-rv-lightbox-close svg {
	width: 17px;
	height: 17px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 1150px) {
	.ffw-rv-grid { --ffw-rv-cols: 3; }
}

@media (max-width: 900px) {
	.ffw-rv-grid { --ffw-rv-cols: 2; }
}

@media (max-width: 680px) {
	.ffw-rv-modal { padding: 0; }

	.ffw-rv-panel {
		max-width: none;
		max-height: none;
		height: 100%;
		height: 100dvh;
		border-radius: 0;
	}

	.ffw-rv-head {
		padding: 13px 50px 12px 16px;
		gap: 4px 12px;
	}

	.ffw-rv-title { font-size: 17px !important; white-space: normal; }
	.ffw-rv-score-number { font-size: 17px; }
	.ffw-rv-close { top: 11px; right: 11px; }

	.ffw-rv-tools {
		gap: 10px;
		padding: 9px 16px;
	}

	.ffw-rv-body { padding: 14px 16px 24px; }
	.ffw-rv-grid { --ffw-rv-cols: 1; gap: 14px; }
	.ffw-rv-col { gap: 14px; }

	.ffw-rv-tab {
		gap: 5px;
		padding: 12px 7px 13px !important;
		border-radius: 12px 0 0 12px !important;
	}

	.ffw-rv-tab-star { width: 13px; height: 13px; }
	.ffw-rv-tab-score { font-size: 11px; }
	.ffw-rv-tab-text { font-size: 10px; letter-spacing: .13em; }

	.ffw-rv-lightbox { padding: 18px; }
	.ffw-rv-lightbox-close { top: 12px; right: 12px; }
}

/* Only hover polish is left to switch off - nothing here hides anything. */
@media (prefers-reduced-motion: reduce) {
	.ffw-rv-tab,
	.ffw-rv-card,
	.ffw-rv-photo img {
		transition: none !important;
	}

	.ffw-rv-card:hover { transform: none; }
	.ffw-rv-tab:hover { transform: translateY(-50%); }
}
