:root {
    /* 配色靈感：古典油畫與清新自然的結合 */
    --primary-color: #556B2F; /* 橄欖綠/鼠尾草綠 - 清新 */
    --accent-color: #C19A6B; /* 古銅金 - 古典 */
    --bg-color: #F9F7F2; /* 米白紙張質感 */
    --bg-gradient: linear-gradient(135deg, #F9F7F2 0%, #F0F4E8 100%); /* 漸層背景 */
    --text-color: #333333; /* 深灰 */
    --light-text: #666666;
    --white: #FFFFFF;
    --card-shadow: 0 4px 20px rgba(85, 107, 47, 0.08);
    --btn-gradient: linear-gradient(135deg, #556B2F 0%, #768f45 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: all 0.3s ease;
}

body {
    font-family: 'Noto Sans TC', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    background-attachment: fixed; /* 讓漸層背景固定 */
}

h1, h2, h3, h4 {
    font-family: 'Noto Serif TC', serif; /* 古典襯線字體 */
    color: var(--primary-color);
}

/* 導覽列 */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(249, 247, 242, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(193, 154, 107, 0.3);
    z-index: 1000;
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    letter-spacing: 1px;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-btn {
    background: none;
    border: none;
    font-family: 'Noto Serif TC', serif;
    font-size: 1.1rem;
    color: var(--light-text);
    cursor: pointer;
    padding: 0.5rem 0;
    position: relative;
    text-decoration: none;
}

.nav-btn:hover, .nav-btn.active {
    color: var(--primary-color);
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s;
}

.nav-btn:hover::after, .nav-btn.active::after {
    width: 100%;
}

html {
    scroll-behavior: smooth;
}

/* 頁面容器 */
.container {
    padding: 2rem 5%;
    min-height: 100vh;
}

/* 頁面切換邏輯 - 改為一頁式 */
.page-section {
    display: block;
    padding-top: 80px; /* 預留 navbar 高度 */
    margin-bottom: 4rem; /* 區塊間距 */
}

/* 首頁 (Home) */
.hero {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    gap: 4rem;
    flex-wrap: wrap;
}

.hero-text {
    flex: 1;
    max-width: 600px;
}

.hero-text h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-text .subtitle {
    font-size: 1.2rem;
    color: var(--accent-color);
    margin-bottom: 2rem;
    font-weight: 500;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--light-text);
    margin-bottom: 1.5rem;
}

.job-tags {
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.job-tag {
    background: var(--white);
    color: var(--primary-color);
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--accent-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.cta-btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    border: none;
    background: var(--btn-gradient);
    color: var(--white);
    text-decoration: none;
    border-radius: 50px;
    font-family: 'Noto Serif TC', serif;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(85, 107, 47, 0.2);
}

.cta-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(85, 107, 47, 0.3);
    filter: brightness(1.1);
}

.hero-img-container {
    position: relative;
    width: 350px;
    height: 350px;
    animation: float 6s ease-in-out infinite;
}

.hero-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50% 50% 0 50%; /* 藝術感形狀 */
    border: 5px solid var(--white);
    box-shadow: var(--card-shadow);
    z-index: 2;
    position: relative;
}

.hero-bg-shape {
    position: absolute;
    top: 20px;
    right: -20px;
    width: 100%;
    height: 100%;
    border: 2px solid var(--accent-color);
    border-radius: 50% 50% 0 50%;
    z-index: 1;
    transition: transform 0.5s ease;
}

.hero-img-container:hover .hero-bg-shape {
    transform: translate(10px, -10px);
}

/* 浮動動畫 */
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

/* 滾動動畫 Reveal */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* 技能頁 (Skills) */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.skill-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    border-left: 4px solid var(--accent-color);
    box-shadow: var(--card-shadow);
}

.skill-card h3 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
}

.skill-list li {
    list-style: none;
    margin-bottom: 0.8rem;
    padding-left: 1.2rem;
    position: relative;
    color: var(--light-text);
}

