/* =========================================
   HOME PAGE STYLES (home.css)
   首頁專用樣式：WebGL 背景、輪播、卡片特效
   ========================================= */

/* --- 1. WebGL Background --- */
#webgl-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    z-index: -1; /* 最底層 */
    opacity: 1; 
    pointer-events: none;
}

/* --- 2. 輪播區塊 (Carousel Hero) --- */
.carousel-hero {
    height: calc(100vh - 80px); /* header height */
    width: 100%;
    position: relative;
    overflow: hidden;
    background: transparent; 
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1; /* 確保在背景之上 */
}

.carousel-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    
    /* 預設隱藏狀態 */
    opacity: 0;
    visibility: hidden;
    /* 不使用轉場動畫，直接切換 */
    transform: none;
    transition: none;
    
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    z-index: 1;
    pointer-events: none;
}

.carousel-slide.active { 
    opacity: 1; 
    visibility: visible;
    transform: none;
    pointer-events: auto; 
    z-index: 10;
}

.carousel-slide::after {
    content: '';
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    /* 稍微加深遮罩，讓文字更清楚 */
    background: rgba(0,0,0,0.55);
    z-index: 1;
}

.carousel-content {
    position: relative;
    z-index: 20;
    text-align: center;
    color: #FFF;
    max-width: 800px;
    padding: 0 20px;
    pointer-events: none; 
}
.carousel-content * {
    pointer-events: auto;
}

.carousel-tag {
    font-family: var(--f-mono); font-size: 0.8rem; color: var(--c-accent);
    letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 1rem; display: block;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.carousel-title {
    font-family: var(--f-display); font-size: 4rem; font-weight: 700;
    line-height: 1.1; margin-bottom: 1.5rem;
    text-shadow: 0 4px 8px rgba(0,0,0,0.5);
}

.carousel-desc {
    font-family: var(--f-body); font-size: 1.1rem; font-weight: 300;
    max-width: 600px; margin: 0 auto; opacity: 0.95;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* --- Indicators (Bottom Lines) --- */
.carousel-indicators {
    position: absolute; 
    bottom: 40px;
    left: 50%; 
    transform: translateX(-50%);
    display: flex; 
    gap: 12px; 
    z-index: 999; /* 極高層級，確保不被遮擋 */
    padding: 10px 20px;
    background: rgba(0,0,0,0.2); /* 微弱背景增加對比 */
    border-radius: 30px;
    backdrop-filter: blur(4px);
}

.indicator {
    width: 40px; 
    height: 4px; 
    background: rgba(255,255,255,0.4);
    cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    border-radius: 2px;
    position: relative;
}

/* 增加點擊感應區 */
.indicator::before {
    content: '';
    position: absolute;
    top: -15px; bottom: -15px; left: -5px; right: -5px;
}

.indicator:hover {
    background: rgba(255,255,255,0.8);
}

.indicator.active { 
    background-color: var(--c-accent); 
    width: 60px; 
    box-shadow: 0 0 10px var(--c-accent-glow);
}

/* --- Navigation Arrows --- */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--f-mono);
    font-size: 1.5rem;
    color: #FFF;
    cursor: pointer;
    z-index: 999; /* 極高層級 */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    border-radius: 50%;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.2);
    user-select: none;
}

.carousel-nav:hover {
    background: var(--c-accent);
    border-color: var(--c-accent);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 15px var(--c-accent-glow);
}

.carousel-nav:active {
    transform: translateY(-50%) scale(0.95);
}

.prev-btn { left: 2rem; }
.next-btn { right: 2rem; }

/* --- 3. 解決方案區塊 (Solutions Section) --- */
.solutions-section { 
    padding: 8rem 10%; 
    background: transparent; 
    position: relative;
    z-index: 1;
}

.solution-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6rem;
    margin-bottom: 12rem;
    align-items: center;
    cursor: default;
    text-align: left;
}

.solution-card .text-col {
    display: block;
    max-width: none;
}

.section-label { 
    font-family: var(--f-mono); color: var(--c-accent); font-size: 0.8rem; 
    display: block; margin-bottom: 1.5rem; letter-spacing: 0.1em;
}
.h2-title { 
    font-family: var(--f-display); font-size: 2.5rem; margin-bottom: 1.5rem; 
    line-height: 1.2; font-weight: 500; color: var(--c-text-main);
}
.body-text { 
    color: var(--c-text-sub); margin-bottom: 2.5rem; 
    text-align: justify; font-weight: 300; max-width: 450px;
}

.btn-arrow {
    display: inline-flex; align-items: center;
    font-family: var(--f-display); font-weight: 500; font-size: 0.9rem;
    color: var(--c-text-main); border-bottom: 1px solid var(--c-border); padding-bottom: 4px;
    cursor: pointer;
}
.btn-arrow:hover { border-color: var(--c-accent); color: var(--c-accent); }

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.8rem;
    border-radius: 999px;
    background-color: var(--c-accent);
    color: #FFF;
    font-family: var(--f-display);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border: none;
    box-shadow: 0 8px 20px var(--c-accent-glow);
    cursor: pointer;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px var(--c-accent-glow);
}

