/* Listing Manager — homepage (templates/front-page.php). Loads after tiles.css, front page only.
   Colours come from the tokens in global.css, so dark and light both follow. The slide and promo
   text sits on a fixed dark overlay and is white in either theme. */

/* ------------------------------------------------------------------
 * Carousel
 * ------------------------------------------------------------------ */

.lm-carousel-section {
	padding-top: 20px;
}

.lm-carousel {
	position: relative;
}

.lm-carousel-track {
	position: relative;
	display: flex;
	gap: 16px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	border-radius: 14px;
}

.lm-carousel-track::-webkit-scrollbar {
	display: none;
}

.lm-slide {
	position: relative;
	flex: 0 0 66%;
	height: 280px;
	overflow: hidden;
	isolation: isolate;
	scroll-snap-align: start;
	background: #082032;
	border-radius: 14px;
	color: #fff;
	text-decoration: none;
}

.lm-slide:hover,
.lm-slide:focus {
	color: #fff;
}

/* The track clips anything outside it, so the focus ring goes inside the slide. */
.lm-slide:focus-visible {
	outline-offset: -4px;
}

.lm-slide .lm-banner {
	position: absolute;
	inset: 0;
	z-index: -2;
	aspect-ratio: auto;
}

/* A listing with no screenshot gets the plain panel: its icon is already in the copy row. */
.lm-slide .lm-banner.is-icon img {
	display: none;
}

.lm-slide::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient( 0deg, rgba( 3, 19, 32, 0.93 ) 0%, rgba( 3, 19, 32, 0.6 ) 45%, rgba( 3, 19, 32, 0 ) 85% );
}

.lm-slide-copy {
	position: absolute;
	right: 24px;
	bottom: 22px;
	left: 24px;
	display: flex;
	align-items: center;
	gap: 14px;
}

.lm-slide-icon {
	flex: none;
	width: 56px;
	height: 56px;
	border-radius: 12px;
	object-fit: cover;
}

.lm-slide-text {
	display: block;
	min-width: 0;
}

.lm-slide-title {
	display: block;
	font-size: 26px;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
}

.lm-slide-desc {
	display: -webkit-box;
	max-width: 520px;
	margin-top: 4px;
	overflow: hidden;
	font-size: 14px;
	line-height: 1.4;
	color: #d6e4f2;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.lm-carousel-arrow {
	position: absolute;
	top: calc( 50% - 22px );
	z-index: 2;
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	color: #fff;
	cursor: pointer;
	background: rgba( 7, 24, 39, 0.82 );
	border: 1px solid rgba( 113, 141, 162, 0.7 );
	border-radius: 50%;
}

.lm-carousel-arrow:hover:not( :disabled ) {
	background: rgba( 7, 24, 39, 0.95 );
	border-color: #fff;
}

.lm-carousel-arrow:disabled {
	cursor: default;
	opacity: 0.35;
}

.lm-carousel-arrow svg {
	width: 22px;
	height: 22px;
}

.lm-carousel-prev {
	left: 12px;
}

.lm-carousel-next {
	right: 12px;
}

/* Dots: drawn small, but each button is a 44px square. */
.lm-carousel-dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
}

.lm-carousel-dots button {
	position: relative;
	width: var( --lm-tap );
	height: var( --lm-tap );
	padding: 0;
	cursor: pointer;
	background: none;
	border: 0;
}

.lm-carousel-dots button::before {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 8px;
	height: 8px;
	background: transparent;
	border: 2px solid var( --lm-muted );
	border-radius: 4px;
	transform: translate( -50%, -50% );
	transition: width 0.18s;
}

.lm-carousel-dots button[aria-current='true']::before {
	width: 22px;
	background: var( --lm-blue );
	border-color: var( --lm-blue );
}

/* ------------------------------------------------------------------
 * Quick-pick circles
 * ------------------------------------------------------------------ */

.lm-quick {
	display: flex;
	gap: 12px;
	margin: 0 -8px;
	padding: 8px;
	overflow-x: auto;
	scrollbar-width: none;
}

.lm-quick::-webkit-scrollbar {
	display: none;
}

/* Centred when they all fit, scrollable from the left when they do not. */
.lm-quick-item:first-child {
	margin-left: auto;
}

.lm-quick-item:last-child {
	margin-right: auto;
}

.lm-quick-item {
	flex: 0 0 76px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	min-height: var( --lm-tap );
	color: var( --lm-ink );
	text-decoration: none;
}

.lm-quick-item:hover {
	color: var( --lm-link );
}

.lm-quick-icon {
	display: block;
	width: 60px;
	height: 60px;
	padding: 3px;
	background: var( --lm-panel );
	border: 2px solid var( --lm-blue );
	border-radius: 50%;
}