.skill-list li::before {
    content: '❧'; /* 古典裝飾符號 */
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* 經歷與學歷 (Experience) */
.timeline {
    position: relative;
    max-width: 1000px; /* 加寬容器以容納更多內容 */
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 2px;
    background-color: var(--accent-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1px;
    opacity: 0.3;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
    box-sizing: border-box;
}

.timeline-item.left { 
    left: 0; 
    padding-left: 10px; /* 減少外側 padding */
    padding-right: 50px; /* 保持與中線距離 */
}

.timeline-item.right { 
    left: 50%; 
    padding-right: 10px; /* 減少外側 padding */
    padding-left: 50px; /* 保持與中線距離 */
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    right: -8px;
    background-color: var(--bg-color);
    border: 3px solid var(--primary-color);
    top: 24px; /* 對齊內容頂部 */
    border-radius: 50%;
    z-index: 1;
}

.timeline-item.right::after { left: -8px; }

.timeline-content {
    padding: 24px;
    background-color: var(--white);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    text-align: left; /* 強制內容靠左對齊，提升閱讀性 */
}

.year-tag {
    display: inline-block;
    background: rgba(85, 107, 47, 0.1);
    color: var(--primary-color);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 10px;
    font-weight: bold;
}

/* 專案作品 (Projects) */
.project-grid {
    display: grid;
    grid-template-columns: 1fr; /* 改為單欄列表式排版 */
    gap: 2.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.project-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s;
    display: flex; /* Flexbox 左右排版 */
    flex-direction: row;
    align-items: stretch;
}

.project-card:hover {
    transform: translateY(-5px);
}

.project-img {
    flex: 0 0 280px; /* 固定左側圖片寬度 */
    background: #f1f3eb; /* 淺綠灰 placeholder 背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4rem;
    color: rgba(85, 107, 47, 0.4);
    min-height: 200px;
}

.project-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.project-content {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.project-tags {
    margin-top: auto; /* 將標籤推到底部 */
    padding-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    margin-top: 1.5rem; /* 與上方標籤區隔 */
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    align-self: flex-start;
    transition: all 0.3s;
    position: relative;
    padding-bottom: 2px;
}

.read-more-btn::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s;
}

.read-more-btn:hover {
    color: var(--accent-color);
}

.read-more-btn:hover::after {
    width: 100%;
}

.read-more-btn i {
    margin-left: 6px;
    font-size: 0.8rem;
    transition: transform 0.3s;
}

.read-more-btn:hover i {
    transform: translateX(4px);
}

.tag {
    background: #F0F2EB;
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* 論文 (Publications) */
.paper-item {
    background: var(--white);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--card-shadow);
}

.paper-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-family: 'Noto Serif TC', serif;
}

/* 頁尾 */
footer {
    text-align: center;
    padding: 3rem;
    margin-top: 4rem;
    border-top: 1px solid rgba(193, 154, 107, 0.2);
    font-size: 0.9rem;
    color: var(--light-text);
}

.social-icons {
    margin-top: 1rem;
}

.social-icons a {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 0 10px;
}

/* --- New Sections CSS --- */

/* Hero Buttons */
.hero-btns {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.cta-btn.secondary {
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    box-shadow: none;
}

.cta-btn.secondary:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: var(--white);
    box-shadow: 0 5px 15px rgba(193, 154, 107, 0.3);
}

/* Highlights Section */
.highlights-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.highlight-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    text-align: center;
    border-top: 4px solid var(--accent-color);
    width: 100%;
}

