feat(static): 优化社区首页美观度与高级感

- index.html: hero 新增品牌徽章、节点树装饰 SVG、下滑提示;章节增加 eyebrow 小标题
- index.css: 主按钮渐变+扫光、卡片序号水印+图标点亮、标题渐变流光、点阵底纹、
  品牌树描绘动画、关于卡装饰、胶囊快捷链接;全部基于 theme.css 变量,深浅色自适应
- index.js: 追加滚动渐显(IntersectionObserver)与特性卡片光标光斑,与登录逻辑解耦
This commit is contained in:
qing committed 2026-08-06 17:31:40 +00:00
1 parent a4611ec737
commit ea2717c400
3 files changed
+403 -85

No files matched your search

+325 -80
View File
@@ -4,6 +4,12 @@ body {
align-items: normal;
}
/* 选中文字着色,与品牌色一致 */
::selection {
background: var(--accent-glow);
color: var(--fg);
}
@media (prefers-reduced-motion: no-preference) {
html { scroll-behavior: smooth; }
}
@@ -22,14 +28,44 @@ body {
cursor: pointer;
text-decoration: none;
line-height: 1.4;
transition: opacity 0.15s, transform 0.1s, background 0.15s, border-color 0.15s;
transition: opacity 0.15s, transform 0.18s, background 0.18s, border-color 0.18s, box-shadow 0.22s;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(232, 133, 58, 0.28); }
.btn-primary:hover { background: var(--accent-dark); opacity: 1; box-shadow: 0 4px 14px rgba(232, 133, 58, 0.36); }
.btn-ghost { background: var(--accent-soft); color: var(--accent-dark); }
.btn-ghost:hover { border-color: var(--accent); opacity: 1; }
.btn-lg { padding: 0.7rem 1.9rem; font-size: 1rem; border-radius: var(--radius-md); }
/* 主按钮:品牌渐变 + hover 上浮与扫光 */
.btn-primary {
position: relative;
overflow: hidden;
background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
color: #fff;
box-shadow: 0 2px 10px rgba(232, 133, 58, 0.32);
}
.btn-primary::after {
content: "";
position: absolute;
top: 0;
left: -80%;
width: 50%;
height: 100%;
background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.35), transparent);
transform: skewX(-20deg);
transition: left 0.5s ease;
pointer-events: none;
}
.btn-primary:hover {
transform: translateY(-1px);
box-shadow: 0 6px 18px rgba(232, 133, 58, 0.4);
}
.btn-primary:hover::after { left: 130%; }
.btn-primary:active { transform: scale(0.96); }
.btn-ghost {
background: var(--accent-soft);
color: var(--accent-dark);
border-color: var(--accent-glow);
}
.btn-ghost:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn-lg { padding: 0.75rem 2rem; font-size: 1rem; border-radius: 999px; letter-spacing: 0.02em; }
/* ===== 头部:悬浮毛玻璃导航(镜像 minimap/userpanel 风格) ===== */
.header {
@@ -44,12 +80,12 @@ body {
width: 100%;
max-width: 960px;
margin: 0 auto;
padding: 0.5rem 1rem;
border-radius: var(--radius-md);
padding: 0.55rem 1.1rem;
border-radius: var(--radius-lg);
background: rgba(253, 246, 238, 0.72);
border: 1px solid var(--border-light);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
backdrop-filter: blur(16px) saturate(1.4);
-webkit-backdrop-filter: blur(16px) saturate(1.4);
box-shadow: var(--shadow-md);
transition: background 0.2s, border-color 0.2s;
}
@@ -95,95 +131,180 @@ body {
white-space: nowrap;
}
#main-page { width: 100%; }
/* ===== Hero 首屏 ===== */
.hero {
position: relative;
text-align: center;
padding: 6rem 1rem 5rem;
padding: 4.5rem 1rem 5.5rem;
overflow: hidden;
}
/* 点阵底纹:中心清晰、四周渐隐 */
.hero::before {
content: "";
position: absolute;
inset: 0;
background: radial-gradient(ellipse 60% 50% at 50% 30%, var(--accent-glow), transparent 70%);
background-image: radial-gradient(var(--border) 1.2px, transparent 1.2px);
background-size: 26px 26px;
-webkit-mask-image: radial-gradient(ellipse 70% 62% at 50% 42%, #000 25%, transparent 72%);
mask-image: radial-gradient(ellipse 70% 62% at 50% 42%, #000 25%, transparent 72%);
pointer-events: none;
}
/* 暖色环境光晕 */
.hero::after {
content: "";
position: absolute;
left: 50%;
top: 52%;
width: 640px;
height: 640px;
top: 46%;
width: 680px;
height: 680px;
transform: translate(-50%, -50%);
background: radial-gradient(circle, var(--accent-glow), transparent 62%);
opacity: 0.5;
background:
radial-gradient(circle, var(--accent-glow), transparent 60%),
radial-gradient(ellipse 55% 40% at 50% 62%, var(--accent-soft), transparent 70%);
opacity: 0.55;
pointer-events: none;
}
.hero > * { position: relative; z-index: 1; }
.hero-title {
font-size: clamp(2rem, 6vw, 3rem);
font-weight: 800;
line-height: 1.28;
letter-spacing: 0.02em;
margin-bottom: 1rem;
.hero-inner { position: relative; z-index: 1; }
/* 品牌装饰:节点树(低透明度衬底,不干扰阅读) */
.hero-tree {
position: absolute;
left: 50%;
bottom: -8px;
transform: translateX(-50%);
width: min(600px, 96%);
height: auto;
color: var(--accent);
opacity: 0.16;
pointer-events: none;
}
@media (prefers-color-scheme: dark) {
.hero-tree { opacity: 0.2; }
}
/* eyebrow 徽章:呼吸圆点 + 胶囊 */
.hero-badge {
display: inline-flex;
align-items: center;
gap: 0.45rem;
padding: 0.35rem 0.95rem;
margin-bottom: 1.4rem;
font-size: 0.8rem;
font-weight: 600;
letter-spacing: 0.06em;
color: var(--accent-dark);
background: var(--accent-soft);
border: 1px solid var(--accent-glow);
border-radius: 999px;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
}
.badge-dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
flex: none;
}
.hero-title {
font-size: clamp(2.1rem, 6.5vw, 3.3rem);
font-weight: 800;
line-height: 1.26;
letter-spacing: 0.04em;
text-wrap: balance;
margin-bottom: 1.1rem;
}
/* 渐变标题字:缓慢流光 */
.accent-text {
background: linear-gradient(120deg, var(--accent) 20%, var(--accent-dark) 80%);
background: linear-gradient(120deg, var(--accent) 15%, var(--accent-dark) 45%, var(--accent) 85%);
background-size: 220% auto;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
}
.hero-sub {
font-size: 1.08rem;
letter-spacing: 0.03em;
color: var(--fg-secondary);
max-width: 30rem;
max-width: 32rem;
margin: 0 auto;
line-height: 1.7;
line-height: 1.75;
}
.hero-actions {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 0.85rem;
margin-top: 2.1rem;
margin-top: 2.2rem;
}
/* ===== 特性卡片 ===== */
/* 下滑提示:浮动小箭头(窄屏隐藏) */
.scroll-hint {
position: absolute;
left: 50%;
bottom: 1.3rem;
transform: translateX(-50%);
z-index: 1;
display: flex;
color: var(--muted);
transition: color 0.2s;
}
.scroll-hint:hover { color: var(--accent); }
.scroll-hint svg { width: 22px; height: 22px; }
/* ===== 章节标题:eyebrow + 标题 + 渐变短杠 ===== */
.section-eyebrow {
text-align: center;
margin-top: 4.5rem;
font-size: 0.78rem;
font-weight: 700;
letter-spacing: 0.28em;
text-indent: 0.28em; /* 视觉居中补偿字距 */
color: var(--accent);
}
.section-title {
text-align: center;
margin-top: 4rem;
font-size: 1.5rem;
margin-top: 0.7rem;
font-size: 1.55rem;
font-weight: 700;
letter-spacing: 0.01em;
letter-spacing: 0.02em;
}
.section-title::after {
content: "";
display: block;
width: 44px;
width: 46px;
height: 3px;
margin: 0.6rem auto 0;
margin: 0.65rem auto 0;
border-radius: 2px;
background: var(--accent);
opacity: 0.85;
background: linear-gradient(90deg, var(--accent), var(--accent-dark));
opacity: 0.9;
}
/* ===== 特性卡片:序号水印 + 光标光斑 + 图标点亮 ===== */
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 1.1rem;
width: 100%;
max-width: 960px;
margin: 1.75rem auto 0;
margin: 2rem auto 0;
counter-reset: feat;
}
.feature-card {
counter-increment: feat;
position: relative;
background: var(--card);
/* 光标光斑:JS 写入 --mx/--my,缺省停在顶部中央 */
background-image: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 75%);
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
padding: 1.7rem 1.4rem;
border-radius: var(--radius-lg);
padding: 1.8rem 1.5rem;
box-shadow: var(--shadow-sm);
overflow: hidden;
transition: transform 0.18s, box-shadow 0.2s, border-color 0.2s;
transition: transform 0.22s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.feature-card::before {
content: "";
@@ -194,98 +315,217 @@ body {
height: 3px;
background: linear-gradient(90deg, var(--accent), var(--accent-dark));
opacity: 0;
transition: opacity 0.2s;
transition: opacity 0.25s;
}
/* 序号水印(编辑感装饰) */
.feature-card::after {
content: "0" counter(feat);
position: absolute;
top: 1rem;
right: 1.2rem;
font-size: 1.55rem;
font-weight: 800;
line-height: 1;
letter-spacing: 0.02em;
color: var(--border);
transition: color 0.25s;
pointer-events: none;
}
.feature-card:hover {
transform: translateY(-4px);
transform: translateY(-5px);
border-color: var(--accent);
box-shadow: var(--shadow-md);
}
.feature-card:hover::before { opacity: 0.9; }
.feature-card:hover::after { color: var(--accent-glow); }
.feature-icon {
display: flex;
align-items: center;
justify-content: center;
width: 44px;
height: 44px;
margin-bottom: 0.9rem;
border-radius: var(--radius-sm);
width: 46px;
height: 46px;
margin-bottom: 0.95rem;
border-radius: 13px;
background: linear-gradient(135deg, var(--accent-soft), rgba(232, 133, 58, 0.16));
color: var(--accent-dark);
transition: transform 0.25s, background 0.25s, color 0.25s, box-shadow 0.25s;
}
.feature-icon svg { width: 22px; height: 22px; }
.feature-card h3 { margin-bottom: 0.4rem; font-size: 1.05rem; }
.feature-card:hover .feature-icon {
background: linear-gradient(135deg, var(--accent), var(--accent-dark));
color: #fff;
transform: translateY(-2px) scale(1.06);
box-shadow: 0 6px 14px rgba(232, 133, 58, 0.35);
}
.feature-card h3 { margin-bottom: 0.4rem; font-size: 1.05rem; letter-spacing: 0.01em; }
.feature-card p {
font-size: 0.88rem;
line-height: 1.7;
line-height: 1.75;
color: var(--fg-secondary);
}
/* ===== 关于本站 ===== */
.about {
text-align: center;
padding: 1rem 1rem 3rem;
max-width: 760px;
padding: 1rem 1rem 3.5rem;
max-width: 780px;
margin: 0 auto;
}
.about .section-eyebrow, .about .section-title { margin-top: 0; }
.about .site-intro {
position: relative;
background: var(--card);
border: 1px solid var(--border-light);
border-radius: var(--radius-md);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-sm);
padding: 1.75rem 1.9rem;
padding: 2rem 2.2rem;
margin-top: 2rem;
overflow: hidden;
}
/* 左侧品牌渐变条 + 右上角装饰引号 */
.about .site-intro::before {
content: "";
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: linear-gradient(180deg, var(--accent), var(--accent-dark));
opacity: 0.85;
}
.about .site-intro::after {
content: "”";
position: absolute;
top: -0.6rem;
right: 1.1rem;
font-family: Georgia, 'Times New Roman', serif;
font-size: 5rem;
line-height: 1;
color: var(--accent-soft);
pointer-events: none;
}
.site-intro {
font-size: 0.96rem;
line-height: 1.95;
color: var(--fg-secondary);
}
/* 快捷链接:胶囊按钮 */
.quick-links {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 1.5rem;
margin-top: 1.75rem;
gap: 0.9rem;
margin-top: 1.9rem;
}
.quick-links a {
display: inline-flex;
align-items: center;
gap: 0.35rem;
padding: 0.5rem 1.15rem;
font-size: 0.86rem;
color: var(--muted);
font-weight: 600;
color: var(--fg-secondary);
background: var(--card);
border: 1px solid var(--border);
border-radius: 999px;
text-decoration: none;
padding-bottom: 1px;
border-bottom: 1px solid transparent;
transition: color 0.15s, border-color 0.15s;
box-shadow: var(--shadow-sm);
transition: color 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.2s;
}
.quick-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.quick-links a::after {
content: "→";
font-size: 0.85em;
transition: transform 0.18s;
}
.quick-links a:hover {
color: var(--accent);
border-color: var(--accent);
transform: translateY(-2px);
box-shadow: var(--shadow-md);
}
.quick-links a:hover::after { transform: translateX(3px); }
/* ===== 入场动画 ===== */
/* ===== 入场动画(首屏元素,页面加载即播) ===== */
@keyframes fade-up {
from { opacity: 0; transform: translateY(12px); }
from { opacity: 0; transform: translateY(14px); }
to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: no-preference) {
.hero > *, .feature-card, .about { animation: fade-up 0.5s ease both; }
.hero-sub { animation-delay: 0.08s; }
.hero-actions { animation-delay: 0.16s; }
.feature-card:nth-child(2) { animation-delay: 0.06s; }
.feature-card:nth-child(3) { animation-delay: 0.12s; }
.feature-card:nth-child(4) { animation-delay: 0.18s; }
/* 品牌树:枝干描绘 + 节点弹出 + 整体轻摆 */
@keyframes tree-draw { to { stroke-dashoffset: 0; } }
@keyframes node-in {
from { opacity: 0; transform: scale(0); }
to { opacity: 1; transform: scale(1); }
}
@keyframes tree-sway {
0%, 100% { transform: translateX(-50%) rotate(0deg); }
50% { transform: translateX(-50%) rotate(0.7deg); }
}
@keyframes text-shine { to { background-position: 220% center; } }
@keyframes badge-pulse {
0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
50% { box-shadow: 0 0 0 5px transparent; }
}
@keyframes hint-bounce {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(5px); }
}
@media (prefers-reduced-motion: no-preference) {
.hero-inner > * { animation: fade-up 0.55s ease both; }
.hero-title { animation-delay: 0.06s; }
.hero-sub { animation-delay: 0.14s; }
.hero-actions { animation-delay: 0.22s; }
.accent-text { animation: text-shine 7s linear infinite; }
.badge-dot { animation: badge-pulse 2.4s ease-in-out infinite; }
.scroll-hint svg { animation: hint-bounce 2s ease-in-out infinite; }
.hero-tree { animation: tree-sway 10s ease-in-out 2.8s infinite; }
.hero-tree path {
stroke-dasharray: 100;
stroke-dashoffset: 100;
animation: tree-draw 0.9s ease-out forwards;
}
.hero-tree path:nth-of-type(1) { animation-delay: 0.15s; }
.hero-tree path:nth-of-type(2),
.hero-tree path:nth-of-type(3) { animation-delay: 0.75s; }
.hero-tree path:nth-of-type(n+4) { animation-delay: 1.35s; }
.hero-tree circle {
opacity: 0;
transform-box: fill-box;
transform-origin: center;
animation: node-in 0.45s ease-out forwards;
}
.hero-tree circle:nth-of-type(1) { animation-delay: 0.2s; }
.hero-tree circle:nth-of-type(2) { animation-delay: 0.85s; }
.hero-tree circle:nth-of-type(3),
.hero-tree circle:nth-of-type(4) { animation-delay: 1.45s; }
.hero-tree circle:nth-of-type(n+5) { animation-delay: 2s; }
}
/* ===== 滚动渐显(JS 加 .reveal 隐藏、入场加 .reveal-in;无 JS 时天然可见) ===== */
.reveal {
opacity: 0;
transform: translateY(18px);
transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.reveal-in { opacity: 1; transform: none; }
/* ===== 响应式 ===== */
/* 触屏设备:加大可点目标 */
@media (hover: none) and (pointer: coarse) {
.btn { min-height: 44px; }
.quick-links a { padding: 0.5rem 0.25rem; }
.quick-links a { padding: 0.6rem 1.1rem; }
}
/* 平板及以下:收敛首屏光晕与留白 */
@media (max-width: 768px) {
body { padding: 1.25rem 0.75rem; }
.hero { padding: 4rem 1.25rem 3.5rem; }
.hero::after { width: 420px; height: 420px; opacity: 0.4; }
.hero-title { letter-spacing: 0.01em; }
.hero { padding: 3.5rem 1.25rem 4rem; }
.hero::after { width: 440px; height: 440px; opacity: 0.45; }
.hero-tree { width: 130%; opacity: 0.12; }
.hero-title { letter-spacing: 0.02em; }
.features { gap: 0.9rem; }
.feature-card { padding: 1.4rem 1.2rem; }
.feature-card { padding: 1.5rem 1.25rem; }
}
/* 手机:全宽布局、紧凑排版 */
@@ -302,9 +542,11 @@ body {
.right-group .btn { padding: 0.5rem 0.95rem; font-size: 0.82rem; }
#name { max-width: 72px; }
.hero { padding: 3rem 0.75rem 2.5rem; }
.hero::after { width: 300px; height: 300px; opacity: 0.32; }
.hero-title { margin-bottom: 0.75rem; }
.hero { padding: 2.75rem 0.75rem 2.5rem; }
.hero::after { width: 310px; height: 310px; opacity: 0.35; }
.hero-tree { width: 160%; opacity: 0.1; }
.hero-badge { font-size: 0.74rem; padding: 0.3rem 0.8rem; margin-bottom: 1.1rem; }
.hero-title { margin-bottom: 0.8rem; }
.hero-sub { font-size: 0.95rem; }
.hero-actions {
flex-direction: column;
@@ -312,19 +554,22 @@ body {
gap: 0.65rem;
}
.hero-actions .btn-lg { width: 100%; padding: 0.85rem 1.5rem; }
.scroll-hint { display: none; }
.section-title { margin-top: 2.5rem; font-size: 1.3rem; }
.section-eyebrow { margin-top: 2.75rem; }
.section-title { font-size: 1.3rem; }
.features { margin-top: 1.25rem; grid-template-columns: 1fr; }
.feature-card:hover { transform: none; } /* 触屏取消悬浮位移 */
.about { padding: 0.5rem 0.5rem 2.5rem; }
.about .site-intro { padding: 1.4rem 1.3rem; text-align: left; }
.quick-links { gap: 1rem 1.5rem; margin-top: 1.5rem; }
.about .site-intro { padding: 1.5rem 1.4rem; text-align: left; }
.about .site-intro::after { font-size: 3.5rem; right: 0.8rem; }
.quick-links { gap: 0.6rem 0.8rem; margin-top: 1.5rem; }
}
/* 超小屏 */
@media (max-width: 360px) {
.hero { padding: 2.5rem 0.5rem 2rem; }
.hero { padding: 2.25rem 0.5rem 2rem; }
.header h1 { font-size: 0.95rem; }
.right-group .btn { padding: 0.45rem 0.8rem; font-size: 0.8rem; }
}
+37 -5
View File
@@ -29,15 +29,46 @@
<main id="main-page">
<section class="hero">
<h2 class="hero-title">让知识像树一样<br><span class="accent-text">自然生长</span></h2>
<p class="hero-sub">每个节点都可以生长出子节点,像树枝一样层层延展</p>
<div class="hero-actions">
<button id="ctaBtn" class="btn btn-primary btn-lg">开始记录</button>
<a class="btn btn-ghost btn-lg" href="#features">了解更多</a>
<!-- 品牌装饰:节点树(生长动画见 index.css,纯装饰不影响交互) -->
<svg class="hero-tree" viewBox="0 0 640 360" fill="none" aria-hidden="true">
<g stroke="currentColor" stroke-width="2" stroke-linecap="round">
<path pathLength="100" d="M320 344 L320 262"/>
<path pathLength="100" d="M320 262 C 282 236, 238 214, 202 184"/>
<path pathLength="100" d="M320 262 C 358 236, 402 214, 438 184"/>
<path pathLength="100" d="M202 184 C 178 156, 156 134, 142 104"/>
<path pathLength="100" d="M202 184 C 222 156, 244 134, 258 104"/>
<path pathLength="100" d="M438 184 C 414 156, 396 134, 382 104"/>
<path pathLength="100" d="M438 184 C 462 156, 484 134, 498 104"/>
</g>
<g fill="currentColor">
<circle cx="320" cy="344" r="6"/>
<circle cx="320" cy="262" r="4.5"/>
<circle cx="202" cy="184" r="4.5"/>
<circle cx="438" cy="184" r="4.5"/>
<circle cx="142" cy="104" r="4"/>
<circle cx="258" cy="104" r="4"/>
<circle cx="382" cy="104" r="4"/>
<circle cx="498" cy="104" r="4"/>
</g>
</svg>
<div class="hero-inner">
<div class="hero-badge"><span class="badge-dot"></span>树状结构 · Markdown · 多媒体分享</div>
<h2 class="hero-title">让知识像树一样<br><span class="accent-text">自然生长</span></h2>
<p class="hero-sub">每个节点都可以生长出子节点,像树枝一样层层延展</p>
<div class="hero-actions">
<button id="ctaBtn" class="btn btn-primary btn-lg">开始记录</button>
<a class="btn btn-ghost btn-lg" href="#features">了解更多</a>
</div>
</div>
<a class="scroll-hint" href="#features" aria-label="下滑了解特性">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>
</a>
</section>
<section id="features">
<p class="section-eyebrow">核心特性</p>
<h2 class="section-title">为什么选择树状笔记</h2>
<div class="features">
<div class="feature-card">
@@ -72,6 +103,7 @@
</section>
<section class="about">
<p class="section-eyebrow">我们的理念</p>
<h2 class="section-title">关于本站</h2>
<p class="site-intro">
DNFS 树状笔记是一个以树状结构组织内容的笔记社区:每个节点都可以生长出子节点,
+41
View File
@@ -58,3 +58,44 @@
checkLogin();
})();
/* ===== 视觉增强:滚动渐显 + 卡片光标光斑(装饰性,与登录逻辑解耦) ===== */
(function () {
'use strict';
const reduceMotion = !window.matchMedia('(prefers-reduced-motion: no-preference)').matches;
/* 滚动进入视口渐显:由 JS 添加 .reveal 隐藏初始态,无 JS / 减弱动效时内容天然可见 */
if (!reduceMotion && 'IntersectionObserver' in window) {
const targets = document.querySelectorAll('.section-eyebrow, .section-title, .feature-card, .about .site-intro, .quick-links');
targets.forEach(function (el, i) {
el.classList.add('reveal');
el.style.transitionDelay = (i % 4) * 70 + 'ms';
});
const io = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
if (!entry.isIntersecting) return;
const el = entry.target;
el.classList.add('reveal-in');
io.unobserve(el);
/* 动画结束后移除类与延迟,把 transition 控制权交还 hover 等交互样式 */
setTimeout(function () {
el.classList.remove('reveal', 'reveal-in');
el.style.transitionDelay = '';
}, 900);
});
}, { threshold: 0.15, rootMargin: '0px 0px -8% 0px' });
targets.forEach(function (el) { io.observe(el); });
}
/* 特性卡片光标光斑:鼠标位置写入 CSS 变量,由 index.css 径向渐变消费(仅精确指针设备) */
if (window.matchMedia('(hover: hover) and (pointer: fine)').matches) {
document.querySelectorAll('.feature-card').forEach(function (card) {
card.addEventListener('mousemove', function (e) {
const rect = card.getBoundingClientRect();
card.style.setProperty('--mx', (e.clientX - rect.left) + 'px');
card.style.setProperty('--my', (e.clientY - rect.top) + 'px');
});
});
}
})();