/* 前台浅色动态网格背景
   参考：浅蓝绿渐变底 + 细密网格 + 柔和光晕，内容卡片保持白色半透明。 */
.front-grid-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    opacity: var(--fbg-opacity, .7);
    filter: blur(var(--fbg-blur, 0px));
    background:
        radial-gradient(circle at 10% 6%, var(--fbg-c1, #cfefff) 0, rgba(207, 239, 255, 0) 34%),
        radial-gradient(circle at 88% 14%, var(--fbg-c2, #d8f7ea) 0, rgba(216, 247, 234, 0) 36%),
        radial-gradient(circle at 68% 96%, var(--fbg-c3, #e8f1ff) 0, rgba(232, 241, 255, 0) 38%),
        linear-gradient(155deg, #eaf8fd 0%, #e8f7f3 48%, #eff6ff 100%);
}

/* 细网格：主网格 + 1/5 辅助网格，浅青灰线条 */
.front-grid-bg::before {
    content: "";
    position: absolute;
    inset: -8%;
    background-image:
        repeating-linear-gradient(0deg, rgba(13, 116, 144, .13) 0 1px, transparent 1px var(--fbg-grid, 36px)),
        repeating-linear-gradient(90deg, rgba(13, 116, 144, .11) 0 1px, transparent 1px var(--fbg-grid, 36px)),
        repeating-linear-gradient(0deg, rgba(13, 116, 144, .05) 0 1px, transparent 1px calc(var(--fbg-grid, 36px) / 5)),
        repeating-linear-gradient(90deg, rgba(13, 116, 144, .045) 0 1px, transparent 1px calc(var(--fbg-grid, 36px) / 5));
    animation: fbg-grid-drift var(--fbg-speed, 18s) linear infinite;
}

/* 右上角的柔光带，模拟参考图中的浅绿高光 */
.front-grid-bg::after {
    content: "";
    position: absolute;
    width: 78vmax;
    height: 52vmax;
    top: -24vmax;
    right: -22vmax;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(120, 232, 205, .32) 0, rgba(120, 232, 205, 0) 66%);
    filter: blur(6px);
    transform: rotate(-18deg);
    animation: fbg-aurora calc(var(--fbg-speed, 18s) * 1.8) ease-in-out infinite alternate;
}

.fbg-orb {
    position: absolute;
    display: block;
    width: 34vw;
    height: 34vw;
    min-width: 260px;
    min-height: 260px;
    border-radius: 50%;
    filter: blur(20px);
    opacity: .72;
    animation: fbg-float calc(var(--fbg-speed, 18s) * 1.3) ease-in-out infinite alternate;
}

.fbg-orb-a {
    top: -18%;
    left: -8%;
    background: radial-gradient(circle, var(--fbg-c1, #cfefff), transparent 68%);
}

.fbg-orb-b {
    bottom: -24%;
    right: -10%;
    background: radial-gradient(circle, var(--fbg-c2, #d8f7ea), transparent 70%);
    animation-delay: calc(var(--fbg-speed, 18s) * -.6);
}

/* 保证内容始终在背景层之上（首页 + 所有前台插件页） */
body.has-front-grid,
body.has-front-grid.user-page,
body.has-front-grid.article-page,
body.has-front-grid.product-page,
body.has-front-grid.ai-page {
    background: transparent;
}

/* 让首页与插件页的大区块透出网格背景，内容卡片仍保持白色可读 */
body.has-front-grid section.hero {
    background: linear-gradient(180deg, rgba(255, 255, 255, .30) 0%, rgba(255, 255, 255, .04) 100%);
}
body.has-front-grid section.section,
body.has-front-grid .front-main,
body.has-front-grid .front-content {
    background: transparent;
}
body.has-front-grid .front-footer--classic {
    background: rgba(255, 255, 255, .72);
}

body.has-front-grid main,
body.has-front-grid .site-header,
body.has-front-grid .site-footer,
body.has-front-grid .front-footer,
body.has-front-grid .plugin-fallback-header,
body.has-front-grid .user-fallback-header,
body.has-front-grid .user-fallback-footer {
    position: relative;
    z-index: 1;
}

body.has-front-grid .front-topbar { z-index: 30; }

/* 插件内容区透出网格但保持卡片可读 */
body.has-front-grid .plugin-main,
body.has-front-grid .user-main {
    position: relative;
    z-index: 1;
}

body.has-front-grid .plugin-hero,
body.has-front-grid .plugin-toolbar,
body.has-front-grid .plugin-result-meta,
body.has-front-grid .article-card,
body.has-front-grid .product-card,
body.has-front-grid .ai-card,
body.has-front-grid .plugin-card,
body.has-front-grid .user-card,
body.has-front-grid .user-auth-card,
body.has-front-grid .user-stats a {
    background-color: rgba(255, 255, 255, .92);
    backdrop-filter: blur(8px);
}

@keyframes fbg-grid-drift {
    from { background-position: 0 0, 0 0, 0 0, 0 0; }
    to { background-position: 0 calc(var(--fbg-grid, 36px) * 4), calc(var(--fbg-grid, 36px) * 4) 0, calc(var(--fbg-grid, 36px) * 2) 0, 0 calc(var(--fbg-grid, 36px) * 2); }
}

@keyframes fbg-aurora {
    from { transform: translate3d(0, 0, 0) rotate(-18deg) scale(1); }
    to { transform: translate3d(-3%, 4%, 0) rotate(-8deg) scale(1.08); }
}

@keyframes fbg-float {
    from { transform: translate3d(-2%, -1%, 0) scale(1); }
    to { transform: translate3d(3%, 4%, 0) scale(1.08); }
}

@media (max-width: 768px) {
    .front-grid-bg--desktop-only { display: none; }
    .front-grid-bg::before { opacity: .72; }
    .front-grid-bg::after { opacity: .7; }
}

@media (prefers-reduced-motion: reduce) {
    .front-grid-bg::before,
    .front-grid-bg::after,
    .fbg-orb { animation: none; }
}
