/* Blueprint Homepage Motion v1.0.1
   Progressive enhancement. Without JS, or with prefers-reduced-motion: reduce,
   everything renders in its final, readable state. Only transform, opacity and
   clip-path animate. Loaded on the front page only (see plugin PHP). */

:root {
	--bbg-ease: cubic-bezier(.2, .7, .2, 1);
	--bbg-ease-out: cubic-bezier(.16, 1, .3, 1);
	--bbg-blue: #315cff;
	--bbg-blue-2: #4d73ff;
	--bbg-ice: #90a9ff;
	--bbg-ro-h: 7rem;
}

/* ---------- Static refinements ---------- */

/* "next." keeps a quiet blueprint underline for emphasis */
.bbg-hero-title mark { display: inline-block; position: relative; }
.bbg-hero-title mark::after {
	content: "";
	position: absolute;
	left: .02em; right: .22em; bottom: .02em;
	height: .065em;
	background: linear-gradient(90deg, var(--bbg-blue-2), var(--bbg-ice));
	transform-origin: left center;
}

/* Reserve room for the step controls before JS runs (no layout shift) */
.bbg-mjs .bbg-hero-system { padding-bottom: var(--bbg-ro-h); }

/* Connection layer (SVG created by JS) */
.bbg-system-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.bbg-system-links path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bbg-link-loop  { stroke: rgba(144, 169, 255, .26); stroke-width: 1; stroke-dasharray: 3 5; }
.bbg-link-spoke { stroke: rgba(144, 169, 255, .14); stroke-width: 1; transition: stroke .5s var(--bbg-ease), stroke-width .5s var(--bbg-ease); }
.bbg-link-spoke.is-active { stroke: rgba(144, 169, 255, .8); stroke-width: 1.5; }
.bbg-link-seg   { stroke: var(--bbg-ice); stroke-width: 1.5; opacity: 0; }
.bbg-comet      { fill: #fff; opacity: 0; filter: drop-shadow(0 0 5px var(--bbg-blue-2)); }

.bbg-system-node { transition: color .45s var(--bbg-ease), opacity .45s var(--bbg-ease); }
.bbg-mjs .bbg-system-node { cursor: pointer; }
.bbg-system-node::before { transition: transform .45s var(--bbg-ease-out), background .45s var(--bbg-ease), box-shadow .45s var(--bbg-ease); }
.bbg-system-node i { transition: color .45s var(--bbg-ease); }
.bbg-system-plane.has-active .bbg-system-node { opacity: .6; }
.bbg-system-plane.has-active .bbg-system-node.is-lit { opacity: .85; }
.bbg-system-plane.has-active .bbg-system-node.is-active { opacity: 1; color: #fff; }
.bbg-system-node.is-active::before { transform: scale(1.6) rotate(45deg); background: #fff; box-shadow: 0 0 0 .2rem rgba(77, 115, 255, .3), 0 0 1.1rem var(--bbg-blue); }
.bbg-system-node.is-active i { color: var(--bbg-ice); }
.bbg-system-core.is-pulse::after {
	content: ""; position: absolute; inset: -1px; border: 1px solid var(--bbg-ice); pointer-events: none; opacity: 0;
}

/* ---------- Step controls ---------- */
.bbg-system-readout {
	position: absolute;
	left: 8%; right: 0; bottom: 0;
	max-width: 34rem;
	height: calc(var(--bbg-ro-h) - 1.1rem);
	display: flex; flex-direction: column; justify-content: flex-start;
	color: rgba(229, 234, 255, .82);
}
.bbg-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
.bbg-step {
	appearance: none; background: none; border: 0; border-radius: 0; margin: 0;
	position: relative;
	min-height: 2.75rem;
	padding: .6rem 0 .35rem;
	color: rgba(229, 234, 255, .68);
	font: inherit; font-size: .62rem; font-weight: 700; letter-spacing: .1em; line-height: 1.2;
	text-align: left; text-transform: uppercase;
	cursor: pointer;
	transition: color .3s var(--bbg-ease);
	-webkit-tap-highlight-color: transparent;
}
.bbg-step::before, .bbg-step::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; }
.bbg-step::before { background: rgba(144, 169, 255, .22); }
.bbg-step::after  { background: var(--bbg-ice); transform: scaleX(0); transform-origin: left center; transition: transform .5s var(--bbg-ease-out); }
.bbg-step.is-lit::after { transform: scaleX(1); }
.bbg-step[aria-pressed="true"] { color: #fff; }
.bbg-step-num { display: block; color: #7188dc; font-size: .55rem; margin-bottom: .15rem; }
.bbg-step[aria-pressed="true"] .bbg-step-num { color: var(--bbg-ice); }
.bbg-step:hover { color: #fff; }
.bbg-step:focus-visible, .bbg-motion-toggle:focus-visible { outline: 2px solid var(--bbg-ice); outline-offset: 3px; }

.bbg-ro-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-top: .55rem; }
.bbg-step-desc { margin: 0; flex: 1; font-size: .8rem; line-height: 1.45; transition: opacity .3s var(--bbg-ease); }
.bbg-step-desc.is-swapping { opacity: 0; }

.bbg-motion-toggle {
	appearance: none; flex: none;
	display: inline-flex; align-items: center; gap: .45rem;
	min-height: 2rem; padding: .4rem .7rem;
	background: transparent; color: #dfe6ff;
	border: 1px solid rgba(144, 169, 255, .35); border-radius: 999px;
	font: inherit; font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
	cursor: pointer;
	transition: border-color .25s var(--bbg-ease), background-color .25s var(--bbg-ease);
}
.bbg-motion-toggle:hover { border-color: var(--bbg-ice); background: rgba(144, 169, 255, .08); }
.bbg-motion-toggle[hidden] { display: none; }
.bbg-motion-toggle .bbg-ico { width: .55rem; height: .6rem; position: relative; }
.bbg-motion-toggle[data-state="playing"] .bbg-ico { border-left: 2px solid currentColor; border-right: 2px solid currentColor; width: .5rem; }
.bbg-motion-toggle:not([data-state="playing"]) .bbg-ico { width: 0; height: 0; border-style: solid; border-width: .3rem 0 .3rem .5rem; border-color: transparent transparent transparent currentColor; }

.bbg-sr {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

@media (max-width: 480px) {
	:root { --bbg-ro-h: 7.75rem; }
	.bbg-system-readout { left: 0; }
	.bbg-step { font-size: .56rem; letter-spacing: .05em; }
}

/* ---------- Primary CTAs (hero + final CTA only) ---------- */
.bbg-hero-actions .wp-block-button:not(.is-style-outline) .wp-element-button::after,
.bbg-final-cta .wp-block-button:not(.is-style-outline) .wp-element-button::after {
	content: "\2192";
	content: "\2192" / "";
	display: inline-block;
	margin-left: .6em;
	transition: transform .3s var(--bbg-ease-out);
}
.bbg-hero-actions .wp-element-button:focus-visible,
.bbg-final-cta .wp-element-button:focus-visible { outline: 2px solid var(--bbg-ice); outline-offset: 3px; }
@media (hover: hover) {
	.bbg-hero-actions .wp-block-button:not(.is-style-outline) .wp-element-button,
	.bbg-final-cta .wp-block-button:not(.is-style-outline) .wp-element-button {
		transition: background-color .22s var(--bbg-ease), color .22s var(--bbg-ease), transform .22s var(--bbg-ease), box-shadow .3s var(--bbg-ease);
	}
	.bbg-hero-actions .wp-block-button:not(.is-style-outline) .wp-element-button:hover,
	.bbg-final-cta .wp-block-button:not(.is-style-outline) .wp-element-button:hover { box-shadow: 0 12px 28px -14px rgba(49, 92, 255, .85); }
	.bbg-hero-actions .wp-block-button:not(.is-style-outline) .wp-element-button:hover::after,
	.bbg-final-cta .wp-block-button:not(.is-style-outline) .wp-element-button:hover::after { transform: translateX(4px); }
	.bbg-hero-actions .is-style-outline .wp-element-button:hover { border-color: var(--bbg-ice); }
}

/* ==========================================================================
   Motion — only when the visitor has not asked for reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
	.bbg-hero-kicker   { animation: bbg-fade-up .8s var(--bbg-ease-out) .1s backwards; }
	.bbg-hero-title    { animation: bbg-rise 1.1s var(--bbg-ease-out) .2s backwards; }
	.bbg-hero-title mark { animation: bbg-next 1s var(--bbg-ease-out) .9s backwards; }
	.bbg-hero-title mark::after { animation: bbg-underline .8s var(--bbg-ease-out) 1.45s backwards; }
	.bbg-hero-lead     { animation: bbg-fade-up .9s var(--bbg-ease-out) .6s backwards; }
	.bbg-hero-actions  { animation: bbg-fade-up .9s var(--bbg-ease-out) .75s backwards; }
	.bbg-hero-system figcaption { animation: bbg-fade-up .9s var(--bbg-ease-out) 1.5s backwards; }

	/* Blueprint assembles once: plane, axes, orbits, core, then 01–05 */
	.bbg-system-plane { animation: bbg-plane 1.3s var(--bbg-ease-out) .25s backwards; }
	.bbg-system-axis  { animation: bbg-draw-axis 1s var(--bbg-ease-out) .6s backwards; }
	.bbg-system-orbit { animation: bbg-orbit-in 1.2s var(--bbg-ease-out) .75s backwards, bbg-spin 120s linear 2s infinite; animation-play-state: running, paused; }
	.bbg-system-orbit.bbg-orbit-b { animation: bbg-orbit-in 1.2s var(--bbg-ease-out) .9s backwards, bbg-spin-rev 160s linear 2s infinite; animation-play-state: running, paused; }
	.bbg-hero.is-playing .bbg-system-orbit { animation-play-state: running, running; }
	.bbg-system-core  { animation: bbg-core-in .8s var(--bbg-ease-out) .95s backwards; }
	.bbg-system-node  { animation: bbg-node-in .6s var(--bbg-ease-out) backwards; }
	.bbg-system-strategy { animation-delay: 1.2s; }
	.bbg-system-brand    { animation-delay: 1.3s; }
	.bbg-system-build    { animation-delay: 1.4s; }
	.bbg-system-grow     { animation-delay: 1.5s; }
	.bbg-system-scale    { animation-delay: 1.6s; }
	.bbg-system-readout  { animation: bbg-fade-up .8s var(--bbg-ease-out) 1.7s backwards; }

	.bbg-system-links .bbg-link-spoke {
		stroke-dasharray: var(--len, 0); stroke-dashoffset: var(--len, 0);
		transition: stroke-dashoffset 1.3s var(--bbg-ease-out), stroke .5s var(--bbg-ease), stroke-width .5s var(--bbg-ease);
	}
	.bbg-system-links.is-drawn .bbg-link-spoke { stroke-dashoffset: 0; }
	.bbg-system-links .bbg-link-loop { opacity: 0; transition: opacity 1.3s var(--bbg-ease); }
	.bbg-system-links.is-drawn .bbg-link-loop { opacity: 1; }
	.bbg-system-core.is-pulse::after { animation: bbg-ping 1.1s var(--bbg-ease-out) forwards; }

	/* Section reveals (JS adds .bbg-reveal-on only when IntersectionObserver exists) */
	.bbg-reveal-on .bbg-rv {
		opacity: 0; translate: 0 20px;
		transition: opacity .8s var(--bbg-ease-out), translate .9s var(--bbg-ease-out);
		transition-delay: calc(var(--rv-i, 0) * 80ms);
	}
	.bbg-reveal-on .bbg-rv.is-in { opacity: 1; translate: none; }
}

@keyframes bbg-fade-up   { from { opacity: 0; transform: translateY(16px); } }
@keyframes bbg-rise      { from { opacity: 0; transform: translateY(.2em); clip-path: inset(0 0 100% 0); } to { clip-path: inset(-20% -10% -30% -10%); } }
@keyframes bbg-next      { from { opacity: 0; transform: translateY(.25em); filter: blur(8px); color: #fff; } 55% { text-shadow: 0 0 .4em rgba(77, 115, 255, .6); } to { text-shadow: 0 0 0 rgba(77, 115, 255, 0); } }
@keyframes bbg-underline { from { transform: scaleX(0); } }
@keyframes bbg-plane     { from { opacity: 0; transform: perspective(55rem) rotateY(-18deg) rotateX(10deg) scale(.93); } }
@keyframes bbg-draw-axis { from { clip-path: inset(0 50% 0 50%); opacity: 0; } to { clip-path: inset(0 0 0 0); } }
@keyframes bbg-orbit-in  { from { opacity: 0; scale: .55; } }
@keyframes bbg-spin      { to { rotate: 360deg; } }
@keyframes bbg-spin-rev  { to { rotate: -360deg; } }
@keyframes bbg-core-in   { from { opacity: 0; scale: .4; } 70% { scale: 1.05; } }
@keyframes bbg-node-in   { from { opacity: 0; translate: 0 10px; } }
@keyframes bbg-ping      { from { opacity: .85; transform: scale(1); } to { opacity: 0; transform: scale(1.5); } }

@media print {
	.bbg-rv { opacity: 1 !important; translate: none !important; }
	.bbg-mjs .bbg-hero-system { padding-bottom: 0; }
	.bbg-system-readout { display: none; }
}
