/* Site-wide mobile refinements (max 782px). Desktop is untouched. */
@media (max-width: 782px) {

	/* ---------- header ---------- */
	.wp-block-site-logo img.custom-logo {
		max-height: 46px;
		width: auto;
		height: auto;
	}
	.wp-block-site-logo { margin: 0 !important; }
	.wp-block-site-logo .custom-logo-link { display: block; }



	/* menu toggle: real tap target */
	.wp-block-navigation__responsive-container-open,
	.wp-block-navigation__responsive-container-close {
		min-width: 44px;
		min-height: 44px;
		padding: 10px;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}

	/* header button: smaller, still tappable */
	header.wp-block-template-part .wp-block-button__link {
		padding: 12px 18px !important;
		font-size: 15px !important;
		min-height: 44px;
		display: inline-flex;
		align-items: center;
	}

	/* ---------- spacing ---------- */
	.wp-site-blocks > .wp-block-group,
	.wp-block-group.has-background {
		background-size: cover;
	}
	.wp-block-post-content > .wp-block-group,
	.entry-content > .wp-block-group {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	/* hero type scale down a notch */
	h1, .wp-block-heading.has-giga-font-size {
		font-size: clamp(1.9rem, 7vw, 2.5rem) !important;
		line-height: 1.2 !important;
	}
	h2, .wp-block-heading.has-mega-font-size {
		font-size: clamp(1.5rem, 5.6vw, 2rem) !important;
	}

	/* keep long words/URLs from breaking layout */
	body { overflow-x: hidden; }
	img, video, iframe { max-width: 100%; height: auto; }

	/* tables scroll instead of squashing */
	.wp-block-table { overflow-x: auto; }
	.wp-block-table table { min-width: 480px; }

	/* ---------- cookie consent: compact ---------- */
	#mm-consent {
		left: 10px;
		right: 10px;
		bottom: 10px;
		padding: 10px 12px !important;
		font-size: 12px !important;
		line-height: 1.35 !important;
		border-radius: 12px !important;
		box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
	}
	#mm-consent p { margin: 0 0 8px !important; }
	#mm-consent > div { gap: 6px !important; }
	#mm-consent button {
		padding: 8px 12px !important;
		font-size: 12px !important;
		min-height: 36px;
		flex: 0 1 auto;
	}
}

