/*
 * Post list (blog archive): three card layouts on core/query + core/post-template (ul > li).
 * list: large image, meta in a white notch over the image's bottom edge, title, excerpt, arrow link.
 * large: full-width image with a white arrow box in its corner, centered meta, title and excerpt.
 * grid-2: two-column grid (core grid layout in the original theme), image, date, title, excerpt.
 */
:where(.rt-post-list) {
	color: var(--rt-color-body);
}

.rt-post-list {
	/* The original theme's fluid typography of the pattern's 2rem title: 20px at 320px, 32px from 1440 */
	--rt-post-list-title-size: clamp(1.25rem, 1.25rem + ((1vw - 0.2rem) * 1.071), 2rem);
	--rt-post-list-title-line: 1.1875;
	--rt-post-list-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 12'%3E%3Cpath d='M0 6h36' stroke='%23000' stroke-width='1'/%3E%3Cpath d='M35 0l5 6-5 6z'/%3E%3C/svg%3E");
}

.rt-post-list__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.rt-post-list__items > li {
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
}

.rt-post-list .rt-post-list__image {
	position: relative;
	margin: 0;
	aspect-ratio: 9 / 5;
	overflow: hidden;
}

.rt-post-list__image a {
	display: block;
	height: 100%;
}

.rt-post-list .rt-post-list__image img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: scale 0.5s ease;
}

/* Meta row: date - author - category, separated by dashes. Doubled class: core's flex layout gap (the group's
   block spacing) would otherwise win in the editor. */
.rt-post-list .rt-post-list__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 0.375rem;
	margin: 0;
	color: var(--rt-color-contrast);
	font-family: var(--rt-font-family-body);
	font-size: var(--rt-font-size-small);
	font-weight: var(--rt-font-weight-medium);
	line-height: 1rem;
}

.rt-post-list__meta > * {
	margin: 0;
}

.rt-post-list__meta > * + *::before {
	content: "-";
	margin-inline-end: 0.3125rem;
}

.rt-post-list__meta a {
	color: inherit;
	text-decoration: none;
}

.rt-post-list__meta a:hover,
.rt-post-list__meta a:focus-visible {
	text-decoration: underline;
}

.rt-post-list__title {
	margin: 0;
	color: var(--rt-color-body);
	font-family: var(--rt-font-family-heading);
	font-size: var(--rt-post-list-title-size);
	font-weight: var(--rt-font-weight-bold);
	line-height: var(--rt-post-list-title-line);
}

.rt-post-list__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.2s ease;
}

.rt-post-list__excerpt {
	/* The original theme's post excerpt block: 615px wide at most */
	max-inline-size: 38.4375rem;
	margin: 0;
	padding-top: 1.9375rem;
	font-size: var(--rt-font-size-base);
	line-height: 1.5625;
}

.rt-post-list__excerpt p {
	margin: 0;
}

/* Arrow link: 40×12 thin arrow; font-size 0 hides the text but keeps it for screen readers. No overflow clipping:
   the arrow slides out of its box on hover. */
.rt-post-list__more {
	position: relative;
	display: block;
	align-self: flex-start;
	width: 2.5rem;
	height: 0.75rem;
	margin: 0;
	color: var(--rt-color-contrast);
	font-size: 0;
	line-height: 0;
	text-decoration: none;
}

.rt-post-list__more::before {
	content: "";
	position: absolute;
	inset: 0;
	background-color: currentColor;
	-webkit-mask: var(--rt-post-list-arrow) 50% 50% / 2.5rem 0.75rem no-repeat;
	mask: var(--rt-post-list-arrow) 50% 50% / 2.5rem 0.75rem no-repeat;
	transition: translate 0.2s ease;
}

.rt-post-list__more:hover::before,
.rt-post-list__more:focus-visible::before {
	translate: 0.25rem 0;
}

.rt-post-list__more:focus-visible {
	outline: 2px solid var(--rt-color-accent);
	outline-offset: 2px;
}

.rt-post-list__items > li:hover .rt-post-list__image img {
	scale: 1.04;
}

.rt-post-list__items > li:hover .rt-post-list__title a,
.rt-post-list__title a:focus-visible {
	color: var(--rt-color-contrast);
}

/* The list keeps its room under the last post when the posts fit on one page (original theme: the post template's bottom
   margin, 71px, stays without the pagination) */
.rt-post-list--list .rt-post-list__items:not(:has(+ .rt-pagination)) {
	margin-block-end: 4.4375rem;
}

.rt-post-list__empty {
	margin: 0;
	font-size: var(--rt-font-size-base);
	line-height: var(--rt-font-line-height-body);
}

.rt-post-list__empty > * {
	margin: 0;
}

/* Search results: the search form under the empty text. */
.rt-post-list__search {
	max-width: 40rem;
	padding-top: var(--rt-spacing-40);
}

/* list: cards separated by a thin line; the meta sits in a white notch over the image's bottom edge */
.rt-post-list--list .rt-post-list__items > li {
	padding-bottom: 1.875rem;
	border-bottom: 1px solid var(--rt-post-list-divider);
}

.rt-post-list--list .rt-post-list__items > li + li {
	padding-top: 3.8125rem;
}

.rt-post-list--list .rt-post-list__items > li:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.rt-post-list--list .rt-post-list__meta {
	padding-bottom: 0.6875rem;
}

