/**
 * guide-loops.css — related-guide sections + the /guides/ index grid.
 *
 * Loaded where guide loops render: the homepage, vehicle make/model hubs,
 * category hubs, product pages, single guides (related block), and the
 * /guides/ posts page + guide archives (see inc/enqueue.php). Reuses the
 * homepage section shell tokens (.mxo-section / .mxo-section__header /
 * .mxo-section__title / .mxo-view-all) so guide sections read as a native
 * part of the page they sit on. Kept lean; zero external HTTP.
 */

/* ── Section shell ──────────────────────────────────────────────── */
/* Mirrors homepage .mxo-section--products so the block matches wherever it
   lands. Homepage already ships those shell rules via homepage.css; the rules
   here re-declare them so the section is styled on hubs/PDPs/archives too. */
.mxo-guides {
	background: var(--background);
	padding-block: 3rem;
}

@media (min-width: 1024px) {
	.mxo-guides { padding-block: 4rem; }
}

.mxo-guides .mxo-section__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
}

.mxo-guides .mxo-section__title {
	font-family: var(--font-display);
	font-size: 1.5rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.025em;
	color: var(--foreground);
	margin: 0;
}

@media (min-width: 768px) {
	.mxo-guides .mxo-section__title { font-size: 1.875rem; }
}

.mxo-guides .mxo-view-all {
	display: none;
	align-items: center;
	gap: 0.25rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: var(--primary);
	text-decoration: none;
	padding: 0.5rem 0.75rem;
	border-radius: var(--radius);
	white-space: nowrap;
	transition: color 200ms, background 200ms;
}

.mxo-guides .mxo-view-all:hover {
	color: var(--accent);
	background: oklch(0.65 0.2 35 / 0.08);
}

.mxo-guides .mxo-view-all svg { flex-shrink: 0; }

@media (min-width: 768px) {
	.mxo-guides .mxo-view-all { display: inline-flex; }
}

/* ── Card grid ──────────────────────────────────────────────────── */
.mxo-guides__grid,
.mxo-guide-index__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.5rem;
	margin-top: 2rem;
}

@media (min-width: 640px) {
	.mxo-guides__grid,
	.mxo-guide-index__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.mxo-guides__grid,
	.mxo-guide-index__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* The /guides/ index grid gets its own top margin from the intro header. */
.mxo-guide-index__grid { margin-top: 0; }

/* ── Guide card ─────────────────────────────────────────────────── */
.mxo-guide-card {
	display: flex;
	flex-direction: column;
	background: var(--card);
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}

.mxo-guide-card:hover {
	border-color: color-mix(in srgb, var(--primary) 50%, transparent);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
}

.mxo-guide-card__image-link {
	display: block;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--muted);
}

.mxo-guide-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 300ms ease;
}

.mxo-guide-card:hover .mxo-guide-card__image { transform: scale(1.03); }

.mxo-guide-card__image--placeholder {
	background: linear-gradient(135deg, var(--muted), var(--secondary));
}

.mxo-guide-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 1.25rem;
	flex: 1 1 auto;
}

.mxo-guide-card__chip {
	align-self: flex-start;
	font-family: var(--font-display);
	font-size: 0.6875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--primary-on-tint);
	background: oklch(0.65 0.2 35 / 0.1);
	padding: 0.2rem 0.55rem;
	border-radius: 9999px;
}

.mxo-guide-card__title {
	font-family: var(--font-display);
	font-size: 1.125rem;
	line-height: 1.25;
	margin: 0;
}

.mxo-guide-card__title a {
	color: var(--foreground);
	text-decoration: none;
}

.mxo-guide-card__title a:hover { color: var(--primary); }

.mxo-guide-card__excerpt {
	margin: 0;
	font-size: 0.9375rem;
	line-height: 1.55;
	color: var(--muted-foreground);
}

.mxo-guide-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
	margin-top: auto;
	padding-top: 0.35rem;
	font-size: 0.8125rem;
	color: var(--muted-foreground);
}

.mxo-guide-card__meta > *:not(:last-child)::after {
	content: "\00B7";
	margin-left: 0.5rem;
	opacity: 0.6;
}

/* ── /guides/ index intro header ────────────────────────────────── */
.mxo-guide-index {
	padding-block: 2.5rem 3.5rem;
}

.mxo-guide-index__header {
	max-width: 42rem;
	margin: 0 0 2rem;
}

.mxo-guide-index__title {
	font-family: var(--font-display);
	font-size: clamp(1.9rem, 4vw, 2.75rem);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: -0.01em;
	line-height: 1.1;
	margin: 0 0 0.75rem;
	color: var(--foreground);
}

.mxo-guide-index__intro {
	font-size: 1.0625rem;
	line-height: 1.6;
	color: var(--muted-foreground);
	margin: 0;
}

.mxo-guide-index__empty {
	color: var(--muted-foreground);
	font-size: 1rem;
}

/* Pagination — styles both the_posts_pagination() (.nav-links) and the
   paginate_links() output used by the page.php shim (.page-numbers direct). */
.mxo-guide-index__pagination {
	margin-top: 2.5rem;
}

.mxo-guide-index__pagination .nav-links,
.mxo-guide-index__pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	justify-content: center;
}

.mxo-guide-index__pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	color: var(--foreground);
	text-decoration: none;
	font-size: 0.9375rem;
	line-height: 1;
	transition: border-color 200ms, background 200ms, color 200ms;
}

.mxo-guide-index__pagination a.page-numbers:hover {
	border-color: var(--primary);
	color: var(--primary);
}

.mxo-guide-index__pagination .page-numbers.current {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}

.mxo-guide-index__pagination .page-numbers.dots {
	border-color: transparent;
}

/* ── Guides category filter bar (no-JS chips) ───────────────────── */
.mxo-guide-filter {
	margin: 0 0 2rem;
}

.mxo-guide-filter__list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.mxo-guide-filter__chip {
	display: inline-flex;
	align-items: center;
	padding: 0.4rem 0.9rem;
	border: 1px solid var(--border);
	border-radius: 9999px;
	font-family: var(--font-display);
	font-size: 0.8125rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--foreground);
	background: var(--card);
	text-decoration: none;
	transition: border-color 200ms, background 200ms, color 200ms;
}

.mxo-guide-filter__chip:hover {
	border-color: var(--primary);
	color: var(--primary);
}

.mxo-guide-filter__chip.is-active {
	background: var(--primary);
	border-color: var(--primary);
	color: #fff;
}
