/* ===== 導入 Google Fonts (設計感的來源) ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+TC:wght@400;500;700&family=Roboto+Mono:wght@400;500&display=swap');

/* ===== 基礎設定與變數 ===== */
:root {
    /* 顏色 (科技感深色主題) */
    --color-bg: #0d1117;         /* 背景色 (類-GitHub 深藍) */
    --color-bg-alt: #161b22;     /* 第二背景色 (卡片、區塊) */
    --color-text: #c9d1d9;       /* 主要文字 */
    --color-heading: #ffffff;    /* 標題文字 */
    --color-primary: #30a8f0;    /* 點綴色 (電光藍) */
    --color-border: #30363d;     /* 邊框色 */
    
    /* 字體 */
    --font-primary: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-code: 'Roboto Mono', monospace;
}

/* 原本的 :root 保持不動... */

/* ===== 亮色主題變數 (Light Theme) ===== */
[data-theme="light"] {
    --color-bg: #f8fafc;         /* 淺灰藍背景 (與你的履歷背景相同) */
    --color-bg-alt: #ffffff;     /* 純白卡片背景 */
    --color-text: #475569;       /* 深灰文字 */
    --color-heading: #0f172a;    /* 近乎黑色的標題 */
    --color-primary: #2563eb;    /* 經典科技藍 (稍微加深以維持對比度) */
    --color-border: #e2e8f0;     /* 淺灰邊框 */
}

/* 針對特定帶有透明度的背景進行亮色優化 */
[data-theme="light"] .navbar {
    background-color: rgba(255, 255, 255, 0.85); /* 導航列變白色毛玻璃 */
}

[data-theme="light"] #hero::before {
    background: radial-gradient(circle, rgba(37, 99, 235, 0.1), transparent 60%);
}

[data-theme="light"] .project-icon-wrapper {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
}

[data-theme="light"] .thesis-box {
    background-color: rgba(37, 99, 235, 0.05); /* 論文框改用極淺的藍色 */
}

/* ===== 主題切換按鈕樣式 ===== */
.theme-toggle-btn {
    background: transparent;
    border: none;
    color: var(--color-text);
    font-size: 1.25rem;
    cursor: pointer;
    margin-left: 1.5rem;
    padding: 0.5rem;
    transition: color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
}

.theme-toggle-btn:hover {
    color: var(--color-primary);
    transform: scale(1.1); /* 滑鼠懸停時微微放大 */
}

/* 手機版微調 */
@media (max-width: 992px) {
    .theme-toggle-btn {
        margin-left: 0;
        margin-bottom: 1rem;
        width: 100%;
        justify-content: center;
    }
}

/* --- 基礎重設 (Reset) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-primary);
    line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-heading);
    font-family: var(--font-primary);
    font-weight: 700;
    margin-bottom: 1rem;
}

h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; }

p {
    margin-bottom: 1.25rem;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--color-heading);
}

ul {
    list-style: none;
}

/* --- 版面配置 (Layout) --- */
.container {
    width: 90%;
    max-width: 1250px;
    margin: 0 auto;
}

/* ===== 導航列 (Navbar) ===== */
.navbar {
    background-color: rgba(13, 17, 23, 0.85); /* 帶透明度的背景 */
    backdrop-filter: blur(10px); /* 毛玻璃效果 (科技感) */
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 0;
    position: sticky; /* 關鍵：黏在頂部 */
    top: 0;
    width: 100%;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-heading);
}

/* ===== 導航列 Logo 圖片樣式 ===== */
.nav-logo img {
    height: 50px; /* 設定圖片高度，你可以根據需要調整 */
    width: auto;  /* 寬度自動調整，保持圖片比例 */
    display: block; /* 確保圖片能正確置中或對齊 */
}

/* 響應式調整：在手機版時，如果 Logo 太大，可以縮小 */
@media (max-width: 992px) {
    .nav-logo img {
        height: 35px; /* 手機版時稍微縮小 */
    }
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
}

