/* ==========================================================================
   MLFH Product Roundup
   - Container queries are the primary responsive mechanism.
   - Viewport media query mirrors them as a fallback for older browsers.
   - Defensive resets + scoped selectors so themes can't quietly break it.
   ========================================================================== */

.mlfh-roundup {
	/* Theming variables — tweak here to restyle everything. */
	--mlfh-ru-cream: #fbf7f0;
	--mlfh-ru-border: #e7ddcb;
	--mlfh-ru-accent: #8b6b4a;          /* warm brown accent */
	--mlfh-ru-btn-bg: #2a2a2a;          /* dark CTA */
	--mlfh-ru-btn-bg-hover: #000000;
	--mlfh-ru-btn-text: #ffffff;
	--mlfh-ru-radius: 10px;
	--mlfh-ru-gap: 1rem;
	--mlfh-ru-img: 72px;

	container-type: inline-size;
	container-name: mlfh-roundup;

	margin: 1.75rem 0;
	box-sizing: border-box;
}

.mlfh-roundup *,
.mlfh-roundup *::before,
.mlfh-roundup *::after {
	box-sizing: border-box;
}

/* List title --------------------------------------------------------------- */
.mlfh-roundup .mlfh-roundup__title {
	margin: 0 0 1rem;
	padding: 0 0 0.5rem;
	font-size: 1.4em;
	line-height: 1.25;
	font-weight: 700;
	color: inherit;                 /* inherit theme typography colour */
	border-bottom: 2px solid var(--mlfh-ru-accent);
}

/* List + rows -------------------------------------------------------------- */
.mlfh-roundup .mlfh-roundup__list {
	list-style: none !important;    /* defensive: kill theme bullets */
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.mlfh-roundup .mlfh-roundup__item {
	list-style: none !important;
	margin: 0 !important;
	padding: 0.75rem 1rem;
	display: flex;
	align-items: center;
	gap: var(--mlfh-ru-gap);

	background: var(--mlfh-ru-cream);
	border: 1px solid var(--mlfh-ru-border);
	border-left: 4px solid var(--mlfh-ru-accent);   /* brown accent edge */
	border-radius: var(--mlfh-ru-radius);
}

.mlfh-roundup .mlfh-roundup__item::before {
	content: none !important;       /* defensive: some themes add ::before bullets */
}

/* Media -------------------------------------------------------------------- */
.mlfh-roundup .mlfh-roundup__media {
	flex: 0 0 auto;
	display: flex;
}

.mlfh-roundup .mlfh-roundup__img {
	width: var(--mlfh-ru-img);
	height: var(--mlfh-ru-img);
	object-fit: cover;
	border-radius: 8px;
	display: block;
	background: #fff;
	border: 1px solid var(--mlfh-ru-border);
}

.mlfh-roundup .mlfh-roundup__img--placeholder {
	background: linear-gradient(135deg, #f2ead9, #e7ddcb);
}

/* Title -------------------------------------------------------------------- */
.mlfh-roundup .mlfh-roundup__name {
	flex: 1 1 auto;
	min-width: 0;                   /* allow text to wrap/ellipsis inside flex */
	font-size: 1.02em;
	font-weight: 600;
	line-height: 1.35;
	color: inherit;
}

/* Action / Shop Now button ------------------------------------------------- */
.mlfh-roundup .mlfh-roundup__action {
	flex: 0 0 auto;
}

.mlfh-roundup .mlfh-roundup__btn,
.mlfh-roundup .mlfh-roundup__btn:visited {
	display: inline-block;
	white-space: nowrap;
	padding: 0.6rem 1.25rem;
	background: var(--mlfh-ru-btn-bg);
	color: var(--mlfh-ru-btn-text) !important;   /* defensive: theme link colour */
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none !important;
	border-radius: 999px;
	border: 0;
	transition: background-color 0.15s ease, transform 0.05s ease;
}

.mlfh-roundup .mlfh-roundup__btn:hover,
.mlfh-roundup .mlfh-roundup__btn:focus {
	background: var(--mlfh-ru-btn-bg-hover);
	color: var(--mlfh-ru-btn-text) !important;
	text-decoration: none !important;
}

.mlfh-roundup .mlfh-roundup__btn:active {
	transform: translateY(1px);
}

/* ==========================================================================
   Responsive: narrow CONTAINER (primary).
   When the roundup's own container is narrow, image + title stay together
   on the first line and the button drops to a full-width line beneath.
   ========================================================================== */
@container mlfh-roundup (max-width: 460px) {
	.mlfh-roundup .mlfh-roundup__item {
		flex-wrap: wrap;
	}
	.mlfh-roundup .mlfh-roundup__name {
		flex: 1 1 0;
	}
	.mlfh-roundup .mlfh-roundup__action {
		flex: 1 1 100%;
	}
	.mlfh-roundup .mlfh-roundup__btn {
		display: block;
		width: 100%;
		text-align: center;
	}
	.mlfh-roundup {
		--mlfh-ru-img: 60px;
	}
}

/* ==========================================================================
   Responsive: narrow VIEWPORT (fallback for browsers without container
   query support). Mirrors the rules above.
   ========================================================================== */
@supports not (container-type: inline-size) {
	@media (max-width: 540px) {
		.mlfh-roundup .mlfh-roundup__item {
			flex-wrap: wrap;
		}
		.mlfh-roundup .mlfh-roundup__name {
			flex: 1 1 0;
		}
		.mlfh-roundup .mlfh-roundup__action {
			flex: 1 1 100%;
		}
		.mlfh-roundup .mlfh-roundup__btn {
			display: block;
			width: 100%;
			text-align: center;
		}
		.mlfh-roundup {
			--mlfh-ru-img: 60px;
		}
	}
}

/* Editor preview niceties (the edit UI is built from controls, not this). */
.mlfh-roundup-editor {
	padding: 4px 0;
}
