/* === 全局變數與設定 === */
:root {
    --bg-color: #0a0a0c;
    --surface-color: #141418;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a5;
    --accent-color: #00f0ff;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Roboto, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-primary); line-height: 1.6; overflow-x: hidden; }

/* === 導覽列 (Navbar) & 手機版漢堡選單 === */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1.5rem 5%; position: fixed; width: 100%; top: 0;
    background: rgba(10, 10, 12, 0.85); backdrop-filter: blur(10px);
    z-index: 1000; border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.logo { font-size: 1.5rem; font-weight: 800; letter-spacing: 1px; }
.logo span { color: var(--accent-color); }
.nav-links { list-style: none; display: flex; gap: 2rem; }
.nav-links a {
    color: var(--text-primary); text-decoration: none; font-size: 0.95rem;
    font-weight: 500; transition: var(--transition); position: relative;
}
.nav-links a::after {
    content: ''; position: absolute; width: 0; height: 2px;
    bottom: -5px; left: 0; background-color: var(--accent-color); transition: var(--transition);
}
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a:hover, .nav-links a.active { color: var(--accent-color); }

.menu-toggle { display: none; font-size: 1.8rem; cursor: pointer; transition: var(--transition); }
.menu-toggle:hover { color: var(--accent-color); }

@media (max-width: 768px) {
    .menu-toggle { display: block; }
    .desktop-only { display: none; }
    .nav-links {
        position: absolute; top: 100%; left: 0; width: 100%;
        background: rgba(20, 20, 24, 0.98); backdrop-filter: blur(15px);
        flex-direction: column; align-items: center; padding: 2rem 0; gap: 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); transition: clip-path 0.4s ease-in-out;
    }
    .nav-links.active { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%); }
    .nav-links a::after { display: none; }
}

/* === 按鈕樣式 === */
.btn-primary {
    padding: 0.8rem 1.8rem; border-radius: 4px; text-decoration: none;
    font-weight: 600; transition: var(--transition); display: inline-block; cursor: pointer;
    background-color: var(--accent-color); color: #000; border: 1px solid var(--accent-color);
}
.btn-primary:hover {
    background-color: transparent; color: var(--accent-color);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.4);
}

