/*
 * scenes.css：3D 与动效增强层（暖白浅色）。
 * 仅当 <html> 带有 .fx 时生效（scroll.js 在“未开启减少动态效果且宽度 > 40rem”时添加）。
 *
 * 开场段驱动变量（scroll.js 写在 #intro 上，均为已缓动的 0 → 1）：
 *   --p      开场段整体滚动进度
 *   --suck   首屏被吸入的程度（p: 0 → .64）
 *   --hole   黑洞大小（p: 0 → .42 长出，.52 → .72 收缩）
 *   --enter  关于两栏滑入的程度（p: .52 → .72）
 * 其它：
 *   --mx / --my  Hero 内指针位置 -1 → 1（hero.js 写入），驱动舞台轻微倾斜
 *   --rx / --ry  卡片悬停倾斜角度（scroll.js 写入）
 *   --d          入场延迟序号
 *
 * 约束：3D 容器的祖先链上不要使用 overflow:hidden|auto|scroll / filter / opacity<1 / mask，
 * 否则 preserve-3d 被压平、sticky 失效。overflow: clip 不受此限。
 */

/* ---------- 开场段：固定一屏，内部叠放首屏 / 黑洞 / 关于 ---------- */
html.fx .intro {
	height: 230svh;
}

html.fx .intro-frame {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100svh;
	/* 不支持 overflow: clip 的旧浏览器退回 hidden，避免首屏地平面撑出横向滚动 */
	overflow: hidden;
	overflow: clip;
	background:
		radial-gradient(60rem 30rem at 72% 18%, rgba(37, 99, 235, .05), transparent 70%),
		radial-gradient(40rem 26rem at 15% 82%, rgba(124, 58, 237, .04), transparent 70%),
		var(--bg);
}

