/**
 * Homepage (front-page.php) layout. Loaded on the front page only.
 * Section styles: hero.css (4.1); featured posts (4.4/4.8), values
 * (4.6) and commitments (4.7) below; the post card is in post-card.css,
 * the testimonials section and its slider in testimonials.css.
 */

/*
 * Featured posts (4.8): sage section #bai-viet-noi-bat, after the
 * testimonials. Grid 1 / 2 (600px) / 3 (1024px); cards centered as in
 * home-07.jpg. Rows stretch, so cards start at the same top and
 * "Đọc thêm" lines up at the bottom.
 */
.bst-home-featured__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--gap);
}

@media (min-width: 600px) {

	.bst-home-featured__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {

	.bst-home-featured__grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

.bst-home-featured .bst-card {
	align-items: center;
	text-align: center;
}

.bst-home-featured__more {
	margin: calc(var(--section-y) / 2) 0 0;
	text-align: center;
}

/*
 * Values (4.6): ivory section after the hero (our-value.jpg, layout only).
 * Stacked below 1024px: heading, paragraphs, photo, cards. From 1024px a
 * 12-column grid: text in columns 1-7, the portrait photo in 9-12 over
 * both rows, and the cards in 1-10 on the second row, overlapping the
 * lower left part of the photo.
 */
.bst-home-values__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--gap);
}

.bst-home-values__title {
	margin-bottom: 0;
	text-wrap: balance;
}

/*
 * Hairline (its own element, so it can draw in from the left where
 * motion is on: .bst-reveal__line in motion.css), then the two
 * paragraphs.
 */
.bst-home-values__rule {
	height: 1px;
	margin-top: var(--gap);
	background-color: var(--color-border);
}

.bst-home-values__text {
	display: grid;
	gap: var(--gap);
	padding-top: var(--gap);
}

.bst-home-values__text p {
	margin: 0;
}

.bst-home-values__photo {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background-color: var(--color-border); /* while the photo loads */
}

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

/* Cards: equal height per row (grid stretch); 3 columns from 600px. */
.bst-home-values__cards {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 600px) {

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

.bst-value-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 0;
	padding: 2em 1.5em;
	border: 1px solid var(--color-border);
	background-color: var(--color-white);
	text-align: center;
}

/* Middle card: dark surface. */
.bst-value-card--dark {
	--focus-color: var(--color-white);
	--surface-color: var(--color-forest);

	border-color: var(--color-forest);
	background-color: var(--color-forest);
	color: var(--color-white);
}

.bst-value-card__icon {
	display: block;
	width: 2.5em;
	height: 2.5em;
	margin-bottom: 1em;
	color: var(--color-accent);
}

.bst-value-card__svg {
	display: block;
	width: 100%;
	height: 100%;
}

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

.bst-value-card--dark .bst-value-card__title {
	color: var(--color-white);
}

.bst-value-card__text {
	margin: 0;
}

@media (min-width: 1024px) {

	.bst-home-values__layout {
		grid-template-columns: repeat(12, minmax(0, 1fr));
		row-gap: calc(var(--section-y) / 2);
	}

	.bst-home-values__intro {
		grid-row: 1;
		grid-column: 1 / 8;
	}

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

	/* Tall portrait over both rows; the cards end a little below it. */
	.bst-home-values__photo {
		grid-row: 1 / 3;
		grid-column: 9 / 13;
		aspect-ratio: auto;
		margin-bottom: var(--gap);
	}

	.bst-home-values__cards {
		position: relative;
		z-index: 1;
		grid-row: 2;
		grid-column: 1 / 11;
		align-self: end;
	}
}

/*
 * Commitments (4.7): sage section after the values section (cam-ket.jpg,
 * layout only). DOM and reading order are figures 1-4.
 * Below 600px: one column, 1, 2, 3, 4.
 * From 600px: two columns with a wide gutter. Left: 1 (square) above
 * 3 (portrait); right: 2 (portrait) above 4 (square). Three rows,
 * `auto 1fr auto`: 1 sits in row 1 and 4 in row 3; the portraits span
 * two rows. Items spanning a flexible row are sized in the fr step, so
 * row 2 takes exactly the portrait's extra height and each column flows
 * on its own, as in the reference.
 * The figure itself (frame, image, caption) is in commitment.css.
 */
.bst-home-commitments__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: calc(var(--gap) * 2);
}

@media (min-width: 600px) {

	.bst-home-commitments__grid {
		grid-template-rows: auto 1fr auto;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: calc(var(--gap) * 3);
		row-gap: calc(var(--gap) * 2);
	}

	.bst-commitment {
		align-self: start;
	}

	.bst-commitment--1 {
		grid-row: 1;
		grid-column: 1;
	}

	.bst-commitment--2 {
		grid-row: 1 / 3;
		grid-column: 2;
	}

	.bst-commitment--3 {
		grid-row: 2 / 4;
		grid-column: 1;
	}

	.bst-commitment--4 {
		grid-row: 3;
		grid-column: 2;
	}
}
