/* ==========================================================================
   BasilBase — animations: keyframes, scroll reveal, hero mesh, decorations
   ========================================================================== */

/* ---------------------------------------------------------------- Keyframes */

@keyframes bb-spin {
	to { transform: rotate(360deg); }
}

@keyframes bb-pulse {
	0%, 100% { opacity: 1; transform: scale(1); }
	50% { opacity: 0.45; transform: scale(0.82); }
}

@keyframes bb-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-50%); }
}

@keyframes bb-drift {
	from { transform: translate3d(-3%, -2%, 0) rotate(0deg); }
	to { transform: translate3d(3%, 4%, 0) rotate(12deg); }
}

@keyframes bb-float {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-14px); }
}

@keyframes bb-float-slow {
	0%, 100% { transform: translateY(0) rotate(0deg); }
	50% { transform: translateY(-22px) rotate(3deg); }
}

@keyframes bb-blob {
	0% { transform: translate(0, 0) scale(1); }
	33% { transform: translate(4%, -6%) scale(1.09); }
	66% { transform: translate(-5%, 5%) scale(0.94); }
	100% { transform: translate(0, 0) scale(1); }
}

@keyframes bb-shimmer {
	from { background-position: -200% 0; }
	to { background-position: 200% 0; }
}

@keyframes bb-step-in {
	from { opacity: 0; transform: translateY(14px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes bb-pop {
	0% { opacity: 0; transform: scale(0.6); }
	60% { transform: scale(1.08); }
	100% { opacity: 1; transform: scale(1); }
}

@keyframes bb-caret {
	0%, 45% { opacity: 1; }
	50%, 95% { opacity: 0; }
	100% { opacity: 1; }
}

@keyframes bb-scan {
	0% { transform: translateY(-100%); opacity: 0; }
	12% { opacity: 0.85; }
	88% { opacity: 0.85; }
	100% { transform: translateY(320%); opacity: 0; }
}

@keyframes bb-dash {
	to { stroke-dashoffset: 0; }
}

@keyframes bb-orbit {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

@keyframes bb-rise {
	from { opacity: 0; transform: translateY(24px); }
	to { opacity: 1; transform: translateY(0); }
}

@keyframes bb-ticker {
	0%, 22% { transform: translateY(0); }
	28%, 50% { transform: translateY(-100%); }
	56%, 78% { transform: translateY(-200%); }
	84%, 100% { transform: translateY(-300%); }
}

@keyframes bb-glow-sweep {
	0% { opacity: 0.15; transform: translateX(-30%) rotate(8deg); }
	50% { opacity: 0.4; }
	100% { opacity: 0.15; transform: translateX(30%) rotate(8deg); }
}

@keyframes bb-bar-grow {
	from { transform: scaleY(0.08); }
	to { transform: scaleY(1); }
}

/* ------------------------------------------------------------ Scroll reveal */

.bb-js .bb-reveal {
	opacity: 0;
	transform: translateY(26px);
	transition: opacity 0.72s var(--bb-ease), transform 0.72s var(--bb-ease);
	transition-delay: var(--bb-reveal-delay, 0ms);
	will-change: opacity, transform;
}

.bb-js .bb-reveal.is-in {
	opacity: 1;
	transform: none;
}

.bb-js .bb-reveal--left { transform: translateX(-32px); }
.bb-js .bb-reveal--right { transform: translateX(32px); }
.bb-js .bb-reveal--scale { transform: scale(0.95); }
.bb-js .bb-reveal--fade { transform: none; }

.bb-js .bb-reveal--left.is-in,
.bb-js .bb-reveal--right.is-in,
.bb-js .bb-reveal--scale.is-in { transform: none; }

/* Staggered children */

.bb-js .bb-stagger > * {
	opacity: 0;
	transform: translateY(22px);
	transition: opacity 0.66s var(--bb-ease), transform 0.66s var(--bb-ease);
}

.bb-js .bb-stagger.is-in > * {
	opacity: 1;
	transform: none;
}

.bb-js .bb-stagger.is-in > *:nth-child(1) { transition-delay: 0ms; }
.bb-js .bb-stagger.is-in > *:nth-child(2) { transition-delay: 70ms; }
.bb-js .bb-stagger.is-in > *:nth-child(3) { transition-delay: 140ms; }
.bb-js .bb-stagger.is-in > *:nth-child(4) { transition-delay: 210ms; }
.bb-js .bb-stagger.is-in > *:nth-child(5) { transition-delay: 280ms; }
.bb-js .bb-stagger.is-in > *:nth-child(6) { transition-delay: 350ms; }
.bb-js .bb-stagger.is-in > *:nth-child(7) { transition-delay: 420ms; }
.bb-js .bb-stagger.is-in > *:nth-child(8) { transition-delay: 490ms; }
.bb-js .bb-stagger.is-in > *:nth-child(9) { transition-delay: 560ms; }
.bb-js .bb-stagger.is-in > *:nth-child(n + 10) { transition-delay: 620ms; }

/* Word-by-word headline reveal */

.bb-words { display: inline; }

.bb-word {
	display: inline-block;
	white-space: pre;
}

.bb-js .bb-words--animate .bb-word {
	opacity: 0;
	transform: translateY(0.5em) rotate(2deg);
	animation: bb-rise 0.85s var(--bb-ease) forwards;
	animation-delay: calc(var(--i, 0) * 55ms);
}

/* ------------------------------------------------------------ Decorations */

.bb-blob {
	position: absolute;
	border-radius: 50%;
	filter: blur(70px);
	opacity: 0.5;
	pointer-events: none;
	will-change: transform;
}

.bb-blob--a {
	top: -140px;
	left: -80px;
	width: 460px;
	height: 460px;
	background: radial-gradient(circle, rgba(107, 91, 255, 0.55), transparent 68%);
	animation: bb-blob 22s var(--bb-ease-in-out) infinite;
}

.bb-blob--b {
	bottom: -180px;
	right: -100px;
	width: 520px;
	height: 520px;
	background: radial-gradient(circle, rgba(37, 216, 238, 0.4), transparent 68%);
	animation: bb-blob 28s var(--bb-ease-in-out) infinite reverse;
}

.bb-blob--c {
	top: 30%;
	right: 22%;
	width: 340px;
	height: 340px;
	background: radial-gradient(circle, rgba(255, 95, 162, 0.32), transparent 66%);
	animation: bb-blob 34s var(--bb-ease-in-out) infinite;
}

.bb-grid-lines {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(140, 160, 224, 0.055) 1px, transparent 1px),
		linear-gradient(90deg, rgba(140, 160, 224, 0.055) 1px, transparent 1px);
	background-size: 64px 64px;
	mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 78%);
	-webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 78%);
	pointer-events: none;
}

.bb-noise {
	position: absolute;
	inset: 0;
	opacity: 0.028;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

.bb-spotlight {
	position: absolute;
	top: -30%;
	left: 50%;
	width: 130%;
	height: 90%;
	transform: translateX(-50%);
	background: conic-gradient(from 200deg at 50% 50%, rgba(107, 91, 255, 0.16), transparent 30%, rgba(37, 216, 238, 0.14) 60%, transparent 78%);
	filter: blur(52px);
	animation: bb-glow-sweep 16s var(--bb-ease-in-out) infinite alternate;
	pointer-events: none;
}

/* --------------------------------------------------------- Cursor spotlight */

.bb-cursor {
	position: fixed;
	top: 0;
	left: 0;
	z-index: 1;
	width: 380px;
	height: 380px;
	margin: -190px 0 0 -190px;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(107, 91, 255, 0.13), transparent 62%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.5s var(--bb-ease);
	will-change: transform;
}

.bb-cursor.is-active { opacity: 1; }

/* -------------------------------------------------------------- Tilt cards */

.bb-tilt {
	transform-style: preserve-3d;
	will-change: transform;
	transition: transform 0.35s var(--bb-ease);
}

.bb-tilt__inner { transform: translateZ(28px); }

/* ------------------------------------------------------- Typing / ticker */

.bb-typed {
	display: inline;
	background: var(--bb-grad);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.bb-caret {
	display: inline-block;
	width: 3px;
	height: 0.92em;
	margin-left: 4px;
	vertical-align: -0.08em;
	background: var(--bb-cyan);
	border-radius: 2px;
	animation: bb-caret 1s steps(1) infinite;
}

.bb-ticker {
	display: inline-block;
	height: 1.14em;
	overflow: hidden;
	vertical-align: bottom;
}

.bb-ticker__list {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	list-style: none;
	animation: bb-ticker 11s var(--bb-ease-in-out) infinite;
}

.bb-ticker__list li {
	height: 1.14em;
	line-height: 1.14em;
	margin: 0;
	white-space: nowrap;
}

/* ----------------------------------------------------------- SVG line draw */

.bb-draw path,
.bb-draw line,
.bb-draw circle {
	stroke-dasharray: var(--len, 600);
	stroke-dashoffset: var(--len, 600);
}

.bb-draw.is-in path,
.bb-draw.is-in line,
.bb-draw.is-in circle {
	animation: bb-dash 1.8s var(--bb-ease) forwards;
}

.bb-draw.is-in path:nth-child(2) { animation-delay: 0.2s; }
.bb-draw.is-in path:nth-child(3) { animation-delay: 0.4s; }
.bb-draw.is-in path:nth-child(4) { animation-delay: 0.6s; }

/* ------------------------------------------------------------- Phone mockup */

.bb-phone {
	position: relative;
	width: 268px;
	aspect-ratio: 9 / 19;
	margin-inline: auto;
	padding: 11px;
	border-radius: 42px;
	background: linear-gradient(160deg, #262c4d, #0b0e1c 55%);
	border: 1px solid rgba(255, 255, 255, 0.14);
	box-shadow: 0 50px 90px -40px rgba(0, 0, 0, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.12);
	animation: bb-float-slow 9s var(--bb-ease-in-out) infinite;
}

.bb-phone__notch {
	position: absolute;
	top: 20px;
	left: 50%;
	width: 74px;
	height: 20px;
	transform: translateX(-50%);
	background: #05060c;
	border-radius: 12px;
	z-index: 3;
}

.bb-phone__screen {
	position: relative;
	height: 100%;
	border-radius: 32px;
	background: linear-gradient(175deg, #0a0d1c, #070912);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	padding: 42px 14px 16px;
	gap: 10px;
}

.bb-phone__scan {
	position: absolute;
	inset: 0 0 auto 0;
	height: 34%;
	background: linear-gradient(180deg, rgba(37, 216, 238, 0.16), transparent);
	animation: bb-scan 5.5s var(--bb-ease-in-out) infinite;
	pointer-events: none;
}

.bb-phone__row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 9px 10px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.045);
	border: 1px solid rgba(255, 255, 255, 0.06);
}

.bb-phone__dot {
	width: 22px;
	height: 22px;
	flex: 0 0 auto;
	border-radius: 7px;
	background: var(--bb-grad);
}

.bb-phone__lines { display: grid; gap: 5px; flex: 1; }

.bb-phone__line {
	height: 6px;
	border-radius: 3px;
	background: linear-gradient(90deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.16));
	background-size: 200% 100%;
	animation: bb-shimmer 2.8s linear infinite;
}

.bb-phone__line--short { width: 55%; }
.bb-phone__line--mid { width: 78%; }

.bb-phone__chart {
	display: flex;
	align-items: flex-end;
	gap: 6px;
	height: 74px;
	margin-top: 4px;
	padding: 10px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.035);
	border: 1px solid rgba(255, 255, 255, 0.06);
}

.bb-phone__bar {
	flex: 1;
	border-radius: 3px 3px 0 0;
	background: var(--bb-grad);
	transform-origin: bottom;
	animation: bb-bar-grow 1.6s var(--bb-ease) infinite alternate;
}

.bb-phone__bar:nth-child(1) { height: 34%; animation-delay: 0s; }
.bb-phone__bar:nth-child(2) { height: 58%; animation-delay: 0.15s; }
.bb-phone__bar:nth-child(3) { height: 42%; animation-delay: 0.3s; }
.bb-phone__bar:nth-child(4) { height: 76%; animation-delay: 0.45s; }
.bb-phone__bar:nth-child(5) { height: 62%; animation-delay: 0.6s; }
.bb-phone__bar:nth-child(6) { height: 92%; animation-delay: 0.75s; }

.bb-phone__badge {
	position: absolute;
	right: -26px;
	padding: 0.5rem 0.8rem;
	border-radius: var(--bb-r-pill);
	background: var(--bb-glass-strong);
	border: 1px solid var(--bb-line-strong);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	font-size: 0.7rem;
	font-weight: 560;
	color: var(--bb-text);
	white-space: nowrap;
	box-shadow: var(--bb-shadow);
	animation: bb-float 6s var(--bb-ease-in-out) infinite;
	z-index: 4;
}

.bb-phone__badge--one { top: 16%; animation-delay: 0.4s; }
.bb-phone__badge--two { bottom: 24%; right: auto; left: -34px; animation-delay: 1.6s; }

.bb-phone__badge span {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
}

.bb-phone__badge svg { color: var(--bb-lime); }

/* --------------------------------------------------------------- Code panel */

.bb-codepanel {
	border: 1px solid var(--bb-line);
	border-radius: var(--bb-r-lg);
	background: rgba(6, 8, 16, 0.9);
	overflow: hidden;
	box-shadow: var(--bb-shadow);
}

.bb-codepanel__bar {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	padding: 0.7rem 1rem;
	border-bottom: 1px solid var(--bb-line);
	background: rgba(255, 255, 255, 0.025);
}

.bb-codepanel__dot {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: #2a3157;
}

.bb-codepanel__dot:nth-child(1) { background: #ff5f57; }
.bb-codepanel__dot:nth-child(2) { background: #ffbd2e; }
.bb-codepanel__dot:nth-child(3) { background: #28c840; }

.bb-codepanel__file {
	margin-left: 0.6rem;
	font-family: var(--bb-font-mono);
	font-size: 0.72rem;
	color: var(--bb-dim);
}

.bb-codepanel__body {
	margin: 0;
	padding: 1.15rem 1.25rem;
	background: none;
	border: 0;
	font-size: 0.78rem;
	line-height: 1.75;
	overflow-x: auto;
}

.bb-codepanel__body code { background: none; border: 0; padding: 0; color: var(--bb-text-soft); }
.bb-tok-key { color: #c4b5ff; }
.bb-tok-str { color: #9ef01a; }
.bb-tok-fn { color: #25d8ee; }
.bb-tok-com { color: #5d668a; font-style: italic; }
.bb-tok-num { color: #ffb340; }

/* ------------------------------------------------------------- Orbit rings */

.bb-orbit {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

.bb-orbit__ring {
	position: absolute;
	top: 50%;
	left: 50%;
	border: 1px dashed rgba(140, 160, 224, 0.16);
	border-radius: 50%;
	transform: translate(-50%, -50%);
}

.bb-orbit__ring--1 { width: 320px; height: 320px; animation: bb-orbit 40s linear infinite; }
.bb-orbit__ring--2 { width: 480px; height: 480px; animation: bb-orbit 60s linear infinite reverse; }
.bb-orbit__ring--3 { width: 640px; height: 640px; animation: bb-orbit 90s linear infinite; }

.bb-orbit__chip {
	position: absolute;
	top: -14px;
	left: 50%;
	transform: translateX(-50%);
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	border-radius: 10px;
	background: var(--bb-surface-2);
	border: 1px solid var(--bb-line-strong);
	color: var(--bb-cyan);
}

/* ------------------------------------------------------- Reduced motion */

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
		scroll-behavior: auto !important;
	}

	.bb-js .bb-reveal,
	.bb-js .bb-stagger > *,
	.bb-js .bb-words--animate .bb-word {
		opacity: 1 !important;
		transform: none !important;
	}

	.bb-cursor { display: none; }
}

body.bb-static .bb-blob,
body.bb-static .bb-spotlight,
body.bb-static .bb-marquee__track,
body.bb-static .bb-phone,
body.bb-static .bb-phone__scan,
body.bb-static .bb-phone__line,
body.bb-static .bb-phone__bar,
body.bb-static .bb-orbit__ring,
body.bb-static .bb-ticker__list {
	animation: none !important;
}

body.bb-static .bb-reveal,
body.bb-static .bb-stagger > * {
	opacity: 1 !important;
	transform: none !important;
}

body.bb-static .bb-cursor { display: none; }