/* --- 4. 視覺展示框 (Monitor Frame) --- */
.visual-col { display: flex; justify-content: center; align-items: center; width: 100%; }

.monitor-frame {
    width: 100%; max-width: 500px;
    background: #FFF; border-radius: 8px; padding: 1rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
    position: relative; overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(0,0,0,0.05);
}
.monitor-frame:hover { transform: translateY(-5px); box-shadow: 0 30px 70px rgba(0,0,0,0.15); }

.comp-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    margin-bottom: 1rem; border-bottom: 1px solid #EEE; padding-bottom: 0.5rem;
}
.comp-title { font-family: var(--f-mono); font-size: 0.7rem; color: var(--c-accent); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; }
.comp-sub { font-family: var(--f-body); font-size: 0.8rem; color: #999; }

.frame-content {
    position: relative; width: 100%; aspect-ratio: 16/9;
    overflow: hidden; border-radius: 4px; background: #000;
    display: flex; align-items: center; justify-content: center;
}

/* System Viz */
.system-viz { width: 100%; height: 100%; background: radial-gradient(circle at 50% 50%, #222, #000); display: flex; align-items: center; justify-content: center; }
.system-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; width: 60%; height: 60%; }
.sys-cell { background: rgba(255,255,255,0.1); border-radius: 2px; animation: pulse-grid 2s infinite ease-in-out; }
@keyframes pulse-grid { 0%,100%{opacity:0.2;} 50%{opacity:0.8;} }

/* Engine Slider Styles (Home Preview) */
.slider-container { position: relative; width: 100%; height: 100%; overflow: hidden; cursor: ew-resize; }
.img-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; }
.img-after { background-image: url('https://images.unsplash.com/photo-1599839575945-a9e5af0c3fa5?q=80&w=800&auto=format&fit=crop'); }
.img-before {
    background-image: url('https://images.unsplash.com/photo-1599839575945-a9e5af0c3fa5?q=80&w=800&auto=format&fit=crop');
    width: 50%; border-right: 2px solid var(--c-accent);
    filter: sepia(0.8) blur(1px) grayscale(0.5) contrast(0.8) brightness(0.8);
    z-index: 2;
}
.slider-handle {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 30px; height: 30px; background: var(--c-accent);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    z-index: 3; box-shadow: 0 0 15px var(--c-accent); pointer-events: none;
}
.slider-handle::after { content: '< >'; font-family: var(--f-mono); font-size: 0.6rem; color: #000; font-weight: bold; }
.label-float {
    position: absolute; top: 1rem; font-family: var(--f-mono); font-size: 0.6rem; color: #FFF;
    background: rgba(0,0,0,0.6); padding: 4px 8px; border-radius: 4px; pointer-events: none; z-index: 4;
}
.lbl-before { left: 1rem; }
.lbl-after { right: 1rem; color: var(--c-accent); border: 1px solid var(--c-accent); }

/* Space Image */
.space-img { width: 100%; height: 100%; object-fit: cover; opacity: 0.8; transition: 0.5s; }
.monitor-frame:hover .space-img { opacity: 1; transform: scale(1.05); }

@media (max-width: 768px) {
    .carousel-title {
        font-size: 2.1rem;
        line-height: 1.25;
        margin-bottom: 1.2rem;
    }

    .carousel-desc {
        font-size: 1rem;
    }

    .solutions-section {
        padding: 4rem 1.5rem;
    }

    .solution-card {
        grid-template-columns: 1fr;
        gap: 3rem;
        margin-bottom: 6rem;
    }

    .section-label {
        font-size: 0.75rem;
    }

    .h2-title {
        font-size: 2rem;
        line-height: 1.3;
        margin-bottom: 1rem;
    }

    .body-text {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .carousel-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

/* --- 2.5 簡介與粒子互動區 (Intro Section) --- */
.intro-section {
    position: relative;
    width: 100%;
    height: 60vh; /* Adjust height */
    background: #FFF;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 0;
    z-index: 2; /* Above background */
}

#intro-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
}

.intro-subtitles {
    position: absolute;
    bottom: 20%;
    text-align: center;
    z-index: 2;
    pointer-events: none; /* Let mouse pass through to canvas */
    width: 100%;
}

.intro-subtitles p {
    font-family: var(--f-body);
    font-size: 1.1rem;
    color: var(--c-text-light);
    margin: 0.5rem 0;
    letter-spacing: 0.1em;
    opacity: 0;
    animation: fadeUp 1s ease forwards;
}

.intro-subtitles p:nth-child(2) {
    animation-delay: 0.5s;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .intro-section { height: 50vh; }
    .intro-subtitles p { font-size: 0.9rem; padding: 0 1rem; }
}
