/**
 * Post Grid block styles.
 * Matches Figma Latest Recipes Module (node 823:11689).
 *
 * Desktop: 244px label column + flexible card grid (Figma 823:11689).
 */

.post-grid {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: 1.25rem; /* 20px — Figma: rule → content */
	margin-left: auto;
	margin-right: auto;
	max-width: 100%; /* 1512px — Figma artboard */
	padding: 2.5rem; /* 40px — Figma */
	width: 100%;
}

@media (max-width: 48rem) {
	.post-grid {
		padding: 20px;
	}
}
.post-grid.no-line::before {
	display: none;
}
.post-grid:not(.has-background) {
	background-color: var(--wp--preset--color--periwinkle, #a2b8e7);
}

.post-grid:not(.has-text-color) {
	color: var(--wp--preset--color--coffee, #3c1f10);
}

.post-grid::before {
	background-color: currentColor;
	content: "";
	display: block;
	flex-shrink: 0;
	height: 1px;
	width: 100%;
}

.post-grid__inner {
	box-sizing: border-box;
	display: grid;
	gap: 1.25rem; /* 20px — Figma */
	grid-template-columns: minmax(0, 1fr);
	margin: 0;
	max-width: none;
	width: 100%;
}

/* Cards inherit block text color (borders, category, title). */
.post-grid .post-card,
.post-grid .post-card__category {
	color: inherit;
}

.post-grid .post-card__media {
	border-color: currentColor;
}

.post-grid .post-card__title {
	text-transform: capitalize;
}

/* -------------------------------------------------------------------------
   Header: mono section label — 244px column on desktop (Figma)
   ------------------------------------------------------------------------- */

.post-grid__header {
	min-width: 0;
	width: 100%;
}

.post-grid__header .wp-block-heading,
.post-grid__header h1,
.post-grid__header h2,
.post-grid__header h3,
.post-grid__header h4,
.post-grid__header h5,
.post-grid__header h6,
.editor-styles-wrapper .post-grid__header .wp-block-heading,
.editor-styles-wrapper .post-grid__header h1,
.editor-styles-wrapper .post-grid__header h2,
.editor-styles-wrapper .post-grid__header h3,
.editor-styles-wrapper .post-grid__header h4,
.editor-styles-wrapper .post-grid__header h5,
.editor-styles-wrapper .post-grid__header h6,
.block-editor-block-list__block .post-grid__header .wp-block-heading,
.block-editor-block-list__block .post-grid__header h1,
.block-editor-block-list__block .post-grid__header h2,
.block-editor-block-list__block .post-grid__header h3,
.block-editor-block-list__block .post-grid__header h4,
.block-editor-block-list__block .post-grid__header h5,
.block-editor-block-list__block .post-grid__header h6 {
	color: inherit;
	font-family: var(--wp--preset--font-family--gt-maru-mono, ui-monospace, Consolas, Menlo, monospace) !important;
	font-size: 12px !important;
	font-weight: 500 !important;
	letter-spacing: 0.72px !important;
	line-height: normal !important;
	margin: 0;
	text-transform: uppercase;
}

/* Legacy InnerBlocks (description / See All) — hide if still present. */
.post-grid__header .wp-block-paragraph,
.post-grid__header p,
.post-grid__header .wp-block-buttons,
.post-grid__header .wp-block-button,
.post-grid__header [data-type="core/paragraph"],
.post-grid__header [data-type="core/buttons"],
.post-grid__header [data-type="core/button"] {
	display: none !important;
}

/* -------------------------------------------------------------------------
   Post grid columns
   ------------------------------------------------------------------------- */

.post-grid__grid.archive-wrap {
	margin-left: 0;
	margin-right: 0;
	max-width: none;
	min-width: 0;
	padding-left: 0;
	padding-right: 0;
	width: 100%;
}

.post-grid__grid.archive-wrap--grid {
	display: grid;
	column-gap: 1.25rem; /* 20px — Figma */
	grid-template-columns: repeat(
		min(2, var(--post-grid-columns, 4)),
		minmax(0, 1fr)
	);
	padding-bottom: 0;
	padding-top: 0;
	row-gap: 2.5rem; /* 40px */
}

@media (min-width: 48rem) {
	.post-grid__grid.archive-wrap--grid {
		grid-template-columns: repeat(
			min(3, var(--post-grid-columns, 4)),
			minmax(0, 1fr)
		);
	}
}

/* Desktop: 244px title track + card grid (above 1080px). */
@media (min-width: 67.5625rem) {
	.post-grid__inner {
		align-items: start;
		grid-template-columns: 15.25rem minmax(0, 1fr); /* 244px + fluid grid */
	}

	.post-grid__header {
		grid-column: 1;
		width: 15.25rem;
	}

	.post-grid__grid.archive-wrap--grid,
	.post-grid__editor-preview {
		grid-column: 2;
		min-width: 0;
	}

	.post-grid__grid.archive-wrap--grid {
		grid-template-columns: repeat(
			var(--post-grid-columns, 4),
			minmax(0, 1fr)
		);
	}
}

/* ≤1080px — stacked header + 2×2 post grid. */
@media (max-width: 67.5rem) {
	.post-grid__inner {
		grid-template-columns: minmax(0, 1fr);
	}

	.post-grid__header {
		grid-column: auto;
		width: 100%;
	}

	.post-grid__grid.archive-wrap--grid,
	.post-grid__editor-preview {
		grid-column: auto;
	}
}

@media (max-width: 67.5rem) {
	.post-grid__grid.archive-wrap--grid {
		grid-template-columns: repeat(
			min(2, var(--post-grid-columns, 4)),
			minmax(0, 1fr)
		);
	}
}

.post-grid__empty {
	color: inherit;
	font-family: var(--wp--preset--font-family--pp-neue-montreal, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
	font-size: 1rem;
	margin: 0;
	opacity: 0.75;
}

/* Editor: SSR preview sits in the posts span */
.post-grid__editor-preview {
	margin-top: 0;
	min-width: 0;
	width: 100%;
}

.post-grid__editor-preview .post-grid {
	background: transparent;
	margin: 0;
	max-width: none;
	padding: 0;
}

.post-grid__editor-preview .post-grid::before {
	display: none;
}

.post-grid__editor-preview .post-grid__inner {
	display: contents;
	margin: 0;
	max-width: none;
	padding: 0;
}
