/* Listing Manager — shared tiles (front page, archives, /categories/, 404)
   Page wrapper, section heads, app tiles and the category grid. Colours come from the tokens in global.css. */

.lm-home-wrap {
	max-width: var( --lm-max );
	margin: 0 auto;
	padding-right: var( --lm-gutter );
	padding-left: var( --lm-gutter );
}

/* ------------------------------------------------------------------
 * Shelves: heading, then a row of 8 tiles
 * ------------------------------------------------------------------ */

.lm-shelf {
	padding-top: 16px;
	padding-bottom: 20px;
}

.lm-shelf-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 14px;
}

.lm-shelf-head h2 {
	margin: 0;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
	color: var( --lm-ink );
}

.lm-shelf-more {
	display: inline-flex;
	align-items: center;
	flex: none;
	gap: 4px;
	min-height: var( --lm-tap );
	padding: 0 4px;
	font-size: 14px;
	font-weight: 600;
	color: var( --lm-link );
	text-decoration: none;
}

.lm-shelf-more:hover {
	color: var( --lm-link );
	text-decoration: underline;
}

.lm-tile-grid {
	display: grid;
	grid-template-columns: repeat( 8, minmax( 0, 1fr ) );
	gap: 20px 16px;
}

.lm-tile {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	color: var( --lm-ink );
	text-align: center;
	text-decoration: none;
}

.lm-tile:hover {
	color: var( --lm-ink );
}

.lm-tile-icon {
	display: block;
	width: 100%;
	max-width: 88px;
	margin-bottom: 8px;
	overflow: hidden;
	aspect-ratio: 1;
	background: var( --lm-panel2 );
	border-radius: 18px;
	transition: transform 0.18s;
}

.lm-tile:hover .lm-tile-icon {
	transform: translateY( -4px );
}

.lm-tile-icon img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.lm-tile-name,
.lm-tile-meta {
	display: -webkit-box;
	max-width: 100%;
	overflow: hidden;
	overflow-wrap: anywhere;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.lm-tile-name {
	font-size: 13px;
	font-weight: 700;
	line-height: 1.3;
}

.lm-tile-meta {
	margin-top: 2px;
	font-size: 12px;
	line-height: 1.3;
	color: var( --lm-muted );
}

/* ------------------------------------------------------------------
 * Category grid
 * ------------------------------------------------------------------ */

.lm-cat-grid {
	display: grid;
	grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	gap: 12px;
}

.lm-cat {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-width: 0;
	min-height: 64px;
	padding: 12px 16px;
	color: var( --lm-ink );
	text-decoration: none;
	background: var( --lm-panel );
	border: 1px solid var( --lm-line );
	border-radius: 12px;
}

.lm-cat:hover {
	color: var( --lm-ink );
	border-color: var( --lm-blue );
}

.lm-cat-name {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.lm-cat-count {
	margin-top: 2px;
	font-size: 12px;
	color: var( --lm-muted );
}

@media ( max-width: 900px ) {
	.lm-tile-grid {
		grid-template-columns: repeat( 4, minmax( 0, 1fr ) );
	}

	.lm-cat-grid {
		grid-template-columns: repeat( 2, minmax( 0, 1fr ) );
	}
}

@media ( max-width: 768px ) {
	.lm-shelf {
		padding-top: 8px;
		padding-bottom: 12px;
	}

	.lm-shelf-head h2 {
		font-size: 19px;
	}

	.lm-tile-grid {
		gap: 16px 8px;
	}

	.lm-tile-icon {
		max-width: 64px;
		border-radius: 14px;
	}

	.lm-tile-name {
		font-size: 12px;
	}

	.lm-cat-grid {
		gap: 10px;
	}

	.lm-cat {
		padding: 12px;
	}
}
