/*
 * Spacca - Issue 2: per-article photo layouts (loaded only on /issue-2/).
 * Shared shell lives in issue.css. Class convention: .spacca-a{N}-* = article N.
 */

/* ===== Article 1 - Neighborhood sickness ================================
   Three rows: desktop = a row with space-between; mobile = stacked (one photo
   full width on top, the other 80% right-aligned). The article media wrapper
   keeps the uniform 2rem gap between the rows on mobile. */
.spacca-a1-r1,
.spacca-a1-r2,
.spacca-a1-r3 {
	display: flex;
	flex-direction: column;
	row-gap: 2rem;
}

.spacca-a1-r1 img,
.spacca-a1-r2 img,
.spacca-a1-r3 img {
	display: block;
	height: auto;
}

/* Vertical stack (5 landscape frames, no gap) - right column of row 2.
   align-items: flex-end keeps the frames at their natural width (no stretch /
   no distortion) and flush to the right edge of the stack. */
.spacca-a1-stack {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
}

.spacca-a1-stack img {
	width: 100%;
}

/* Mobile stacking: which photo is full width on top, which is 80% right below. */
.spacca-a1-r1 img:nth-child(1) {
	width: 80%;
	align-self: flex-end;
}

.spacca-a1-r1 img:nth-child(2) {
	width: 100%;
	order: -1;
}

.spacca-a1-r2 > img {
	width: 100%;
}

.spacca-a1-r2 .spacca-a1-stack {
	width: 80%;
	align-self: flex-end;
}

.spacca-a1-r3 img:nth-child(1) {
	width: 100%;
}

.spacca-a1-r3 img:nth-child(2) {
	width: 80%;
	align-self: flex-end;
}

@media (min-width: 768px) {
	.spacca-a1-r1,
	.spacca-a1-r2,
	.spacca-a1-r3 {
		flex-direction: row;
		justify-content: space-between;
		row-gap: 0;
	}

	/* div.1 and div.3 bottom-aligned; div.2 top-aligned. */
	.spacca-a1-r1,
	.spacca-a1-r3 {
		align-items: flex-end;
	}

	.spacca-a1-r2 {
		align-items: stretch;
	}

	/* row 1: photo.1 30% (left), photo.2 40% (right) - reset mobile order/align. */
	.spacca-a1-r1 img:nth-child(1) {
		width: 30%;
		align-self: auto;
	}

	.spacca-a1-r1 img:nth-child(2) {
		width: 40%;
		order: 0;
	}

	/* row 2: photo.3 40% (left); the stack stretches to foto.3's height and its
	   width derives from the frames (no crop), so it ends up under 30%. */
	.spacca-a1-r2 > img {
		width: 40%;
		align-self: flex-start;
	}

	.spacca-a1-r2 .spacca-a1-stack {
		align-self: auto;
	}

	.spacca-a1-r2 .spacca-a1-stack img {
		flex: 1 1 0;
		min-height: 0;
		width: auto;
	}

	/* row 3: photo.4 40% (left), photo.5 30% (right) */
	.spacca-a1-r3 img:nth-child(1) {
		width: 40%;
	}

	.spacca-a1-r3 img:nth-child(2) {
		width: 30%;
		align-self: auto;
	}
}

/* ===== Article 2 - Blackbody ============================================
   A centered 80% column: a lead photo, then a strip of five photos.
   Desktop: the strip is a single row (equal widths, 1rem gap).
   Mobile: the strip wraps two per line (1rem gaps, row and column). */
.spacca-a2-block {
	width: 100%;
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	row-gap: 1rem;
}

.spacca-a2-block > img {
	display: block;
	width: 100%;
	height: auto;
}

.spacca-a2-line {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
}

.spacca-a2-line img {
	display: block;
	width: calc(50% - 0.5rem);
	height: auto;
}

