/**
 * Category archive — custom layout stylesheet.
 *
 * Enqueued only when the current category has `use_custom_layout = true`
 * (see upcomer_category_archive_styles() in functions.php). Standard archive
 * categories are unaffected.
 *
 * Tokens reuse the gamurs top-nav container so the page lines up with the
 * site nav at every breakpoint; colours reuse the existing site palette
 * (no new tokens). Where we need a feed-row article-card or a most-read
 * list, this file repeats the rules locally rather than depending on
 * tabbed-article-feed/style.css — keeps the category surface independent
 * of any future block CSS churn.
 */

.category-archive {
	/* Local palette — pulled from the existing theme tokens used by every
	   light surface (text-section, article-card-grid, tabbed-article-feed in
	   its light mode). */
	--ca-fg:          var(--wp--custom--light--general-color--h-1, #171717);
	--ca-fg-body:     var(--wp--custom--light--general-color--paragraph, #494949);
	--ca-fg-muted:    var(--wp--custom--light--general-color--caption, #5D5D5D);
	--ca-rule:        rgba(15, 15, 15, 0.12);
	--ca-rule-strong: rgba(15, 15, 15, 0.22);
	--ca-thumb-bg:    rgba(15, 15, 15, 0.06);
	--ca-chip-bg:     var(--wp--custom--light--general-color-bg--minimal, #FEFEFE);

	color: var(--ca-fg-body);
	background: var(--ca-chip-bg);
	padding-block: clamp(1.25rem, 2.5vw, 2rem) clamp(2.5rem, 5vw, 4rem);
}

.category-archive *,
.category-archive *::before,
.category-archive *::after {
	box-sizing: border-box;
}

/* Container — same width tokens the gamurs top-nav uses, so the archive
   lines up with the nav at every breakpoint. */
.category-archive__inner {
	max-width: calc(1px * var(--wp--custom--top-nav--primary-container-spacing--desktop--max-width, 1200));
	margin-inline: auto;
	padding-inline: clamp(1rem, 3vw, 1.5rem);
}

@media (max-width: 1247px) {
	.category-archive__inner {
		max-width: calc(1px * var(--wp--custom--top-nav--primary-container-spacing--laptop--max-width, 1200));
	}
}

@media (max-width: 943px) {
	.category-archive__inner {
		max-width: unset;
		padding-inline: clamp(0.75rem, 3vw, 1.25rem);
	}
}

/* ---- Header (h1 + lede) --------------------------------------------- */
/* Breadcrumb styling is shared — see assets/css/breadcrumb.css (.upcomer-breadcrumb). */

.category-archive__header {
	margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.category-archive__title {
	margin: clamp(0.5rem, 1vw, 0.75rem) 0 clamp(0.5rem, 1vw, 0.75rem);
	font-family: "Barlow Condensed", "Barlow", sans-serif;
	font-weight: 800;
	font-size: clamp(1.875rem, 4vw, 3rem);
	line-height: 1.05;
	letter-spacing: -0.01em;
	color: var(--ca-fg);
}

.category-archive__lede {
	max-width: 65ch;
	font-family: "Barlow", sans-serif;
	font-weight: 400;
	font-size: clamp(0.9375rem, 1.2vw, 1.0625rem);
	line-height: 1.55;
	color: var(--ca-fg-body);
}

.category-archive__lede > * {
	margin: 0 0 0.75rem;
}

.category-archive__lede > *:last-child {
	margin-bottom: 0;
}

/* ---- Section spacing ------------------------------------------------- */

/* Rendered blocks (featured-news-hero, guide-card-grid, text-section) carry
   their own padding-block — this just adds the inter-section rhythm on the
   archive canvas. */
.category-archive .upcomer-block + .category-archive__main,
.category-archive__header + .category-archive__main {
	margin-top: clamp(1.5rem, 3vw, 2.5rem);
}

.category-archive__main + .upcomer-block,
.category-archive .upcomer-block + .upcomer-block {
	margin-top: clamp(2rem, 4vw, 3rem);
}

/* Gutter is the archive's job, not the block's. Blocks that carry their own
   `padding-inline` for the full-width canvas (guide-card-grid, article-card-grid,
   hub-pages-grid) render *inside* .category-archive__inner here, which already
   supplies the inset — leaving both on would step their content in from the
   feed and hero. Same reasoning as
   `.upcomer-block--card-grid-row .upcomer-block--article-card-grid`. */
.category-archive .upcomer-block {
	padding-inline: 0;
}

/* Section eyebrow — shared by feed header and sidebar. */
.category-archive .section-eyebrow {
	margin: 0;
	font-family: "Barlow Condensed", "Barlow", sans-serif;
	font-weight: 800;
	font-size: clamp(0.9375rem, 1.4vw, 1.0625rem);
	line-height: 1.2;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ca-fg);
}

/* ---- Two-column main (feed + sidebar) ------------------------------- */

.category-archive__main {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 280px;
	gap: clamp(1.5rem, 3vw, 2.5rem);
	align-items: start;
}

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

/* ---- Feed column ---------------------------------------------------- */

.category-archive__feed {
	min-width: 0;
}

.category-archive__feed-header {
	display: flex;
	align-items: flex-end;
	min-height: 2.5rem;
	padding-bottom: 0.625rem;
	margin-bottom: clamp(0.75rem, 1.5vw, 1.25rem);
	border-bottom: 1px solid var(--ca-rule-strong);
}

.category-archive__feed-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}

.category-archive__feed-item {
	padding-block: clamp(0.875rem, 1.8vw, 1.25rem);
	border-bottom: 1px solid var(--ca-rule);
}

.category-archive__feed-item:last-child {
	border-bottom: 0;
}

.category-archive__empty {
	margin: 0;
	padding-block: clamp(1rem, 2vw, 1.5rem);
	font-family: "Barlow", sans-serif;
	color: var(--ca-fg-muted);
}

/* ---- Article-card feed-row variant — local rules -------------------- */

/* The article-card partial emits .article-card--feed-row; the visual rules
   below are scoped to .category-archive so we don't depend on any block
   stylesheet. */

.category-archive .article-card--feed-row {
	margin: 0;
}

.category-archive .article-card--feed-row .article-card__link {
	display: grid;
	grid-template-columns: clamp(5rem, 9vw, 7rem) minmax(0, 1fr);
	column-gap: clamp(0.875rem, 1.8vw, 1.25rem);
	color: inherit;
	text-decoration: none;
}

.category-archive .article-card--feed-row .article-card__media {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--ca-thumb-bg);
	overflow: hidden;
}

.category-archive .article-card--feed-row .article-card__media .article-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.category-archive .article-card--feed-row.article-card--no-image .article-card__link {
	grid-template-columns: minmax(0, 1fr);
}

.category-archive .article-card--feed-row .article-card__body {
	display: flex;
	flex-direction: column;
	gap: clamp(0.25rem, 0.6vw, 0.45rem);
	min-width: 0;
	align-self: center;
}

.category-archive .article-card--feed-row .article-card__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	font-family: "Barlow Condensed", "Barlow", sans-serif;
	font-weight: 700;
	font-size: clamp(1rem, 1.6vw, 1.25rem);
	line-height: 1.15;
	letter-spacing: -0.005em;
	color: var(--ca-fg);
	transition: color 150ms ease;
}

.category-archive .article-card--feed-row .article-card__link:hover .article-card__title,
.category-archive .article-card--feed-row .article-card__link:focus-visible .article-card__title {
	color: var(--ca-fg-body);
}

.category-archive .article-card--feed-row .article-card__excerpt {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	font-family: "Barlow", sans-serif;
	font-weight: 400;
	font-size: clamp(0.8125rem, 1.05vw, 0.9375rem);
	line-height: 1.4;
	color: var(--ca-fg-body);
}

.category-archive .article-card--feed-row .article-card__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.5rem;
	margin: 0;
	font-family: "Barlow", sans-serif;
	font-weight: 600;
	font-size: clamp(0.625rem, 0.85vw, 0.6875rem);
	line-height: 1.2;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ca-fg-muted);
}

