/*
 * BP Reviews — front-end styles
 *
 * Every theme-able value is a CSS variable on .bp-rv. Bricks element controls
 * write inline overrides on the same selector via %root%, so this file holds
 * the brand defaults; the element retheme everything below by writing the
 * matching var on the wrapper.
 *
 * BerleyPro defaults: brand red #CB333B, dark #1A1A1A, square corners.
 */

.bp-rv {
	/* brand tokens (override-able from Bricks element) */
	--bp-rv-accent:        #CB333B;
	--bp-rv-accent-dark:   #A8282E;
	--bp-rv-text:          #1A1A1A;
	--bp-rv-muted:         #666666;
	--bp-rv-line:          #E6E6E6;
	--bp-rv-soft:          #F5F5F5;
	--bp-rv-card-bg:       #FFFFFF;
	--bp-rv-score-bg:      var(--bp-rv-soft);
	--bp-rv-score-num:     var(--bp-rv-text);
	--bp-rv-bar:           var(--bp-rv-accent);
	--bp-rv-star:          var(--bp-rv-accent);
	--bp-rv-star-empty:    #D9D9D9;
	--bp-rv-radius:        0;

	/* layout tokens */
	--bp-rv-max-width:     1440px;
	--bp-rv-cols-desktop:  6;
	--bp-rv-cols-tablet:   3;
	--bp-rv-cols-mobile:   1;
	--bp-rv-gap:           20px;
	--bp-rv-clamp:         4;

	box-sizing: border-box;
	max-width: var(--bp-rv-max-width);
	margin: 0 auto;
	color: var(--bp-rv-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.bp-rv *,
.bp-rv *::before,
.bp-rv *::after { box-sizing: border-box; }

/* ───── header ───── */
.bp-rv__header { margin-bottom: 36px; }
.bp-rv__kicker {
	display: inline-block;
	color: var(--bp-rv-accent);
	font-size: 13px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	font-weight: 600;
	margin-bottom: 14px;
}
.bp-rv__title {
	font-size: 36px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin: 0 0 12px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--bp-rv-text);
}
.bp-rv__rule {
	border: none;
	border-top: 2px solid var(--bp-rv-text);
	width: 64px;
	margin: 0 0 16px;
}
.bp-rv__subtitle {
	color: var(--bp-rv-muted);
	font-size: 16px;
	margin: 0 0 8px;
	max-width: 640px;
}

/* ───── visibility toggles (set on wrapper) ───── */
.bp-rv--score-hidden .bp-rv__score { display: none !important; }
.bp-rv--grid-hidden  .bp-rv__grid  { display: none !important; }
.bp-rv--grid-hidden  .bp-rv__loadmore { display: none !important; }

/* ───── score block ───── */
.bp-rv__score {
	display: grid;
	grid-template-columns: 280px 1fr;
	gap: 48px;
	align-items: center;
	background: var(--bp-rv-score-bg);
	border: 1px solid var(--bp-rv-line);
	padding: 36px 40px;
	margin-bottom: 32px;
}
.bp-rv--score-below .bp-rv__score {
	margin-top: 32px;
	margin-bottom: 0;
}
.bp-rv--score-layout-flip .bp-rv__score {
	grid-template-columns: 1fr 280px;
}
.bp-rv--score-layout-flip .bp-rv__score-block { order: 2; align-items: flex-end; text-align: right; }
.bp-rv--score-layout-flip .bp-rv__score-bars  { order: 1; }
.bp-rv--score-layout-center .bp-rv__score {
	grid-template-columns: 1fr;
	justify-items: center;
	text-align: center;
}
.bp-rv--score-layout-center .bp-rv__score-block { align-items: center; }
.bp-rv--score-layout-center .bp-rv__score-bars  { width: 100%; max-width: 520px; }

.bp-rv__score-block {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}
.bp-rv__score-num {
	font-size: 64px;
	line-height: 1;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.02em;
	margin-bottom: 6px;
	color: var(--bp-rv-score-num);
}
.bp-rv__score-stars {
	display: flex;
	gap: 2px;
	margin-bottom: 8px;
}
.bp-rv__score-meta {
	color: var(--bp-rv-muted);
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}
.bp-rv__score-bars {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.bp-rv__bar {
	display: grid;
	grid-template-columns: 48px 1fr 56px;
	align-items: center;
	gap: 14px;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
}
.bp-rv__bar-label {
	display: flex;
	align-items: center;
	gap: 4px;
	color: var(--bp-rv-text);
	font-weight: 500;
}
.bp-rv__bar-track {
	height: 8px;
	background: #FFFFFF;
	border: 1px solid var(--bp-rv-line);
	position: relative;
	overflow: hidden;
}
.bp-rv__bar-fill {
	position: absolute;
	inset: 0 auto 0 0;
	background: var(--bp-rv-bar);
	transition: width 360ms cubic-bezier(0.2, 0.6, 0.2, 1);
	width: 0;
}
.bp-rv__bar-count {
	color: var(--bp-rv-muted);
	text-align: right;
	letter-spacing: 0.02em;
}

/* ───── grid ───── */
.bp-rv__grid {
	display: grid;
	grid-template-columns: repeat(var(--bp-rv-cols-desktop), minmax(0, 1fr));
	gap: var(--bp-rv-gap);
}

/* ───── slider mode ─────
   Single-row horizontal scroller with prev/next arrows.
   Pure CSS scroll-snap for native swipe; JS handles arrow clicks. */
.bp-rv--slider .bp-rv__slider-viewport {
	position: relative;
}
.bp-rv--slider .bp-rv__grid {
	display: flex;
	gap: var(--bp-rv-gap);
	overflow-x: auto;
	overflow-y: visible;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-ms-overflow-style: none;
	padding-bottom: 4px;
}
.bp-rv--slider .bp-rv__grid::-webkit-scrollbar { display: none; }
.bp-rv--slider .bp-rv__card {
	flex: 0 0 calc((100% - (var(--bp-rv-cols-desktop) - 1) * var(--bp-rv-gap)) / var(--bp-rv-cols-desktop));
	scroll-snap-align: start;
	min-width: 0;
}

.bp-rv__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	width: 44px;
	height: 44px;
	background: var(--bp-rv-card-bg);
	border: 1px solid var(--bp-rv-line);
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}
.bp-rv__nav:hover { background: var(--bp-rv-text); border-color: var(--bp-rv-text); }
.bp-rv__nav:hover span { border-color: #fff; }
.bp-rv__nav[disabled] { opacity: 0.3; cursor: default; }
.bp-rv__nav span {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-top: 2px solid var(--bp-rv-text);
	border-right: 2px solid var(--bp-rv-text);
	transition: border-color 160ms ease;
}
.bp-rv__nav--prev { left: -22px; }
.bp-rv__nav--prev span { transform: rotate(-135deg); margin-left: 3px; }
.bp-rv__nav--next { right: -22px; }
.bp-rv__nav--next span { transform: rotate(45deg); margin-right: 3px; }

/* Hide load-more in slider mode (slider just keeps scrolling) */
.bp-rv--slider .bp-rv__loadmore { display: none; }

/* ───── card ───── */
.bp-rv__card {
	background: var(--bp-rv-card-bg);
	border: 1px solid var(--bp-rv-line);
	display: flex;
	flex-direction: column;
	min-height: 0;
	border-radius: var(--bp-rv-radius);
	transition: transform 200ms ease, box-shadow 200ms ease;
}
.bp-rv__card.is-expanded { /* expanded "Read more" state */ }
.bp-rv__card-media {
	aspect-ratio: 1 / 1;
	background: var(--bp-rv-soft);
	position: relative;
	overflow: hidden;
	border-bottom: 1px solid var(--bp-rv-line);
}
.bp-rv__card-media-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.bp-rv__card-media-fallback {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 42px;
	font-weight: 600;
	letter-spacing: 0.04em;
	color: #FFFFFF;
	text-transform: uppercase;
}
.bp-rv__card-verified {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(26, 26, 26, 0.86);
	color: #FFFFFF;
	font-size: 10px;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	padding: 4px 8px;
	font-weight: 600;
}
.bp-rv__card-body {
	padding: 14px 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
	min-height: 0;
}
.bp-rv__card-stars { display: flex; gap: 2px; }
.bp-rv__card-title {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	margin: 2px 0 0;
	color: var(--bp-rv-text);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.bp-rv__card-comment {
	font-size: 14px;
	line-height: 1.5;
	color: #333;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: var(--bp-rv-clamp);
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.bp-rv__card.is-expanded .bp-rv__card-comment {
	display: block;
	overflow: visible;
	-webkit-line-clamp: unset;
}
.bp-rv__card-readmore {
	font-size: 12px;
	color: var(--bp-rv-accent);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-weight: 600;
	margin-top: auto;
	padding-top: 6px;
	cursor: pointer;
	background: none;
	border: 0;
	text-align: left;
	padding-left: 0;
	padding-right: 0;
}
.bp-rv__card-readmore:hover { color: var(--bp-rv-accent-dark); }
.bp-rv__card-footer {
	display: flex;
	flex-direction: column;
	border-top: 1px solid var(--bp-rv-line);
	padding-top: 10px;
	margin-top: 6px;
}
.bp-rv__card-name {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.02em;
}
.bp-rv__card-date {
	font-size: 11px;
	color: var(--bp-rv-muted);
	letter-spacing: 0.06em;
	text-transform: uppercase;
}
.bp-rv__card-sku {
	font-size: 10px;
	color: var(--bp-rv-muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin-top: 4px;
	font-variant-numeric: tabular-nums;
}

/* ───── card variants ───── */
.bp-rv--card-compact .bp-rv__card-media { display: none; }
.bp-rv--card-compact .bp-rv__card-body  { padding: 18px 18px 18px; }
.bp-rv--card-compact .bp-rv__card-head  {
	display: flex; align-items: center; gap: 10px; margin-bottom: 6px;
}
.bp-rv--card-compact .bp-rv__avatar {
	width: 40px; height: 40px; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	color: #FFFFFF; font-weight: 600; font-size: 15px; flex-shrink: 0;
}
.bp-rv--card-compact .bp-rv__card-head-meta {
	display: flex; flex-direction: column; min-width: 0;
}

.bp-rv--card-hybrid .bp-rv__card-media { aspect-ratio: 16 / 10; }

/* ───── stars ───── */
.bp-rv__star {
	width: 14px; height: 14px;
	display: inline-block;
	background: var(--bp-rv-star);
	clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
	flex-shrink: 0;
}
.bp-rv__star--empty { background: var(--bp-rv-star-empty); }
.bp-rv__star--lg { width: 24px; height: 24px; }

/* ───── load more / status ───── */
.bp-rv__loadmore { margin-top: 32px; text-align: center; }
.bp-rv__loadmore-btn {
	background: transparent;
	color: var(--bp-rv-text);
	border: 2px solid var(--bp-rv-text);
	padding: 14px 28px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease;
	border-radius: var(--bp-rv-radius);
	font-family: inherit;
}
.bp-rv__loadmore-btn:hover {
	background: var(--bp-rv-text);
	color: #FFFFFF;
}
.bp-rv__status {
	color: var(--bp-rv-muted);
	font-size: 13px;
	text-align: center;
	margin-top: 16px;
	min-height: 1em;
}
.bp-rv__status--error { color: var(--bp-rv-accent); }

/* ───── responsive ───── */
@media (max-width: 1200px) {
	.bp-rv__grid { grid-template-columns: repeat(var(--bp-rv-cols-tablet), minmax(0, 1fr)); }
	.bp-rv--slider .bp-rv__card {
		flex: 0 0 calc((100% - (var(--bp-rv-cols-tablet) - 1) * var(--bp-rv-gap)) / var(--bp-rv-cols-tablet));
	}
	.bp-rv--hide-score-tablet .bp-rv__score    { display: none !important; }
	.bp-rv--hide-grid-tablet  .bp-rv__grid     { display: none !important; }
	.bp-rv--hide-grid-tablet  .bp-rv__loadmore { display: none !important; }
	.bp-rv--hide-grid-tablet  .bp-rv__nav      { display: none !important; }
}
@media (max-width: 900px) {
	.bp-rv__score {
		grid-template-columns: 1fr;
		padding: 28px 24px;
		gap: 28px;
	}
	.bp-rv--score-layout-flip .bp-rv__score-block,
	.bp-rv--score-layout-flip .bp-rv__score-bars { order: unset; }
	.bp-rv--score-layout-flip .bp-rv__score-block { align-items: flex-start; text-align: left; }
}
@media (max-width: 600px) {
	.bp-rv__grid { grid-template-columns: repeat(var(--bp-rv-cols-mobile), minmax(0, 1fr)); gap: 14px; }
	.bp-rv--slider .bp-rv__card {
		flex: 0 0 calc((100% - (var(--bp-rv-cols-mobile) - 1) * 14px) / var(--bp-rv-cols-mobile));
	}
	.bp-rv__nav { width: 36px; height: 36px; }
	.bp-rv__nav--prev { left: -6px; }
	.bp-rv__nav--next { right: -6px; }

	/* Tighter mobile typography */
	.bp-rv__title       { font-size: 22px; letter-spacing: 0.02em; }
	.bp-rv__kicker      { font-size: 11px; letter-spacing: 0.14em; margin-bottom: 8px; }

	/* Compact score block on phone */
	.bp-rv__score        { padding: 18px 16px; gap: 16px; margin-bottom: 20px; }
	.bp-rv__score-num    { font-size: 40px; margin-bottom: 4px; }
	.bp-rv__score-stars  { gap: 1px; margin-bottom: 4px; }
	.bp-rv__score-meta   { font-size: 11px; }
	.bp-rv__score-bars   { gap: 6px; }
	.bp-rv__bar          { grid-template-columns: 36px 1fr 40px; gap: 10px; font-size: 12px; }
	.bp-rv__bar-track    { height: 6px; }
	.bp-rv__bar-count    { font-size: 11px; }
	.bp-rv__star--lg     { width: 18px; height: 18px; }

	/* Per-breakpoint hides */
	.bp-rv--hide-score-mobile .bp-rv__score    { display: none !important; }
	.bp-rv--hide-grid-mobile  .bp-rv__grid     { display: none !important; }
	.bp-rv--hide-grid-mobile  .bp-rv__loadmore { display: none !important; }
	.bp-rv--hide-grid-mobile  .bp-rv__nav      { display: none !important; }
}
