/*
 * Guide directory (the Resources & Guides page and category archives)
 *
 * A Query Loop of posts (`kindling-guide-directory`) with the Core Features
 * Term Filter and Load More blocks, and the Featured Guide Card pattern as its
 * template:
 *
 *   - three cards a row, two on tablets (600 to 1023px), one on phones,
 *     like the Places Directory
 *   - cards lifted slightly with the design's card shadow
 *   - results fade while a filter or Load More is fetching
 *
 * @package Kindling
 * @since Kindling 4.1.0
 */

.kindling-guide-directory {
	.wp-block-post-template {
		transition: opacity 0.2s ease-out;

		> li {
			display: flex;
			margin: 0;

			> * {
				flex: 1;
				box-shadow:
					0 4px 8px -2px rgba(16, 24, 40, 0.1),
					0 2px 4px -2px rgba(16, 24, 40, 0.06);
			}
		}

		@media (min-width: 600px) and (max-width: 1023px) {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}

		@media (max-width: 599px) {
			grid-template-columns: minmax(0, 1fr);
		}

		@media (prefers-reduced-motion: reduce) {
			transition: none;
		}
	}

	&.is-loading .wp-block-post-template {
		opacity: 0.5;
	}
}

/*
 * Category archive (the "Category" template)
 *
 * The same card grid, from the archive's own query, plus:
 *
 *   kindling-category-nav   "Filter by:" and a Categories block (core), styled
 *                           like the Term Filter: outlined links, the current
 *                           category (current-cat) solid Navy
 *   pagination              core Query Pagination as square outlined links,
 *                           the current page solid Navy
 */

.kindling-category-nav {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--wp--custom--spacing--12) var(--wp--custom--spacing--24);

	> p {
		margin: 0;
		color: var(--wp--custom--color--text--heading);
		font-size: var(--wp--preset--font-size--small);
		font-weight: 600;
		letter-spacing: 0.14em;
		line-height: 1.4;
		text-transform: uppercase;
	}

	.wp-block-categories-list {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: var(--wp--custom--spacing--12) var(--wp--custom--spacing--24);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.wp-block-categories-list > li {
		margin: 0;
	}

	.wp-block-categories-list a {
		display: inline-flex;
		align-items: center;
		min-height: 2.375rem;
		padding: var(--wp--custom--spacing--8) var(--wp--custom--spacing--12);
		color: var(--wp--custom--color--text--heading);
		background-color: transparent;
		border: 1px solid var(--wp--custom--color--text--heading);
		font-size: var(--wp--preset--font-size--body-small);
		font-weight: 600;
		line-height: 1.3;
		text-decoration: none;
		white-space: nowrap;
		transition:
			background-color 0.2s ease-out,
			color 0.2s ease-out;

		&:hover {
			background-color: color-mix(in srgb, var(--wp--custom--color--text--heading) 10%, transparent);
		}

		@media (prefers-reduced-motion: reduce) {
			transition: none;
		}
	}

	.wp-block-categories-list .current-cat > a {
		color: var(--wp--preset--color--theme-01);
		background-color: var(--wp--custom--color--text--heading);
	}

	@media (max-width: 599px) {
		flex-direction: column;

		.wp-block-categories-list {
			gap: var(--wp--custom--spacing--8);
		}
	}
}

.kindling-guide-directory .wp-block-query-pagination {
	gap: var(--wp--custom--spacing--8);
	margin-block-start: var(--wp--preset--spacing--60);
	font-size: var(--wp--preset--font-size--body-small);
	font-weight: 600;

	:is(.page-numbers, .wp-block-query-pagination-previous, .wp-block-query-pagination-next) {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-width: 2.5rem;
		min-height: 2.5rem;
		margin: 0;
		padding: var(--wp--custom--spacing--8) var(--wp--custom--spacing--12);
		color: var(--wp--custom--color--text--heading);
		border: 1px solid var(--wp--custom--color--text--heading);
		text-decoration: none;
	}

	:is(a.page-numbers, .wp-block-query-pagination-previous, .wp-block-query-pagination-next):hover {
		background-color: color-mix(in srgb, var(--wp--custom--color--text--heading) 10%, transparent);
	}

	.page-numbers.current {
		color: var(--wp--preset--color--theme-01);
		background-color: var(--wp--custom--color--text--heading);
	}

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

	.wp-block-query-pagination-numbers {
		display: flex;
		gap: var(--wp--custom--spacing--8);
	}
}