/* --- 提升 Navbar 質感 (連結樣式) --- */
.nav-menu a {
    color: var(--color-text);
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem;
    position: relative; /* 關鍵：為了讓 ::after 偽元素定位 */
    text-decoration: none; /* 移除預設底線 */
    padding-bottom: 8px; /* 增加一點空間給底線 */
    transition: color 0.3s ease; /* 文字顏色變化的 transition */
}

/* 建立一個隱藏的底線 */
.nav-menu a::after {
    content: ''; /* 偽元素必須的 */
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0; /* 關鍵：預設寬度為 0 (隱藏) */
    height: 2px; /* 底線的高度 */
    background-color: var(--color-primary); /* 使用我們的科技藍 */
    transition: width 0.3s ease-in-out; /* 關鍵：寬度變化的動畫 */
}

/* 當滑鼠懸停 (hover) 時，將底線寬度變成 100% */
.nav-menu a:hover::after {
    width: 100%;
}

/* 滑鼠懸停時，文字也輕微變亮 */
.nav-menu a:hover {
    color: var(--color-heading);
}

/* "目前" 所在區塊的連結樣式 (未來用 JS 加上) */
.nav-menu a.active {
    color: var(--color-primary);
    font-weight: 700;
}

/* --- 修正 Navbar 排版 (nav 標籤) --- */
.navbar nav {
    display: flex; /* 讓內部的 .nav-menu 和 .lang-dropdown 水平並排 */
    align-items: center; /* 讓它們垂直置中對齊 */
}

/* ===== 語言切換選單 (Language Dropdown) ===== */
.lang-dropdown {
    position: relative; /* 關鍵：讓子選單可以相對於此定位 */
    margin-left: 2rem; /* 與主導航選單保持距離 */
}

.lang-dropbtn {
    background-color: transparent;
    color: var(--color-text);
    font-family: var(--font-primary);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem;
    border: none;
    cursor: pointer;
    transition: color 0.3s ease;
    
    /* 使用 Flexbox 來對齊圖示和文字 */
    display: flex;
    align-items: center;
    gap: 0.5rem; /* 在圖示和文字間增加一點空隙 */
}

/* 滑鼠懸停效果 (同主選單) */
.lang-dropbtn:hover,
.lang-dropbtn:focus { /* 增加 :focus 提升可訪問性 */
    color: var(--color-heading);
    outline: none; /* 移除點擊時的預設外框 */
}

/* 下拉式選單的"內容" (放置連結的地方) */
.lang-dropdown-content {
    display: none; /* 關鍵：預設隱藏 */
    position: absolute;
    top: 100%; /* 顯示在按鈕正下方 */
    right: 0; /* 靠右對齊 */
    background-color: var(--color-bg-alt); /* 使用卡片背景色 */
    min-width: 180px; /* 最小寬度 */
    border: 1px solid var(--color-border);
    border-radius: 5px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); /* 增加陰影以突顯層次 */
    z-index: 101; /* 確保在導航列之上 */
    overflow: hidden; /* 確保子項目的圓角裁切正確 */
}

/* 選單中的連結 */
.lang-dropdown-content a {
    color: var(--color-text);
    padding: 10px 16px;
    text-decoration: none;
    display: block; /* 讓連結填滿寬度 */
    font-size: 0.95rem;
    transition: background-color 0.3s ease, color 0.3s ease;
    white-space: nowrap; /* 確保 "中文 (繁體)" 不會換行 */
}

/* 連結的滑鼠懸停效果 */
.lang-dropdown-content a:hover {
    background-color: var(--color-primary); /* 科技藍背景 */
    color: var(--color-bg); /* 文字反白 */
}

/* "目前" 語言的樣式 */
.lang-dropdown-content a.active {
    color: var(--color-primary);
    font-weight: 700;
    background-color: rgba(48, 168, 240, 0.1); /* 給 active 一個淡淡的背景色 */
}

/* 關鍵：當 JavaScript 加上 .show class 時，顯示選單 */
.lang-dropdown-content.show {
    display: block;
}


/* ===== 響應式設計 (RWD) - 漢堡選單 ===== */

/* --- 漢堡按鈕的樣式 (預設隱藏) --- */
.nav-toggle {
    display: none; /* 電腦版時隱藏 */
    background: transparent;
    border: none;
    color: var(--color-heading);
    font-size: 1.5rem; /* 加大圖示, 方便點擊 */
    cursor: pointer;
    z-index: 1001; /* 確保在選單之上 */
    padding: 0.5rem; /* 增加點擊範圍 */
}