html.fx .intro-canvas,
html.fx .hole-canvas {
	display: block;
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

html.fx .intro-canvas { z-index: 0; }
html.fx .hole-canvas { z-index: 2; }

/* 首屏：铺满固定帧 */
html.fx .hero {
	position: absolute;
	inset: 0;
	z-index: 1;
	min-height: 0;
	background: none;
}

html.fx .intro.is-hero-gone .hero {
	pointer-events: none;
}

/* 吸入：整组内容绕屏幕中心螺旋旋转并缩小，越接近中心越模糊、越透明 */
html.fx .hero-frame {
	perspective: 1100px;
	perspective-origin: 50% 40%;
	transform-origin: 50% 50%;
	transform:
		rotate(calc(var(--suck, 0) * 300deg))
		scale(calc(1 - var(--suck, 0) * .96));
	opacity: calc(1 - var(--suck, 0) * var(--suck, 0));
	filter: blur(calc(var(--suck, 0) * 5px));
	will-change: transform, opacity;
}

/* 标题比球“慢半拍”，形成拉扯的螺旋感 */
html.fx .hero-text {
	transform: rotate(calc(var(--suck, 0) * 70deg)) translateX(calc(var(--suck, 0) * -3rem));
	transform-origin: 0% 50%;
}

html.fx .scroll-hint {
	opacity: calc(.7 - var(--suck, 0) * 6);
}

html.fx .hero-floor {
	display: block;
	position: absolute;
	left: -50%;
	right: -50%;
	bottom: 0;
	height: 62%;
	transform-origin: 50% 100%;
	transform: rotateX(78deg);
	background-image:
		linear-gradient(to right, rgba(37, 99, 235, .16) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(37, 99, 235, .16) 1px, transparent 1px);
	background-size: 64px 64px;
	-webkit-mask-image: linear-gradient(to top, #000 10%, transparent 85%);
	mask-image: linear-gradient(to top, #000 10%, transparent 85%);
	opacity: calc(1 - var(--suck, 0) * 1.6);
	pointer-events: none;
	animation: floor-drift 24s linear infinite;
}

@keyframes floor-drift {
	from { background-position: 0 0; }
	to { background-position: 0 640px; }
}

html.fx .hero-stage {
	transform-style: preserve-3d;
	transform:
		rotateX(calc(var(--my, 0) * -5deg))
		rotateY(calc(var(--mx, 0) * 7deg));
	transition: transform .15s linear;
}

/* 关于：铺满固定帧并垂直居中，两栏分别从左右滑入 */
html.fx .about {
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	align-items: center;
	padding-top: calc(var(--header-h) + 1rem);
	padding-bottom: 2rem;
	pointer-events: none;
}

html.fx .intro.is-about-in .about {
	pointer-events: auto;
}

html.fx .about .scene-inner {
	width: 100%;
	perspective: 1200px;
}

html.fx .about .scene-label {
	opacity: calc(var(--enter, 0) * 1.4 - .4);
	transform: translateY(calc((1 - var(--enter, 0)) * 1rem));
}

/* 卡片外壳不裁剪，背景与边框下放到两栏，拼合后与整卡外观一致 */
html.fx .about-card {
	overflow: visible;
	border: 0;
	background: none;
	box-shadow: none;
	transform-style: preserve-3d;
}

html.fx .about-col {
	border: 1px solid var(--line);
	background: var(--surface);
	box-shadow: var(--shadow-lg);
	will-change: transform, opacity;
}

html.fx .about-col:first-child {
	border-right: 0;
	border-radius: var(--radius) 0 0 var(--radius);
	transform:
		translate3d(calc((1 - var(--enter, 0)) * -62vw), 0, calc((1 - var(--enter, 0)) * -240px))
		rotateY(calc((1 - var(--enter, 0)) * 38deg));
	opacity: var(--enter, 0);
}

html.fx .about-col + .about-col {
	border-radius: 0 var(--radius) var(--radius) 0;
	transform:
		translate3d(calc((1 - var(--enter, 0)) * 62vw), 0, calc((1 - var(--enter, 0)) * -240px))
		rotateY(calc((1 - var(--enter, 0)) * -38deg));
	opacity: var(--enter, 0);
}

@media (max-width: 60rem) {
	html.fx .about-col:first-child {
		border-right: 1px solid var(--line);
		border-bottom: 0;
		border-radius: var(--radius) var(--radius) 0 0;
	}

	html.fx .about-col + .about-col {
		border-radius: 0 0 var(--radius) var(--radius);
	}
}

/* ---------- 卡片：指针倾斜 + 高光 ---------- */
html.fx .tilt {
	transform: perspective(700px) rotateX(var(--rx)) rotateY(var(--ry)) translateZ(0);
	transition: transform .12s linear, box-shadow .25s ease, border-color .25s ease;
}

html.fx .tilt::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: radial-gradient(16rem 10rem at var(--gx, 50%) var(--gy, 0%), rgba(37, 99, 235, .14), transparent 60%);
	opacity: 0;
	transition: opacity .25s ease;
	pointer-events: none;
}

html.fx .tilt:hover::after {
	opacity: 1;
}

/* ---------- 入场：从下方淡入上浮，进入视口一次后保持 ---------- */
html.fx .reveal {
	opacity: 0;
	transform: translate3d(0, 2.2rem, 0);
	transition:
		opacity .6s var(--ease) calc(var(--d, 0) * 55ms),
		transform .8s var(--ease) calc(var(--d, 0) * 55ms);
}

html.fx .reveal.is-in {
	opacity: 1;
	transform: none;
}

/* ---------- 场景 6：页脚地平面 ---------- */
html.fx .footer {
	perspective: 900px;
	perspective-origin: 50% 0%;
}

html.fx .footer-floor {
	display: block;
	position: absolute;
	left: -40%;
	right: -40%;
	top: 0;
	height: 100%;
	transform-origin: 50% 0%;
	transform: rotateX(52deg);
	background-image:
		linear-gradient(to right, rgba(37, 99, 235, .10) 1px, transparent 1px),
		linear-gradient(to bottom, rgba(37, 99, 235, .10) 1px, transparent 1px);
	background-size: 56px 56px;
	-webkit-mask-image: linear-gradient(to bottom, #000, transparent 90%);
	mask-image: linear-gradient(to bottom, #000, transparent 90%);
	pointer-events: none;
}

/* ---------- 首屏文字贴球面 ----------
   curved.js 把标题、眉题、标语拆成单字（.curve-item），连同两个按钮，按球面写入
   --tx / --ty / --tz（位移）与 --ry / --rx（转角）。--ox / --oy 是球面正对观察者的点，透视原点须与它一致。 */
html.fx .hero-text {
	perspective: 1000px;
	perspective-origin: var(--ox, 50%) var(--oy, 50%);
}

html.fx .curve-item {
	transform:
		translate3d(var(--tx, 0px), var(--ty, 0px), var(--tz, 0px))
		rotateY(var(--ry, 0rad))
		rotateX(var(--rx, 0rad));
}

/* 标语与按钮只随球面平移，不转角，保持正向 */
html.fx .hero-tagline,
html.fx .hero-social a {
	transform: translate3d(var(--tx, 0px), var(--ty, 0px), var(--tz, 0px));
}

/* 按钮悬停时整体上浮 2px，沿用基础版式的手感 */
html.fx .hero-social a:hover {
	transform: translate3d(var(--tx, 0px), calc(var(--ty, 0px) - 2px), var(--tz, 0px));
}

/* 拆字后的行：本行自己的渐变背景停画，渐变改由每个字自己画（见 curved.js 的说明） */
html.fx .is-curved {
	background: none;
}

html.fx .curve-item {
	display: inline-block;
	/* 字距不放进字盒（负字距会让盒子比字形窄，渐变只画在盒内，e 的右缘被裁），改由右边距补回 */
	letter-spacing: 0;
	margin-right: var(--ls, 0px);
	/* 渐变背景由 curved.js 逐字写入 */
	background-repeat: no-repeat;
	background-size: var(--gw, 100%) 100%;
	background-position: var(--gl, 0px) 0;
	-webkit-background-clip: text;
	background-clip: text;
}
