/*
 * Naef Post Loop: Swiss-style layout.
 * Strict grid, one strong rule + hairlines, left-aligned type, tabular numerals, no ornament.
 * Colours follow the surrounding text colour, so it works on light and dark sections.
 * Adjust the variables below; the font is inherited from the theme.
 */
.npl {
	--npl-gap-x: clamp(20px, 2.2vw, 32px);
	--npl-gap-y: clamp(40px, 5vw, 72px);
	--npl-ratio: 700 / 450;
	--npl-rule: rgba(0, 0, 0, 0.2);
	--npl-muted: rgba(0, 0, 0, 0.58);
	scroll-margin-top: 110px;
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
	.npl {
		--npl-rule: color-mix(in srgb, currentColor 22%, transparent);
		--npl-muted: color-mix(in srgb, currentColor 62%, transparent);
	}
}

.npl__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Filters ---------------------------------------------------------- */
.npl__filters {
	margin: 0 0 clamp(28px, 4vw, 56px);
	padding-top: 14px;
	border-top: 1px solid currentColor;
}
.npl__tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px clamp(20px, 3vw, 40px);
	list-style: none;
	margin: 0;
	padding: 0;
}
.npl__filter {
	display: inline-block;
	padding: 4px 0;
	font-size: 0.9375rem;
	line-height: 1.3;
	color: var( --e-global-color-accent );
	text-decoration: none;
	text-underline-offset: 0.45em;
	text-decoration-thickness: 2px;
	transition: color 0.2s;
}
.npl__filter:hover,
.npl__filter:focus-visible {
	color: var( --e-global-color-accent );
}
.npl__filter.is-active {
	color: var( --e-global-color-accent );
	text-decoration: underline;
}
.npl__select {
	display: none;
	width: 100%;
	padding: 0.5em 0;
	font: inherit;
	color: inherit;
	background: transparent;
	border: 0;
	border-bottom: 1px solid currentColor;
	border-radius: 0;
}
@media (max-width: 767px) {
	.npl--js .npl__tabs { display: none; }
	.npl--js .npl__select { display: block; }
}

/* ---- Results ---------------------------------------------------------- */
.npl__results {
	transition: opacity 0.2s;
}
.npl__results.is-loading {
	opacity: 0.4;
	pointer-events: none;
}
.npl__grid {
	display: grid;
	grid-template-columns: repeat(var(--npl-cols, 3), minmax(0, 1fr));
	gap: var(--npl-gap-y) var(--npl-gap-x);
	list-style: none;
	margin: 0;
	padding: 0;
}
@media (max-width: 1024px) {
	.npl__grid { grid-template-columns: repeat(min(var(--npl-cols, 3), 2), minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.npl__grid { grid-template-columns: 1fr; }
}
.npl__empty {
	margin: 0;
	padding: 2em 0;
}

/* ---- Card ------------------------------------------------------------- */
.npl__card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
}

.npl__media {
	aspect-ratio: var(--npl-ratio);
	overflow: hidden;
	background: var(--npl-rule);
}
.npl__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
@media (prefers-reduced-motion: no-preference) {
	.npl__img { transition: transform 0.6s cubic-bezier(0.2, 0, 0, 1); }
	.npl__card:hover .npl__img { transform: scale(1.03); }
}

.npl__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	margin-top: 14px;
	padding-top: 12px;
	border-top: 1px solid var(--npl-rule);
	transition: border-color 0.2s;
}
.npl__card:hover .npl__body {
	border-top-color: currentColor;
}

.npl__meta {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	margin: 0 0 0.9em;
	font-size: 0.75rem;
	line-height: 1.4;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var( --e-global-color-accent );
	font-variant-numeric: tabular-nums;
}
.npl__date { margin-left: auto; white-space: nowrap; }

.npl__title {
	margin: 0;
	font-size: clamp(1.0625rem, 0.95rem + 0.45vw, 1.375rem);
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-wrap: pretty;
}
.npl__link {
	color: inherit;
	text-decoration: none;
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
}
.npl .npl__title { overflow-wrap: anywhere; hyphens: auto;}
.npl__card:hover .npl__link { text-decoration: underline; }
/* One link covers the whole card (no empty duplicate link for screen readers). */
.npl__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}
.npl__link:focus-visible { outline: none; }
.npl__link:focus-visible::after {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

/* Author sits at the bottom so author lines align across a row. */
.npl__author {
	margin: auto 0 0;
	padding-top: 1.1em;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--npl-muted);
}
.npl__author a {
	position: relative; /* stays clickable above the stretched title link */
	z-index: 2;
	color: inherit;
	text-decoration: none;
}
.npl__author a:hover { text-decoration: underline; }

/* ---- Pagination ------------------------------------------------------- */
.npl__pagination {
	margin-top: clamp(40px, 5vw, 72px);
	padding-top: 14px;
	border-top: 1px solid var( --e-global-color-accent );
}
.npl__pages {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
	font-variant-numeric: tabular-nums;
}
.npl__page,
.npl__gap {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5em;
	height: 2.5em;
	padding: 0 0.5em;
	font-size: 0.9375rem;
	color: var(--npl-muted);
	text-decoration: none;
	border-bottom: 2px solid transparent;
	transition: color 0.2s, border-color 0.2s;
}
a.npl__page:hover,
a.npl__page:focus-visible {
	color: inherit;
	border-bottom-color: var( --e-global-color-accent );
}
.npl__page.is-current {
	color: inherit;
	font-weight: 600;
	border-bottom-color: currentColor;
}
/* Arrows go to the far right, numbers stay on the left. */
.npl__li--prev { order: 100; margin-left: auto; }
.npl__li--next { order: 101; }
.npl__page--prev,
.npl__page--next {
	color: inherit;
	border: 1px solid var(--npl-rule);
}
.npl__page--prev:hover,
.npl__page--next:hover,
.npl__page--prev:focus-visible,
.npl__page--next:focus-visible {
	border-color: var( --e-global-color-accent );
}
.npl__li--end { margin-left: auto; } /* page 1: no prev arrow, so "next" takes the right edge */
