/**
 * PickNest Affiliate Engine — frontend styles.
 * Minimal, dependency-free, responsive. Uses CSS custom properties so themes
 * can override the palette without touching this file.
 */

.pn-card,
.pn-winner,
.pn-compare-wrap {
	--pn-accent: #ff6a3d;
	--pn-accent-dark: #e2552c;
	--pn-ink: #1f2733;
	--pn-muted: #6b7683;
	--pn-line: #e6e9ee;
	--pn-bg: #ffffff;
	--pn-radius: 12px;
	--pn-shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .06);
	font-family: inherit;
	color: var(--pn-ink);
	box-sizing: border-box;
}

.pn-card *,
.pn-winner *,
.pn-compare-wrap * {
	box-sizing: border-box;
}

/* ---------- Buttons ---------- */
.pn-btn {
	display: inline-block;
	background: var(--pn-accent);
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	padding: .7em 1.2em;
	border-radius: 8px;
	line-height: 1.2;
	transition: background .15s ease;
	border: none;
	cursor: pointer;
}

.pn-btn:hover,
.pn-btn:focus {
	background: var(--pn-accent-dark);
	color: #fff;
}

.pn-btn-sm {
	padding: .45em .8em;
	font-size: .85em;
}

.pn-btn-lg {
	padding: .85em 1.5em;
	font-size: 1.05em;
}

/* ---------- Product card ---------- */
.pn-card {
	background: var(--pn-bg);
	border: 1px solid var(--pn-line);
	border-radius: var(--pn-radius);
	box-shadow: var(--pn-shadow);
	overflow: hidden;
	width: 100%;
	margin: 1.5em 0;
}

/* Image left, title/summary/best-for right. Stacks on narrow screens. */
.pn-card-top {
	display: grid;
	grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
	align-items: start;
}

/* Flex centring rather than text-align: many themes set `img { display: block }`,
   which leaves the image stuck to the left of the media area. */
.pn-card-media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1.25em;
	background: #fafbfc;
	height: 100%;
}

.pn-card-intro {
	padding: 1.25em;
}

.pn-card-intro > :last-child {
	margin-bottom: 0;
}

.pn-card-media img {
	display: block;
	max-height: 320px;
	width: auto;
	max-width: 100%;
	margin: 0 auto;
	object-fit: contain;
}

.pn-score {
	position: absolute;
	top: 12px;
	left: 12px;
	background: var(--pn-ink);
	color: #fff;
	font-weight: 700;
	border-radius: 50%;
	width: 52px;
	height: 52px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	line-height: 1.1;
	font-size: 1em;
}

/* "/10" sits under the number so the badge stays circular. */
.pn-score-max {
	font-weight: 400;
	font-size: .6em;
	white-space: nowrap;
	opacity: .8;
}

.pn-card-body {
	padding: 1.25em;
	border-top: 1px solid var(--pn-line);
}

.pn-card-title {
	margin: 0 0 .5em;
	font-size: 1.25em;
	line-height: 1.3;
}

.pn-card-meta {
	display: flex;
	align-items: center;
	gap: .5em;
	flex-wrap: wrap;
	margin-bottom: .6em;
}

.pn-reviews {
	color: var(--pn-muted);
	font-size: .9em;
}

.pn-badge {
	display: inline-block;
	font-size: .72em;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	padding: .2em .5em;
	border-radius: 4px;
	background: #eef2f7;
	color: var(--pn-muted);
}

.pn-badge-prime {
	background: #e8f1ff;
	color: #0b6bcb;
}

/* ---------- Stars ---------- */
.pn-stars {
	position: relative;
	display: inline-block;
	width: 6em;
	height: 1em;
	vertical-align: middle;
	background: linear-gradient(currentColor 0 0) 0 0 / 0 0 no-repeat;
	color: #f5b301;
}

.pn-stars::before {
	content: "★★★★★";
	letter-spacing: .1em;
	color: #d9dee4;
	position: absolute;
	left: 0;
	top: 0;
	line-height: 1;
}

.pn-stars-fill {
	position: absolute;
	left: 0;
	top: 0;
	height: 100%;
	overflow: hidden;
	white-space: nowrap;
}

.pn-stars-fill::before {
	content: "★★★★★";
	letter-spacing: .1em;
	color: #f5b301;
	line-height: 1;
}

/* ---------- Price ---------- */
.pn-price {
	display: flex;
	align-items: baseline;
	gap: .6em;
	margin: .6em 0;
}

.pn-price-now {
	font-size: 1.35em;
	font-weight: 700;
	color: var(--pn-ink);
}

.pn-price-was {
	text-decoration: line-through;
	color: var(--pn-muted);
	font-size: .95em;
}

.pn-summary {
	color: var(--pn-ink);
	margin: .5em 0 .75em;
}

.pn-highlights {
	margin: .5em 0 .75em;
	padding-left: 1.2em;
}

.pn-highlights li {
	margin-bottom: .25em;
}

/* ---------- Pros / cons ---------- */
.pn-proscons {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1em;
	margin: .75em 0;
}