/* === 首頁區塊 === */
.hero { height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 5%; background: radial-gradient(circle at center, #1a1a24 0%, var(--bg-color) 70%); }
.hero-content h1 { font-size: 4rem; line-height: 1.2; margin-bottom: 1.5rem; }
.highlight { color: var(--accent-color); text-shadow: 0 0 20px rgba(0, 240, 255, 0.3); }
.hero-content p { font-size: 1.2rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto 2rem; }
.hero-buttons { display: flex; gap: 1rem; justify-content: center; }

.services { padding: 8rem 5%; }
.section-title { text-align: center; margin-bottom: 4rem; }
.section-title h2 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.section-title p { color: var(--text-secondary); }

.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; max-width: 1200px; margin: 0 auto; }
.service-card { background-color: var(--surface-color); padding: 3rem 2rem; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.05); transition: var(--transition); }
.service-card:hover { transform: translateY(-10px); border-color: var(--accent-color); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.service-card i { font-size: 2.5rem; color: var(--accent-color); margin-bottom: 1.5rem; }
.service-card h3 { font-size: 1.5rem; margin-bottom: 1rem; }
.service-card p { color: var(--text-secondary); }

/* === 社群 (Discord) 專屬區塊 === */
.page-header-section { padding: 10rem 5% 3rem 5%; text-align: center; }
.discord-servers { padding: 0 5% 6rem 5%; }
.server-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 2rem; }
.server-card { background: var(--surface-color); border: 1px solid rgba(255, 255, 255, 0.05); border-radius: 12px; padding: 2rem; display: flex; flex-direction: column; transition: var(--transition); }
.server-card:hover { transform: translateY(-8px); border-color: var(--accent-color); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.card-header { display: flex; align-items: center; margin-bottom: 1.5rem; }
.server-icon { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; background-color: #1a1a20; margin-right: 1.2rem; flex-shrink: 0; transition: filter 0.3s ease; }
.server-icon.grayscale { filter: grayscale(100%); }
.server-name { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.server-desc { font-size: 0.95rem; color: var(--text-secondary); margin-bottom: 1.5rem; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.server-counts { display: flex; align-items: center; gap: 1.2rem; font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1.5rem; font-weight: 500; }
.count-item { display: flex; align-items: center; gap: 0.4rem; }
.dot-online { width: 10px; height: 10px; background-color: #23a559; border-radius: 50%; box-shadow: 0 0 8px #23a559;}
.dot-offline { width: 10px; height: 10px; background-color: #5b5e66; border-radius: 50%; }

.join-btn { background-color: var(--surface-color); color: var(--accent-color); border: 1px solid var(--accent-color); text-decoration: none; width: 100%; text-align: center; padding: 0.8rem 1rem; border-radius: 6px; font-weight: 600; font-size: 1rem; transition: var(--transition); cursor: pointer; display: inline-block; }
.join-btn:hover { background-color: var(--accent-color); color: #000; box-shadow: 0 0 15px rgba(0, 240, 255, 0.3); }

.server-card.disabled { background: rgba(255, 255, 255, 0.02); border-color: rgba(255, 255, 255, 0.02); }
.server-card.disabled:hover { transform: none; box-shadow: none; border-color: rgba(255, 255, 255, 0.05); }
.server-card.disabled .server-icon { filter: grayscale(100%); opacity: 0.4; }
.server-card.disabled .server-name, .server-card.disabled .server-desc, .server-card.disabled .server-counts { opacity: 0.4; }
.join-btn.disabled { background-color: transparent; border-color: rgba(255, 255, 255, 0.1); color: rgba(255, 255, 255, 0.3); cursor: not-allowed; pointer-events: none; }

.loading { text-align: center; color: var(--accent-color); grid-column: 1 / -1; padding: 4rem; font-size: 1.2rem; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 0.6; } 50% { opacity: 1; text-shadow: 0 0 15px var(--accent-color); } 100% { opacity: 0.6; } }

/* === 頁尾 === */
footer { background-color: #050505; padding: 3rem 5%; text-align: center; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.footer-content p { color: var(--text-secondary); margin-top: 1rem; font-size: 0.9rem; }

/* ========================================== */
/* ▼▼▼ 作品集 / 瀑布流 (Masonry) 專用樣式 ▼▼▼ */
/* ========================================== */

.portfolio-section {
    padding: 0 5% 6rem 5%;
}

/* 瀑布流核心排版 */
.masonry-gallery {
    /* 預設電腦版 3 欄 */
    column-count: 3;
    column-gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-item {
    /* 避免圖片被切斷分到下一欄 */
    break-inside: avoid;
    margin-bottom: 1.5rem;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    background-color: var(--surface-color);
}

.image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
}

.image-wrapper img {
    width: 100%;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1); /* 超絲滑放大 */
}

/* 懸停遮罩特效 */
.image-wrapper .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,240,255,0.4) 0%, rgba(10,10,12,0) 60%);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: var(--transition);
}

.image-wrapper .overlay i {
    color: var(--text-primary);
    font-size: 1.5rem;
    transform: scale(0.5);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 懸停時的觸發動作 */
.gallery-item:hover .image-wrapper img {
    transform: scale(1.05); /* 圖片微微放大 */
}

.gallery-item:hover .overlay {
    opacity: 1; /* 顯示科技藍漸層遮罩 */
}

.gallery-item:hover .overlay i {
    transform: scale(1); /* 圖示彈跳出現 */
}

/* RWD 響應式：平板改為 2 欄，手機改為 1 欄 */
@media (max-width: 1024px) {
    .masonry-gallery {
        column-count: 2;
    }
}

@media (max-width: 600px) {
    .masonry-gallery {
        column-count: 1;
    }
}

/* ========================================== */
/* ▼▼▼ 載入失敗 / 無作品提示樣式 ▼▼▼ */
/* ========================================== */

.error-message {
    /* 讓錯誤訊息在瀑布流中也能置中且佔滿寬度 */
    display: block;
    width: 100%;
    text-align: center;
    padding: 5rem 2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
}

.error-message i {
    font-size: 3.5rem;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    opacity: 0.8;
}

.error-message h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.error-message p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ========================================== */
/* ▼▼▼ 放大檢視 (Lightbox) 樣式 ▼▼▼ */
/* ========================================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 12, 0.95);
    backdrop-filter: blur(10px); /* 高級毛玻璃背景 */
    z-index: 2000; /* 確保蓋過導覽列 */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none; /* 隱藏時不可點擊 */
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto; /* 顯示時恢復點擊 */
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
    transform: scale(0.9); /* 預設縮小一點點 */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 顯示時圖片會稍微放大彈出 */
.lightbox.active img {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    font-size: 2.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    z-index: 2001;
}

.lightbox-close:hover {
    color: var(--accent-color);
    transform: scale(1.1) rotate(90deg); /* 懸停時旋轉的酷炫特效 */
}