/*
 * .service-project-wrapper mobile slider - js/service-project-mobile-slider.js
 * wraps the existing Gutenberg Columns cards into Swiper below 781px, one
 * full-width card at a time, auto-advancing.
 *
 * Gutenberg's own layout CSS fights Swiper here: a Columns block is
 * display:flex with each Column given a fixed flex-basis share (33% for
 * three columns) via its "is-layout-flex" class - once Swiper is moving
 * those columns around with its own transform-based positioning, that
 * flex sizing is still trying to apply underneath it, squashing every
 * slide down to a sliver (or nothing at all, depending on content). These
 * !important rules hand control of layout on the mobile-only .swiper-wrapper
 * sibling back to Swiper itself rather than Gutenberg's generated
 * flex/width rules, which are more specific than a plain class selector
 * and would otherwise win.
 */

.service-project-swiper {
	position: relative;
	overflow: hidden;
	display: block !important;
}

.service-project-swiper > .swiper-wrapper {
	display: flex !important;
}

.service-project-swiper .swiper-slide {
	flex: 0 0 auto !important;
	width: 100% !important;
	height: auto !important;
	/* Deliberately NOT margin-right here - Swiper sets that one inline,
	   per-slide, from the spaceBetween option, and an !important shorthand
	   would always beat that inline style and erase the gap entirely. */
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	margin-left: 0 !important;
}

/*
 * Case Studies section ("Real Projects, Real Results.", .case-studies-wrapper
 * > ul.wp-block-post-template > li.wp-block-post - a Query Loop block, not a
 * Columns block, so js/service-project-mobile-slider.js's Swiper wrapping
 * doesn't apply here). A Swiper wrapper needs a definite height to render
 * anything (its own CSS sets .swiper-wrapper{height:100%}, and this block's
 * <div>/<ul> never had one to inherit), so this is a plain CSS scroll-snap
 * slider instead - the same pattern this theme already uses for
 * .product-post-wrapper ul.wp-block-post-template (style.css, "Product
 * Slider In Mobile Device"), just scoped to this section's own classes so
 * it doesn't fight that section's desktop CSS (.case-studies-wrapper ul{
 * display:flex} / ul li{width:calc(33.33% - 10px)} etc., style.css ~21299).
 */
@media (max-width: 781px) {

	.case-studies-wrapper ul {
		flex-wrap: nowrap !important;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 4px;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}

	.case-studies-wrapper ul::-webkit-scrollbar {
		display: none;
	}

	.case-studies-wrapper ul li {
		width: 85% !important;
		flex: 0 0 auto !important;
		scroll-snap-align: start;
	}
}
