/*
 * DX BR Listicle - front-end + editor styles.
 * Faithful port of the BuyersReport ".cardstores .item" product container.
 *
 * Layout strategy:
 *  - Shared visual styles (border, hover, ribbon, rating, button, features)
 *    apply to .br-card everywhere (editor + front-end).
 *  - The exact absolute-positioned layout (rank circle outside-left, image
 *    pinned left, actions pinned right) is scoped to ".br-listicle .br-card"
 *    so it only runs on the front-end template; the editor keeps an editable
 *    flex layout.
 */

:root {
	--brl-text: #000000;
	--brl-muted: #726e78;
	--brl-intro: #5e5c62;
	--brl-card-bg: #ffffff;
	--brl-border: #ededed;
	--brl-border-hover: #ff8d00;
	--brl-rank-border: #000000;
	--brl-ribbon: #5b31dd;
	--brl-star: #f8b200;
	--brl-check-bg: #f1efe9;
	--brl-btn: #f6ae18;
	--brl-btn-hover: #e6a51c;
	--brl-picked: #999999;
	--brl-rule: #e2e0da;
	--brl-radius: 22px;
	--brl-max: 1320px;
	--brl-media-w: 170px;
	--brl-action-w: 210px;
	--brl-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Page wrapper ---------- */

/* The theme caps .row at 1200px; widen our row to match BuyersReport's
 * Bootstrap xxl container (1320px). */
.section-main .row.br-listicle-row {
	max-width: var(--brl-max) !important;
	width: 100%;
	margin-left: auto;
	margin-right: auto;
}

.br-listicle {
	width: 100%;
	max-width: var(--brl-max);
	margin: 0 auto;
	padding: 24px 16px 48px;
	box-sizing: border-box;
	color: var(--brl-text);
	font-family: var(--brl-sans);
}

/* The 22W theme forces a serif font on headings via higher-specificity
 * selectors; override so the listicle stays clean sans-serif like the original. */
.br-listicle,
.br-listicle h1,
.br-listicle h2,
.br-listicle h3,
.br-listicle h4,
.br-listicle p,
.br-listicle ul,
.br-listicle li,
.br-listicle a,
.br-listicle strong,
.br-listicle span {
	font-family: var(--brl-sans) !important;
}

.br-listicle .br-page-title {
	font-size: 38px;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -1px;
	color: var(--brl-text);
	margin: 0 0 10px;
}

.br-listicle .br-intro {
	font-size: 16px;
	line-height: 1.45;
	color: var(--brl-intro);
	margin: 0 0 32px;
}

/* ---------- Product card: shared visual styles ---------- */

.br-card {
	position: relative;
	background: var(--brl-card-bg);
	border: 2px solid var(--brl-border);
	border-radius: var(--brl-radius);
	box-shadow: 0 0 10px rgba(0, 0, 0, 0.08);
	margin: 0 0 20px;
	box-sizing: border-box;
	transition: border-color 0.2s linear;
	/* editor fallback layout */
	display: flex;
	align-items: center;
	gap: 20px;
	padding: 22px;
}

.br-card:hover {
	border-color: var(--brl-border-hover);
}

/* Rank circle */
.br-card .br-rank {
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	margin: 0;
	background: #fff;
	border: 2px solid var(--brl-rank-border);
	border-radius: 100%;
	color: var(--brl-text);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	align-self: center;
	z-index: 2;
}

/* Media (image + brand) */
.br-card .br-media {
	flex: 0 0 var(--brl-media-w);
	max-width: var(--brl-media-w);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	position: relative;
	text-align: center;
}

/* "Our Top Pick" ribbon (purple flag with a triangular tail). */
.br-card .br-badge {
	display: none;
	position: absolute;
	top: 0;
	left: -6px;
	z-index: 3;
	margin: 0;
	background: var(--brl-ribbon);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	padding: 0 10px;
	line-height: 30px;
	border-top-left-radius: 5px;
	border-bottom-left-radius: 5px;
	white-space: nowrap;
}

.br-card .br-badge::after {
	content: "";
	position: absolute;
	top: 0;
	right: -20px;
	width: 0;
	height: 0;
	border-style: solid;
	border-width: 15px;
	border-color: var(--brl-ribbon) transparent var(--brl-ribbon) var(--brl-ribbon);
}

.br-card.br-card--top .br-badge {
	display: inline-block;
}

/*
 * The dx-wp-gallery-cls plugin injects an inline "padding-top:56.25%" on image
 * figures (and makes the <img> fill that box) to reserve aspect-ratio space.
 * That squishes the product image and inflates the retailer logo, so neutralize
 * it on our figures and size the images ourselves.
 */
.br-card .br-image,
.br-card .br-retailer-logo {
	padding-top: 0 !important;
	height: auto !important;
}

.br-card .br-image img,
.br-card .br-retailer-logo img {
	position: static !important;
	inset: auto !important;
}

.br-card .br-image {
	width: 100%;
	margin: 0;
}

.br-card .br-image img {
	max-width: 100% !important;
	max-height: var(--brl-media-w) !important;
	width: auto !important;
	height: auto !important;
	object-fit: contain;
	display: block;
	margin: 0 auto;
}

/* Hide the dx-image-source "via Walmart" caption inside cards. */
.br-card .br-image figcaption,
.br-card .br-image .isc-image-source-wrapper,
.br-card .br-image .isc-source-text {
	display: none !important;
}

.br-card .br-brand {
	margin: 0;
	font-size: 14px;
	font-weight: 700;
	color: var(--brl-text);
	text-align: center;
}

/* Content (title + rating + features) */
.br-card .br-content {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	align-content: flex-start;
	column-gap: 10px;
	row-gap: 8px;
}

.br-card .br-title {
	flex: 0 1 auto;
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--brl-text);
}

