/* =========================================================================
   BioEvidenceHub — archives, post cards and rows

   Also loaded (for the card rules alone) by the homepage's latest band and
   the related-articles strip on single posts.

   The editorial layout follows four patterns that recur across well-made
   magazines and are largely absent from templates: asymmetric weight, white
   space used as structure rather than padding, a real scale gap between
   display and body type, and a reading serif for headlines against a sans
   interface. Those four are what stop an archive looking auto-generated.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Archive header
   ---------------------------------------------------------------------- */

.beh-archive-head {
	padding-block: var(--beh-s-10) var(--beh-s-8);
	border-block-end: 1px solid var(--beh-line);
	background:
		radial-gradient(60rem 20rem at 15% -20%, var(--beh-pale), transparent 70%),
		var(--beh-surface);
}

.beh-archive-head__inner {
	max-inline-size: 46rem;
}

.beh-archive-head .beh-icon-tile {
	margin-block-end: var(--beh-s-5);
}

.beh-archive-head__title {
	font-family: var(--beh-font-editorial);
	font-size: clamp(2.25rem, 4.4vw, 3.5rem);
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1.06;
	margin-block-end: var(--beh-s-5);
}

/* When the serif is switched off in the Customizer, headlines revert to the
   interface stack and pick the tighter tracking Inter needs at display size. */
.beh-font-sans .beh-archive-head__title,
.beh-font-sans .beh-lead-story__title,
.beh-font-sans .beh-post-row__title,
.beh-font-sans .beh-post-card__title,
.beh-font-sans .beh-article__title {
	font-family: var(--beh-font-ui);
	font-weight: 800;
	letter-spacing: var(--beh-tracking-snug);
}

.beh-archive-head__desc {
	font-size: var(--beh-fs-lg);
	color: var(--beh-body);
	max-inline-size: 42rem;
}

.beh-archive-head__desc p:last-child {
	margin-block-end: 0;
}

.beh-archive-head__count {
	margin-block: var(--beh-s-5) 0;
	font-size: var(--beh-fs-sm);
	font-weight: 700;
	color: var(--beh-muted);
	font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------------------
   2. Archive shell
   ---------------------------------------------------------------------- */

.beh-archive {
	padding-block: var(--beh-s-14) var(--beh-s-20);
}

.beh-archive__inner {
	display: block;
}

.beh-archive--sidebar .beh-archive__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 19rem;
	gap: var(--beh-s-16);
	align-items: start;
}

/* -------------------------------------------------------------------------
   3. Lead story
   ---------------------------------------------------------------------- */

.beh-lead-story {
	display: grid;
	grid-template-columns: 1.15fr 1fr;
	align-items: center;
	gap: var(--beh-s-12);
	padding-block-end: var(--beh-s-12);
	margin-block-end: var(--beh-s-10);
	border-block-end: 1px solid var(--beh-line);
}

.beh-lead-story__media {
	display: block;
	border-radius: var(--beh-r-lg);
	overflow: hidden;
}

.beh-lead-story__media .beh-media {
	aspect-ratio: 16 / 10;
	border-radius: var(--beh-r-lg);
}

.beh-lead-story__title {
	font-family: var(--beh-font-editorial);
	/* The deliberate scale gap: the lead headline is roughly three times the
	   body size, which is what makes the hierarchy read instantly instead of
	   requiring the reader to work it out. */
	font-size: clamp(1.875rem, 3.4vw, 2.875rem);
	font-weight: 600;
	line-height: 1.08;
	letter-spacing: -0.025em;
	margin-block: var(--beh-s-4) var(--beh-s-5);
}

.beh-lead-story__title a {
	color: var(--beh-navy);
	/* An underline that grows from the baseline on hover — quieter than a
	   colour change and it keeps the headline's colour stable. */
	background-image: linear-gradient(var(--beh-primary), var(--beh-primary));
	background-size: 0% 2px;
	background-repeat: no-repeat;
	background-position: 0 100%;
	transition: background-size var(--beh-dur) var(--beh-ease),
		color var(--beh-dur-fast) var(--beh-ease);
}

.beh-lead-story__title a:hover {
	color: var(--beh-primary);
	background-size: 100% 2px;
}

