/**
 * Post card: 1:1 image, date, title, "Đọc thêm". No border or background.
 * Variants: lead and compact (below).
 * Markup: bstieunhien_theme_post_card() in inc/post-card.php.
 * See "Post card" in docs/design-system.md (blog-archive-01.jpg).
 */

.bst-card {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

/* Image: square, cropped; plain --color-border square without a featured image. */
.bst-card__image {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	margin-bottom: 1.25em;
	overflow: hidden;
	background-color: var(--color-border);
	transition: opacity var(--motion-fast) ease;
}

.bst-card__image:hover {
	opacity: 0.85;
}

.bst-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/*
 * Zoom on hover and focus-within (Motion, kind 1): the image scales to
 * 1.04 inside its frame (overflow hidden). No zoom with reduced motion.
 */
@media (prefers-reduced-motion: no-preference) {

	.bst-card__img {
		transition: scale var(--motion-hover) var(--motion-ease);
	}

	.bst-card:hover .bst-card__img,
	.bst-card:focus-within .bst-card__img {
		scale: 1.04;
	}
}

/*
 * Category label (plain text, read once; not in the tab order). Default
 * and lead: flush with the top left corner of the image, forest with
 * white eyebrow type, never wider than the image (= the card width),
 * wraps. Clicks pass through to the image link below it.
 */
.bst-card__category {
	position: absolute;
	top: 0;
	left: 0;
	max-width: 100%;
	padding: 0.6em 0.9em 0.6em 1.2em;
	background-color: var(--color-forest);
	color: var(--color-white);
	font-family: var(--font-body);
	font-size: var(--text-small);
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 0.3em;
	text-align: left;
	text-transform: uppercase;
	overflow-wrap: anywhere;
	pointer-events: none;
}

/* Date: the site-wide date style. */
.bst-card__date {
	display: block;
	margin-bottom: 0.25em;
	color: var(--color-accent);
	font-family: var(--font-heading);
	font-size: var(--text-body);
	font-style: italic;
	line-height: 1.4;
}

.bst-card__title {
	margin: 0 0 0.75em;
	font-size: var(--text-h3);
}

/* Title link: heading color (base.css); accent underline on hover/focus. */
.bst-card__title a:hover,
.bst-card__title a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--color-accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.bst-card__more {
	margin-top: auto;
}

/*
 * Lead variant (Blog page): 16:9 image, title at --text-h2, excerpt in
 * body text, then "Đọc thêm".
 */
.bst-card--lead .bst-card__image {
	aspect-ratio: 16 / 9;
}

.bst-card--lead .bst-card__title {
	font-size: var(--text-h2);
}

.bst-card__excerpt {
	margin: 0 0 1em;
}

/*
 * Compact variant (Blog page): a row with a small square image on the
 * left (a quarter of the row, at most 120px) and the date and title on
 * the right, vertically centered as a pair. No "Đọc thêm".
 */
.bst-card--compact {
	display: grid;
	grid-template-rows: 1fr auto auto auto 1fr;
	grid-template-columns: min(25%, 120px) minmax(0, 1fr);
	column-gap: 1.25em;
	align-items: start;
}

.bst-card--compact .bst-card__image {
	grid-row: 1 / -1;
	grid-column: 1;
	margin-bottom: 0;
}

/* Compact: the label is an eyebrow text line above the date. */
.bst-card--compact .bst-card__category {
	position: static;
	grid-row: 2;
	grid-column: 2;
	margin-bottom: 0.25em;
	padding: 0;
	background-color: transparent;
	color: var(--color-accent);
}

.bst-card--compact .bst-card__date {
	grid-row: 3;
	grid-column: 2;
}

.bst-card--compact .bst-card__title {
	grid-row: 4;
	grid-column: 2;
	margin-bottom: 0;
	font-size: var(--text-h4);
}

/*
 * Card grid (bstieunhien_theme_card_grid()): Blog page category sections
 * and related posts. 1 column, 2 from 600px, 3 from 1024px, gap --gap.
 * The fourth card (--extra) shows only in the two-column range, so no
 * row is left half empty; display: none elsewhere also removes it from
 * the tab order and from screen readers.
 */
.bst-card-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bst-card-grid__item {
	display: flex;
	margin: 0;
}

.bst-card-grid__item > .bst-card {
	width: 100%;
}

.bst-card-grid__item--extra {
	display: none;
}

@media (min-width: 600px) {

	.bst-card-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.bst-card-grid__item--extra {
		display: flex;
	}
}

@media (min-width: 1024px) {

	.bst-card-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.bst-card-grid__item--extra {
		display: none;
	}
}
