/* =====================================================================
   Brina product presentation system — card styles (Stage 3)
   Variants: .brina-card--standard | --compact | --deal, plus
   .brina-catmod (category / collection module).

   Uses the existing homepage palette only; the Stage 4 surface system
   (canvas, bands, final shadows) will restyle these. Structure notes:
   - the title link is stretched over the whole card (::after), so the
     wishlist toggle / add-to-cart controls sit above it without nested links
   - titles clamp to 2 lines with a reserved 2-line height, and price rows
     are pushed to the card bottom, so cards in a row share one height
   ===================================================================== */

.brina-card {
	--brina-card-bg: #F9F8FC;
	--brina-card-line: #E7E5EE;
	--brina-ink: #111827;
	--brina-muted: #6B7280;
	--brina-price: #5B4CF0;
	--brina-sale: #E62547;
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
	color: var(--brina-ink);
}

.brina-card__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 1 / 1;
}

.brina-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.brina-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.brina-card__title {
	margin: 0;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.35;
	color: var(--brina-ink);
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	overflow: hidden;
	min-height: calc(2em * 1.35);
	overflow-wrap: anywhere;
}

.brina-card__link {
	color: inherit;
	text-decoration: none;
}

/* Whole-card hit area. */
.brina-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border-radius: inherit;
}

.brina-card:focus-within {
	outline: 2px solid var(--brina-price);
	outline-offset: 2px;
}

.brina-card__link:focus-visible {
	outline: none;
}