/* 漢堡按鈕中的 關閉(X)圖示 預設隱藏 */
.nav-toggle .fa-times {
    display: none;
}

/* --- 當漢堡選單被觸發時 (JS 會為 <nav> 加上 .nav-active) --- */

/* 顯示 關閉(X)圖示 */
.navbar nav.nav-active .nav-toggle .fa-times {
    display: block;
}

/* 隱藏 漢堡(三)圖示 */
.navbar nav.nav-active .nav-toggle .fa-bars {
    display: none;
}


/* --- 媒體查詢：當螢幕寬度小於 992px 時 (平板與手機) --- */
@media (max-width: 992px) {

    /* 1. 顯示漢堡按鈕 */
    .nav-toggle {
        display: block;
    }
    
    /* 2. 重新定義 <nav> 容器 (它變成彈出式選單) */
	.navbar nav {
		position: absolute;
		top: 100%; /* 抓取 .navbar 的底部 (65px) */
		left: 0;
		width: 100%;

		/* 轉為垂直排列 */
		flex-direction: column;
		align-items: center; /* 讓選項置中 */

		/* 外觀 */
		background-color: var(--color-bg-alt);
		border-bottom: 1px solid var(--color-border);
		box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);

		/* 關鍵：預設不顯示 (使用 transform 準備做動畫) */
		opacity: 0;
		visibility: hidden;
		transform: translateY(-10px); /* 從上面一點點的位置滑入 */
		transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
	}

    /* 3. 主選單 (ul) 改為垂直 */
    .nav-menu {
        flex-direction: column;
        align-items: center; /* 讓選項置中 */
        width: 100%; /* 確保 ul 填滿 nav */
    }

    /* 4. 語言選單 (div) 也改為垂直 */
	.lang-dropdown {
		margin-left: 0;
		width: 100%;
		border-top: 1px dashed var(--color-border); /* 用虛線與主選單分隔 */
	}
    
    /* 5. 手機版的語言按鈕樣式 */
    .lang-dropbtn {
        justify-content: center; /* 文字置中 */
        width: 100%;
        padding: 1rem 0;
    }
    
    /* 6. 手機版的語言子選單 (不要彈出，改為直接展開) */
    .lang-dropdown-content {
        position: relative; /* 改為相對定位，在原地展開 */
        width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background-color: var(--color-bg); /* 用更深的背景色區分 */
    }

    .lang-dropdown-content a {
        text-align: center;
    }

    /* 7. 觸發漢堡選單 (關鍵) */
	.navbar nav.nav-active {
		display: flex; /* 確保 display:flex 優先級 */
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}
    
    /* 8. 手機版選單連結樣式 */
    .nav-menu li {
        width: 100%;
        text-align: center;
    }

    .nav-menu a {
        display: block; /* 讓連結填滿整個 li */
        width: 100%;
        padding: 1rem 0;
        border-bottom: 1px solid var(--color-border);
    }
    
    /* 移除電腦版的 hover 底線動畫 */
    .nav-menu a::after {
        display: none;
    }
    
    /* 手機版改用不同的 hover 效果 */
    .nav-menu a:hover {
        background-color: var(--color-primary);
        color: var(--color-bg);
    }
}

/* ===== [新] Hero Section (首屏) ===== */

#hero {
    /* * 使用 padding-top 來將 hero 內容推到 navbar 下方
     * 使用 vh (viewport height) 讓它有足夠的高度感
     */
    padding: 6rem 0;
    min-height: 90vh; /* 確保在多數螢幕上能填滿首屏 */
    display: flex;
    align-items: center;
    position: relative; /* 關鍵：為了讓光暈定位 */
    overflow: hidden; /* 關鍵：裁切掉多餘的光暈 */
}

/* * 🎨 關鍵的「光暈效果」
 * 我們使用 ::before 偽元素在背景中插入一個徑向漸層
 */
