/**
 * “4 steps” section — tabs, image carousel, CTAs (template-parts/section-moving-steps.php).
 *
 * @package Beaver_Movers
 */

/* -------------------------------------------------------------------------
 * 4 steps
 * ------------------------------------------------------------------------- */
.beaver-moving-steps {
	/* Match image track + text panels-track (<900px) */
	--bms-carousel-duration: 0.45s;
	--bms-carousel-ease: cubic-bezier(0.33, 1, 0.68, 1);
	position: relative;
	margin-top: 108px;
	padding: 0;
	background: var(--bm-color-bg-page, #fff);
}

.beaver-moving-steps__page-title {
	font-family: var(--bm-font-nav, inherit);
	font-weight: 700;
	font-size: 32px;
	text-align: center;
	text-transform: uppercase;
	color: var(--bm-color-text-heading, #2c2008);
	margin: 0 auto 32px;
	max-width: 48rem;
	line-height: 1.2;
}

.beaver-moving-steps__tabs {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	/* 24px from stepper row to image slider (Figma) */
	margin-bottom: 24px;
}

.beaver-moving-steps__tab {
	display: inline-block;
	align-items: center;
	gap: 0.25rem;
	padding: 16px 8px;
	border: none;
	border-radius: var(--bm-radius-pill, 90px);
	background: transparent;
	font-family: var(--bm-font-nav, inherit);
	font-weight: 600;
	font-size: 16px;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	color: var(--bm-color-text-main, #151515);
	cursor: pointer;
	transition: color 0.2s ease, background 0.2s ease, opacity 0.2s ease;
	box-shadow: none;
}

/* Figma: #FF4600 on hover, focus, and selected (active step) */
.beaver-moving-steps__tab:hover,
.beaver-moving-steps__tab:focus-visible,
.beaver-moving-steps__tab--active,
.beaver-moving-steps__tab[aria-selected="true"] {
	color: var(--bm-color-moving-steps-tab-accent, #ff4600);
	background: transparent;
}

.beaver-moving-steps__tab:hover .beaver-moving-steps__tab-chevron,
.beaver-moving-steps__tab:focus-visible .beaver-moving-steps__tab-chevron,
.beaver-moving-steps__tab--active .beaver-moving-steps__tab-chevron,
.beaver-moving-steps__tab[aria-selected="true"] .beaver-moving-steps__tab-chevron {
	opacity: 1;
}

.beaver-moving-steps__tab:focus-visible {
	outline: 2px solid var(--bm-color-moving-steps-tab-accent, #ff4600);
	outline-offset: 3px;
}

.beaver-moving-steps__tab--active:focus-visible,
.beaver-moving-steps__tab[aria-selected="true"]:focus-visible {
	outline-color: var(--bm-color-moving-steps-tab-accent, #ff4600);
}

.beaver-moving-steps__tab-chevron {
	display: inline-flex;
	opacity: 0.85;
}

/* <900px: one tab; hide image arrows; swipe text in `.beaver-moving-steps__panels-viewport` only; CTAs stay put */
@media (max-width: 899px) {
	.beaver-moving-steps__tab[aria-selected="false"] {
		display: none;
	}

	.beaver-moving-steps__tab .beaver-moving-steps__tab-chevron {
		display: none;
	}

	.beaver-moving-steps__carousel-nav {
		display: none !important;
	}

	.beaver-moving-steps__panels-viewport {
		touch-action: pan-y;
		overflow: hidden;
	}
}

.beaver-moving-steps__layout {
	position: relative;
	display: grid;
	grid-template-columns: 1fr;
	gap: 40px;
	align-items: start;
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 80px;
}

@media (min-width: 900px) {
	.beaver-moving-steps__layout {
		grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
		gap: 40px;
		align-items: stretch;
	}

	.beaver-moving-steps__media {
		display: block !important;
		width: 100%;
		max-width: 938px;
		margin: 0 auto;
		border-radius: var(--bm-radius-card, 20px);
		overflow: hidden;
		min-height: 180px;
	}
}

.beaver-moving-steps__media {
	display: none;
}

.beaver-moving-steps__slides {
	position: relative;
	border-radius: inherit;
	overflow: hidden;
}

/* Horizontal slide animation (--beaver-ms-count on .beaver-moving-steps__slides, --beaver-ms-index on track) */
.beaver-moving-steps__track {
	display: flex;
	width: calc(100% * var(--beaver-ms-count, 4));
	transform: translateX(calc(-100% * var(--beaver-ms-index, 0) / var(--beaver-ms-count, 4)));
	transition: transform var(--bms-carousel-duration) var(--bms-carousel-ease);
	will-change: transform;
}

.beaver-moving-steps__slide {
	flex: 0 0 calc(100% / var(--beaver-ms-count, 4));
	margin: 0;
	min-width: 0;
	box-sizing: border-box;
}

@media (prefers-reduced-motion: reduce) {

	.beaver-moving-steps__track,
	.beaver-moving-steps__panels-track {
		transition: none;
	}
}

.beaver-moving-steps__slide-crop {
	margin: 0;
	line-height: 0;
}

.beaver-moving-steps__slide-img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
	aspect-ratio: 16 / 9;
}

/* First slide: Figma art (wavy/rounded) as RGBA — no extra CSS mask */
.beaver-moving-steps__slide-img--first {
	object-fit: contain;
	aspect-ratio: 444 / 295;
	max-width: 100%;
	height: auto;
}

.beaver-moving-steps__carousel-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border-radius: 50%;
	border: none;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	padding: 0;
	z-index: 2;
	transition: opacity 0.2s ease, transform 0.15s ease;
	box-shadow: none;
}

.beaver-moving-steps__carousel-nav--is-hidden {
	display: none !important;
}

.beaver-moving-steps__nav-icon {
	display: block;
	line-height: 0;
}

.beaver-moving-steps__nav-icon svg {
	display: block;
}

.beaver-moving-steps__carousel-nav:hover {
	opacity: 0.92;
}

.beaver-moving-steps__carousel-nav:hover,
.beaver-moving-steps__carousel-nav:focus,
.beaver-moving-steps__carousel-nav:focus-visible {
	outline: none;
	box-shadow: none;
	background-color: transparent;
	border: none;
}

.beaver-moving-steps__carousel-nav--prev {
	left: 0.5rem;
}

.beaver-moving-steps__carousel-nav--next {
	right: 0.5rem;
}

/* --bms-panel-count on .beaver-moving-steps__panels; swipe track lives in __panels-viewport */
.beaver-moving-steps__panels {
	position: relative;
	display: flex;
	flex-direction: column;
	padding-top: 16px;
	padding-bottom: 16px;
	box-sizing: border-box;
}

.beaver-moving-steps__panels-viewport {
	position: relative;
	width: 100%;
	overflow: hidden;
	box-sizing: border-box;
}

/* Same transform/transition as `.beaver-moving-steps__track` (see <900px: horizontal strip) */
.beaver-moving-steps__panels-track {
	display: flex;
	width: calc(100% * var(--bms-panel-count, 4));
	transform: translateX(calc(-100% * var(--bms-panel-index, 0) / var(--bms-panel-count, 4)));
	transition: transform var(--bms-carousel-duration) var(--bms-carousel-ease);
	will-change: transform;
}

.beaver-moving-steps__panel {
	display: flex;
	flex-direction: column;
	flex: 0 0 calc(100% / var(--bms-panel-count, 4));
	margin: 0;
	min-width: 0;
	box-sizing: border-box;
}

/* Desktop: no sliding text strip; show one column; viewport grows, CTAs follow under with gap */
@media (min-width: 900px) {
	.beaver-moving-steps__panels {
		flex: 1;
		min-height: 0;
		gap: 24px;
		overflow: visible;
	}

	.beaver-moving-steps__panels-viewport {
		flex: 1;
		min-height: 0;
		overflow: visible;
		display: flex;
		flex-direction: column;
	}

	/* Single grid cell: every panel overlays the same slot so row height = max(intrinsic heights) — no vertical jump between steps */
	.beaver-moving-steps__panels-track {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: auto;
		grid-template-areas: "stack";
		width: 100% !important;
		transform: none !important;
		transition: none;
		will-change: auto;
		flex: 1;
		align-content: start;
		align-items: start;
	}

	.beaver-moving-steps__panel {
		grid-area: stack;
		width: 100%;
		justify-self: stretch;
	}

	.beaver-moving-steps__panel[aria-hidden="true"] {
		visibility: hidden;
		pointer-events: none;
	}

	.beaver-moving-steps__panel[aria-hidden="false"] {
		visibility: visible;
		z-index: 1;
	}

	.beaver-moving-steps__panel-text {
		margin-bottom: 0;
	}
}

.beaver-moving-steps__panel-title {
	font-family: var(--bm-font-nav, inherit);
	font-weight: 700;
	font-size: 20px;
	text-transform: uppercase;
	color: var(--bm-color-text-main, #151515);
	margin: 0 0 16px;
}

.beaver-moving-steps__panel-text {
	font-family: var(--bm-font-nav, inherit);
	font-size: 16px;
	line-height: 1.6;
	color: var(--bm-color-text-body, #151515);
	margin: 0 0 24px;
	max-width: 36rem;
}

.beaver-moving-steps__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
}

/* Shared row below the sliding copy (mobile + desktop) */
.beaver-moving-steps__actions--shared {
	flex-shrink: 0;
}

.beaver-moving-steps__btn {
	display: inline-block;
	min-height: 48px;
	padding: 16px 24px;
	border-radius: var(--bm-radius-pill, 90px);
	font-family: var(--bm-font-nav, inherit);
	font-weight: 500;
	font-size: 14px;
	letter-spacing: 0.01em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	vertical-align: middle;
	line-height: 1;
}

.beaver-moving-steps__btn--primary {
	background: var(--bm-color-bg-cta, #a7f100);
	color: var(--bm-color-cta-text, #000);
	border: 2px solid transparent;
}

.beaver-moving-steps__btn--primary:hover,
.beaver-moving-steps__btn--primary:focus-visible {
	background: var(--bm-color-bg-cta-hover);
	color: var(--bm-color-cta-text-hover);
	outline: none;
}

.beaver-moving-steps__btn--outline {
	background: transparent;
	color: var(--bm-color-text-main, #151515);
	border: 1px solid var(--bm-color-text-main, #151515);
}

.beaver-moving-steps__btn--outline:hover,
.beaver-moving-steps__btn--outline:focus-visible {
	background: var(--bm-color-bg-cta-hover);
	color: var(--bm-color-cta-text-hover);
	border-color: var(--bm-color-bg-cta-hover);
	outline: none;
}

.beaver-moving-steps__btn-phone-icon {
	display: inline-block;
	vertical-align: text-bottom;
}

@media (max-width: 900px) {
	.beaver-moving-steps {
		margin-top: 64px;
	}

	.beaver-moving-steps__layout {
		padding-left: 24px;
		padding-right: 24px;
		max-width: 768px;
	}

	.beaver-moving-steps__tabs {
		margin-bottom: 0;
	}

	.beaver-moving-steps__panels {
		padding-top: 0;
		padding-bottom: 0;
		min-height: auto;
		display: flex;
		flex-direction: column;
	}

	.beaver-moving-steps__panel-title {
		display: none;
	}

	.beaver-moving-steps__panel-text {
		margin-bottom: 0;
	}

	.beaver-moving-steps__actions--shared {
		margin-top: 24px;
	}
}

@media (max-width: 736px) {
	.beaver-moving-steps__page-title {
		font-size: 20px;
		margin-bottom: 8px;
	}
}

@media (max-width: 600px) {
	.beaver-moving-steps__layout {
		padding-left: 12px;
		padding-right: 12px;
	}
}