.beh-lead-story__excerpt {
	font-size: var(--beh-fs-lg);
	line-height: var(--beh-lh-relaxed);
	margin-block-end: var(--beh-s-5);
}

/* -------------------------------------------------------------------------
   4. Rows
   ---------------------------------------------------------------------- */

.beh-rows {
	display: flex;
	flex-direction: column;
}

.beh-post-row {
	display: grid;
	grid-template-columns: 2.5rem 8.75rem minmax(0, 1fr);
	align-items: start;
	gap: var(--beh-s-6);
	padding-block: var(--beh-s-8);
	border-block-end: 1px solid var(--beh-line-soft);
	transition: background var(--beh-dur) var(--beh-ease);
}

.beh-post-row:first-child {
	padding-block-start: 0;
}

.beh-post-row:last-child {
	border-block-end: 0;
}

/* The running number down the edge of the list. Tabular figures keep the
   column perfectly straight regardless of the digits. */
.beh-post-row__index {
	font-size: var(--beh-fs-sm);
	font-weight: 800;
	font-variant-numeric: tabular-nums;
	color: var(--beh-line-strong);
	padding-block-start: 0.25rem;
	letter-spacing: 0.04em;
}

.beh-post-row:hover .beh-post-row__index {
	color: var(--beh-primary);
}

.beh-post-row__media {
	display: block;
	border-radius: var(--beh-r-md);
	overflow: hidden;
}

.beh-post-row__media .beh-media {
	aspect-ratio: 4 / 3;
}

.beh-post-row__title {
	font-family: var(--beh-font-editorial);
	font-size: clamp(1.1875rem, 1.8vw, 1.5rem);
	font-weight: 600;
	line-height: 1.22;
	letter-spacing: -0.015em;
	margin-block: var(--beh-s-2) var(--beh-s-2);
}

.beh-post-row__title a {
	color: var(--beh-navy);
}

.beh-post-row__title a:hover {
	color: var(--beh-primary);
}

.beh-post-row__excerpt {
	font-size: var(--beh-fs-base);
	color: var(--beh-muted);
	margin: 0;
	/* Two lines maximum: the row is a scanning aid, not a summary. Clamping
	   also keeps every row the same height, which is what lets the list read
	   as a single column rather than a ragged stack. */
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* -------------------------------------------------------------------------
   5. Post cards
   ---------------------------------------------------------------------- */

.beh-post-card {
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;
}

.beh-post-card__media {
	border-radius: 0;
	aspect-ratio: 3 / 2;
}

.beh-post-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	padding: var(--beh-s-6);
}

.beh-post-card__title {
	font-family: var(--beh-font-editorial);
	font-size: 1.25rem;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.015em;
	margin-block: var(--beh-s-3) var(--beh-s-3);
}

.beh-post-card__title a {
	color: var(--beh-navy);
}

.beh-post-card:hover .beh-post-card__title a {
	color: var(--beh-primary);
}

.beh-post-card__excerpt {
	font-size: var(--beh-fs-base);
	color: var(--beh-muted);
	margin-block-end: var(--beh-s-5);
}

.beh-post-card__cta {
	margin-block-start: auto;
}

/* -------------------------------------------------------------------------
   6. Chips
   ---------------------------------------------------------------------- */

.beh-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4375rem;
}

a.beh-pill:hover {
	background: var(--beh-primary);
	color: #fff;
}

a.beh-pill--neutral:hover {
	background: var(--beh-navy);
	color: #fff;
}

/* -------------------------------------------------------------------------
   7. Pagination
   ---------------------------------------------------------------------- */

.beh-pagination {
	margin-block-start: var(--beh-s-14);
	padding-block-start: var(--beh-s-8);
	border-block-start: 1px solid var(--beh-line);
}

.beh-pagination ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.375rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Direct children of the list item only.
   `.beh-pagination :is(a, span)` also matched the <span> that wraps the
   label inside each prev/next link, so those controls drew a border
   around the anchor AND another around the span inside it. */
