/**
 * 色彩格子2：dlc-html/css/index.html 对应「top-stats-glass-section」样式独立迁移。
 * 选择器统一加前缀 .modules-color-grid-2，避免依赖全站是否加载 index.css。
 */

@media (max-width: 992px) {
    .modules-color-grid-2 .top-stats-glass-section::before {
        animation: none !important;
    }
}

/**
 * 统计行：CSS Grid 均分整行（不依赖 Bootstrap col），由模块内联 style 的
 * --cg2-cols-lg / --cg2-cols-sm / --cg2-gap 控制列数与间距。
 */
.modules-color-grid-2 .top-stats-glass-section .cg2-stats-row {
    display: grid;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    gap: var(--cg2-gap, 0);
    grid-template-columns: repeat(var(--cg2-cols-sm, 2), minmax(0, 1fr));
}

@media (min-width: 768px) {
    .modules-color-grid-2 .top-stats-glass-section .cg2-stats-row {
        grid-template-columns: repeat(var(--cg2-cols-lg, 4), minmax(0, 1fr));
    }
}

.modules-color-grid-2 .top-stats-glass-section .cg2-stats-row > .cg2-stat-cell {
    box-sizing: border-box;
    min-width: 0;
}

.modules-color-grid-2 .top-stats-glass-section {
    position: relative;
    width: 100%;
    padding: 25px 0;
    /* 渐变 + 半透明叠层，强化毛玻璃层次 */
    background: linear-gradient(135deg, rgba(254, 207, 81, 0.85), rgba(247, 137, 46, 0.85), rgba(246, 132, 37, 0.85)),
        rgba(255, 255, 255, 0.06);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 5px 15px rgba(247, 137, 46, 0.1);
    z-index: 10;
    overflow: hidden;
    --pointer-x: 50%;
    --pointer-y: 50%;
}

.modules-color-grid-2 .top-stats-glass-section::before {
    content: '';
    position: absolute;
    top: 0;
    width: 250px;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.6) 50%, rgba(255, 255, 255, 0) 100%);
    transform: translateX(-140%) skewX(-25deg);
    transition: transform 0.35s ease, opacity 0.35s ease;
    opacity: 0.45;
    pointer-events: none;
    z-index: 1;
}

.modules-color-grid-2 .top-stats-glass-section.is-hovering::before {
    transform: translateX(260%) skewX(-25deg);
    opacity: 0.7;
}

.modules-color-grid-2 .top-stats-glass-section::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.18s ease;
    /* 随 --pointer-x/y 变化的光晕（由 main.js 写入），略加大半径便于感知 */
    background: radial-gradient(
        240px 240px at var(--pointer-x) var(--pointer-y),
        rgba(255, 255, 255, 0.28) 0%,
        rgba(255, 255, 255, 0.1) 38%,
        rgba(255, 255, 255, 0) 70%
    );
}

.modules-color-grid-2 .top-stats-glass-section.is-hovering::after {
    opacity: 1;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-item {
    color: #fff;
    padding: 8px 10px;
    position: relative;
    z-index: 2;
}

/* 取消单格 hover 上浮；交互由整条 .top-stats-glass-section 的光晕/扫光承担（!important 压过全站 index.css） */
.modules-color-grid-2 .top-stats-glass-section .top-stat-item:hover {
    transform: none !important;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-value {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 6px;
}

/* 与 index.html 一致：数字 + 单位同一行（抵消主题对 h2 的 width:100% 等） */
.modules-color-grid-2 .top-stats-glass-section .top-stat-value > .d-flex {
    display: flex !important;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: baseline;
    justify-content: center;
    width: auto;
    max-width: 100%;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-value .top-stat-number {
    display: inline-block;
    width: auto;
    max-width: none;
    flex: 0 0 auto;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-value .top-stat-unit {
    display: inline-block;
    flex: 0 0 auto;
    white-space: nowrap;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-icon {
    font-size: 2.2rem;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0;
    line-height: 1;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-unit {
    font-size: 1.5rem;
    font-weight: 600;
    margin-left: 2px;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-text {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    opacity: 0.95;
    letter-spacing: 1px;
}

.modules-color-grid-2 .top-stats-glass-section .top-stat-desc {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    opacity: 0.9;
    line-height: 1.45;
}

@media (max-width: 768px) {
    .modules-color-grid-2 .top-stats-glass-section {
        padding: 20px 0;
    }
    .modules-color-grid-2 .top-stats-glass-section .top-stat-value {
        gap: 8px;
    }
    .modules-color-grid-2 .top-stats-glass-section .top-stat-number {
        font-size: 1.98rem;
    }
    .modules-color-grid-2 .top-stats-glass-section .top-stat-unit {
        font-size: 1.08rem;
    }
    .modules-color-grid-2 .top-stats-glass-section .top-stat-icon {
        font-size: 1.8rem;
    }
    .modules-color-grid-2 .top-stats-glass-section .top-stat-text {
        font-size: 0.83rem;
    }
    .modules-color-grid-2 .top-stats-glass-section .top-stat-desc {
        font-size: 0.8rem;
    }
}

.mobile-lite-mode .modules-color-grid-2 .top-stats-glass-section {
    backdrop-filter: saturate(150%) blur(12px);
    -webkit-backdrop-filter: saturate(150%) blur(12px);
}

.page-hidden .modules-color-grid-2 .top-stats-glass-section::before {
    animation-play-state: paused !important;
}