.br-card .br-title a {
	color: var(--brl-text);
	text-decoration: none;
}

.br-card .br-score {
	flex: 0 0 auto;
	margin: 0;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
}

.br-card .br-score-num {
	font-weight: 700;
	color: var(--brl-text);
}

.br-card .br-stars {
	color: var(--brl-star);
	font-size: 18px;
	letter-spacing: 1px;
	line-height: 1;
}

.br-card .br-reviews {
	color: var(--brl-muted);
}

.br-card .br-features {
	flex: 0 0 100%;
	width: 100%;
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

.br-card .br-features li {
	position: relative;
	padding: 0 0 0 35px;
	margin: 0 0 4px;
	font-size: 15px;
	line-height: 25px;
	color: var(--brl-text);
	list-style: none;
}

.br-card .br-features li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	width: 25px;
	height: 25px;
	border-radius: 100%;
	background: var(--brl-check-bg);
}

.br-card .br-features li::after {
	content: "✓";
	position: absolute;
	left: 0;
	top: 0;
	width: 25px;
	height: 25px;
	line-height: 25px;
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	color: var(--brl-text);
}

/* Actions (CTA + retailer logo + picked) */
.br-card .br-action {
	flex: 0 0 var(--brl-action-w);
	max-width: var(--brl-action-w);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 0;
}

.br-card .br-cta {
	margin: 0 0 15px;
	width: 100%;
	justify-content: center;
}

.br-card .br-cta .wp-block-button,
.br-card .br-button {
	width: 100%;
}

.br-card .br-button .wp-block-button__link,
.br-card .br-cta .wp-block-button__link {
	display: block;
	width: 100%;
	background: var(--brl-btn);
	color: #ffffff !important;
	border: none;
	border-radius: 5px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	padding: 0 12px;
	height: 50px;
	line-height: 50px;
	font-size: 14px;
	text-align: center;
	text-decoration: none;
	box-sizing: border-box;
	transition: background-color 0.2s linear;
}

.br-card .br-button .wp-block-button__link:hover,
.br-card .br-cta .wp-block-button__link:hover {
	background: var(--brl-btn-hover);
}

.br-card .br-retailer-logo {
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.br-card .br-retailer-logo img {
	height: 30px !important;
	width: auto !important;
	max-width: 100px !important;
	max-height: 30px !important;
	object-fit: contain;
	display: block;
	margin: 0 auto;
}

.br-card .br-picked {
	margin: 10px 0 0;
	padding-top: 10px;
	border-top: 1px solid var(--brl-rule);
	font-size: 13px;
	line-height: 1.4;
	color: var(--brl-picked);
	text-align: center;
}

/* ---------- Front-end only: exact absolute layout ---------- */

.br-listicle .br-card {
	display: block;
	padding: 0;
	min-height: 210px;
}

.br-listicle .br-card .br-rank {
	position: absolute;
	top: 50%;
	left: -20px;
	margin-top: -20px;
}

.br-listicle .br-card .br-media {
	position: absolute;
	top: 0;
	left: 30px;
	height: 100%;
	width: var(--brl-media-w);
	margin: 0;
}

.br-listicle .br-card .br-content {
	display: flex;
	padding: 22px 230px 22px 230px;
}

.br-listicle .br-card .br-action {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: var(--brl-action-w);
	padding: 20px 10px;
}

/* ---------- Responsive (front-end): stack like the original mobile view) ---------- */

@media (max-width: 820px) {
	.br-listicle .br-card {
		display: block;
		min-height: 0;
	}

	.br-listicle .br-card .br-rank {
		display: none;
	}

	.br-listicle .br-card .br-media {
		position: relative;
		top: 0;
		left: 0;
		width: 100%;
		max-width: 100%;
		height: auto;
		padding: 16px 10px 0;
	}

	.br-listicle .br-card .br-content {
		display: flex;
		padding: 12px 16px 0;
	}

	.br-listicle .br-card .br-action {
		position: relative;
		top: 0;
		right: 0;
		width: 100%;
		max-width: 100%;
		padding: 12px 16px 18px;
	}

	.br-listicle .br-card .br-action .br-picked {
		border-top: none;
		margin-top: 0;
		padding-top: 0;
	}
}

@media (max-width: 560px) {
	.br-listicle {
		padding: 16px 12px 32px;
	}

	.br-listicle .br-page-title {
		font-size: 26px;
	}

	.br-card .br-title {
		font-size: 20px;
	}
}

/* ---------- Editor-only tweaks ---------- */

.editor-styles-wrapper .br-card {
	display: flex;
}

.editor-styles-wrapper .br-card .br-features {
	list-style: none;
}
