/* --- 1. 基礎設定與 CSS 變數 --- */
:root {
    /* 淺色模式 */
    --primary: #1e293b;       /* 深灰藍 (文字/標題/選中時的顏色) */
    --accent: #0d9488;        /* 藍綠色 (只保留給區塊標題左側直線) */
    --bg-body: #f8fafc;       /* 極淺灰藍背景 */
    --bg-content: #ffffff;
    --text-main: #334155;
    --text-secondary: #64748b; /* 通用灰色 */
    --border-color: #e2e8f0;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    --edu-logo-bg: #ffffff;
    --transition-speed: 0.3s;
}

/* 深色模式設定 */
[data-theme="dark"] {
    --primary: #f1f5f9;
    --accent: #2dd4bf;
    --bg-body: #0f172a;
    --bg-content: #1e293b;
    --text-main: #e2e8f0;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --nav-bg: rgba(30, 41, 59, 0.95);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --edu-logo-bg: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    padding-top: 80px;
    -webkit-font-smoothing: antialiased;
}

/* --- 2. 導航列 (Navigation) --- */
nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    height: 60px;
    transition: all var(--transition-speed);
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

/* 手機版漢堡按鈕 */
.hamburger {
    display: none;
    cursor: pointer;
    background: none;
    border: none;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-main);
    border-radius: 2px;
    transition: all var(--transition-speed);
}

.nav-links {
    display: flex;
    gap: 25px;
    list-style: none;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    padding: 5px 0;
    transition: color var(--transition-speed);
}

/* 導航連結：只變色，不變粗，不加底線 */
.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

/* 深色模式按鈕 */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.theme-toggle-btn:hover {
    background-color: var(--border-color);
}

/* --- 3. 主要容器 --- */
main {
    max-width: 900px;
    margin: 20px auto 40px;
    background: var(--bg-content);
    padding: 30px;
    box-shadow: var(--card-shadow);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* --- 4. Header --- */
header {
    text-align: center;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.profile-img-container {
    width: 150px;
    height: 150px;
    margin: 0 auto 15px auto;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--bg-content);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    background-color: #eee;
}

.profile-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

header h1 {
    font-size: 2.2rem;
    color: var(--primary);
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 500;
}

.contact-info {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.contact-info span {
    margin: 0 8px;
    display: inline-block;
}

/* --- 5. Sections & Items --- */
section {
    margin-bottom: 25px;
    scroll-margin-top: 80px;
}

h2 {
    font-size: 1.5rem;
    color: var(--primary);
    border-left: 5px solid var(--accent);
    padding-left: 15px;
    margin-bottom: 15px;
    font-weight: 700;
}

.item {
    margin-bottom: 15px;
    padding: 5px 0;
    border-radius: 0;
}

/* Education Logo */
.edu-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.edu-logo {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 5px;
    background: var(--edu-logo-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.edu-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.edu-content {
    flex-grow: 1;
}

/* --- Item Headers & Icons --- */
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 2px;
    gap: 10px;
}

/* 圖片與標題的群組容器 */
.item-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
}

/* 強制縮小自訂圖標 */
.item-title-group img {
    width: 32px !important;
    height: 32px !important;
    object-fit: contain;
    border-radius: 4px;
    display: block;
}

.item-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.item-subtitle {
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 3px;
    font-size: 0.95rem;
}

/* 日期保持正常字體 */
.item-date {
    font-style: normal;
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
}

.item-desc {
    color: var(--text-main);
    opacity: 0.95;
    line-height: 1.6;
}

.item-desc ul {
    padding-left: 20px;
    margin-top: 3px;
}

.item-desc li {
    margin-bottom: 2px;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 0 20px 40px 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: -10px;
}

footer p {
    margin-bottom: 4px;
    opacity: 0.8;
}

/* 進場動畫 */
.fade-in {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- 6. RWD 手機版調整 --- */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background-color: var(--bg-content);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all 0.3s ease;
        z-index: 999;
    }

    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: all;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
        margin: 10px 0;
    }

    main {
        margin: 0;
        padding: 25px 20px;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    header {
        margin-bottom: 25px;
        padding-bottom: 15px;
    }
    
    .profile-img-container {
        width: 120px;
        height: 120px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }

    .edu-logo {
        width: 48px;
        height: 48px;
    }

    .item-header {
        flex-direction: column;
        gap: 2px;
        align-items: flex-start;
    }
    
    .item-title-group img {
        flex-shrink: 0;
    }

    .item-date {
        margin-bottom: 2px;
    }
    
    footer {
        padding-bottom: 30px;
    }
}