/*
 * Brands: archive header and the [lm_brands] tile grid.
 *
 * Built entirely on the theme's design tokens, so a brand tile keeps step with
 * the theme's category tiles as it evolves. No hard-coded brand colours.
 *
 * Specificity note: the shortcode is normally dropped into a page whose content
 * is wrapped in `.prose`, and the theme styles `.prose ul` as a vertical flex
 * list — one class plus one element, which outranks a single utility class.
 * Every layout rule below is therefore written as `.lm-brands ul.lm-brands__grid`
 * (two classes plus an element) so it wins on specificity rather than with
 * !important.
 */

/* --- Brand archive header ------------------------------------------------ */

.lm-brand-head {
	display: flex;
	align-items: center;
	gap: clamp(1rem, 3vw, 2rem);
	margin-bottom: 1.5rem;
}

.lm-brand-head__logo {
	flex: 0 0 auto;
	width: clamp(88px, 14vw, 132px);
	aspect-ratio: 1 / 1;
	display: grid;
	place-items: center;
	padding: .75rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: var(--white);
	overflow: hidden;
}

.lm-brand-head__logo-img {
	max-width: 100%;
	height: auto;
	object-fit: contain;
}

.lm-brand-head__text {
	display: flex;
	flex-direction: column;
	gap: .35rem;
	min-width: 0;
}

.lm-brand-head__eyebrow {
	color: var(--red-deep);
}

.lm-brand-head .shop__title {
	margin: 0;
	overflow-wrap: anywhere;
}

.lm-brand-intro {
	margin-top: 0;
}

/* --- [lm_brands] grid ---------------------------------------------------- */

.lm-brands ul.lm-brands__grid {
	display: grid;
	/* auto-fill rather than a fixed column count: the shortcode is dropped into
	   pages of very different widths (the .prose column is ~74ch), and a tile
	   narrower than ~13rem starts breaking brand names mid-word. */
	grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
	gap: 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.lm-brands ul.lm-brands__grid > li.lm-brand-card {
	display: block;
	padding: 0;
	margin: 0;
	overflow: hidden;
	list-style: none;
}

/* The theme decorates every .prose list item with a red bullet and an indent;
   a tile is not a bullet point. */
.lm-brands ul.lm-brands__grid > li.lm-brand-card::before {
	content: none;
}

.lm-brands ul.lm-brands__grid .lm-brand-card__link {
	display: flex;
	align-items: center;
	gap: .9rem;
	padding: 1.15rem;
	color: inherit;
	text-decoration: none;
	height: 100%;
}

.lm-brand-card__media {
	flex: 0 0 auto;
	width: 54px;
	height: 54px;
	display: grid;
	place-items: center;
	border-radius: 14px;
	background: var(--white);
	overflow: hidden;
}

.lm-brand-card__media img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.lm-brand-card__mark {
	width: 100%;
	height: 100%;
	display: grid;
	place-items: center;
	border-radius: 14px;
	background: rgba(238, 58, 41, .1);
	color: var(--red-deep);
	font-family: var(--font-display);
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1;
	transition: background .35s var(--ease), color .35s var(--ease);
}

.lm-brand-card:hover .lm-brand-card__mark {
	background: var(--red);
	color: var(--white);
}

.lm-brand-card__body {
	display: flex;
	flex-direction: column;
	gap: .2rem;
	min-width: 0;
}

.lm-brands ul.lm-brands__grid .cat-card__title {
	font-size: 1.02rem;
	line-height: 1.3;
	overflow-wrap: break-word;
}

.lm-brands__empty {
	color: var(--muted);
}

@media (max-width: 900px) {
	.lm-brand-head {
		gap: 1rem;
	}
}

@media (max-width: 520px) {
	.lm-brands ul.lm-brands__grid {
		grid-template-columns: 1fr 1fr;
		gap: .75rem;
	}

	.lm-brands ul.lm-brands__grid .lm-brand-card__link {
		flex-direction: column;
		align-items: flex-start;
		gap: .6rem;
		padding: .95rem;
	}

	.lm-brand-head {
		flex-direction: column;
		align-items: flex-start;
	}
}
