/* Suntyp Block — blog templates */

.suntyp-main {
	padding-block-end: var(--wp--preset--spacing--80, 4rem);
}

.suntyp-archive-header :where(.wp-block-query-title) {
	text-wrap: balance;
}

.suntyp-post-meta {
	align-items: center;
}

.suntyp-post-meta :where(.wp-block-post-date, .wp-block-post-author, .wp-block-post-terms) {
	margin: 0;
}

/* Grid — consistent column + row gap from the spacing scale */
.suntyp-query--grid .wp-block-post-template {
	gap: var(--wp--preset--spacing--60, 2rem);
}

/* Archive column count (excludes the home custom grid, which sets its own columns) */
body.suntyp-blog-cols-1:not(.suntyp-blog-single) .suntyp-query--grid:not(.suntyp-home-grid) .wp-block-post-template {
	grid-template-columns: minmax(0, 1fr) !important;
}

body.suntyp-blog-cols-2:not(.suntyp-blog-single) .suntyp-query--grid:not(.suntyp-home-grid) .wp-block-post-template {
	grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

body.suntyp-blog-cols-3:not(.suntyp-blog-single) .suntyp-query--grid:not(.suntyp-home-grid) .wp-block-post-template {
	grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

@media (max-width: 47.99rem) {
	.suntyp-query--grid:not(.suntyp-home-grid) .wp-block-post-template {
		grid-template-columns: minmax(0, 1fr) !important;
	}
}

.suntyp-query--grid.suntyp-related-posts .wp-block-post-template {
	grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 47.99rem) {
	.suntyp-query--grid.suntyp-related-posts .wp-block-post-template {
		grid-template-columns: 1fr !important;
	}
}

/* List */
.suntyp-query--list .suntyp-post-list-item {
	padding-block-end: var(--wp--preset--spacing--50, 1.5rem);
	border-block-end: 1px solid var(--wp--preset--color--border, #e2e8f0);
}

.suntyp-query--list .suntyp-post-list-item:last-child {
	border-block-end: 0;
	padding-block-end: 0;
}

@media (max-width: 35.99rem) {
	.suntyp-query--list .suntyp-post-list-item {
		flex-direction: column;
	}

	.suntyp-query--list .wp-block-post-featured-image {
		inline-size: 100% !important;
		max-inline-size: 100%;
	}
}

/* Post card — spacing system (full-bleed image + padded body, equal height) */
.suntyp-post-card {
	display: flex;
	flex-direction: column;
	block-size: 100%;
	padding: 0;
	overflow: hidden;
}

.suntyp-post-card__image {
	margin: 0;
}

/* Collapse the image slot entirely when a post has no featured image */
.suntyp-post-card__image:not(:has(img)) {
	display: none;
}

:where(.suntyp-post-card__image img) {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.suntyp-post-card__body {
	flex: 1 1 auto;
}

.suntyp-post-card__title {
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.suntyp-post-card__excerpt {
	line-height: 1.6;
}

:where(.suntyp-post-card__excerpt .wp-block-post-excerpt__excerpt) {
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.suntyp-post-card__footer {
	margin-block-start: auto;
	padding-block-start: var(--wp--preset--spacing--50, 1.5rem);
}

:where(.suntyp-post-card .suntyp-post-meta) {
	gap: var(--wp--preset--spacing--30, 0.75rem);
}

:where(.suntyp-post-card .wp-block-read-more) {
	font-weight: 600;
	text-decoration: none;
}

/* Card: category and date links use normal text color, no underline */
.suntyp-post-card :where(.wp-block-post-terms a, .wp-block-post-date a) {
	text-decoration: none;
	color: var(--wp--preset--color--secondary, #475569);
}

/* Single */
.suntyp-entry :where(.wp-block-post-content) {
	margin-block-start: var(--wp--preset--spacing--50, 1.5rem);
}

.suntyp-author-box :where(.wp-block-post-author) {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: var(--wp--preset--spacing--40, 1rem);
	align-items: start;
}

.suntyp-author-box :where(.wp-block-post-author__avatar) {
	margin: 0;
}

.suntyp-related :where(.wp-block-heading) {
	margin-block-end: var(--wp--preset--spacing--50, 1.5rem);
}

/* Pagination */
:where(.suntyp-pagination) {
	gap: var(--wp--preset--spacing--30, 0.75rem);
}

:where(.suntyp-pagination .wp-block-query-pagination-previous, .suntyp-pagination .wp-block-query-pagination-next, .suntyp-pagination .page-numbers) {
	padding: 0.5rem 0.875rem;
	border: 1px solid var(--wp--preset--color--border, #e2e8f0);
	border-radius: var(--st-radius, 0.375rem);
	text-decoration: none;
}

:where(.suntyp-pagination .page-numbers.current) {
	background: var(--wp--preset--color--primary, #2563eb);
	border-color: var(--wp--preset--color--primary, #2563eb);
	color: var(--wp--preset--color--base, #fff);
}

/* GenerateBlocks in blog content */
:where(.suntyp-entry .gb-container, .suntyp-entry .gb-element) {
	max-inline-size: var(--gb-container-width, var(--wp--style--global--content-size));
}
