/*
 * Mylistingo Discover front page.
 * Scoped entirely under .mlg-front so nothing here can leak into article,
 * category or archive pages. Palette follows JNews's own dark-mode state
 * (body.jnews-dark-mode) so the feed matches the header instead of fighting it.
 */

.mlg-front {
	--mlg-bg: #ffffff;
	--mlg-surface: #ffffff;
	--mlg-surface-2: #f5f6f8;
	--mlg-border: rgba(16, 18, 24, 0.10);
	--mlg-text: #101218;
	--mlg-muted: #5c6373;
	--mlg-accent: #6c3ef4;
	--mlg-accent-ink: #ffffff;
	--mlg-radius: 12px;
	--mlg-gap: 20px;

	background: var(--mlg-bg);
	color: var(--mlg-text);
	padding: 8px 0 40px;
}

body.jnews-dark-mode .mlg-front {
	--mlg-bg: #0b0c0f;
	--mlg-surface: #14161b;
	--mlg-surface-2: #1b1e25;
	--mlg-border: rgba(255, 255, 255, 0.09);
	--mlg-text: #eef0f4;
	--mlg-muted: #9aa2b1;
	--mlg-accent: #8b6cff;
}

/* h1 is required for document structure but should not shout. */
.mlg-front .mlg-tagline {
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--mlg-muted);
	margin: 0 0 14px;
	padding: 0;
}

/* ---------- category chips ---------- */
.mlg-front .mlg-chips {
	position: sticky;
	top: 0;
	z-index: 5;
	margin: 0 0 22px;
	padding: 10px 0;
	background: var(--mlg-bg);
	border-bottom: 1px solid var(--mlg-border);
}

.mlg-front .mlg-chips ul {
	display: flex;
	gap: 8px;
	margin: 0;
	padding: 0 2px 2px;
	list-style: none;
	overflow-x: auto;
	scrollbar-width: none;
}

.mlg-front .mlg-chips ul::-webkit-scrollbar { display: none; }

.mlg-front .mlg-chips li { flex: 0 0 auto; margin: 0; }

.mlg-front .mlg-chips a {
	display: block;
	padding: 7px 14px;
	border: 1px solid var(--mlg-border);
	border-radius: 999px;
	background: var(--mlg-surface-2);
	color: var(--mlg-text);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	white-space: nowrap;
	text-decoration: none;
	transition: background .15s, border-color .15s, color .15s;
}

.mlg-front .mlg-chips a:hover,
.mlg-front .mlg-chips a:focus-visible {
	background: var(--mlg-accent);
	border-color: var(--mlg-accent);
	color: var(--mlg-accent-ink);
}

/* ---------- layout ---------- */
.mlg-front .mlg-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 320px;
	gap: 28px;
	align-items: start;
}

.mlg-front .mlg-feed {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: var(--mlg-gap);
}

/* ---------- cards ---------- */
.mlg-front .mlg-card {
	min-width: 0;
	margin: 0;
	background: var(--mlg-surface);
	border: 1px solid var(--mlg-border);
	border-radius: var(--mlg-radius);
	overflow: hidden;
	transition: transform .16s ease, box-shadow .16s ease;
}

.mlg-front .mlg-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 22px rgba(0, 0, 0, .10);
}

body.jnews-dark-mode .mlg-front .mlg-card:hover {
	box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
}

.mlg-front .mlg-card__media {
	display: block;
	position: relative;
	aspect-ratio: 16 / 9;
	background: var(--mlg-surface-2);
	overflow: hidden;
	text-decoration: none;
}

.mlg-front .mlg-card__img,
.mlg-front .mlg-card__noimg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mlg-front .mlg-card__noimg {
	background: linear-gradient(135deg, var(--mlg-surface-2), var(--mlg-border));
}

.mlg-front .mlg-card__body { padding: 12px 14px 14px; }

.mlg-front .mlg-badge {
	display: inline-block;
	margin-bottom: 7px;
	padding: 3px 8px;
	border-radius: 5px;
	background: var(--mlg-accent);
	color: var(--mlg-accent-ink);
	font-size: 10.5px;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
	text-decoration: none;
	line-height: 1.4;
}