.highlight-card .icon-box {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.highlight-card h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.highlight-card p {
    font-size: 0.95rem;
    color: var(--light-text);
    text-align: justify;
}

/* Education Section */
.education-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.edu-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.edu-year {
    font-family: 'Noto Serif TC', serif;
    font-weight: bold;
    color: var(--accent-color);
    font-size: 1.2rem;
    min-width: 120px;
    padding-top: 5px;
}

.edu-content h3 {
    margin-bottom: 0.5rem;
}

.edu-content h4 {
    font-size: 1rem;
    color: var(--light-text);
    margin-bottom: 1rem;
    font-weight: 400;
}

.edu-content p {
    font-size: 0.95rem;
    color: #555;
}

/* Contact Section */
.contact-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.contact-intro {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: var(--text-color);
}

.contact-cards {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    text-decoration: none;
    color: var(--text-color);
    width: 200px;
    transition: transform 0.3s;
}

.contact-card:hover {
    transform: translateY(-5px);
}

.contact-card .icon {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.contact-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.contact-card p {
    font-size: 0.85rem;
    color: var(--light-text);
    word-break: break-all;
}

/* RWD 調整 */
@media screen and (max-width: 1200px) {
    .container {
        padding: 2rem 4%;
    }
}

@media screen and (max-width: 1024px) {
    /* iPad Pro / Air (2025) 平板直立或橫放優化 (769px - 1024px) */
    .hero-text h1 {
        font-size: 3rem;
    }
    
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    /* Project Card RWD: Card Stack */
    .project-card {
        flex-direction: column;
    }
    
    .project-img {
        width: 100%;
        height: 200px;
        flex: none;
    }

    /* Highlights RWD: Tablet Landscape / Small Laptops */
    .highlights-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    /* 平板直立與大尺寸手機 (iPhone Pro Max, Galaxy Ultra) */

    .container {
        margin-top: 100px; /* 增加頂部間距，避免被變高的導覽列遮擋 */
    }
    
    /* 導覽列優化：轉為上下排列並可橫向滑動 */
    nav {
        flex-direction: column;
        padding: 0.8rem 5%;
        gap: 0.5rem;
    }

    .nav-links {
        display: flex; /* 確保顯示，取代原本的 display: none */
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 5px;
        gap: 1.5rem;
        justify-content: flex-start; /* 手機上靠左，方便滑動 */
        -webkit-overflow-scrolling: touch; /* iOS 滑動順暢 */
        scrollbar-width: none; /* Firefox 隱藏滾動條 */
    }
    
    /* 隱藏 Webkit 瀏覽器的滾動條 */
    .nav-links::-webkit-scrollbar {
        height: 0px; 
        background: transparent;
    }

    .nav-btn {
        font-size: 1rem;
        padding: 0.5rem 0;
        flex-shrink: 0; /* 防止按鈕被壓縮 */
    }

    /* Hero區塊調整 */
    .hero { 
        flex-direction: column-reverse; 
        text-align: center; 
        gap: 2rem;
        padding-top: 1rem;
    }
    
    .hero-text {
        width: 100%;
    }

    .hero-text h1 { font-size: 2.5rem; }
    
    .hero-img-container {
        width: 280px;
        height: 280px;
        margin: 0 auto;
    }

    /* Timeline RWD */
    .timeline::after { left: 31px; }
    .timeline-item { width: 100%; padding-left: 70px; padding-right: 25px; }
    .timeline-item.left { text-align: left; }
    .timeline-item.left::after, .timeline-item.right::after { left: 21px; }
    .timeline-item.right { left: 0%; }
    
    /* Grid 調整：在 768px 以下預設單欄較安全，或雙欄 */
    .skills-grid, .highlights-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
    /* 針對較寬的平板直立或摺疊機展開 (Galaxy Fold) 以及大尺寸手機橫放 */
    .skills-grid, .highlights-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 480px) {
    /* 支援 iPhone 17/16/15 Pro, Pixel 9 Pro, Galaxy S25 等手機直立模式 */
    .hero-text h1 { font-size: 2.2rem; }
    
    .hero-img-container {
        width: 240px;
        height: 240px;
    }
    
    .cta-btn {
        width: 100%;
        text-align: center;
    }
    
    .skill-card, .project-card, .paper-item {
        padding: 1.5rem;
    }
    
    .project-grid, .skills-grid, .highlights-container {
        grid-template-columns: 1fr; /* 強制單欄 */
    }

    /* Edu Card RWD */
    .edu-card {
        flex-direction: column;
        gap: 0.5rem;
    }
}
