/* Bump and Beyond motion 2: "more animated, still calm".
   Loaded ONLY when bb_motion2_on() (inc/motion2.php), after bb-motion and bb-r5.
   Rules:
   - Start (hidden) states exist only under html.bb-m2 (added by bb-motion2.js once it
     has started) or on attributes that JS itself sets. No JS = finished page.
   - Reveals use the individual `translate` / `scale` properties so they compose with
     the existing `transform` rules (card rotate, hover lift, badge offset) instead of
     replacing them.
   - Reduced motion: no movement; everything in its final state. */

/* ================= 1. Logo comes alive ================= */
.bb-logo { overflow: visible; }

@keyframes bb-m2-draw { from { stroke-dashoffset: 1.06; } }          /* >1 hides the round cap at the start */
@keyframes bb-m2-dot  { from { transform: scale(.4); opacity: 0; } }
@keyframes bb-m2-word { from { opacity: 0; } }
@keyframes bb-m2-wave { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } } /* 8 svg units = ~3px on screen */

/* Header, once per session. html.bb-m2-logo is set by a tiny inline script in <head>
   (so the logo never flashes visible first); the animation ends in the normal state. */
@media (prefers-reduced-motion: no-preference) {
	html.bb-m2-logo .bb-header .bb-logo-line {
		stroke-dasharray: 1 2;
		animation: bb-m2-draw 600ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)) backwards;
	}
	html.bb-m2-logo .bb-header .bb-logo-dot {
		transform-box: fill-box;
		transform-origin: center;
		animation: bb-m2-dot 250ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)) backwards;
	}
	html.bb-m2-logo .bb-header .bb-logo-dot:nth-of-type(1) { animation-delay: 600ms; }
	html.bb-m2-logo .bb-header .bb-logo-dot:nth-of-type(2) { animation-delay: 720ms; }
	html.bb-m2-logo .bb-header .bb-logo-dot:nth-of-type(3) { animation-delay: 840ms; }
	html.bb-m2-logo .bb-header .bb-logo-word { animation: bb-m2-word 400ms ease-out 200ms backwards; }

	/* Footer: the same draw, once, when the footer scrolls into view (JS sets
	   .bb-drawn; the hidden start state exists only under html.bb-m2). */
	.bb-m2 .bb-footer svg.bb-logo .bb-logo-line {
		stroke-dasharray: 1 2;
		transition: stroke-dashoffset 600ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1));
	}
	.bb-m2 .bb-footer svg.bb-logo .bb-logo-dot {
		transform-box: fill-box;
		transform-origin: center;
		transition: transform 250ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)), opacity 250ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1));
	}
	.bb-m2 .bb-footer svg.bb-logo .bb-logo-dot:nth-of-type(1) { transition-delay: 600ms; }
	.bb-m2 .bb-footer svg.bb-logo .bb-logo-dot:nth-of-type(2) { transition-delay: 720ms; }
	.bb-m2 .bb-footer svg.bb-logo .bb-logo-dot:nth-of-type(3) { transition-delay: 840ms; }
	.bb-m2 .bb-footer svg.bb-logo .bb-logo-word { transition: opacity 400ms ease-out 200ms; }
	.bb-m2 .bb-footer svg.bb-logo:not(.bb-drawn) .bb-logo-line { stroke-dashoffset: 1.06; }
	.bb-m2 .bb-footer svg.bb-logo:not(.bb-drawn) .bb-logo-dot { transform: scale(.4); opacity: 0; }
	.bb-m2 .bb-footer svg.bb-logo:not(.bb-drawn) .bb-logo-word { opacity: 0; }
}

/* Header logo hover / keyboard focus: one gentle wave through the three dots. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	html:not(.bb-m2-logo) .bb-wordmark--logo:is(:hover, :focus-visible) .bb-logo-dot { animation: bb-m2-wave 300ms var(--bb-ease, ease) both; }
	html:not(.bb-m2-logo) .bb-wordmark--logo:is(:hover, :focus-visible) .bb-logo-dot:nth-of-type(2) { animation-delay: 80ms; }
	html:not(.bb-m2-logo) .bb-wordmark--logo:is(:hover, :focus-visible) .bb-logo-dot:nth-of-type(3) { animation-delay: 160ms; }
}

/* ================= 2. Section reveals on scroll ================= */
/* JS marks targets with data-bb-rv="text|card|img" only when they start below the
   fold, then adds .bb-m2-in when they enter. Everything else is visible by default. */
