/* articles-cards.css
 * Reusable "resource" (directory/listing) cards for article pages.
 *
 * Include manually on pages that need it (after default CSS):
 *   <link rel="stylesheet" href="/css3/articles-cards.css">
 *
 * Supports:
 * - Full cards with image + "Read more" button + dialog
 * - Lightweight cards (no button, no dialog)
 *
 * Uses global vars from sitewide.css where possible:
 *   --head-font, --body-font, --accent, --text
 *
 * Introduces component-specific tokens (edit these for theming):
 *   --resource-card-font
 *   --resource-type-color
 *   --resource-visit-color
 *
 * === USAGE GUIDELINES ===
 * - Place .resource-grid(s) as the last major content block inside the <article>.
 * - AVOID standard body paragraphs or headings immediately after the grid(s).
 *   Plain body text looks out of place and breaks the visual rhythm.
 *   If you need closing text, either:
 *     • Move it before the grids, or
 *     • Wrap it in a dedicated class (e.g. .resource-after-note) with adjusted styling, or
 *     • End the section with the grid.
 */

:root {
	/* Component tokens — edit here for easy theming */
	--resource-card-image-height: 180px;
	--resource-card-radius: 11px;
	--resource-card-gap: 8px;
	--resource-card-padding: 20px;
	--resource-dialog-max-width: 672px;
	--resource-card-font: "Merriweather Sans", sans-serif;

	/* Component colors for easy theming in this file */
	--resource-type-color: #6a6d5b;
	--resource-visit-color: #b4472d;
}
.resource-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--resource-card-gap);
	margin: 32px 0 56px;
}

.resource-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	background: #fff;
	border: 1px solid rgba(62, 78, 54, 0.12);
	border-radius: var(--resource-card-radius);
	overflow: hidden;
	box-shadow: 0 4px 14px rgba(44, 42, 37, 0.08);
	font-family: var(--resource-card-font);
}

.resource-card__image {
	display: block;
	width: 100%;
	height: var(--resource-card-image-height);
	object-fit: cover;
}

.resource-card h3 {
	margin: 0 0 8px;
	color: var(--accent);
	font-family: var(--head-font);
	font-size: 24px;
	line-height: 1.2;
}

.resource-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: flex-start;
	padding: var(--resource-card-padding);
}

.resource-card__type {
	margin: 0 0 8px;
	color: var(--resource-type-color);
	font-family: var(--head-font);
	font-size: 18px;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.3;
	text-transform: uppercase;
}

.resource-card__summary {
	margin: 0 0 8px;
	font-size: 18px;
	line-height: 1.5;
}

.resource-card__more,
.resource-card__visit {
	display: inline-block;
	font-size: 15px;
	font-weight: 700;
}

.resource-card__more {
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--accent);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.resource-card__more:hover,
.resource-card__more:focus-visible {
	color: var(--resource-visit-color);
}

.resource-card__visit {
	margin-top: 8px;
	color: var(--resource-visit-color);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.resource-dialog {
	position: fixed;
	top: 50%;
	left: 50%;
	width: min(var(--resource-dialog-max-width), calc(100% - 32px));
	max-height: calc(100vh - 32px);
	margin: 0;
	padding: 40px 24px 24px;
	border: 0;
	border-radius: var(--resource-card-radius);
	box-shadow: 0 16px 64px rgba(0, 0, 0, 0.28);
	color: var(--text);
	font-family: var(--resource-card-font);
	line-height: 1.6;
	transform: translate(-50%, -50%);
}

.resource-dialog::backdrop {
	background: rgba(31, 37, 27, 0.66);
}

.resource-dialog__close {
	position: absolute;
	top: 8px;
	right: 12px;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--text);
	font-size: 0;
	cursor: pointer;
}

.resource-dialog__close::before {
	content: "×";
	font-family: var(--head-font);
	font-size: 24px;
	font-weight: 400;
	line-height: 32px;
}

.resource-dialog__close:hover,
.resource-dialog__close:focus-visible {
	background: #eee9dc;
}

.resource-dialog p {
	margin: 0 0 16px;
}

@media (min-width: 640px) {
	.resource-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1100px) {
	.resource-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (prefers-reduced-motion: no-preference) {
	.resource-card {
		transition: transform 0.2s ease, box-shadow 0.2s ease;
	}

	.resource-card:hover {
		transform: translateY(-4px);
		box-shadow: 0 10px 24px rgba(44, 42, 37, 0.14);
	}
}