#hero::before {
    content: '';
    position: absolute;
    z-index: -1; /* 把它放到內容的後面 */
    
    /* 讓它在中間 */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%); 
    
    /* 製作一個巨大的、以主題色為中心的漸層 */
    width: 800px;
    height: 800px;
    background: radial-gradient(
        circle, 
        rgba(48, 168, 240, 0.15), /* 中心：使用 15% 透明度的主題藍 */
        transparent 60%           /* 60% 以外：完全透明 */
    );
    filter: blur(50px); /* 讓邊緣更加柔和 */
}

.hero-content {
    /* 使用 Grid 實現「左/右」佈局 */
    display: grid;
    grid-template-columns: 1fr 1fr; /* 左右各佔 50% */
    align-items: center; /* 垂直置中 */
    gap: 3rem; /* 左右間距 */
}

/* --- Hero 左側 (動畫) --- */
.hero-visual video {
    width: 100%;
    max-width: 500px; /* 限制最大寬度，避免動畫太大 */
    height: auto;
    border-radius: 15px; /* 增加圓角，提升質感 */
    border: 1px solid var(--color-border); /* 加上主題邊框 */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); /* 加上陰影 */
}

/* --- Hero 右側 (文字) --- */
.hero-text h3 {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-primary); /* 使用主題藍色 */
    margin-bottom: 0.5rem;
}

.hero-text h1 {
    font-size: 3.5rem; /* 沿用你已定義的 H1 尺寸 */
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

/* 標題中的高亮文字 */
.hero-text .highlight {
    color: var(--color-primary);
    /* (可選) 增加一點漸層感 */
    /* background: linear-gradient(90deg, #30a8f0, #30e0f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; */
}

.hero-description {
    font-size: 1.15rem; /* 讓描述文字比內文大一點 */
    color: var(--color-text); /* 使用次要文字顏色 */
    margin-bottom: 2.5rem;
    max-width: 600px; /* 避免文字行太長 */
}

/* --- Hero 按鈕 (我們需要定義新的按鈕樣式) --- */
.hero-buttons {
    display: flex;
    gap: 1rem; /* 按鈕間距 */
}

/* 基本按鈕樣式 (共用) */
.btn {
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-primary);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

/* 主要按鈕 (填滿) */
.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-bg); /* 文字用深色背景 */
}

.btn-primary:hover {
    filter: brightness(1.15); /* 讓按鈕變亮 */
    transform: translateY(-3px); 
    box-shadow: 0 8px 20px rgba(48, 168, 240, 0.2);
}

/* 次要按鈕 (外框) */
.btn-secondary {
    background-color: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-primary);
    color: var(--color-bg);
    border-color: var(--color-primary);
    transform: translateY(-3px);
}


/* --- 響應式設計 (RWD for Hero) --- */
@media (max-width: 992px) {
    #hero {
        padding: 4rem 0; /* 手機版上下 padding 縮小 */
        min-height: auto; /* 移除最小高度限制 */
        text-align: center; /* 讓所有內容置中 */
    }
    
    .hero-content {
        grid-template-columns: 1fr; /* 關鍵：改為單欄，垂直堆疊 */
        gap: 2.5rem;
    }

    .hero-text {
        /* * 關鍵：在手機上，我們希望文字在上面，動畫在下面 
         * 透過 order 屬性調整順序
        */
        order: 1; 
    }

    .hero-visual {
        order: 2;
        display: flex;
        justify-content: center; /* 讓動畫在中間 */
    }

    .hero-visual video {
        max-width: 80%; /* 讓影片不要佔滿全寬 */
    }
    
    .hero-text h1 {
        font-size: 2.5rem; /* 手機版標題縮小 */
    }
    
    .hero-description {
        font-size: 1rem;
    }

    .hero-buttons {
        justify-content: center; /* 讓按鈕置中 */
        flex-direction: column; /* 垂直排列 */
        gap: 0.8rem;
    }
}

/* ===== 共用區塊設計 (Sections Common) ===== */
.section-title {
    text-align: center;
    margin-bottom: 2.5rem;
}

/* 標題旁邊的英文小字 */
.section-title span {
    color: var(--color-primary);
    font-size: 1.5rem;
    margin-left: 0.5rem;
    font-family: var(--font-primary);
    font-weight: 500;
}

