/* ==================================== */
/* 1. 基礎、字體與變數 */
/* ==================================== */

/* 引入 Google Font 'Poppins' */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

:root {
    /* 專業深色主題 */
    --bg-color: #121212; /* 背景黑 */
    --surface-color: #1E1E1E; /* 表面/卡片黑 */
    --primary-color: #00A3FF; /* 亮藍色 (主色) */
    --text-color: #E0E0E0; /* 主要文字 (淺灰) */
    --text-secondary: #AAAAAA; /* 次要文字 (稍暗) */
    --shadow-color: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif; /* 使用 Google Font */
    margin: 0;
    line-height: 1.7;
    color: var(--text-color);
    background-color: var(--bg-color);
    scroll-behavior: smooth;
}

/* ==================================== */
/* 2. 載入動畫 (Preloader) */
/* ==================================== */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}
.preloader.fade-out {
    opacity: 0;
}
/* 簡易的旋轉動畫 */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--surface-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================================== */
/* 3. 導覽列 (Navbar) - 玻璃擬態 */
/* ==================================== */
.navbar {
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease;
    
    /* 玻璃擬態效果 */
    background-color: rgba(30, 30, 30, 0.7); /* 半透明背景 */
    backdrop-filter: blur(10px); /* 模糊背景 */
    -webkit-backdrop-filter: blur(10px);
}

.navbar-brand {
    color: white;
    text-decoration: none;
    font-size: 1.8em;
    font-weight: 600;
}

.nav-links {
    display: flex;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    padding: 10px 15px;
    position: relative; /* 為了底下的動畫線 */
    transition: color 0.3s;
}
/* 酷炫的 Hover 底線動畫 */
.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 5px;
    left: 50%;
    background-color: var(--primary-color);
    transition: all 0.3s ease-out;
}
.nav-links a:hover {
    color: white;
}
.nav-links a:hover::after {
    width: 80%;
    left: 10%;
}

.menu-toggle {
    display: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
}

/* ==================================== */
/* 4. 標頭 (Header) */
/* ==================================== */
header {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    color: white;
    padding: 80px 40px;
    text-align: center;
    height: 40vh; /* 讓它高一點 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
header h1 {
    font-size: 3.5em;
    font-weight: 600;
}
header p {
    font-size: 1.2em;
    font-weight: 300;
    opacity: 0.9;
}

/* ==================================== */
/* 5. 區塊 (Sections) 與卡片 */
/* ==================================== */
section {
    padding: 80px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    text-align: center;
    font-size: 2.5em;
    font-weight: 600;
    margin-bottom: 50px;
    color: var(--primary-color);
    position: relative;
}
/* H2 的底線裝飾 */
h2::after {
    content: '';
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 2px;
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
}

/* 卡片通用樣式 (用於 Contact) */
.card {
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
/* 酷炫的 Hover 浮動特效 */
.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow-color);
}

/* ==================================== */
/* 6. 關於我 (About) */
/* ==================================== */
.about-content {
    display: flex;
    align-items: center;
    gap: 50px;
}
.about-image img {
    width: 300px;
    height: 300px;
    object-fit: cover; /* 確保圖片不變形 */
    border-radius: 50%;
    border: 5px solid var(--primary-color);
    box-shadow: 0 0 25px rgba(0, 163, 255, 0.5);
}
.about-text {
    flex: 1;
}
.about-text h3 {
    font-size: 1.8em;
    color: white;
    margin-bottom: 15px;
}

/* ==================================== */
/* 7. 作品集 (Portfolio) - 輪播 */
/* ==================================== */
#portfolio {
    background-color: var(--surface-color); /* 換個背景色 */
}
.carousel-container {
    position: relative;
    max-width: 800px; /* 放大輪播 */
    margin: 0 auto;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 5px 20px var(--shadow-color);
}
.carousel-slides {
    display: flex;
    transition: transform 0.5s ease-in-out;
}
.carousel-slide {
    min-width: 100%;
    box-sizing: border-box;
    position: relative; /* 為了文字 */
}
.carousel-slide img {
    width: 100%;
    height: auto;
    display: block;
}
/* 輪播文字 (更酷的樣式) */
.carousel-slide p {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    text-align: center;
    background: linear-gradient(to top, rgba(0,0,0,0.9), transparent); /* 漸層背景 */
    color: white;
    padding: 40px 20px 20px 20px;
    margin: 0;
    font-size: 1.1em;
}
/* 輪播按鈕 */
.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
    font-size: 1.5em;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.3s;
}
.carousel-prev { left: 15px; }
.carousel-next { right: 15px; }
.carousel-prev:hover, .carousel-next:hover {
    background-color: var(--primary-color);
}

/* ==================================== */
/* 8. 聯絡 (Contact) - Grid */
/* ==================================== */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    text-align: center;
}
.contact-item { /* 使用 .card 樣式 */
    background-color: var(--surface-color);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.contact-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px var(--shadow-color);
}
.contact-item h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
}
.contact-item a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
}

/* ==================================== */
/* 9. 頁尾與頂部按鈕 */
/* ==================================== */
footer {
    text-align: center;
    padding: 40px 20px;
    background-color: var(--surface-color);
    color: var(--text-secondary);
    font-size: 0.9em;
}
#backToTopBtn {
    display: none;
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    border: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 12px 15px;
    border-radius: 50%;
    font-size: 1.2em;
    box-shadow: 0 2px 10px var(--shadow-color);
    transition: background-color 0.3s, transform 0.3s;
}
#backToTopBtn:hover {
    background-color: #007bbd;
    transform: scale(1.1);
}

/* ==================================== */
/* 10. 滾動動畫 (Scroll Animation) */
/* ==================================== */
.fade-in-section {
    opacity: 0; /* 預設隱藏 */
    transform: translateY(30px); /* 稍微往下移 */
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in-section.is-visible {
    opacity: 1; /* 觸發時顯示 */
    transform: translateY(0); /* 移回原位 */
}

/* ==================================== */
/* 11. 響應式 (RWD) */
/* ==================================== */
@media (max-width: 768px) {
    header h1 { font-size: 2.5em; }
    .navbar { padding: 15px 20px; }
    
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px; /* 根據 navbar 高度調整 */
        left: 0;
        background-color: var(--surface-color);
    }
    .nav-links.active { display: flex; }
    .nav-links a {
        text-align: center;
        padding: 15px;
        border-bottom: 1px solid var(--bg-color);
    }
    .nav-links a:hover::after { width: 0; }
    .menu-toggle { display: block; }
    
    .about-content { flex-direction: column; }
    .about-image img { width: 250px; height: 250px; }
}