.category-archive .article-card--feed-row .article-card__meta-sep {
	color: var(--ca-rule-strong);
	font-weight: 400;
}

@media (max-width: 640px) {
	.category-archive .article-card--feed-row .article-card__link {
		grid-template-columns: clamp(3.5rem, 22vw, 5rem) minmax(0, 1fr);
		column-gap: 0.75rem;
	}
}

/* ---- Sidebar (Most Read) -------------------------------------------- */

.category-archive__sidebar {
	min-width: 0;
}

.category-archive .feed-sidebar {
	margin: 0;
	padding: 0;
	min-width: 0;
}

.category-archive .feed-sidebar__header {
	display: flex;
	align-items: flex-end;
	min-height: 2.5rem;
	padding-bottom: 0.625rem;
	margin: 0 0 clamp(0.5rem, 1.2vw, 0.875rem);
	border-bottom: 1px solid var(--ca-rule-strong);
}

.category-archive .most-read {
	list-style: none;
	margin: 0;
	padding: 0;
	counter-reset: none;
}

.category-archive .most-read__row {
	display: grid;
	grid-template-columns: clamp(1.5rem, 2.8vw, 2.25rem) minmax(0, 1fr);
	column-gap: clamp(0.75rem, 1.6vw, 1.125rem);
	align-items: center;
	padding-block: clamp(0.5rem, 1vw, 0.75rem);
	border-bottom: 1px solid var(--ca-rule);
}