//* ===== 關於我區塊 (About Section) - 升級雙欄畫框版 ===== */
.about-section {
    padding: 5rem 0;
    scroll-margin-top: 65px;
}

/* 雙欄容器 (Flexbox) - 改為置中對齊，不強制等高 */
.about-card-split {
    background-color: var(--color-bg-alt);
    padding: 3rem; /* 統一設定整張卡片的內距 */
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center; /* 關鍵：讓左右兩邊垂直置中，高度各自獨立，不再互相綁架 */
    gap: 3rem; /* 圖片與文字的間距 */
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

[data-theme="light"] .about-card-split:hover {
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 15px 40px rgba(37, 99, 235, 0.1);
}

/* 圖片欄位 - 畫框設計 */
.about-image-column {
    flex: 0 0 32%; /* 圖片佔卡片的 32% 寬度 */
}

.about-image-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4; /* 關鍵：鎖定完美的 3:4 直式人像比例 (若喜歡方形可改為 1 / 1) */
    border-radius: 16px; /* 讓照片擁有柔和的圓角 */
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15); /* 給照片獨立的陰影，提升立體感 */
    border: 1px solid var(--color-border);
}

.about-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top; /* 預設對齊圖片的「中上方」，盡量保證人臉不被裁 */
    transition: transform 0.5s ease;
}

.about-card-split:hover .about-image-wrapper img {
    transform: scale(1.05); /* 滑鼠懸停時微微放大，增加互動感 */
}

