/*
 * Taxonomy Archive — Category / Tag / Date / Author.
 *
 * Layout: centered editorial header (Compact spacing) → 3-col live post grid
 *   (Normal spacing) → pagination. Post cards reuse .wpdl-blog-post-card
 *   from blog-archive.css — no card styles redefined here.
 *
 * core/query-title outputs the prefix ("Category:", "Tag:") as a span;
 *   CSS splits it into a kicker style above the term name.
 *
 * Tokens read (same set as blog-archive):
 *   semantic.color.text.primary   — term title, card titles
 *   semantic.color.text.secondary — term description
 *   semantic.color.text.muted     — card meta, pagination inactive
 *   semantic.color.text.brand     — kicker prefix, pagination active
 *   semantic.color.border.base    — divider between header and grid
 *   semantic.color.bg.base        — section backgrounds
 *   semantic.typography.display   — term title (Cormorant)
 *   semantic.typography.body      — prefix/kicker, description, meta (Jost)
 *   space.3 – 8
 *   color.terracotta / green / neutral — card placeholder backgrounds
 *   duration.base  easing.default
 */

/* stylelint-disable no-descending-specificity -- query-title prefix and
   grid card nth-child rules must follow base selectors by design. */

/* ── Archive header ───────────────────────────────────────────────── */
.wpdl-taxonomy-archive__header {
	text-align: center;
	border-block-end: 0.0625rem solid var(--wp--custom--semantic--color--border--base);
}

/* Term title — Cormorant display, fluid */
.wpdl-taxonomy-archive__title {
	font-family: var(--wp--custom--semantic--typography--display--font-family);
	font-size: clamp(1.3125rem, 1rem + 1.7vw, 2.5rem); /* 21 → 40px */
	font-weight: 500;
	line-height: 1.15;
	color: var(--wp--custom--semantic--color--text--primary);
	margin-block: 0;
}

/*
 * The prefix ("Category:", "Tag:", "Date:") rendered as a kicker above the
 * term name. core/query-title with showPrefix:true wraps the prefix in a
 * span inside the heading — we convert it to block display + kicker type.
 */
.wpdl-taxonomy-archive__title .wp-block-query-title__prefix {
	display: block;
	font-family: var(--wp--custom--semantic--typography--body--font-family);
	font-size: 0.75rem; /* 12px */
	font-weight: 400;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	color: var(--wp--custom--semantic--color--brand--primary);
	margin-block-end: var(--wp--custom--space--3);

	/* Strip the trailing colon that WP appends */
	font-style: normal;
}

/* Hide colon appended by WP to prefix (e.g. "Category:") */
.wpdl-taxonomy-archive__title .wp-block-query-title__prefix::after {
	content: "";
}

/* Term description — muted body copy, max readable width */
.wpdl-taxonomy-archive__description {
	font-family: var(--wp--custom--semantic--typography--body--font-family);
	font-size: 0.875rem;
	font-weight: 300;
	line-height: 1.7;
	color: var(--wp--custom--semantic--color--text--secondary);
	max-inline-size: 42rem;
	margin-inline: auto;
	margin-block: var(--wp--custom--space--4) 0;
}

/* Hide term-description block entirely when empty (WP renders empty div) */
.wpdl-taxonomy-archive__description:empty {
	display: none;
}

/* ── Grid section ─────────────────────────────────────────────────── */

/* 3-col card grid — matches blog-archive layout */
.wpdl-taxonomy-archive__grid.wp-block-post-template {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--wp--custom--space--8); /* ~40px */
	margin-block: 0;
	list-style: none;
	padding: 0;
}

/* Card placeholder backgrounds (same palette as blog-archive) */
.wpdl-taxonomy-archive__grid > li:nth-child(1) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--accent--primary); }
.wpdl-taxonomy-archive__grid > li:nth-child(2) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--brand--primary); }
.wpdl-taxonomy-archive__grid > li:nth-child(3) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--text--muted); }
.wpdl-taxonomy-archive__grid > li:nth-child(4) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--brand--soft); }
.wpdl-taxonomy-archive__grid > li:nth-child(5) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--accent--primary); }
.wpdl-taxonomy-archive__grid > li:nth-child(6) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--border--subtle); }

/* Repeat cycle for 7–9 */
.wpdl-taxonomy-archive__grid > li:nth-child(7) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--accent--primary); }
.wpdl-taxonomy-archive__grid > li:nth-child(8) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--brand--primary); }
.wpdl-taxonomy-archive__grid > li:nth-child(9) .wpdl-blog-post-card__img { background-color: var(--wp--custom--semantic--color--text--muted); }

/* Meta row: category + date on same line */
.wpdl-blog-post-card__meta-row.wp-block-group {
	gap: var(--wp--custom--space--3);
	align-items: center;
	margin-block: 0 var(--wp--custom--space--2);
}

/* "No posts" message */
.wpdl-taxonomy-archive__no-results {
	font-family: var(--wp--custom--semantic--typography--body--font-family);
	font-size: 0.875rem;
	color: var(--wp--custom--semantic--color--text--muted);
	text-align: center;
	padding-block: var(--wp--custom--space--8);
	margin-block: 0;
}

/* ── Pagination ───────────────────────────────────────────────────── */
.wpdl-taxonomy-archive__pagination {
	gap: var(--wp--custom--space--4);
	margin-block-start: var(--wp--custom--space--8);
}

.wpdl-taxonomy-archive__pagination a,
.wpdl-taxonomy-archive__pagination .page-numbers {
	font-family: var(--wp--custom--semantic--typography--body--font-family);
	font-size: 0.875rem;
	color: var(--wp--custom--semantic--color--text--muted);
	text-decoration: none;
	transition: color var(--wp--custom--duration--base) var(--wp--custom--easing--default);
}

.wpdl-taxonomy-archive__pagination a:hover {
	color: var(--wp--custom--semantic--color--text--primary);
}

.wpdl-taxonomy-archive__pagination .page-numbers.current {
	font-weight: 700;
	color: var(--wp--custom--semantic--color--text--primary);
	border-block-end: 0.0938rem solid var(--wp--custom--semantic--color--text--primary);
	padding-block-end: 0.125rem;
}

/* ── Tablet (< 48em / 768px) ──────────────────────────────────────── */
@media (width < 48em) {
	.wpdl-taxonomy-archive__grid.wp-block-post-template {
		grid-template-columns: repeat(2, 1fr);
		gap: var(--wp--custom--space--6);
	}
}

/* ── Mobile (< 30em / 480px) ──────────────────────────────────────── */
@media (width < 30em) {
	.wpdl-taxonomy-archive__grid.wp-block-post-template {
		grid-template-columns: 1fr;
		gap: var(--wp--custom--space--5);
	}

	.wpdl-taxonomy-archive__title {
		text-align: start;
	}

	.wpdl-taxonomy-archive__description {
		text-align: start;
	}
}