.lm-quick-icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.lm-quick-name {
	display: -webkit-box;
	overflow: hidden;
	max-width: 76px;
	font-size: 12px;
	line-height: 1.3;
	text-align: center;
	overflow-wrap: anywhere;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ------------------------------------------------------------------
 * Games worth exploring: banner teasers
 * ------------------------------------------------------------------ */

.lm-teasers {
	display: grid;
	grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	gap: 16px;
}

.lm-teaser {
	display: block;
	min-width: 0;
	overflow: hidden;
	color: var( --lm-ink );
	text-decoration: none;
	background: var( --lm-panel );
	border: 1px solid var( --lm-line );
	border-radius: 12px;
}

.lm-teaser:hover {
	color: var( --lm-ink );
	border-color: var( --lm-blue );
}

.lm-teaser-body {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px;
}

.lm-teaser-body img {
	flex: none;
	width: 40px;
	height: 40px;
	object-fit: cover;
	border-radius: 10px;
}

.lm-teaser-text {
	display: block;
	min-width: 0;
}

.lm-teaser-title {
	display: block;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.lm-teaser-desc {
	display: -webkit-box;
	margin-top: 2px;
	overflow: hidden;
	font-size: 13px;
	line-height: 1.35;
	color: var( --lm-muted );
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* ------------------------------------------------------------------
 * Newest desktop listing
 * ------------------------------------------------------------------ */

.lm-promo {
	position: relative;
	display: flex;
	align-items: center;
	min-height: 130px;
	overflow: hidden;
	isolation: isolate;
	background: #07172c;
	border: 1px solid #38467c;
	border-radius: 14px;
	color: #fff;
	text-decoration: none;
}

.lm-promo:hover {
	color: #fff;
	border-color: var( --lm-blue );
}

.lm-promo .lm-banner {
	position: absolute;
	inset: 0;
	z-index: -2;
	aspect-ratio: auto;
}

/* The icon is already shown beside the text; the plain-panel fallback does not repeat it. */
.lm-promo .lm-banner.is-icon img {
	display: none;
}

.lm-promo::after {
	content: '';
	position: absolute;
	inset: 0;
	z-index: -1;
	background: linear-gradient( 90deg, rgba( 7, 23, 44, 0.95 ) 0%, rgba( 7, 23, 44, 0.8 ) 45%, rgba( 7, 23, 44, 0.12 ) 100% );
}

.lm-promo-copy {
	display: flex;
	align-items: center;
	gap: 20px;
	width: 100%;
	padding: 24px;
}

.lm-promo-icon {
	flex: none;
	width: 78px;
	height: 78px;
	object-fit: cover;
	border-radius: 15px;
}

.lm-promo-text {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.lm-promo-kicker {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #7fd0ff;
}

.lm-promo-title {
	font-size: 25px;
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
	overflow-wrap: anywhere;
}

.lm-promo-desc {
	display: -webkit-box;
	max-width: 620px;
	overflow: hidden;
	font-size: 14px;
	line-height: 1.45;
	color: #d0deec;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.lm-promo-os {
	font-size: 12px;
	color: #b4cbe2;
}

.lm-promo-go {
	flex: none;
	margin-left: auto;
	font-size: 34px;
	line-height: 1;
}

/* ------------------------------------------------------------------
 * Narrower screens
 * ------------------------------------------------------------------ */

@media ( max-width: 1050px ) {
	.lm-slide {
		height: 250px;
	}
}

@media ( max-width: 900px ) {

	.lm-teasers {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

@media ( max-width: 768px ) {
	.lm-carousel-section {
		padding-top: 12px;
	}

	/* Swipe on a phone; the dots stay. */
	.lm-carousel-arrow {
		display: none;
	}

	/* 8 hit areas of 44px need 352px; overlap them by 4px so they also fit on a 360px phone. */
	.lm-carousel-dots button {
		margin: 0 -2px;
	}

	.lm-carousel-track {
		gap: 12px;
		border-radius: 10px;
	}

	.lm-slide {
		flex-basis: 90%;
		height: 176px;
		border-radius: 10px;
	}

	.lm-slide-copy {
		right: 14px;
		bottom: 14px;
		left: 14px;
		gap: 10px;
	}

	.lm-slide-icon {
		width: 44px;
		height: 44px;
		border-radius: 10px;
	}

	.lm-slide-title {
		font-size: 19px;
	}

	.lm-slide-desc {
		margin-top: 2px;
		font-size: 12px;
		-webkit-line-clamp: 1;
	}

	.lm-teasers {
		gap: 12px;
	}

	.lm-teaser-body {
		gap: 8px;
		padding: 10px;
	}

	.lm-teaser-body img {
		width: 36px;
		height: 36px;
	}

	.lm-teaser-title {
		font-size: 13px;
	}

	.lm-teaser-desc {
		font-size: 12px;
	}

	.lm-promo::after {
		background: rgba( 7, 23, 44, 0.9 );
	}

	.lm-promo-copy {
		gap: 12px;
		padding: 16px;
	}

	.lm-promo-icon {
		width: 56px;
		height: 56px;
		border-radius: 12px;
	}

	.lm-promo-title {
		font-size: 19px;
	}

	.lm-promo-go {
		font-size: 28px;
	}

}
