/* ====================
   元凯3D打印 - 创新3D视觉效果
   3D Printing Visual Effects
   ==================== */

/* ========================================
   P0: 材料质感卡片系统
   Material Texture Card System
   ======================================== */

/* 基础3D卡片样式 */
.card-3d-material {
    position: relative;
    border-radius: var(--radius-xl);
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    transform-style: preserve-3d;
}

.card-3d-material::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.card-3d-material:hover {
    transform: translateY(-10px) rotateX(5deg);
}

.card-3d-material:hover::before {
    opacity: 1;
}

/* 金属质感 - Metal 3D Printing */
.card-metal {
    background: linear-gradient(135deg, #e8e8e8 0%, #c0c0c0 50%, #d5d5d5 100%);
    border: 1px solid rgba(255,255,255,0.4);
    box-shadow: 
        inset 0 1px 0 rgba(255,255,255,0.6),
        inset 0 -1px 0 rgba(0,0,0,0.1),
        0 15px 35px rgba(0,0,0,0.2),
        0 5px 15px rgba(0,0,0,0.1);
}

.card-metal::before {
    background: linear-gradient(
        105deg,
        transparent 40%,
        rgba(255,255,255,0.4) 50%,
        transparent 60%
    );
}

.card-metal::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255,255,255,0.4),
        transparent
    );
    transform: skewX(-25deg);
    transition: left 0.7s;
}

.card-metal:hover::after {
    left: 150%;
}

.card-metal .card-icon {
    background: linear-gradient(135deg, #8a8a8a, #4a4a4a);
    box-shadow: 
        inset 0 2px 4px rgba(255,255,255,0.3),
        0 4px 8px rgba(0,0,0,0.2);
}

/* 树脂质感 - Resin/SLA Printing */
.card-resin {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.08) 0%, rgba(79, 70, 229, 0.08) 100%);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(124, 58, 237, 0.3);
    box-shadow: 
        0 8px 32px rgba(124, 58, 237, 0.15),
        inset 0 0 20px rgba(255,255,255,0.3),
        0 0 0 1px rgba(255,255,255,0.1);
}

.card-resin::before {
    background: radial-gradient(
        circle at 30% 30%,
        rgba(124, 58, 237, 0.2) 0%,
        transparent 70%
    );
}

.card-resin:hover {
    box-shadow: 
        0 20px 40px rgba(59, 130, 246, 0.25),
        inset 0 0 30px rgba(255,255,255,0.4);
}

.card-resin .card-icon {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.9));
    box-shadow: 
        0 0 20px rgba(59, 130, 246, 0.4),
        inset 0 2px 4px rgba(255,255,255,0.3);
}

/* 尼龙质感 - Nylon/SLS Printing */
.card-nylon {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.03),
        0 4px 6px rgba(0,0,0,0.02),
        0 10px 20px rgba(0,0,0,0.03);
    filter: contrast(0.98) brightness(0.99);
}

/* 磨砂纹理效果 */
.card-nylon::before {
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    opacity: 0.5;
}

.card-nylon:hover {
    filter: contrast(1) brightness(1);
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.02),
        0 8px 16px rgba(0,0,0,0.04);
}

.card-nylon .card-icon {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.2);
}

/* 卡片图标基础样式 */
.card-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: white;
    margin-bottom: 1.5rem;
    transition: transform 0.3s;
}

.card-3d-material:hover .card-icon {
    transform: scale(1.1) translateZ(20px);
}

/* ========================================
   P0: 3D卡片倾斜交互效果
   3D Card Tilt Interaction
   ======================================== */

.card-tilt-3d {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.card-tilt-3d .card-content {
    position: relative;
    z-index: 2;
    transform: translateZ(30px);
}

/* 层纹装饰 - 像3D打印的层线 */
.card-tilt-3d::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(255,255,255,0.02) 3px,
        rgba(255,255,255,0.02) 4px
    );
    pointer-events: none;
    border-radius: inherit;
    z-index: 1;
}

/* 光泽反射层 */
.card-tilt-3d .shine {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0) 100%
    );
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    border-radius: inherit;
}

.card-tilt-3d:hover .shine {
    opacity: 1;
}

/* 悬浮时的Z轴提升 */
.card-tilt-3d:hover {
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255,255,255,0.1);
}

/* ========================================
   P1: 打印进度按钮动画
   3D Print Progress Button
   ======================================== */

.btn-print-progress {
    position: relative;
    overflow: hidden;
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    z-index: 1;
    transition: color 0.4s;
}

/* 打印层效果 - 从下往上 */
.btn-print-progress::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: repeating-linear-gradient(
        0deg,
        var(--accent-color) 0px,
        var(--accent-color) 2px,
        var(--accent-dark) 2px,
        var(--accent-dark) 4px
    );
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.btn-print-progress:hover {
    color: white;
}

.btn-print-progress:hover::before {
    height: 100%;
}

/* 激光扫描效果 */
@keyframes laser-scan {
    0% {
        opacity: 0.5;
        box-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color);
    }
    50% {
        opacity: 1;
        box-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--accent-color);
    }
    100% {
        opacity: 0.5;
        box-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color);
    }
}