.category-archive .most-read__row:last-child {
	border-bottom: 0;
}

.category-archive .most-read__rank {
	display: block;
	font-family: "Barlow Condensed", "Barlow", sans-serif;
	font-weight: 400;
	font-size: clamp(1.5rem, 3vw, 2rem);
	line-height: 1;
	color: var(--ca-rule-strong);
	text-align: left;
}

.category-archive .most-read__link,
.category-archive .most-read__link:link,
.category-archive .most-read__link:visited,
.category-archive .most-read__link:hover,
.category-archive .most-read__link:focus,
.category-archive .most-read__link:focus-visible,
.category-archive .most-read__link:active {
	color: var(--ca-fg);
	text-decoration: none;
}

.category-archive .most-read__link:hover .most-read__title,
.category-archive .most-read__link:focus-visible .most-read__title {
	color: var(--ca-fg-body);
}

.category-archive .most-read__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	font-family: "Barlow Condensed", "Barlow", sans-serif;
	font-weight: 700;
	font-size: clamp(0.875rem, 1.2vw, 1rem);
	line-height: 1.2;
	letter-spacing: -0.005em;
	color: var(--ca-fg);
	transition: color 150ms ease;
}

/* ---- Pagination ----------------------------------------------------- */

.category-archive__pagination {
	margin-top: clamp(1.25rem, 2.5vw, 1.75rem);
}

.category-archive__pagination .page-numbers {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: "Barlow", sans-serif;
	font-weight: 600;
	font-size: clamp(0.8125rem, 1vw, 0.9375rem);
}

.category-archive__pagination .page-numbers > li {
	display: block;
}

.category-archive__pagination .page-numbers a,
.category-archive__pagination .page-numbers span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.25rem;
	height: 2.25rem;
	padding-inline: 0.625rem;
	border: 1px solid var(--ca-rule-strong);
	border-radius: 999px;
	background: transparent;
	color: var(--ca-fg);
	text-decoration: none;
	letter-spacing: 0.04em;
	transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.category-archive__pagination .page-numbers a:hover,
.category-archive__pagination .page-numbers a:focus-visible {
	background: var(--ca-fg);
	color: var(--ca-chip-bg);
	border-color: var(--ca-fg);
}

.category-archive__pagination .page-numbers .current {
	background: var(--ca-fg);
	color: var(--ca-chip-bg);
	border-color: var(--ca-fg);
}

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

.category-archive__pagination .page-numbers .prev,
.category-archive__pagination .page-numbers .next {
	font-weight: 400;
	font-size: 1.125rem;
}

/* ---- The custom-layout block sections render full-bleed by default.
       Inside the .category-archive__inner container they're already inside
       a constrained column, so any inner gamurs-token padding still applies
       inside their own wrapper. Nothing to do here. ----------------------*/
