/*
 * CroatiaRentalCars compact mobile layout (phones, up to 781px).
 * Goal: less scrolling. Long stacks of cards become swipeable rows, small cards sit two or three
 * per row, and section spacing is tighter. Content and links are unchanged.
 * Switch: Appearance > Travel Tools & Trust > "Compact mobile layout".
 */
@media (max-width: 781px) {

	/* No sideways page drag (a 12px overflow was found on the homepage). clip keeps sticky bars working. */
	html, body { overflow-x: clip; }

	/* ---------- Section rhythm ---------- */
	body.crc-mobile .wp-block-post-content > .wp-block-group:not(.top-search-location),
	body.crc-mobile .wp-block-post-content > section.wp-block-group {
		padding-top: 36px !important;
		padding-bottom: 36px !important;
		margin-top: 0 !important;
	}
	body.crc-mobile .wp-block-post-content h2.wp-block-heading { font-size: clamp(23px, 6.4vw, 27px) !important; line-height: 1.2 !important; margin-bottom: 8px !important; }
	body.crc-mobile .wp-block-post-content h2.wp-block-heading + p,
	body.crc-mobile .wp-block-post-content .sub-heading + h2 + p { font-size: 14.5px !important; line-height: 1.55 !important; }

	/* ---------- Swipe rows (shared) ---------- */
	body.crc-mobile .popular-searches-wrapper:not(.category-page),
	body.crc-mobile .one-way-rental .one-way-grid,
	body.crc-mobile .journey-car-deals,
	body.crc-mobile .reviews-list ul,
	body.crc-mobile .cross-tabs .cards:not(.swiper-initialized),
	body.crc-mobile .tips-tabs .tab-pane.active,
	body.crc-mobile .local-driving-insights .section-highlights {
		display: flex !important;
		flex-wrap: nowrap !important;
		grid-template-columns: none !important;
		gap: 12px !important;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scroll-padding-inline: 16px;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
		margin-left: -16px !important;
		margin-right: -16px !important;
		padding: 4px 16px 12px !important;
		max-height: none !important;
	}
	body.crc-mobile .popular-searches-wrapper:not(.category-page)::-webkit-scrollbar,
	body.crc-mobile .one-way-rental .one-way-grid::-webkit-scrollbar,
	body.crc-mobile .journey-car-deals::-webkit-scrollbar,
	body.crc-mobile .reviews-list ul::-webkit-scrollbar,
	body.crc-mobile .local-driving-insights .section-highlights::-webkit-scrollbar { display: none; }

	body.crc-mobile .popular-searches-wrapper:not(.category-page) > *,
	body.crc-mobile .one-way-rental .one-way-grid > .wp-block-group,
	body.crc-mobile .journey-car-deals > .wp-block-column,
	body.crc-mobile .reviews-list ul > li,
	body.crc-mobile .cross-tabs .cards:not(.swiper-initialized) > .card,
	body.crc-mobile .tips-tabs .tab-pane.active > .tips-item,
	body.crc-mobile .local-driving-insights .section-highlights > .wp-block-group {
		flex: 0 0 80% !important;
		width: 80% !important;
		max-width: 320px !important;
		margin: 0 !important;
		scroll-snap-align: start;
	}

	/* One-way routes: all routes in the swipe row, no "View More" needed. */
	body.crc-mobile .one-way-grid > .wp-block-group:nth-child(n + 5) { display: block !important; }
	body.crc-mobile #oneWayViewMore,
	body.crc-mobile .one-way-rental .one-way-grid + .wp-block-buttons { display: none !important; }

	/* Reviews: horizontal cards instead of a 600px inner scroll box. */
	body.crc-mobile .home-reviews-sec { height: auto !important; max-height: none !important; overflow: visible !important; }
	body.crc-mobile .reviews-list ul > li { max-height: 360px; overflow: auto; }

	/* Why book: six reason boxes two per row. */
	body.crc-mobile .wp-block-group:has(> .why-book-box) {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 8px !important;
	}
	body.crc-mobile .why-book-box { margin: 0 !important; padding: 12px !important; flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }
	body.crc-mobile .why-book-box > * { width: 100% !important; flex-basis: auto !important; }
	body.crc-mobile .why-book-box img, body.crc-mobile .why-book-box figure { width: 32px !important; max-width: 32px !important; }
	body.crc-mobile .why-book-box .wp-block-heading { font-size: 14px !important; line-height: 1.3 !important; }
	body.crc-mobile .why-book-box p { font-size: 12.5px !important; line-height: 1.45 !important; }

	/* Local driving facts: decorative connectors do not fit a swipe row. */
	body.crc-mobile .local-driving-insights .section-highlights > .wp-block-group::after,
	body.crc-mobile .local-driving-insights .section-highlights > .wp-block-group::before { display: none !important; }

	/* ---------- Small cards: two or three per row ---------- */
	body.crc-mobile .success-counters .wp-block-group.is-layout-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
		gap: 8px !important;
	}
	body.crc-mobile .success-counters .wp-block-group.is-layout-grid > .wp-block-group {
		padding: 12px 8px !important;
		text-align: center;
	}
	body.crc-mobile .success-counters .wp-block-group.is-layout-grid > .wp-block-group > figure,
	body.crc-mobile .success-counters .wp-block-group.is-layout-grid > .wp-block-group > .wp-block-image,
	body.crc-mobile .success-counters .wp-block-group.is-layout-grid > .wp-block-group p:last-of-type:not(:first-of-type) { display: none !important; }
	body.crc-mobile .success-counters h3.wp-block-heading,
	body.crc-mobile .success-counters .counter-heading { font-size: 22px !important; }
	body.crc-mobile .success-counters h4, body.crc-mobile .success-counters strong { font-size: 13px !important; }

	body.crc-mobile .wp-block-group.why-book-grid {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 10px !important;
	}
	body.crc-mobile .wp-block-group.why-book-grid > .wp-block-group { padding: 12px !important; margin: 0 !important; }
	body.crc-mobile .wp-block-group.why-book-grid > .wp-block-group h3,
	body.crc-mobile .wp-block-group.why-book-grid > .wp-block-group .wp-block-heading { font-size: 14.5px !important; line-height: 1.3 !important; }
	body.crc-mobile .wp-block-group.why-book-grid > .wp-block-group p { font-size: 12.5px !important; line-height: 1.45 !important; }
	/* The large photo beside "Why Book With Us?" is decorative on phones. */
	body.crc-mobile .alignfull.why-book .wp-block-columns > .wp-block-column > .wp-block-image,
	body.crc-mobile .alignfull.why-book .wp-block-columns > .wp-block-column:has(> .wp-block-image:only-child) { display: none !important; }

	/* ---------- Tables: tighter rows ---------- */
	body.crc-mobile .wp-block-post-content .wp-block-table td,
	body.crc-mobile .wp-block-post-content .wp-block-table th { padding: 8px 10px !important; font-size: 13.5px !important; line-height: 1.4 !important; }

	/* ---------- FAQ: tighter questions ---------- */
	body.crc-mobile .faq-item { margin-bottom: 8px !important; }
	body.crc-mobile .faq-item h3.wp-block-heading, body.crc-mobile .faq-item h4.wp-block-heading { font-size: 15px !important; }

	/* ---------- Footer: two link columns ---------- */
	body.crc-mobile footer .wp-block-columns { gap: 16px !important; }
}

/* Swipe hint: a soft edge shows there is more to the right. */
@media (max-width: 781px) and (prefers-reduced-motion: no-preference) {
	body.crc-mobile .popular-searches-wrapper:not(.category-page),
	body.crc-mobile .one-way-rental .one-way-grid,
	body.crc-mobile .journey-car-deals { scroll-behavior: smooth; }
}