/* Only a card with a featured image gets the notch */
.rt-post-list--list .rt-post-list__image + .rt-post-list__meta {
	position: relative;
	box-sizing: border-box;
	align-self: flex-start;
	width: calc(100% - 6.5625rem);
	margin-top: -3.375rem;
	padding: 1.6875rem var(--rt-spacing-30) 0.6875rem 0;
	background-color: var(--rt-post-list-panel);
}

.rt-post-list--list .rt-post-list__more {
	margin-top: 1.875rem;
}

/* large: centered text under a wide image; the arrow sits in a white box in the image's corner */
.rt-post-list--large {
	--rt-pagination-offset: 5.875rem;
}

.rt-post-list--large .rt-post-list__items > li {
	align-items: center;
	padding-bottom: 3.75rem;
	text-align: center;
	border-bottom: 1px solid var(--rt-post-list-divider);
}

.rt-post-list--large .rt-post-list__items > li + li {
	padding-top: 4.125rem;
}

.rt-post-list--large .rt-post-list__items > li:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.rt-post-list--large .rt-post-list__image {
	align-self: stretch;
	aspect-ratio: 38 / 21;
}

.rt-post-list--large .rt-post-list__more {
	align-self: flex-end;
	width: 4.75rem;
	height: 4.75rem;
	background-color: var(--rt-post-list-panel);
}

.rt-post-list--large .rt-post-list__image + .rt-post-list__more {
	margin-top: -4.75rem;
}

/* Without a featured image there is no corner for the arrow box; the title still links to the post */
.rt-post-list--large .rt-post-list__items > li > .rt-post-list__more:first-child {
	display: none;
}

.rt-post-list--large .rt-post-list__meta {
	justify-content: center;
	padding-top: 4.4375rem;
}

.rt-post-list--large .rt-post-list__title {
	padding-top: 1.1875rem;
}

.rt-post-list--large .rt-post-list__excerpt {
	padding-top: 2.5625rem;
}

/* grid-2: column count is core's grid layout setting in the original theme (its rule wins over this zero-specificity default) */
:where(.rt-post-list--grid-2 .rt-post-list__items) {
	display: grid;
	grid-template-columns: repeat(var(--rt-post-list-columns, 2), minmax(0, 1fr));
}

.rt-post-list--grid-2 {
	/* the fluid value of 1.375rem (original theme: 14.6px at 320px, 22px from 1440) */
	--rt-post-list-title-size: clamp(0.915rem, 0.915rem + ((1vw - 0.2rem) * 0.657), 1.375rem);
	--rt-post-list-title-line: 1.1364;
	--rt-pagination-offset: 3.125rem;
}

.rt-post-list--grid-2 .rt-post-list__items {
	gap: 3.125rem 1.875rem;
}

.rt-post-list--grid-2 .rt-post-list__image {
	aspect-ratio: 36 / 25;
}

.rt-post-list--grid-2 .rt-post-list__meta {
	padding-top: 0.875rem;
	color: var(--rt-color-warm);
}

.rt-post-list--grid-2 .rt-post-list__title {
	padding-top: 0.6875rem;
}

.rt-post-list--grid-2 .rt-post-list__excerpt {
	padding-top: 1.3125rem;
}

@media (prefers-reduced-motion: reduce) {
	.rt-post-list .rt-post-list__image img,
	.rt-post-list__title a,
	.rt-post-list__more::before {
		transition: none;
	}
}

/* Tablet */
@media (max-width: 64rem) {
	/* The fluid Medium preset between the posts, as the original theme's post template gap */
	.rt-post-list--list .rt-post-list__items > li + li,
	.rt-post-list--large .rt-post-list__items > li + li {
		padding-top: var(--rt-spacing-50-fluid, var(--rt-spacing-50));
	}

	.rt-post-list--large .rt-post-list__items > li {
		padding-bottom: var(--rt-spacing-50);
	}

	.rt-post-list--large .rt-post-list__meta {
		padding-top: var(--rt-spacing-50);
	}

	.rt-post-list--grid-2 .rt-post-list__items {
		gap: var(--rt-spacing-50) var(--rt-spacing-40);
	}
}

/* Mobile: one column */
@media (max-width: 37.5rem) {
	.rt-post-list__excerpt {
		padding-top: var(--rt-spacing-30);
	}

	.rt-post-list--list .rt-post-list__image + .rt-post-list__meta {
		width: calc(100% - var(--rt-spacing-40));
		margin-top: -2.875rem;
		padding-top: 1.1875rem;
	}

	.rt-post-list--list .rt-post-list__more {
		margin-top: var(--rt-spacing-40);
	}

	.rt-post-list--large .rt-post-list__more {
		width: 3.5rem;
		height: 3.5rem;
	}

	.rt-post-list--large .rt-post-list__image + .rt-post-list__more {
		margin-top: -3.5rem;
	}

	.rt-post-list--large .rt-post-list__meta {
		padding-top: var(--rt-spacing-40);
	}

	.rt-post-list--large .rt-post-list__title {
		padding-top: 0.75rem;
	}

	.rt-post-list--large .rt-post-list__excerpt {
		padding-top: var(--rt-spacing-30);
	}

	:where(.rt-post-list--grid-2 .rt-post-list__items) {
		grid-template-columns: minmax(0, 1fr);
	}

	.rt-post-list--grid-2 {
		--rt-post-list-title-size: var(--rt-font-size-medium);
	}
}
