/**
 * Styles for custom theme block patterns (BEM-ish classes added directly in
 * pattern markup, not core Gutenberg block classes). Added 2026-08-16.
 */

/**
 * "tp-block-horizontal" card pattern: media + content side-by-side.
 * Structure: .tp-block-horizontal > .__inner (grid) > .__media, .__content
 * (> .__title-wrap, .__text, .__link).
 */

/* The theme's root-padding-aware layout (useRootPaddingAwareAlignments)
   adds has-global-padding to every nested group, not just the root, so
   padding compounds one step per nesting level. Zero it out for the content
   column and anything inside it so text isn't over-indented. */
.tp-block-horizontal .__content.has-global-padding,
.tp-block-horizontal .__content .has-global-padding {
	padding-left: 0;
	padding-right: 0;
}

@media (max-width: 781px) {
	/* Stack media above content instead of side-by-side grid columns.
	   Scoped selector (rather than relying on the generic is-layout-grid
	   rule in blocks.css) so it wins over the block's own auto-generated
	   wp-container-core-group-is-layout-* column count regardless of
	   stylesheet order. */
	.tp-block-horizontal .__inner {
		grid-template-columns: 1fr !important;
		justify-items: start !important;
	}
}

/**
 * "odd-even" opt-in modifier for a Post Template/Query Loop card grid
 * built from the tp-block card pattern: reverses the media/content column
 * order on every second card, for a "zig-zag" alternating layout.
 * Add "odd-even" as an Additional CSS Class on the Post Template block.
 * Structure: ul.odd-even > li.wp-block-post > ... > .__inner (grid)
 * > .__media, .__content.
 */
.odd-even > li:nth-child(even) .__inner > .__media {
	order: 2;
}

.odd-even > li:nth-child(even) .__inner > .__content {
	order: 1;
}

@media (max-width: 781px) {
	/* Cards stack to a single column below 781px (see the generic
	   is-layout-grid rule in blocks.css) — keep media first in reading
	   order on every card rather than carrying the desktop zig-zag into
	   a stacked layout. */
	.odd-even > li:nth-child(even) .__inner > .__media,
	.odd-even > li:nth-child(even) .__inner > .__content {
		order: initial;
	}
}
