/**
 * Lumigram Front-end Stylesheet.
 *
 * .lumi-feed   wrapper: Feed Width %, centred with auto side margins.
 * .lumi-grid   grid with N equal columns (N = Columns setting, like Tailwind grid-cols-N).
 * .lumi-item   one image, one column (like col-span-1).
 *
 * Layout properties carry !important so theme / page-builder CSS can't shrink the feed.
 */

.lumi-feed {
	--lumi-width: 100%;
	--lumi-cols: 4;
	--lumi-cols-tablet: 2;
	--lumi-cols-mobile: 1;
	--lumi-gap: 20px;
	--lumi-overlay-bg: rgba(0, 0, 0, 0.75);
	--lumi-overlay-text: #ffffff;
	--lumi-btn-color: #3a3b5c;
	--lumi-btn-bg: transparent;
	--lumi-btn-border: #3a3b5c;

	display: block !important;
	box-sizing: border-box !important;
	width: var(--lumi-width) !important;
	max-width: 100% !important;
	min-width: 0 !important;
	margin: 0 auto !important; /* mx-auto */
	padding: 0;
	float: none !important;
}

.lumi-feed *,
.lumi-feed *::before,
.lumi-feed *::after {
	box-sizing: border-box;
}

/* ---- Grid: N equal columns that always span the full wrapper width ---- */
.lumi-grid {
	display: grid !important;
	grid-template-columns: repeat(var(--lumi-cols), minmax(0, 1fr)) !important;
	gap: var(--lumi-gap) !important;
	width: 100% !important;
	margin: 0 !important;
	padding: 0 !important;
	list-style: none;
}

/* ---- Item: one column each; height follows the image so nothing is cropped ---- */
.lumi-item {
	grid-column: span 1 !important;
	position: relative;
	align-self: start; /* rows may mix aspect ratios; don't stretch items */
	width: 100%;
	min-width: 0;
	margin: 0;
	padding: 0;
	overflow: hidden;
}

.lumi-item--hidden {
	display: none !important;
}

.lumi-link {
	position: relative;
	display: block;
	text-decoration: none;
	color: inherit;
}

.lumi-image {
	display: block;
	width: 100% !important;
	height: auto !important; /* natural aspect ratio: the complete image, never cropped */
	max-width: 100% !important;
	margin: 0 !important;
	object-fit: contain;
	transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
}

.lumi-item:hover .lumi-image {
	transform: scale(1.06);
}

/* ---- Hover overlay ----
   Dark layer, stats row (outline heart + comment) centred above a 4-line centred caption.
   Sizes use container units (cqw = 1% of the card width) so the overlay scales with the card
   at any column count; the px values are fallbacks for browsers without container queries. */
.lumi-item {
	container-type: inline-size;
}

.lumi-overlay {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	padding: 24px;
	text-align: center;
	background: var(--lumi-overlay-bg);
	color: var(--lumi-overlay-text);
	opacity: 0;
	transition: opacity 0.4s ease;
}

.lumi-item:hover .lumi-overlay,
.lumi-link:focus-visible .lumi-overlay {
	opacity: 1;
}

.lumi-meta {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 24px;
	margin-bottom: 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1;
}

.lumi-stat {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	line-height: 1;
}

/* Icons are drawn from the stylesheet (CSS mask), not inline <svg>, because themes and page
   builders often strip <svg> tags from shortcode output. They take the overlay text colour. */
.lumi-icon {
	flex-shrink: 0;
	display: block;
	width: 22px;
	height: 22px;
	background-color: currentColor;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

.lumi-icon--heart {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M16.792 3.904A4.989 4.989 0 0 1 21.5 9.122c0 3.072-2.652 4.959-5.197 7.222-2.512 2.243-3.865 3.469-4.303 3.652-.438-.183-1.8-1.409-4.303-3.652C5.151 14.08 2.5 12.193 2.5 9.122a4.989 4.989 0 0 1 4.708-5.218 4.21 4.21 0 0 1 3.675 1.941c.84 1.175.98 1.763 1.12 1.763s.278-.588 1.11-1.766a4.17 4.17 0 0 1 3.679-1.938z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M16.792 3.904A4.989 4.989 0 0 1 21.5 9.122c0 3.072-2.652 4.959-5.197 7.222-2.512 2.243-3.865 3.469-4.303 3.652-.438-.183-1.8-1.409-4.303-3.652C5.151 14.08 2.5 12.193 2.5 9.122a4.989 4.989 0 0 1 4.708-5.218 4.21 4.21 0 0 1 3.675 1.941c.84 1.175.98 1.763 1.12 1.763s.278-.588 1.11-1.766a4.17 4.17 0 0 1 3.679-1.938z'/%3E%3C/svg%3E");
}

.lumi-icon--comment {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M20.656 17.008a9.993 9.993 0 1 0-3.59 3.615L22 22z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M20.656 17.008a9.993 9.993 0 1 0-3.59 3.615L22 22z'/%3E%3C/svg%3E");
}

.lumi-caption {
	display: -webkit-box;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	-webkit-line-clamp: 4;
	-webkit-box-orient: vertical;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.75;
}

@supports (width: 1cqw) {
	.lumi-overlay {
		padding: 8cqw 10cqw;
	}
	.lumi-meta {
		gap: 15cqw;
		margin-bottom: 12cqw;
		font-size: 4.7cqw;
	}
	.lumi-stat {
		gap: 2cqw;
	}
	.lumi-icon {
		width: 6.5cqw;
		height: 6.5cqw;
	}
	.lumi-caption {
		font-size: 4cqw;
	}
}

/* Very small cards (many columns): keep the dark layer and stats, drop the caption. */
@container (max-width: 150px) {
	.lumi-caption {
		display: none;
	}
	.lumi-meta {
		margin-bottom: 0;
	}
}

/* ---- Show more button ---- */
.lumi-more {
	width: 100%;
	margin-top: 40px;
	text-align: center;
}

.lumi-more-btn {
	display: inline-block;
	padding: 8px 2px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 2px;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--lumi-btn-color);
	background: var(--lumi-btn-bg);
	border: none;
	border-bottom: 1.5px solid var(--lumi-btn-border);
	border-radius: 0;
	outline: none;
	cursor: pointer;
	transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.lumi-more-btn:hover {
	opacity: 0.75;
	letter-spacing: 2.8px;
	padding-left: 4px;
	padding-right: 4px;
}

/* ---- Admin-only error ---- */
.lumi-error {
	padding: 15px;
	background: #fff8f8;
	border-left: 4px solid #d93838;
	color: #a81c1c;
	font-size: 13px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---- Tablet: scale columns down (Columns setting / 2) ---- */
@media (max-width: 1024px) {
	.lumi-grid {
		grid-template-columns: repeat(var(--lumi-cols-tablet), minmax(0, 1fr)) !important;
		gap: min(var(--lumi-gap), 12px) !important;
	}
}

/* ---- Mobile: scale columns down further (Columns setting / 4) ---- */
@media (max-width: 640px) {
	.lumi-grid {
		grid-template-columns: repeat(var(--lumi-cols-mobile), minmax(0, 1fr)) !important;
		gap: min(var(--lumi-gap), 8px) !important;
	}
}
