/*
 * PressCreate WP Core — Base stylesheet
 *
 * Handles layout corrections that theme.json cannot express,
 * primarily alignwide / alignfull breakout within constrained containers.
 */

/* =============================================================================
   Align wide — constrain to wide-size with auto margins
   ============================================================================= */
.is-layout-constrained > .alignwide {
	max-width: var( --wp--style--global--wide-size );
	margin-left: auto !important;
	margin-right: auto !important;
}

/* =============================================================================
   Align full — break out of root padding on both sides
   ============================================================================= */
.is-layout-constrained > .alignfull {
	max-width: 100vw;
	width: calc( 100% + var( --wp--style--root--padding-left, 0px ) + var( --wp--style--root--padding-right, 0px ) );
	margin-left: calc( -1 * var( --wp--style--root--padding-left, 0px ) ) !important;
	margin-right: calc( -1 * var( --wp--style--root--padding-right, 0px ) ) !important;
}

/* =============================================================================
   Nested constrained containers — alignfull should still break out fully
   ============================================================================= */
.is-layout-constrained .is-layout-constrained > .alignfull {
	margin-left: calc( -1 * var( --wp--style--root--padding-left, 0px ) ) !important;
	margin-right: calc( -1 * var( --wp--style--root--padding-right, 0px ) ) !important;
	width: 100vw;
	max-width: 100vw;
	position: relative;
	left: 50%;
	transform: translateX( -50% );
}

/* =============================================================================
   Post cards — grid layout (index / home templates)
   ============================================================================= */

.post-card {
	height: 100%;
}

.post-card .wp-block-post-featured-image {
	overflow: hidden;
}

.post-card .wp-block-post-featured-image img {
	width: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.post-card .wp-block-post-featured-image a:hover img {
	transform: scale( 1.03 );
}

.post-card__body {
	flex: 1;
}

/* Two columns on tablet */
@media ( max-width: 1023px ) {
	.wp-block-query .wp-block-post-template.is-layout-grid {
		grid-template-columns: repeat( 2, 1fr ) !important;
	}
}

/* Single column on mobile */
@media ( max-width: 599px ) {
	.wp-block-query .wp-block-post-template.is-layout-grid {
		grid-template-columns: 1fr !important;
	}
}

/* =============================================================================
   Post list — single column layout (post-list template)
   ============================================================================= */

.post-list-item .wp-block-post-featured-image {
	flex-shrink: 0;
	overflow: hidden;
}

.post-list-item .wp-block-post-featured-image img {
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.post-list-item .wp-block-post-featured-image a:hover img {
	transform: scale( 1.03 );
}

.post-list-item__body {
	flex: 1;
}

/* Stack on mobile */
@media ( max-width: 599px ) {
	.post-list-item.wp-block-group {
		flex-direction: column;
	}
}

/* =============================================================================
   Related Posts block
   ============================================================================= */

.pc-related-posts__title {
	margin-bottom: 1.5rem;
}

.pc-related-posts__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: var( --wp--preset--spacing--md, 2rem );
	grid-template-columns: repeat( var( --pc-related-cols, 3 ), 1fr );
}

.pc-related-posts--cols-1 { --pc-related-cols: 1; }
.pc-related-posts--cols-2 { --pc-related-cols: 2; }
.pc-related-posts--cols-3 { --pc-related-cols: 3; }
.pc-related-posts--cols-4 { --pc-related-cols: 4; }

.pc-related-posts__card {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.pc-related-posts__image {
	display: block;
	overflow: hidden;
	margin-bottom: 0.75rem;
}

.pc-related-posts__image img {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.pc-related-posts__image:hover img {
	transform: scale( 1.03 );
}

.pc-related-posts__body {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.pc-related-posts__post-title {
	margin: 0;
}

.pc-related-posts__post-title a {
	text-decoration: none;
}

.pc-related-posts__post-title a:hover {
	text-decoration: underline;
}

.pc-related-posts__date,
.pc-related-posts__excerpt {
	margin: 0;
}

/* Responsive */
@media ( max-width: 1023px ) {
	.pc-related-posts--cols-3,
	.pc-related-posts--cols-4 {
		--pc-related-cols: 2;
	}
}

@media ( max-width: 599px ) {
	.pc-related-posts__grid {
		--pc-related-cols: 1 !important;
	}
}

/* =============================================================================
   Check List block style
   ============================================================================= */

.is-style-check-list {
	list-style: none;
	padding-left: 0;
}

.is-style-check-list li {
	display: flex;
	align-items: flex-start;
	gap: 0.6em;
	padding-left: 0;
}

.is-style-check-list .pc-check-icon {
	width: 1em;
	height: 1em;
	flex-shrink: 0;
	margin-top: 0.2em;
	fill: currentColor;
}