.bb-m2 [data-bb-rv] {
	transition:
		opacity 600ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)),
		translate 600ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)),
		scale 600ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1));
	transition-delay: var(--bb-rv-d, 0ms);
}
.bb-m2 [data-bb-rv]:not(.bb-m2-in) { opacity: 0; }
.bb-m2 [data-bb-rv="text"]:not(.bb-m2-in) { translate: 0 14px; }
.bb-m2 [data-bb-rv="card"]:not(.bb-m2-in) { translate: 0 20px; }
.bb-m2 [data-bb-rv="img"]:not(.bb-m2-in)  { scale: .97; }

/* ================= 3. Hero mini-story (Home) ================= */
/* The float uses `translate`, so the card's own rotate(-1.2deg) is untouched. */
@keyframes bb-m2-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
@media (prefers-reduced-motion: no-preference) {
	.bb-mock-card.bb-m2-float,
	.bb-mock-hero.bb-m2-float { animation: bb-m2-float 6s ease-in-out infinite; }
	.bb-m2-float.bb-m2-off,
	html.bb-m2-hidden .bb-m2-float { animation-play-state: paused; }
}
.bb-m2-host { position: relative; }
.bb-m2-slip {
	position: absolute;
	right: 0;
	top: -13px;
	z-index: 2;
	padding: 2px 9px;
	border-radius: var(--bb-radius-pill, 999px);
	background: var(--bb-peach-100, #FDE1D6);
	color: var(--bb-olive-900, #4A2F27);
	font-family: var(--bb-font-body, inherit);
	font-size: .75rem;
	font-weight: 700;
	line-height: 1.5;
	white-space: nowrap;
	box-shadow: 0 4px 10px -4px rgba(74, 47, 39, .35);
	pointer-events: none;
	opacity: 0;
}

/* ================= 4. Bump-line dividers (marketing pages) =================
   Safer approach chosen: NO new DOM node between Elementor sections. JS sets
   data-bb-divider on up to 3 sections; the divider is that section's ::before,
   sitting inside its own top padding (so it cannot change any layout), drawn
   by a clip-path wipe. Line, then the three dots, reveal in that order because
   the dots are at the right end of the same image. */
[data-bb-divider] { position: relative; }
[data-bb-divider]::before {
	content: "";
	position: absolute;
	top: max(6px, calc(var(--bb-section-padding, 64px) / 2 - 15px));
	left: 50%;
	translate: -50% 0;
	width: min(240px, 70%);
	aspect-ratio: 7 / 1;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 210 30'%3E%3Cpath d='M2 25H62A22 22 0 0 1 106 25H148' fill='none' stroke='%23E07A5F' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='166' cy='25' r='3.5' fill='%23E07A5F'/%3E%3Ccircle cx='180' cy='25' r='3.5' fill='%23E07A5F' fill-opacity='.65'/%3E%3Ccircle cx='194' cy='25' r='3.5' fill='%23E07A5F' fill-opacity='.35'/%3E%3C/svg%3E") center / contain no-repeat;
	pointer-events: none;
	clip-path: inset(0 100% 0 0);
	transition: clip-path 800ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1));
}
[data-bb-divider="show"]::before { clip-path: inset(0 0 0 0); }

