/**
 * layout.css
 * Containers, grids, section rhythm. Breakpoints tested against §21:
 * desktop 1920/1440/1280, tablet 1024/768, mobile 430/390/375/320.
 */

/* ---------------------------------------------------------------
 * Container
 * ------------------------------------------------------------- */
.container {
	width: 100%;
	max-width: var(--container-width);
	margin-inline: auto;
	padding-inline: var(--container-padding);
}

.content-area {
	padding-block: var(--space-5) var(--space-6);
}

.content-area--narrow {
	max-width: 760px;
	margin-inline: auto;
}

/* ---------------------------------------------------------------
 * Section rhythm — every homepage/shop section uses this for
 * consistent vertical spacing instead of one-off margins.
 * ------------------------------------------------------------- */
.section {
	padding-block: var(--space-6);
}

.section--tight {
	padding-block: var(--space-5);
}

.section__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
}

.section__title {
	font-size: var(--font-size-h3);
}

.section__link {
	display: inline-flex;
	align-items: center;
	gap: var(--space-1);
	font-size: var(--font-size-small);
	font-weight: 600;
	color: var(--color-text);
	white-space: nowrap;
}

.section__link svg {
	width: 16px;
	height: 16px;
}

/* ---------------------------------------------------------------
 * Grid
 * Desktop: 4 cols · Tablet: 3 cols · Mobile: 2 cols (§9).
 * ------------------------------------------------------------- */
.grid {
	display: grid;
	gap: var(--space-3);
	grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 1024px) {
	.grid,
	.grid--3 {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.grid,
	.grid--3,
	.grid--2 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.grid--single-mobile {
		grid-template-columns: 1fr;
	}
}

/* ---------------------------------------------------------------
 * Two-column layout used by shop-with-sidebar, checkout, single
 * product. Sidebar collapses above content on tablet/mobile.
 * ------------------------------------------------------------- */
.layout-with-sidebar {
	display: grid;
	grid-template-columns: 260px 1fr;
	gap: var(--space-5);
	align-items: start;
}

@media (max-width: 1024px) {
	.layout-with-sidebar {
		grid-template-columns: 1fr;
	}
}

/* ---------------------------------------------------------------
 * Post list (blog index) — single column, comfortable reading width.
 * ------------------------------------------------------------- */
.post-list {
	display: flex;
	flex-direction: column;
	gap: var(--space-6);
}

/* ---------------------------------------------------------------
 * Utility: visually hide overflow-causing elements never happen —
 * safety net rather than a fix; see §21 "no horizontal scroll".
 * ------------------------------------------------------------- */
html, body {
	max-width: 100vw;
	overflow-x: hidden;
}