@media (min-width: 768px) {
	.spacca-a2-block {
		width: 80%;
	}

	.spacca-a2-line {
		flex-wrap: nowrap;
	}

	.spacca-a2-line img {
		flex: 1 1 0;
		min-width: 0;
		width: auto;
	}
}

/* ===== Article 3 - As much as possible =================================
   div.1: space-between (img.1 70% left, img.2 20% right).
   div.2: a 70%-wide left block, two equal photos with a 3rem column gap
   (same as the gap between the two rows). Mobile: img.2 on top at 50% left,
   everything else full width; uniform 2rem gap via the media wrapper. */
.spacca-a3-r1,
.spacca-a3-r2 {
	display: flex;
	flex-direction: column;
	row-gap: 2rem;
}

.spacca-a3-r1 img,
.spacca-a3-r2 img {
	display: block;
	height: auto;
}

.spacca-a3-r1 img:nth-child(1) {
	width: 100%;
}

.spacca-a3-r1 img:nth-child(2) {
	width: 50%;
	align-self: flex-start;
	order: -1;
}

.spacca-a3-r2 img {
	width: 100%;
}

@media (min-width: 768px) {
	.spacca-a3-r1,
	.spacca-a3-r2 {
		flex-direction: row;
		align-items: flex-start;
		row-gap: 0;
	}

	.spacca-a3-r1 {
		justify-content: space-between;
	}

	.spacca-a3-r1 img:nth-child(1) {
		width: 60%;
	}

	.spacca-a3-r1 img:nth-child(2) {
		width: 20%;
		align-self: flex-end;
		order: 0;
	}

	.spacca-a3-r2 {
		width: 60%;
		align-self: flex-start;
		column-gap: 3rem;
	}

	.spacca-a3-r2 img {
		flex: 1 1 0;
		min-width: 0;
		width: auto;
	}
}

/* ===== Article 4 - The Rabbit Hole Diy =================================
   Two rows, space-between, bottom-aligned. Mobile: the right photo on top
   (full width), the left photo below at 80% (div.1 left, div.2 right). */
.spacca-a4-r1,
.spacca-a4-r2 {
	display: flex;
	flex-direction: column;
	row-gap: 2rem;
}

.spacca-a4-r1 img,
.spacca-a4-r2 img {
	display: block;
	height: auto;
}

.spacca-a4-r1 img:nth-child(1) {
	width: 80%;
	align-self: flex-start;
}

.spacca-a4-r1 img:nth-child(2) {
	width: 100%;
	order: -1;
}

.spacca-a4-r2 img:nth-child(1) {
	width: 80%;
	align-self: flex-end;
}

.spacca-a4-r2 img:nth-child(2) {
	width: 100%;
	order: -1;
}

@media (min-width: 768px) {
	.spacca-a4-r1,
	.spacca-a4-r2 {
		flex-direction: row;
		justify-content: space-between;
		align-items: flex-end;
		row-gap: 0;
	}

	.spacca-a4-r1 img:nth-child(1) {
		width: 20%;
		align-self: auto;
	}

	.spacca-a4-r1 img:nth-child(2) {
		width: 40%;
		order: 0;
	}

	.spacca-a4-r2 img:nth-child(1) {
		width: 40%;
		align-self: auto;
	}

	.spacca-a4-r2 img:nth-child(2) {
		width: 20%;
		order: 0;
	}
}

/* ===== Article 5 - 90's Maybe ==========================================
   div.1: two photos space-between, bottom-aligned.
   div.2: img.3 (40%) + a polaroid group (40%): three ~square polaroids at 30%
   each with space-between, centered. Mobile: everything stacks with the uniform
   2rem gap; the polaroid group becomes a centered column (space-between off). */
.spacca-a5-r1,
.spacca-a5-r2 {
	display: flex;
	flex-direction: column;
	row-gap: 2rem;
}

.spacca-a5-r1 img,
.spacca-a5-r2 > img {
	display: block;
	height: auto;
}