.mlg-front .mlg-card__title {
	margin: 0 0 7px;
	font-weight: 700;
	line-height: 1.28;
	/* clamp to 3 lines */
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mlg-front .mlg-card__title a {
	color: inherit;
	text-decoration: none;
}

.mlg-front .mlg-card__title a:hover { color: var(--mlg-accent); }

.mlg-front .mlg-card__meta {
	margin: 0;
	font-size: 12px;
	color: var(--mlg-muted);
}

/* hero: 6 cols, overlaid headline */
.mlg-front .mlg-card--hero {
	grid-column: span 6;
	position: relative;
}

.mlg-front .mlg-card--hero .mlg-card__media { aspect-ratio: 16 / 10; }

.mlg-front .mlg-card--hero .mlg-card__body {
	position: absolute;
	inset: auto 0 0 0;
	padding: 46px 20px 18px;
	background: linear-gradient(to top, rgba(0, 0, 0, .88) 0%, rgba(0, 0, 0, .55) 55%, rgba(0, 0, 0, 0) 100%);
}

.mlg-front .mlg-card--hero .mlg-card__title {
	font-size: clamp(20px, 2vw, 27px);
	-webkit-line-clamp: 3;
	color: #fff;
}

.mlg-front .mlg-card--hero .mlg-card__title a { color: #fff; }
.mlg-front .mlg-card--hero .mlg-card__meta { color: rgba(255, 255, 255, .82); }

/* lead: 3 cols */
.mlg-front .mlg-card--lead { grid-column: span 3; }
.mlg-front .mlg-card--lead .mlg-card__title { font-size: 15px; }

/* medium: 4 cols */
.mlg-front .mlg-card--md { grid-column: span 4; }
.mlg-front .mlg-card--md .mlg-card__title { font-size: 15.5px; }

/* two stacked image-left smalls sharing 4 cols */
.mlg-front .mlg-smstack {
	grid-column: span 4;
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.mlg-front .mlg-card--sm {
	display: grid;
	grid-template-columns: 108px minmax(0, 1fr);
	align-items: stretch;
}

/*
 * Explicit width, and aspect-ratio reset to auto. Leaving the inherited 16/9
 * aspect-ratio alongside height:100% lets the browser derive the WIDTH from the
 * height, which overflows the 108px track and covers the headline.
 */
.mlg-front .mlg-card--sm .mlg-card__media {
	aspect-ratio: auto;
	width: 108px;
	height: 100%;
	min-height: 86px;
}

.mlg-front .mlg-card--sm .mlg-card__body {
	padding: 10px 12px;
	min-width: 0;
}

.mlg-front .mlg-card--sm .mlg-card__title {
	font-size: 13.5px;
	-webkit-line-clamp: 3;
}

.mlg-front .mlg-card--sm .mlg-badge {
	margin-bottom: 5px;
	font-size: 9.5px;
	padding: 2px 6px;
}

/* ---------- right rail ---------- */
.mlg-front .mlg-rail { min-width: 0; }

.mlg-front .mlg-rail__inner {
	position: sticky;
	top: 84px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mlg-front .mlg-widget {
	background: var(--mlg-surface);
	border: 1px solid var(--mlg-border);
	border-radius: var(--mlg-radius);
	padding: 14px 16px;
}

.mlg-front .mlg-widget__title {
	margin: 0 0 10px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--mlg-muted);
}

.mlg-front .mlg-weather {
	display: flex;
	align-items: center;
	gap: 12px;
}

.mlg-front .mlg-weather__icon { font-size: 30px; line-height: 1; }

.mlg-front .mlg-weather__temp {
	font-size: 26px;
	font-weight: 700;
	line-height: 1;
}

.mlg-front .mlg-weather__meta {
	display: flex;
	flex-direction: column;
	font-size: 12.5px;
	color: var(--mlg-muted);
}

.mlg-front .mlg-weather__meta strong { color: var(--mlg-text); font-size: 13px; }

.mlg-front .mlg-trending__list {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.mlg-front .mlg-trending__list li {
	display: grid;
	grid-template-columns: 22px minmax(0, 1fr);
	gap: 8px;
	padding: 9px 0;
	border-top: 1px solid var(--mlg-border);
	margin: 0;
}

.mlg-front .mlg-trending__list li:first-child { border-top: 0; padding-top: 0; }

.mlg-front .mlg-trending__n {
	font-size: 14px;
	font-weight: 800;
	color: var(--mlg-accent);
	line-height: 1.35;
}

.mlg-front .mlg-trending__list a {
	color: var(--mlg-text);
	text-decoration: none;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.mlg-front .mlg-trending__list a:hover { color: var(--mlg-accent); }

/* mobile "Today" card: hidden until the rail is dropped */
.mlg-front .mlg-today { display: none; }

/* ---------- tablet: rail folds into the feed ---------- */
@media (max-width: 1199px) {
	.mlg-front .mlg-layout { grid-template-columns: minmax(0, 1fr); }
	.mlg-front .mlg-rail { display: none; }

	.mlg-front .mlg-today {
		display: grid;
		grid-column: span 12;
		gap: 14px;
	}

	.mlg-front .mlg-card--hero { grid-column: span 12; }
	.mlg-front .mlg-card--lead { grid-column: span 6; }
	.mlg-front .mlg-card--md { grid-column: span 6; }
	.mlg-front .mlg-smstack { grid-column: span 6; }
}

/* ---------- phone: single column, hero first ---------- */
@media (max-width: 767px) {
	.mlg-front { padding-top: 4px; }
	.mlg-front .mlg-feed { gap: 16px; }

	.mlg-front .mlg-card--hero,
	.mlg-front .mlg-card--lead,
	.mlg-front .mlg-card--md,
	.mlg-front .mlg-smstack,
	.mlg-front .mlg-today { grid-column: span 12; }

	.mlg-front .mlg-card--hero .mlg-card__media { aspect-ratio: 16 / 9; }

	.mlg-front .mlg-card--hero .mlg-card__title { font-size: 19px; }

	.mlg-front .mlg-card--hero .mlg-card__body { padding: 34px 14px 14px; }

	.mlg-front .mlg-card--sm { grid-template-columns: 104px minmax(0, 1fr); }
	.mlg-front .mlg-card--sm .mlg-card__media { width: 104px; }

	.mlg-front .mlg-chips { margin-bottom: 16px; }
}

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	.mlg-front .mlg-card,
	.mlg-front .mlg-chips a { transition: none; }
	.mlg-front .mlg-card:hover { transform: none; }
}