.btn-print-progress:hover {
    animation: laser-scan 0.3s ease-in-out infinite;
}

/* 完成状态 */
.btn-print-progress.complete::before {
    height: 100%;
    background: var(--success-color);
}

/* ========================================
   P1: 层叠文字3D效果
   Layered 3D Text Effect
   ======================================== */

.text-3d-layered {
    position: relative;
    display: inline-block;
    color: transparent;
    transform-style: preserve-3d;
    perspective: 500px;
}

/* 基础层 - 像打印的第一层 */
.text-3d-layered::before {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    color: rgba(124, 58, 237, 0.2);
    transform: translateZ(-15px) translateY(6px);
    filter: blur(1px);
}

/* 中间层 */
.text-3d-layered .layer-mid {
    position: absolute;
    left: 0;
    top: 0;
    color: rgba(124, 58, 237, 0.5);
    transform: translateZ(-7px) translateY(3px);
}

/* 顶层 - 完成品 */
.text-3d-layered .layer-top {
    position: relative;
    color: var(--secondary-color);
    transform: translateZ(10px);
    text-shadow: 
        0 1px 0 rgba(0,0,0,0.1),
        0 2px 0 rgba(0,0,0,0.08),
        0 3px 0 rgba(0,0,0,0.06),
        0 0 20px rgba(124, 58, 237, 0.3);
}

/* 悬停展开效果 */
.text-3d-layered:hover::before {
    transform: translateZ(-25px) translateY(10px);
    transition: transform 0.4s ease-out;
}

.text-3d-layered:hover .layer-mid {
    transform: translateZ(-12px) translateY(5px);
    transition: transform 0.3s ease-out;
}

.text-3d-layered:hover .layer-top {
    transform: translateZ(20px);
    transition: transform 0.3s ease-out;
}

/* 打印完成动画 */
@keyframes print-complete {
    0% {
        text-shadow: 0 0 0 transparent;
    }
    50% {
        text-shadow: 0 0 30px rgba(124, 58, 237, 0.6);
    }
    100% {
        text-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
    }
}

.text-3d-layered.animate {
    animation: print-complete 1s ease-out;
}

/* ========================================
   P2: 3D网格地板背景
   3D Grid Floor Background
   ======================================== */

.floor-3d-grid {
    position: absolute;
    bottom: 0;
    left: -50%;
    width: 200%;
    height: 50%;
    background: 
        linear-gradient(90deg, rgba(37,99,235,0.1) 1px, transparent 1px),
        linear-gradient(rgba(37,99,235,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: perspective(500px) rotateX(60deg);
    transform-origin: center bottom;
    animation: grid-move 20s linear infinite;
    pointer-events: none;
}

@keyframes grid-move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 0 50px;
    }
}

/* 网格渐变淡出 */
.floor-3d-grid::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: linear-gradient(
        to top,
        transparent 0%,
        rgba(15, 23, 42, 0.5) 100%
    );
}

/* 打印喷头光标 */
.cursor-print-head {
    position: fixed;
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s, opacity 0.3s;
    mix-blend-mode: difference;
    opacity: 0;
}

.cursor-print-head.visible {
    opacity: 1;
}

.cursor-print-head::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px var(--accent-color);
}

/* ========================================
   P2: 分层服务流程展示
   Layered Service Process
   ======================================== */

.slice-process-container {
    perspective: 1000px;
    padding: 2rem 0;
}

.slice-layer {
    position: relative;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-bottom: -2rem;
    transform: translateZ(calc(var(--layer-index, 0) * -15px));
    opacity: calc(1 - var(--layer-index, 0) * 0.1);
    filter: blur(calc(var(--layer-index, 0) * 0.5px));
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 4px 6px -1px rgba(0,0,0,0.1),
        0 0 0 1px rgba(0,0,0,0.02);
}

.slice-layer:hover {
    transform: translateZ(30px) scale(1.02);
    opacity: 1;
    filter: blur(0);
    z-index: 10;
    box-shadow: 
        0 25px 50px -12px rgba(0,0,0,0.15),
        0 0 0 1px rgba(124, 58, 237, 0.1);
}

/* 层编号 */
.slice-layer-number {
    position: absolute;
    top: -15px;
    left: 2rem;
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

/* 层线装饰 */
.slice-layer::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    background: repeating-linear-gradient(
        90deg,
        var(--primary-color) 0px,
        var(--primary-color) 5px,
        transparent 5px,
        transparent 10px
    );
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.3;
}

.slice-layer:hover::before {
    opacity: 1;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

/* 响应式调整 */
@media (max-width: 768px) {
    .card-3d-material:hover {
        transform: translateY(-5px);
    }
    
    .text-3d-layered {
        transform: none;
    }
    
    .floor-3d-grid {
        display: none;
    }
    
    .slice-layer {
        margin-bottom: 1rem;
        transform: none;
        opacity: 1;
        filter: none;
    }
}