/* div.1 mobile: img.2 on top 80% right, img.1 below full width. */
.spacca-a5-r1 img:nth-child(1) {
	width: 100%;
}

.spacca-a5-r1 img:nth-child(2) {
	width: 80%;
	align-self: flex-end;
	order: -1;
}

/* div.2 mobile: polaroid group on top, img.3 below full width. */
.spacca-a5-r2 > img {
	width: 100%;
}

.spacca-a5-polaroid {
	display: flex;
	flex-direction: column;
	align-items: center;
	row-gap: 2rem;
	order: -1;
}

.spacca-a5-polaroid img {
	display: block;
	width: 50%;
	height: auto;
}

@media (min-width: 768px) {
	.spacca-a5-r1,
	.spacca-a5-r2 {
		flex-direction: row;
		row-gap: 0;
	}

	.spacca-a5-r1 {
		justify-content: space-between;
		align-items: flex-end;
	}

	.spacca-a5-r1 img:nth-child(1) {
		width: 40%;
	}

	.spacca-a5-r1 img:nth-child(2) {
		width: 30%;
		align-self: auto;
		order: 0;
	}

	.spacca-a5-r2 {
		justify-content: space-between;
		align-items: center;
	}

	.spacca-a5-r2 > img {
		width: 30%;
	}

	.spacca-a5-polaroid {
		width: 60%;
		flex-direction: row;
		justify-content: space-between;
		row-gap: 0;
		order: 0;
	}

	.spacca-a5-polaroid img {
		width: 30%;
	}
}

/* ===== Article 6 - Rough, Strong and Eternal ==========================
   div.1: two photos space-between, bottom-aligned.
   div.2: three photos (20/60/20) with a 3rem column gap, centered.
   img.6: a closing photo at 70% left (desktop) / full width (mobile).
   Mobile: everything stacks; uniform 2rem gap via the media wrapper. */
.spacca-a6-r1,
.spacca-a6-r2 {
	display: flex;
	flex-direction: column;
	row-gap: 2rem;
}

.spacca-a6-r1 img,
.spacca-a6-r2 img {
	display: block;
	height: auto;
}

/* div.1 mobile: img.2 on top 80% right, img.1 below full width. */
.spacca-a6-r1 img:nth-child(1) {
	width: 100%;
}

.spacca-a6-r1 img:nth-child(2) {
	width: 80%;
	align-self: flex-end;
	order: -1;
}

/* div.2 mobile: centered column; img.3 & img.5 at 50%, img.4 full width. */
.spacca-a6-r2 {
	align-items: center;
}

.spacca-a6-r2 img:nth-child(1),
.spacca-a6-r2 img:nth-child(3) {
	width: 50%;
}

.spacca-a6-r2 img:nth-child(2) {
	width: 100%;
}

.spacca-a6-solo {
	display: block;
	width: 100%;
	height: auto;
}

@media (min-width: 768px) {
	.spacca-a6-r1,
	.spacca-a6-r2 {
		flex-direction: row;
		row-gap: 0;
	}

	.spacca-a6-r1 {
		justify-content: space-between;
		align-items: flex-end;
	}

	.spacca-a6-r1 img:nth-child(1) {
		width: 40%;
	}

	.spacca-a6-r1 img:nth-child(2) {
		width: 30%;
		align-self: auto;
		order: 0;
	}

	/* div.2: 20/60/20 with a 3rem column gap; flex-grow keeps the proportions
	   while the gaps fit (no overflow). */
	.spacca-a6-r2 {
		column-gap: 3rem;
	}

	.spacca-a6-r2 img {
		min-width: 0;
		width: auto;
	}

	.spacca-a6-r2 img:nth-child(1),
	.spacca-a6-r2 img:nth-child(3) {
		flex: 20 0 0;
	}

	.spacca-a6-r2 img:nth-child(2) {
		flex: 60 0 0;
	}

	.spacca-a6-solo {
		width: 100%;
	}
}