/* 文字欄位 */
.about-text-column {
    flex: 1; /* 佔據右側剩餘的所有空間 */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.about-subtitle {
    color: var(--color-primary);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
}

.about-text-column p {
    margin-bottom: 1.2rem;
}

.about-text-column p:last-child {
    margin-bottom: 0;
}

/* ===== 關於我 響應式微調 (RWD) ===== */
@media (max-width: 992px) {
    .about-card-split {
        flex-direction: column; /* 手機版改為上下堆疊 */
        padding: 2rem;
        gap: 2rem;
    }
    
    .about-image-column {
        width: 60%; /* 手機版時圖片不要太大，留點空間 */
        max-width: 280px; 
        margin: 0 auto; /* 讓圖片在手機上置中 */
    }
}
/* ===== 學歷與經歷共用：時間軸設計 (Timeline) ===== */
.education-section {
    padding: 5rem 0;
    scroll-margin-top: 65px;
}

.timeline {
    position: relative;
    max-width: 850px;
    margin: 0 auto;
    padding-left: 2rem;
    border-left: 2px solid var(--color-border); /* 垂直時間線 */
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* 時間軸上的發光圓點 */
.timeline-dot {
    position: absolute;
    left: -2.45rem; /* 根據邊框與 padding 調整位置 */
    top: 0.25rem;
    width: 16px;
    height: 16px;
    background-color: var(--color-bg);
    border: 3px solid var(--color-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(48, 168, 240, 0.5); /* 科技感發光效果 */
}

/* 內容卡片 */
.timeline-content {
    background-color: var(--color-bg-alt);
    padding: 1.8rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* 滑鼠懸停卡片會微微浮起並亮起邊框 */
.timeline-content:hover {
    transform: translateY(-3px);
    border-color: rgba(48, 168, 240, 0.4);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--color-heading);
}

.timeline-date {
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 600;
    background: rgba(48, 168, 240, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

.timeline-degree {
    color: var(--color-text);
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 1rem;
}

.gpa-badge {
    display: inline-block;
    background-color: var(--color-border);
    color: var(--color-text);
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    margin-bottom: 1.2rem;
    font-weight: 600;
}

/* 論文資訊區塊 (突顯亮點) */
.thesis-box {
    background-color: rgba(0, 0, 0, 0.25);
    border-left: 3px solid var(--color-primary);
    padding: 1rem 1.2rem;
    border-radius: 0 8px 8px 0;
}

.thesis-title {
    font-size: 0.95rem;
    color: var(--color-heading);
    margin-bottom: 0.5rem;
}

.thesis-details {
    margin-left: 1.2rem;
    list-style-type: disc;
    color: var(--color-text);
    font-size: 0.9rem;
}

.thesis-details li {
    margin-bottom: 0.4rem;
}

.thesis-details li:last-child {
    margin-bottom: 0;
}

/* ===== 響應式設計 (手機版微調) ===== */
@media (max-width: 768px) {
    .timeline {
        padding-left: 1.5rem;
    }
    
    .timeline-dot {
        left: -1.95rem;
    }
    
    .timeline-content {
        padding: 1.5rem;
    }
    
    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .timeline-date {
        margin-top: 0.2rem;
    }
}
/* ===== 經歷區塊的列表設計 ===== */
.experience-list {
    margin-left: 1.2rem;
    list-style-type: disc;
    color: var(--color-text);
    font-size: 0.95rem; /* 字體大小適中，方便閱讀長篇描述 */
}

.experience-list li {
    margin-bottom: 0.8rem; /* 增加每個項目之間的距離，避免文字擠在一起 */
    line-height: 1.6;
}

.experience-list li:last-child {
    margin-bottom: 0;
}

.experience-list strong {
    color: var(--color-heading); /* 讓粗體字亮起來，引導視覺焦點 */
}
/* ===== 技能區塊 (Skills) ===== */
.skills-section {
    padding: 5rem 0;
    scroll-margin-top: 65px;
}

/* 使用 Grid 網格系統，讓卡片自動排列 */
.skills-grid {
    display: grid;
    /* 自動適應寬度：最小 300px，最大填滿剩餘空間 */
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.skill-card {
    background-color: var(--color-bg-alt);
    padding: 1.8rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.skill-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 8px 25px rgba(48, 168, 240, 0.15); /* 懸停發光陰影 */
}

.skill-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed var(--color-border); /* 虛線分隔線 */
}

.skill-icon {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.skill-title {
    font-size: 1.2rem;
    margin: 0;
    color: var(--color-heading);
}

/* 標籤容器：讓標籤自動換行 */
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* 獨立技能標籤 (Pill 設計) */
.skill-tag {
    background: rgba(48, 168, 240, 0.1); /* 帶有透明度的科技藍 */
    color: var(--color-text);
    font-size: 0.85rem;
    font-family: var(--font-code); /* 使用等寬字體，更有工程師感 */
    padding: 0.4rem 0.8rem;
    border-radius: 20px; /* 圓角膠囊形狀 */
    border: 1px solid rgba(48, 168, 240, 0.3);
    transition: all 0.3s ease;
}

.skill-tag:hover {
    background: var(--color-primary);
    color: var(--color-bg);
}
/* ===== 專案區塊 (Projects) ===== */
.projects-section {
    padding: 5rem 0;
    scroll-margin-top: 65px;
}

.projects-grid {
    display: grid;
    /* 三欄排版，若螢幕太小則自動改為單欄或雙欄 */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--color-bg-alt);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    overflow: hidden; /* 確保內容不會超出圓角 */
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    border-color: rgba(48, 168, 240, 0.3);
}

.project-icon-wrapper {
    background: linear-gradient(135deg, rgba(48, 168, 240, 0.1) 0%, rgba(13, 17, 23, 0) 100%);
    padding: 2.5rem 0;
    text-align: center;
    border-bottom: 1px solid var(--color-border);
}

.project-icon {
    font-size: 3.5rem;
    color: var(--color-primary);
    filter: drop-shadow(0 0 10px rgba(48, 168, 240, 0.4));
}

.project-content {
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* 讓內容區塊填滿剩餘空間，使底部的按鈕對齊 */
}

.project-header {
    margin-bottom: 1rem;
}

.project-title {
    font-size: 1.25rem;
    margin-bottom: 0.3rem;
    color: var(--color-heading);
}

.project-date {
    font-size: 0.85rem;
    color: var(--color-primary);
    font-family: var(--font-code);
}

.project-desc {
    color: var(--color-text);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    flex-grow: 1; /* 讓文字區塊伸展，把標籤跟按鈕往下推 */
}

.project-desc strong {
    color: var(--color-heading);
}

/* 實用工具類 (Utilities) */
.w-100 {
    width: 100%;
}

.text-center {
    text-align: center;
}

/* 外框按鈕樣式 (Outline Button) */
.btn-outline {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-outline i {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

.btn-outline:hover {
    background-color: var(--color-heading);
    color: var(--color-bg);
    border-color: var(--color-heading);
}
/* ===== 聯繫區塊 (Contact) ===== */
.contact-section {
    padding: 5rem 0;
    scroll-margin-top: 65px;
}

.contact-container {
    max-width: 900px;
    margin: 0 auto;
    text-align: center;
}

.contact-intro {
    font-size: 1.1rem;
    color: var(--color-text);
    margin-bottom: 3rem;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.contact-card {
    background-color: var(--color-bg-alt);
    padding: 2rem 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    text-decoration: none;
    color: var(--color-text);
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 確保不是連結的卡片 (如地址) 也有相同的懸停效果，但不顯示指標 */
a.contact-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-primary);
    box-shadow: 0 8px 25px rgba(48, 168, 240, 0.15);
}

div.contact-card:hover {
    transform: translateY(-5px);
    border-color: var(--color-border);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.contact-icon-box {
    width: 60px;
    height: 60px;
    background: rgba(48, 168, 240, 0.1);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.2rem;
    color: var(--color-primary);
    font-size: 1.8rem;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a.contact-card:hover .contact-icon-box {
    background-color: var(--color-primary);
    color: var(--color-bg);
}

.contact-card h4 {
    color: var(--color-heading);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.contact-card p {
    margin: 0;
    font-size: 0.95rem;
    word-break: break-all; /* 防止長 Email 破壞版面 */
}

/* 社群連結按鈕 */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.btn-linkedin {
    background-color: #0077b5; /* LinkedIn 品牌色 */
    color: #ffffff;
    border: 2px solid #0077b5;
}

.btn-linkedin:hover {
    background-color: transparent;
    color: #0077b5;
}

.btn-github {
    background-color: #333; /* GitHub 品牌深色 */
    color: #ffffff;
    border: 2px solid #333;
}

.btn-github:hover {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}
/* 個人網頁 (使用主題色) */
.btn-website {
    background-color: var(--color-primary);
    color: var(--color-bg);
    border: 2px solid var(--color-primary);
}

.btn-website:hover {
    background-color: transparent;
    color: var(--color-primary);
}

/* Kaggle 品牌色 */
.btn-kaggle {
    background-color: #20BEFF;
    color: #ffffff;
    border: 2px solid #20BEFF;
}

.btn-kaggle:hover {
    background-color: transparent;
    color: #20BEFF;
}

/* Medium 品牌色 */
.btn-medium {
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #000000;
}

.btn-medium:hover {
    background-color: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}

/* ===== 頁尾區塊 (Footer) ===== */
.footer {
    background-color: var(--color-bg-alt);
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    margin-top: 3rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-logo img {
    height: 40px;
    width: auto;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-logo:hover img {
    opacity: 1;
}

.footer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--color-text);
    opacity: 0.7;
}
/* ===== 論文連結特效 ===== */
.thesis-link {
    color: var(--color-heading); /* 預設跟一般標題顏色一樣 */
    text-decoration: none; /* 隱藏預設底線 */
    transition: color 0.3s ease;
    display: inline-block; /* 讓斷行比較漂亮 */
    margin-top: 0.3rem;
}

.thesis-link:hover {
    color: var(--color-primary); /* 滑鼠懸停時變成科技藍 */
}

.thesis-link i {
    font-size: 0.85em;
    margin-left: 0.3rem;
    opacity: 0.7; /* 讓外部連結的小圖示稍微淡一點，不搶主角風采 */
}

/* ===== 專業證照區塊 (Certifications) ===== */
.certifications-section {
    padding: 2rem 0 5rem 0; /* 縮小上方的 padding，讓它跟 Skills 區塊靠得更緊密 */
    scroll-margin-top: 65px;
}

.cert-grid {
    display: grid;
    /* 三欄排版，寬度縮小時會自動變雙欄或單欄 */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.cert-card {
    background-color: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.cert-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: var(--color-primary);
}

[data-theme="light"] .cert-card:hover {
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.1);
    border-color: rgba(37, 99, 235, 0.3);
}

/* 證照圖示外框 */
.cert-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    flex-shrink: 0; /* 防止圖示被壓縮 */
}

/* 微軟專屬顏色 (藍色系) */
.microsoft-color {
    background-color: rgba(0, 164, 239, 0.1);
    color: #00a4ef;
}

/* Google 專屬顏色 (經典色/深灰皆可，這裡用 Google 藍) */
.google-color {
    background-color: rgba(66, 133, 244, 0.1);
    color: #4285f4;
}

.cert-content h4 {
    margin: 0 0 0.2rem 0;
    font-size: 0.95rem;
    color: var(--color-primary);
    font-weight: 700;
}

.cert-content p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--color-heading);
    font-weight: 600;
    line-height: 1.4;
}
/* TOEIC 專屬顏色 (金黃色系，象徵金色證書) */
.toeic-color {
    background-color: rgba(212, 175, 55, 0.1);
    color: #d4af37; /* 金色 (Gold) */
}

/* 確保作為連結的證照卡片在亮色/暗色模式下都有正確的文字顏色 */
a.cert-card {
    text-decoration: none;
}

[data-theme="light"] a.cert-card:hover {
    background-color: #ffffff;
}

/* ===== 專業培訓區塊 (Training) ===== */
.training-section {
    padding: 2rem 0 5rem 0;
    scroll-margin-top: 65px;
}

/* 上下堆疊容器 */
.training-stack {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* 卡片外觀基礎設定 */
.training-group {
    background-color: var(--color-bg-alt);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.training-group-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-border);
}

.training-group-header i {
    font-size: 1.5rem;
    color: var(--color-primary);
}

.training-group-header h3 {
    margin: 0;
    font-size: 1.3rem;
    color: var(--color-heading);
}

/* 清單基礎與網格設定 */
.training-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.training-list li {
    margin-bottom: 0 !important;
    position: relative;
}

/* 核心學程：電腦版左右並排 */
.core-programs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 2.5rem;
}

/* 短期進修：電腦版自適應多欄 */
.short-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* 短期課程特有的科技藍色小圓點 */
.short-courses-grid li {
    padding-left: 1.2rem;
}

.short-courses-grid li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    width: 6px;
    height: 6px;
    background-color: var(--color-primary);
    border-radius: 50%;
}

/* 文字排版：標題、機構、日期、描述 */
.training-item-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.4;
    margin-bottom: 0.3rem;
}

.training-item-title span {
    font-size: 0.85rem;
    color: var(--color-primary);
    font-weight: 500;
}

.training-item-org {
    font-size: 0.9rem;
    color: var(--color-text);
    opacity: 0.7;
}

.training-item-date {
    font-size: 0.85rem;
    color: var(--color-primary);
    font-family: var(--font-code);
    margin-top: 0.3rem;
    margin-bottom: 0.8rem;
    font-weight: 500;
}

.training-item-desc {
    margin-top: 0.8rem;
    border-left: 3px solid rgba(48, 168, 240, 0.3);
    padding-left: 1rem;
    font-size: 0.95rem;
    color: var(--color-heading);
}

/* 核心學程內的子列表樣式 (▹ 符號) */
.item-inner-list {
    margin-top: 0.8rem;
    padding-left: 0;
    list-style: none;
}

.item-inner-list li {
    font-size: 0.9rem;
    color: var(--color-text);
    margin-bottom: 0.5rem !important;
    padding-left: 1.2rem;
    position: relative;
    line-height: 1.6;
}

.item-inner-list li::before {
    content: "▹"; 
    position: absolute;
    left: 0;
    top: 0;
    color: var(--color-primary);
    font-weight: bold;
    background: none; 
    width: auto;
    height: auto;
}

.item-inner-list li strong {
    color: var(--color-heading);
}

/* 手機版微調 (RWD) */
@media (max-width: 768px) {
    .training-group {
        padding: 1.5rem; /* 手機版卡片內距縮小 */
    }
    .core-programs-grid {
        grid-template-columns: 1fr; /* 核心學程在手機版改為上下排列 */
        gap: 2rem;
    }
}