/* ---------- plugin pages ---------- */
@media (max-width: 640px) {
	/* stepper: numbers only, so it never clips */
	.mmbook-progress { padding: 5px; gap: 2px; }
	.mmbook-progress li { font-size: 0; padding: 7px 10px; gap: 0; }
	.mmbook-progress li::before { width: 22px; height: 22px; font-size: 0.75rem; }
	.mmbook-progress li.now { font-size: 0.82rem; }
	.mmbook-progress li.now::before { margin-right: 6px; }

	/* job browser: panes stay short and scroll, never a 2,500px page list */
	.mmbook-browser { gap: 12px !important; }
	#b-cats, #b-subs, #b-jobs, .mmbook-pane-list {
		max-height: 42vh !important;
		overflow-y: auto !important;
		-webkit-overflow-scrolling: touch;
		padding-right: 2px;
	}
	/* empty panes (types/jobs before a choice is made) just waste space */
	.mmbook-pane:not(:has(.mmbook-pane-list > *)) { display: none; }
	.mmbook-pane + .mmbook-pane { border-top: 1px solid var(--mm-border); padding-top: 10px; }
	.mmbook-pane button { min-height: 44px; text-align: left; }
	.mmbook-pane h3 { position: sticky; top: 0; background: #fff; padding: 4px 0 6px; z-index: 2; }

	.mmbook-card { padding: 18px 16px; border-radius: 18px; }
	.mmbook-main, .mmbook-wrap { padding-left: 14px; padding-right: 14px; }
	.mmbook-fields { gap: 12px; }
	.mmbook-searchbar input { padding: 14px 14px 14px 42px; font-size: 0.95rem; }
	.mmbook-slots { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
	.mmbook-tabs .mmbook-tab { padding: 9px 14px; font-size: 0.86rem; }
	.mmacct-booking-top { flex-direction: column; }
	.mmacct-when { text-align: left; }
	.mmacct-photos { gap: 6px; }
	.mmacct-photo { width: 30%; }
}

/* header: keep logo, menu and CTA on one line */
@media (max-width: 782px) {
	header.wp-block-template-part .is-layout-flex {
		flex-wrap: nowrap !important;
		align-items: center !important;
	}
	header.wp-block-template-part .wp-block-group { padding-top: 6px !important; padding-bottom: 6px !important; }
	header.wp-block-template-part .wp-block-button__link {
		font-size: 13px !important;
		padding: 10px 14px !important;
		min-height: 40px;
		white-space: nowrap;
	}
	header.wp-block-template-part .wp-block-site-logo img.custom-logo { max-height: 42px; }
	header.wp-block-template-part nav { margin: 0 !important; }
	/* social row sits above without extra gap */
	header.wp-block-template-part .wp-block-social-links { margin: 0 !important; }
}

/* account header: buttons side by side, tighter */
@media (max-width: 640px) {
	.mmacct-head-actions { flex-direction: row !important; flex-wrap: wrap; gap: 8px; }
	.mmacct-head-actions .mmbook-btn { padding: 10px 16px; font-size: 0.9rem; }
	.mmacct-head { padding-top: 8px; }
	.mmacct-tabs { gap: 6px; }
}

/* footer: stack the columns on phones instead of squeezing them */
@media (max-width: 782px) {
	footer .wp-block-columns { flex-wrap: wrap !important; gap: 18px !important; }
	footer .wp-block-columns > .wp-block-column { flex-basis: 100% !important; flex-grow: 1 !important; min-width: 0; }
	footer .wp-block-group { padding-top: 0; padding-bottom: 0; }
	footer h1, footer h2, footer h3, footer h4 { font-size: 1.05rem !important; }
	footer p, footer li { font-size: 0.92rem !important; line-height: 1.5 !important; }
	footer .wp-block-social-links { flex-wrap: wrap; }
	footer ul { margin: 0 !important; padding: 0 !important; }
	footer li { margin: 0 0 6px !important; }
	footer .wp-block-group { margin-top: 12px !important; }
	footer > * { padding-bottom: 12px !important; }
}

/* ---------- mobile menu panel ---------- */
@media (max-width: 782px) {
	.wp-block-navigation__responsive-container.is-menu-open {
		background: #ffffff !important;
		padding: 0 !important;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
		padding: 72px 22px 28px !important;
		width: 100%;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
		width: 100%;
		gap: 0 !important;
		align-items: stretch !important;
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
		width: 100%;
		border-bottom: 1px solid rgba(27, 29, 29, 0.08);
	}
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
		display: block;
		width: 100%;
		padding: 16px 2px !important;
		font-size: 1.05rem;
		font-weight: 500;
		text-align: left;
	}
	.wp-block-navigation__responsive-container-close {
		position: absolute;
		top: 10px;
		right: 10px;
		width: 44px;
		height: 44px;
		padding: 10px;
		border-radius: 10px;
		background: #f5f8f6;
	}
	/* first item reads as the primary action */
	.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item:first-child .wp-block-navigation-item__content {
		color: var(--wp--preset--color--primary, #045cb4);
		font-weight: 600;
	}
}

/* ---------- tap targets ---------- */
@media (max-width: 782px) {

	/* homepage category / service title links: full-width rows, easy to hit */
	a[class*="postcategory"],
	a[class*="servicetitle"],
	.post-category a { display: flex; align-items: center; min-height: 44px; padding: 8px 0; }
	footer a { display: inline-block; padding: 6px 0; min-height: 34px; }
	.skip-link { position: absolute; }
}

/* Phones: the slim booking header is now the site-wide header */
@media (max-width: 782px) {
	header .wp-block-group.has-primary-background-color:has(.wp-block-social-links),
	header .wp-block-social-links { display: none !important; }
	header .wp-block-site-logo img.custom-logo { max-height: 40px !important; }
	header .wp-block-group { padding-top: 2px !important; padding-bottom: 2px !important; }
	header .wp-block-site-logo, header .wp-block-site-logo a { display: flex; align-items: center; line-height: 0; }
	header .wp-block-navigation { margin: 0 !important; }
	header.wp-block-template-part { border-bottom: 1px solid rgba(27, 29, 29, 0.08); padding-bottom: 4px; }
	.mmbook-page .mmbook-progress { margin-top: 4px; }
}

/* booking step 1 on a phone: one level at a time instead of three stacked lists */
@media (max-width: 640px) {
	.mmbook-mobileback { margin: 0 0 8px; }
	.mmbook-mobileback .mmbook-link-btn { font-size: 0.9rem; padding: 8px 2px; min-height: 40px; }
	#mm-browser.lvl-0 > .mmbook-pane:nth-child(2),
	#mm-browser.lvl-0 > .mmbook-pane:nth-child(3),
	#mm-browser.lvl-1 > .mmbook-pane:nth-child(1),
	#mm-browser.lvl-2 > .mmbook-pane:nth-child(1),
	#mm-browser.lvl-2 > .mmbook-pane:nth-child(2) { display: none; }
	#mm-browser.lvl-1 > .mmbook-pane + .mmbook-pane { border-top: 1px solid var(--mm-border); padding-top: 10px; }
	#mm-browser.lvl-1 #b-jobs { max-height: 40vh !important; }
	#mm-browser.lvl-2 #b-jobs { max-height: 58vh !important; }
}

/* booking step 2 on a phone: week nav full width, fee chips scroll */
@media (max-width: 640px) {
	.mmbook-timecontrols { display: block !important; }
	.mmbook-layout, .mmbook-step, .mmbook-timecontrols { min-width: 0 !important; max-width: 100%; }
	.mmbook-weeknav {
		width: 100%;
		max-width: 100%;
		box-sizing: border-box;
		justify-content: space-between;
		margin-bottom: 10px;
		padding: 6px;
		overflow: hidden;
	}
	.mmbook-weeknav span {
		min-width: 0 !important;
		flex: 1 1 auto;
		font-size: 0.86rem;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.mmbook-weekbtn { min-width: 40px; min-height: 40px; }
	.mmbook-feefilter {
		display: flex !important;
		flex-wrap: nowrap !important;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		gap: 6px;
		padding-bottom: 4px;
		scrollbar-width: none;
	}
	.mmbook-feefilter::-webkit-scrollbar { display: none; }
	.mmbook-feefilter > * { flex: 0 0 auto; padding: 8px 14px; font-size: 0.85rem; }
	.mmbook-days { gap: 6px; }
	.mmbook-day-tab { min-width: 84px; padding: 10px 8px; }
	.mmbook-slots { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
	.mmbook-slot { padding: 12px 8px; }
	/* Back is a quiet secondary action, not a full-width slab */
	.mmbook-actions { display: flex !important; flex-direction: row !important; gap: 8px; align-items: center; }
	.mmbook-actions .mmbook-btn { width: auto !important; flex: 0 0 auto; }
	.mmbook-actions .mmbook-btn-ghost { padding: 10px 16px; font-size: 0.9rem; }
	.mmbook-actions .mmbook-btn-primary { flex: 1 1 auto; }
}

/* Header CTA removed on the owner's request (all screen sizes). The menu still carries
   "Book a repair", so the booking route is one tap away. */
header .wp-block-buttons { display: none !important; }
