/*
 * RES-3: publications shelf. Each resource is shown as its cover, like booklets
 * on a shelf. The button holds the PDF address; with the NetRhyme WP Flipbook
 * plugin it opens the file as a page-turning book (the section carries the
 * class nrfb-auto), and without the plugin it opens the PDF itself.
 */

.wprk-res-3 .wprk-res-3__shelf {
	gap: var(--wp--preset--spacing--50) var(--wp--preset--spacing--40);
}

/* The whole item is one target: the button's link is stretched over it. */
.wprk-res-3 .wprk-res-3__item {
	display: flex;
	flex-direction: column;
	height: 100%;
	position: relative;
}

.wprk-res-3 .wprk-res-3__item > * {
	margin-block: 0;
}

.wprk-res-3 .wprk-res-3__item .wp-block-button__link::after {
	content: "";
	inset: 0;
	position: absolute;
}

/* The cover: a thin edge and a soft shadow, as if the booklet stood upright. */
.wprk-res-3 .wprk-res-3__cover {
	background-color: var(--wprk-card-bg);
	border: 1px solid var(--wprk-border);
	border-radius: 2px;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 10px 22px -10px rgb(0 0 0 / 0.35);
	overflow: hidden;
}

.wprk-res-3 .wprk-res-3__cover :where(img) {
	display: block;
	object-position: top center;
	width: 100%;
}

/* An entry that has no cover yet still gets a tile of the same shape. */
.wprk-res-3 .wprk-res-3__item:not(:has(.wprk-res-3__cover))::before {
	aspect-ratio: 3 / 4;
	background-color: var(--wprk-soft);
	border: 1px solid var(--wprk-border);
	border-radius: 2px;
	content: "";
	display: block;
}

.wprk-res-3 .wprk-res-3__item > .wp-block-post-title {
	color: var(--wprk-heading);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
	line-height: 1.35;
	margin-block-start: var(--wp--preset--spacing--30);
}

.wprk-res-3 .wprk-res-3__item > .wp-block-buttons {
	margin-block-start: auto;
	padding-block-start: var(--wp--preset--spacing--10);
}

.wprk-res-3 .wprk-res-3__item:focus-within .wprk-res-3__cover {
	outline: 2px solid var(--wprk-focus);
	outline-offset: 3px;
}

.wprk-res-3 .wprk-res-3__item .wp-block-button__link:focus-visible {
	outline: none;
}

@media (prefers-reduced-motion: no-preference) {
	.wprk-res-3 .wprk-res-3__cover {
		transition: box-shadow 0.2s ease, transform 0.2s ease;
	}

	.wprk-res-3 .wprk-res-3__item:hover .wprk-res-3__cover {
		box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 18px 30px -12px rgb(0 0 0 / 0.42);
		transform: translateY(-4px);
	}
}

/* Phones: two covers side by side. */
@media (max-width: 480px) {
	.wprk-res-3 .wp-block-post-template.wprk-res-3__shelf {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