.pn-pros,
.pn-cons {
	border: 1px solid var(--pn-line);
	border-radius: 8px;
	padding: .75em 1em;
}

.pn-pros h4,
.pn-cons h4 {
	margin: 0 0 .4em;
	font-size: .9em;
}

.pn-pros h4 {
	color: #1a7f4b;
}

.pn-cons h4 {
	color: #b4232a;
}

.pn-pros ul,
.pn-cons ul {
	margin: 0;
	padding-left: 1.1em;
	font-size: .92em;
}

/* Shown in place of pros/cons when neither has been written yet. */
.pn-features {
	border: 1px solid var(--pn-line);
	border-radius: 8px;
	padding: .8em .9em;
	margin: .75em 0;
}

.pn-features h4 {
	margin: 0 0 .4em;
	font-size: .9em;
}

.pn-features ul {
	margin: 0;
	padding-left: 1.1em;
	font-size: .92em;
}

.pn-card-actions {
	margin-top: 1em;
}

/* ---------- Winner card ---------- */
.pn-winner {
	position: relative;
	border: 2px solid var(--pn-accent);
	border-radius: var(--pn-radius);
	box-shadow: var(--pn-shadow);
	background: var(--pn-bg);
	margin: 1.75em 0;
	overflow: hidden;
}

.pn-winner-ribbon {
	background: var(--pn-accent);
	color: #fff;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	font-size: .82em;
	padding: .5em 1em;
}

.pn-winner-inner {
	display: grid;
	grid-template-columns: 220px 1fr;
	gap: 1.25em;
	padding: 1.25em;
}

.pn-winner-media {
	text-align: center;
	background: #fafbfc;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1em;
}

.pn-winner-media img {
	max-width: 100%;
	max-height: 200px;
	object-fit: contain;
}

.pn-winner-title {
	margin: 0 0 .4em;
	font-size: 1.35em;
}

.pn-bestfor {
	margin: .5em 0;
}

.pn-winner-footer {
	display: flex;
	align-items: center;
	gap: 1em;
	flex-wrap: wrap;
	margin-top: 1em;
}

/* ---------- Comparison table ---------- */
.pn-compare-wrap {
	margin: 1.75em 0;
}

.pn-table-scroll {
	overflow-x: auto;
}

/* Not every theme ships this core class, and the Buy header relies on it. */
.pn-compare-wrap .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.pn-compare-table {
	width: 100%;
	border-collapse: collapse;
	font-size: .95em;
	min-width: 640px;
}

.pn-compare-table th,
.pn-compare-table td {
	border-bottom: 1px solid var(--pn-line);
	padding: .7em .8em;
	text-align: left;
	vertical-align: middle;
}

.pn-compare-table thead th {
	background: #f7f8fa;
	font-weight: 700;
	white-space: nowrap;
}

.pn-col-product {
	min-width: 370px;
}

.pn-cell-product {
	display: flex;
	align-items: center;
	gap: .7em;
}

.pn-cell-product img {
	width: 52px;
	height: 52px;
	object-fit: contain;
	flex: 0 0 auto;
}

/* Two lines, then ellipsis — keeps every row the same height however long
   the merchant's title is. */
.pn-cell-title {
	font-weight: 600;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-width: 0;
}

/* The Buy column rides along as the table scrolls sideways, so the button is
   always reachable however many spec columns there are. */
.pn-compare-table .pn-col-buy {
	position: sticky;
	right: 0;
	z-index: 1;
	background: var(--pn-bg);
	text-align: center;
	box-shadow: -6px 0 8px -6px rgba(16, 24, 40, .18);
}

.pn-compare-table thead .pn-col-buy {
	background: #f7f8fa;
	z-index: 2;
}

.pn-col-rank {
	width: 2.5em;
	text-align: center;
	font-weight: 700;
	color: var(--pn-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
	.pn-card-top {
		grid-template-columns: 1fr;
	}

	.pn-proscons {
		grid-template-columns: 1fr;
	}

	.pn-winner-inner {
		grid-template-columns: 1fr;
	}

	.pn-compare-table {
		min-width: 0;
	}

	.pn-compare-table thead {
		display: none;
	}

	.pn-compare-table,
	.pn-compare-table tbody,
	.pn-compare-table tr,
	.pn-compare-table td {
		display: block;
		width: 100%;
	}

	.pn-compare-table tr {
		border: 1px solid var(--pn-line);
		border-radius: 8px;
		margin-bottom: 1em;
		padding: .25em .5em;
	}

	.pn-compare-table td {
		border: none;
		display: flex;
		justify-content: space-between;
		gap: 1em;
		padding: .5em .4em;
	}

	.pn-compare-table td::before {
		content: attr(data-label);
		font-weight: 700;
		color: var(--pn-muted);
	}

	.pn-cell-product {
		justify-content: flex-end;
	}

	/* Rows are stacked cards here, so nothing scrolls sideways to stick to. */
	.pn-col-product {
		min-width: 0;
	}

	.pn-compare-table .pn-col-buy {
		position: static;
		box-shadow: none;
		text-align: left;
	}
}