.brina-card__brand {
	margin: 0;
	min-height: 1.3em;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: .02em;
	color: var(--brina-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.brina-card__price {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 6px;
	row-gap: 2px;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.25;
	color: var(--brina-price);
}

.brina-card__price del {
	font-size: .92em;
	font-weight: 400;
	color: var(--brina-muted);
	margin-right: 4px;
}

.brina-card__price ins {
	text-decoration: none;
	color: var(--brina-price);
}

.brina-card__discount {
	font-size: 11px;
	font-weight: 600;
	color: var(--brina-sale);
}

.brina-card__rating {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	line-height: 1;
	color: var(--brina-muted);
}

.brina-card__stars {
	--brina-star-w: calc(var(--brina-rating, 0) / 5 * 100%);
	display: inline-block;
	width: 62px;
	height: 12px;
	background: linear-gradient(90deg, #F59E0B var(--brina-star-w), #D9DCE3 var(--brina-star-w));
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 62 12'%3E%3Cg fill='%23000'%3E%3Cpath id='s' d='M6 0l1.8 3.9 4.2.4-3.2 2.8.9 4.1L6 9.1 2.3 11.2l.9-4.1L0 4.3l4.2-.4z'/%3E%3Cuse href='%23s' x='12.5'/%3E%3Cuse href='%23s' x='25'/%3E%3Cuse href='%23s' x='37.5'/%3E%3Cuse href='%23s' x='50'/%3E%3C/g%3E%3C/svg%3E") no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 62 12'%3E%3Cg fill='%23000'%3E%3Cpath id='s' d='M6 0l1.8 3.9 4.2.4-3.2 2.8.9 4.1L6 9.1 2.3 11.2l.9-4.1L0 4.3l4.2-.4z'/%3E%3Cuse href='%23s' x='12.5'/%3E%3Cuse href='%23s' x='25'/%3E%3Cuse href='%23s' x='37.5'/%3E%3Cuse href='%23s' x='50'/%3E%3C/g%3E%3C/svg%3E") no-repeat;
}

.brina-card__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	padding: 3px 7px;
	border-radius: 5px;
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	color: #FFFFFF;
	background: #172033;
	pointer-events: none;
}

.brina-card__badge--sale {
	background: var(--brina-sale);
}

/* ---- Wishlist toggle (shared by every variant) ---------------------
   A bare heart: no disc, ring or shadow. The button keeps a larger,
   invisible hit area; it sits above the stretched card link (z-index 2)
   as a sibling, so clicking it never follows the product link.
   Outline = not saved; filled commerce red = saved. State comes from
   data-state (set by PHP from YITH, and by JS only after YITH confirms). */

.brina-wishlist {
	--brina-heart-size: 21px;
	--brina-heart-hit: 38px;
	--brina-heart-ink: #374151;
	--brina-heart-ink-hover: #111827;
	--brina-heart-active: var(--brina-promo, #C92F55);
	--brina-heart-active-hover: var(--brina-promo-strong, #A8244A);
	position: absolute;
	top: 6px;
	right: 6px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--brina-heart-hit);
	height: var(--brina-heart-hit);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: none;
	box-shadow: none;
	color: var(--brina-heart-ink);
	line-height: 0;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	appearance: none;
}

.brina-wishlist__icon {
	width: var(--brina-heart-size);
	height: var(--brina-heart-size);
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linejoin: round;
	overflow: visible;
	/* Keeps the outline readable over darker product photography. */
	filter: drop-shadow(0 0 1px rgba(255, 255, 255, .95));
	transition: transform .15s ease, fill .15s ease, color .15s ease;
}

.brina-wishlist[data-state="saved"] {
	color: var(--brina-heart-active);
}

.brina-wishlist[data-state="saved"] .brina-wishlist__icon {
	fill: currentColor;
}

.brina-wishlist:hover {
	color: var(--brina-heart-ink-hover);
}

.brina-wishlist[data-state="saved"]:hover {
	color: var(--brina-heart-active-hover);
}

.brina-wishlist:focus {
	outline: none;
}

.brina-wishlist:focus-visible {
	outline: 2px solid var(--brina-accent, #5B4CF0);
	outline-offset: -2px;
}

.brina-wishlist[aria-busy="true"] {
	cursor: progress;
}

.brina-wishlist[aria-busy="true"] .brina-wishlist__icon {
	opacity: .5;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.brina-wishlist:hover .brina-wishlist__icon {
		transform: scale(1.08);
	}
}

@media (prefers-reduced-motion: reduce) {
	.brina-wishlist__icon {
		transition: none;
	}
}

/* Variant placement: inside each variant's image area. */
.brina-card--deal .brina-wishlist {
	top: 10px;
	right: 10px;
}

.brina-card--compact .brina-wishlist {
	--brina-heart-size: 18px;
	--brina-heart-hit: 34px;
	top: 0;
	right: 0;
}

/* Screen-reader-only live region for wishlist results. */
.brina-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.brina-card__action {
	position: relative;
	z-index: 2;
	align-self: flex-start;
	margin-top: 4px;
	font-size: 12px;
	font-weight: 600;
	color: var(--brina-price);
	text-decoration: none;
}

.brina-card__action:hover,
.brina-card__action:focus-visible {
	text-decoration: underline;
}

/* ---- Standard ------------------------------------------------------- */

.brina-card--standard {
	overflow: hidden;
	background: var(--brina-card-bg);
	border: 1px solid var(--brina-card-line);
	border-radius: 12px;
}

.brina-card--standard .brina-card__media {
	border-radius: 10px 10px 0 0;
}

.brina-card--standard .brina-card__body {
	padding: 8px 10px 10px;
}

/* ---- Rails (standard cards) ------------------------------------------ */

.brina-rail {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: 16px;
	width: 100%;
	align-items: stretch;
}

@media (max-width: 1200px) {
	/* Below desktop keep the previous single row of 7. */
	.brina-rail > :nth-child(n+8) {
		display: none;
	}
}

/* ---- Deal ----------------------------------------------------------- */

.brina-card--deal {
	aspect-ratio: 1 / 1;
	width: 100%;
	min-height: 0;
	overflow: hidden;
	padding: 16px 14px 14px;
	gap: 10px;
	background: #FAFBFC;
	border: 1px solid #E5E7EB;
	border-radius: 8px;
	box-shadow: 0 2px 17px rgba(23, 32, 51, .06);
}

.brina-card--deal .brina-card__media {
	flex: 1 1 auto;
	min-height: 0;
	aspect-ratio: auto;
	position: static;
}

.brina-card--deal .brina-card__img {
	object-fit: contain;
}

.brina-card--deal .brina-card__badge {
	top: 10px;
	left: 10px;
	padding: 4px 7px;
	font-size: 14px;
	line-height: 1;
}

.brina-card--deal .brina-card__body {
	flex: 0 0 auto;
}

.brina-card--deal .brina-card__title {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	min-height: calc(2em * 1.3);
}

.brina-card--deal .brina-card__price {
	font-size: 16px;
}

.brina-card--deal .brina-card__savings {
	margin: 0;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--brina-sale);
}

.brina-card--deal .brina-card__savings .woocommerce-Price-amount {
	color: inherit;
}

/* ---- Compact -------------------------------------------------------- */

.brina-card--compact {
	gap: 4px;
	--brina-compact-img: 82px;
}

.brina-card--compact .brina-card__media {
	aspect-ratio: auto;
	height: var(--brina-compact-img);
	border-radius: 6px;
}

.brina-card--compact .brina-card__img {
	width: auto;
	max-width: 100%;
	object-fit: contain;
}

.brina-card--compact .brina-card__title {
	font-size: 12px;
	line-height: 1.25;
	min-height: 0;
	-webkit-line-clamp: 1;
	line-clamp: 1;
}

.brina-card--compact .brina-card__price {
	font-size: 12px;
	font-weight: 600;
	margin-top: 0;
}

/* Bricks shortcode wrapper that should not create its own box
   (cards become items of the surrounding Bricks grid). */
.brina-contents {
	display: contents;
}

/* ---- Category / collection module ------------------------------------ */

.brina-catmod {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
	padding: 20px;
	background: #FAFBFC;
	border: 1px solid #E5E7EB;
	border-radius: 8px;
	font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

.brina-catmod__title {
	margin: 0;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.25;
	color: #172033;
}

.brina-catmod__title a {
	color: inherit;
	text-decoration: none;
}

.brina-catmod__subtitle {
	margin: 4px 0 0;
	font-size: 13px;
	color: #6B7280;
}

.brina-catmod__promo img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.brina-catmod__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 14px;
}

.brina-catmod--grid-2x3 .brina-catmod__grid {
	grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brina-catmod .brina-card--compact {
	--brina-compact-img: 120px;
}

.brina-catmod--feature .brina-catmod__grid {
	grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brina-catmod--feature .brina-card--feature {
	grid-column: 1 / -1;
	--brina-compact-img: 200px;
}

.brina-catmod__cta {
	align-self: flex-start;
	font-size: 14px;
	font-weight: 600;
	color: #5B3DF5;
	text-decoration: none;
}

.brina-catmod__cta:hover,
.brina-catmod__cta:focus-visible {
	text-decoration: underline;
}