.beh-pagination li > :is(a, span) {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	min-inline-size: 2.5rem;
	block-size: 2.5rem;
	padding-inline: 0.75rem;
	justify-content: center;
	border: 1px solid var(--beh-line);
	border-radius: var(--beh-r-sm);
	font-size: var(--beh-fs-base);
	font-weight: 700;
	color: var(--beh-navy);
	font-variant-numeric: tabular-nums;
	transition: background var(--beh-dur-fast) var(--beh-ease),
		border-color var(--beh-dur-fast) var(--beh-ease),
		color var(--beh-dur-fast) var(--beh-ease);
}

.beh-pagination li > a:hover {
	border-color: var(--beh-primary);
	color: var(--beh-primary);
	background: var(--beh-primary-050);
}

.beh-pagination li > .current {
	background: var(--beh-primary);
	border-color: var(--beh-primary);
	color: #fff;
}

.beh-pagination li > .dots {
	border-color: transparent;
	color: var(--beh-muted-soft);
}

/* The "previous" arrow points backwards; the shared chevron icon points
   forward, so it is flipped here rather than shipping a second icon. */
.beh-pagination .prev .beh-i {
	scale: -1 1;
}

[dir='rtl'] .beh-pagination .prev .beh-i {
	scale: 1 1;
}

[dir='rtl'] .beh-pagination .next .beh-i {
	scale: -1 1;
}

/* -------------------------------------------------------------------------
   8. Empty state
   ---------------------------------------------------------------------- */

.beh-empty {
	max-inline-size: 34rem;
	padding-block: var(--beh-s-10);
}

.beh-empty__title {
	font-size: clamp(1.5rem, 2.6vw, 2rem);
	margin-block: var(--beh-s-5) var(--beh-s-3);
}

.beh-empty__text {
	font-size: var(--beh-fs-lg);
	color: var(--beh-muted);
	margin-block-end: var(--beh-s-8);
}

.beh-empty__search {
	margin-block-end: var(--beh-s-10);
}

.beh-empty__suggest .beh-label {
	margin-block-end: var(--beh-s-4);
}

/* -------------------------------------------------------------------------
   9. Sidebar
   ---------------------------------------------------------------------- */

.beh-sidebar {
	position: sticky;
	inset-block-start: calc(var(--beh-header-h) + var(--beh-admin-bar) + 1.5rem);
}

.beh-widget {
	padding: var(--beh-s-6);
	margin-block-end: var(--beh-s-6);
	background: var(--beh-surface-soft);
	border: 1px solid var(--beh-line);
	border-radius: var(--beh-r-lg);
}

.beh-widget__title {
	font-size: var(--beh-fs-md);
	margin-block-end: var(--beh-s-4);
}

.beh-widget ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.beh-widget li {
	padding-block: 0.4375rem;
	border-block-end: 1px solid var(--beh-line);
	font-size: var(--beh-fs-base);
}

.beh-widget li:last-child {
	border-block-end: 0;
}

.beh-widget a {
	color: var(--beh-navy);
	font-weight: 600;
}

.beh-widget a:hover {
	color: var(--beh-primary);
}

/* -------------------------------------------------------------------------
   10. Responsive
   ---------------------------------------------------------------------- */

@media (max-width: 1000px) {
	.beh-archive--sidebar .beh-archive__inner {
		grid-template-columns: 1fr;
		gap: var(--beh-s-12);
	}

	.beh-sidebar {
		position: static;
	}
}

@media (max-width: 860px) {
	.beh-archive {
		padding-block: var(--beh-s-10) var(--beh-s-14);
	}

	.beh-lead-story {
		grid-template-columns: 1fr;
		gap: var(--beh-s-6);
	}

	/* The running number is a desktop refinement; at phone width it competes
	   with the thumbnail for a scarce 40px and earns nothing. */
	.beh-post-row {
		grid-template-columns: 5.5rem minmax(0, 1fr);
		gap: var(--beh-s-4);
		padding-block: var(--beh-s-6);
	}

	.beh-post-row__index {
		display: none;
	}
}

@media (max-width: 480px) {
	.beh-post-row {
		grid-template-columns: 1fr;
	}

	.beh-post-row__media {
		max-inline-size: 100%;
	}

	.beh-post-row__media .beh-media {
		aspect-ratio: 16 / 9;
	}
}
