/* Rangura Infinite Products Grid */

.rip-wrapper,
.rip-wrapper * {
	box-sizing: border-box;
}

.rip-wrapper {
	--rip-columns: 6;
	--rip-gap: 20px;
	--rip-card-padding: 12px;
	display: block;
	max-width: 100%;
	width: 100%;
	/* If a page builder (Elementor/Martfury column, flexbox, etc.) places this
	   inside a flex or grid parent, children default to min-width: auto and
	   can either overflow or refuse to grow to fill the available space.
	   min-width: 0 + flex/grid basis 100% makes sure this always expands to
	   fill whatever container it's dropped into, edge to edge. */
	min-width: 0;
	flex: 1 1 100%;
	overflow-x: hidden; /* belt-and-suspenders: never let this component push the page wider than the viewport */
	margin: 24px 0;
	/* Turns this element into a CSS Container Query context, so the column
	   breakpoints below respond to the ACTUAL width available to the grid
	   (e.g. a narrower sidebar/widget column) instead of just the browser
	   window size. This is what guarantees the 6-column layout fills the
	   real container on desktop rather than assuming full viewport width. */
	container-type: inline-size;
	container-name: rip;
}

.rip-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 16px;
}

@media (max-width: 480px) {
	.rip-header {
		flex-direction: column;
		align-items: stretch;
	}

	.rip-sort-label {
		justify-content: space-between;
	}

	.rip-sort {
		flex: 1;
		min-width: 0;
	}
}

.rip-title {
	font-size: 22px;
	font-weight: 700;
	margin: 0;
}

.rip-sort-label {
	font-size: 14px;
	display: flex;
	align-items: center;
	gap: 8px;
	color: #444;
}

.rip-sort {
	padding: 6px 10px;
	border: 1px solid #d7d7d7;
	border-radius: 4px;
	background: #fff;
	font-size: 14px;
	cursor: pointer;
}

.rip-grid {
	display: grid;
	grid-template-columns: repeat(var(--rip-columns), 1fr);
	gap: var(--rip-gap);
	width: 100%;
}

/* Responsive breakpoints — desktop keeps the requested column count (default 6),
   tapering down on smaller screens so cards never get too cramped. Gap and card
   padding also shrink on phones so 2 columns actually fit comfortably. */
@media (max-width: 1200px) {
	.rip-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@media (max-width: 768px) {
	.rip-grid {
		grid-template-columns: repeat(3, 1fr);
		--rip-gap: 14px;
	}
}

@media (max-width: 480px) {
	.rip-grid {
		grid-template-columns: repeat(2, 1fr);
		--rip-gap: 10px;
		--rip-card-padding: 8px;
	}

	.rip-title {
		font-size: 18px;
	}
}

/* --- Container-query overrides (progressive enhancement) ---
   Same breakpoints as above, but measured against the grid's own
   container instead of the browser viewport. Where supported, these
   win over the @media rules, so a 6-column desktop layout that's been
   dropped into a narrower column/widget/sidebar correctly steps down
   to 4/3/2 columns even on a huge monitor — and, just as importantly,
   a wide, unconstrained container always gets the full 6 columns edge
   to edge instead of being limited by viewport guesswork. */
@container rip (max-width: 1200px) {
	.rip-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

@container rip (max-width: 768px) {
	.rip-grid {
		grid-template-columns: repeat(3, 1fr);
		--rip-gap: 14px;
	}
}

@container rip (max-width: 480px) {
	.rip-grid {
		grid-template-columns: repeat(2, 1fr);
		--rip-gap: 10px;
		--rip-card-padding: 8px;
	}

	.rip-title {
		font-size: 18px;
	}

	.rip-header {
		flex-direction: column;
		align-items: stretch;
	}

	.rip-sort {
		flex: 1;
		min-width: 0;
	}
}

.rip-card {
	display: flex;
	flex-direction: column;
	/* Prevents the classic CSS-grid overflow bug: grid items default to
	   min-width: auto, which means an unbreakable string (a long price or
	   title) can force a column wider than its 1fr share and push the
	   whole grid past the viewport on phones. min-width: 0 lets the text
	   wrap/truncate instead of blowing out the layout. */
	min-width: 0;
	text-decoration: none;
	color: inherit;
	background: #fff;
	border: 1px solid #eee;
	border-radius: 6px;
	padding: var(--rip-card-padding);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	opacity: 0;
	animation: rip-fade-in 0.35s ease forwards;
}

@keyframes rip-fade-in {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.rip-card:hover {
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.rip-card-image {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f5f5f5;
	border-radius: 4px;
	margin-bottom: 10px;
}

.rip-card-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.rip-card-image img.rip-loaded {
	opacity: 1;
}

.rip-card-title {
	font-size: 14px;
	line-height: 1.4;
	color: #1a73c1;
	margin-bottom: 6px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.rip-card:hover .rip-card-title {
	text-decoration: underline;
}

.rip-card-price {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	font-size: 15px;
	font-weight: 600;
	color: #e8590c;
	overflow-wrap: anywhere;
	word-break: break-word;
}

@media (max-width: 480px) {
	.rip-card-price {
		font-size: 13px;
	}

	.rip-card-title {
		font-size: 13px;
	}
}

.rip-card-price del {
	color: #999;
	font-weight: 400;
	font-size: 13px;
}

.rip-card-price ins {
	text-decoration: none;
}

.rip-status {
	text-align: center;
	padding: 20px 0;
}

.rip-spinner {
	width: 30px;
	height: 30px;
	margin: 0 auto;
	border: 3px solid #e5e5e5;
	border-top-color: #1a73c1;
	border-radius: 50%;
	animation: rip-spin 0.7s linear infinite;
}

@keyframes rip-spin {
	to {
		transform: rotate(360deg);
	}
}

.rip-empty,
.rip-end {
	color: #888;
	font-size: 14px;
	margin: 0;
}

.rip-sentinel {
	height: 1px;
}