/* ================= 5. Livelier buttons and cards =================
   Fine pointers only; coarse devices get no hover transforms. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	/* Primary (coral): lift + soft coral glow. */
	.bb-btn:not(.elementor-widget):not(.bb-btn-secondary):not(.bb-btn--oncream):not(.bb-btn--soon),
	body .elementor-widget-button:not(.bb-btn-secondary):not(.bb-btn--oncream) .elementor-button,
	.bb-btn-secondary:not(.elementor-widget),
	body .elementor-widget-button.bb-btn-secondary .elementor-button,
	.bb-btn--oncream:not(.elementor-widget),
	body .elementor-widget-button.bb-btn--oncream .elementor-button {
		transition:
			background var(--bb-duration-fast, 150ms) var(--bb-ease, ease),
			border-color 200ms var(--bb-ease, ease),
			color var(--bb-duration-fast, 150ms) var(--bb-ease, ease),
			transform 200ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)),
			box-shadow 200ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1));
	}
	body:not(.woocommerce-checkout) .bb-btn:not(.elementor-widget):not(.bb-btn-secondary):not(.bb-btn--oncream):not(.bb-btn--soon):is(:hover, :focus-visible),
	body:not(.woocommerce-checkout) .elementor-widget-button:not(.bb-btn-secondary):not(.bb-btn--oncream) .elementor-button:is(:hover, :focus-visible) {
		transform: translateY(-2px);
		box-shadow: 0 8px 20px -8px rgba(176, 74, 48, .45);
	}
	/* Keep R5's two-tone focus ring (cream gap) when the glow is added. */
	body:not(.woocommerce-checkout) .bb-btn:not(.elementor-widget):not(.bb-btn-secondary):not(.bb-btn--oncream):not(.bb-btn--soon):focus-visible,
	body:not(.woocommerce-checkout) .elementor-widget-button:not(.bb-btn-secondary):not(.bb-btn--oncream) .elementor-button:focus-visible {
		box-shadow: 0 0 0 2px #FFF6F0, 0 8px 20px -8px rgba(176, 74, 48, .45);
	}
	/* Secondary / outline: border darkens + the same lift, no coral glow. */
	.bb-btn-secondary:not(.elementor-widget):is(:hover, :focus-visible),
	body .elementor-widget-button.bb-btn-secondary .elementor-button:is(:hover, :focus-visible) {
		transform: translateY(-2px);
		border-color: color-mix(in srgb, var(--bb-olive-900, #4A2F27) 65%, #000);
		box-shadow: 0 8px 20px -10px rgba(74, 47, 39, .3);
	}
	/* Cream button on the brown band: lift with a quiet dark shadow. */
	.bb-btn--oncream:not(.elementor-widget):is(:hover, :focus-visible),
	body .elementor-widget-button.bb-btn--oncream .elementor-button:is(:hover, :focus-visible) {
		transform: translateY(-2px);
		box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .35);
	}
	/* Active: back down to the existing 1px press (the lift rules above out-rank bb-base's :active). */
	.bb-btn:not(.elementor-widget):not(.bb-btn--soon):active,
	.elementor-widget-button .elementor-button:active { transform: translateY(1px) !important; }

	/* Arrow links: the chevron nudges 4px right and eases back. */
	.bb-link.bb-arrow-right::after { transition: transform 250ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)); }
	.bb-link.bb-arrow-right:is(:hover, :focus-visible)::after { transform: translateX(4px) rotate(-45deg); }

	/* Cards that behave like links: lift 3px with a slightly stronger shadow
	   (plan cards already lift in bb-motion.css). */
	.related.products li.product,
	.woocommerce ul.products li.product,
	.bb-hiw-illus-card {
		transition: transform 200ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1)), box-shadow 200ms var(--bb-ease-out-expo, cubic-bezier(.16, 1, .3, 1));
	}
	.related.products li.product:is(:hover, :focus-within),
	.woocommerce ul.products li.product:is(:hover, :focus-within),
	.bb-hiw-illus-card:hover {
		transform: translateY(-3px);
		box-shadow: 0 18px 36px -16px rgba(74, 47, 39, .3), 0 2px 6px rgba(74, 47, 39, .06);
	}
}
/* Reduced motion: colour / border feedback only, no movement. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: reduce) {
	.bb-btn-secondary:not(.elementor-widget):is(:hover, :focus-visible),
	body .elementor-widget-button.bb-btn-secondary .elementor-button:is(:hover, :focus-visible) {
		border-color: color-mix(in srgb, var(--bb-olive-900, #4A2F27) 65%, #000);
	}
}

/* ================= Reduced motion: final state, immediately ================= */
@media (prefers-reduced-motion: reduce) {
	[data-bb-rv] { opacity: 1 !important; translate: none !important; scale: none !important; transition: none !important; }
	[data-bb-divider]::before { clip-path: none; transition: none; }
	.bb-m2-float { animation: none !important; }
	.bb-m2-slip { display: none; }
}
