/* --- 基本設定與變數 --- */
:root {
    --primary-color: #00aaff; /* 科技藍 */
    --secondary-color: #00e6e6; /* 青色點綴 */
    --bg-color: #121212; /* 深邃黑 */
    --surface-color: #1e1e1e; /* 卡片/區塊背景 */
    --text-color: #e0e0e0; /* 主要文字 */
    --text-secondary-color: #a0a0a0; /* 次要文字 */
    --heading-font: 'Montserrat', 'Noto Sans TC', sans-serif;
    --body-font: 'Noto Sans TC', 'Montserrat', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.7;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

h1, h2, h3 {
    font-family: var(--heading-font);
    font-weight: 600;
    color: #ffffff;
}

h2 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

h2::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

section {
    padding: 6rem 0;
}

/* --- 導覽列 --- */
.navbar {
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    background-color: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(10px);
    z-index: 1000;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid #2a2a2a;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-family: var(--heading-font);
    font-size: 1.8rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
}

.logo:hover {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* --- 右側控制項 (新增) --- */
.controls-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* --- 語言切換器 (新增) --- */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary-color);
    font-weight: 500;
}
.lang-switcher span {
    cursor: pointer;
    transition: color 0.3s ease;
}
.lang-switcher span:not(:nth-child(2)):hover {
    color: var(--primary-color);
}
.lang-switcher span.active {
    color: #fff;
    font-weight: bold;
}


/* --- 主視覺區 --- */
#hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(rgba(18, 18, 18, 0.8), rgba(18, 18, 18, 0.9)), url('https://images.unsplash.com/photo-1550751827-4bd374c3f58b?q=80&w=2070&auto=format&fit=crop') center/cover no-repeat;
}

#hero h1 {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}

#hero h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-secondary-color);
    min-height: 2.5rem; /* 避免中英文切換時跳動 */
}

#hero h2::after {
    display: none;
}

.typing-effect {
    color: var(--primary-color);
    font-weight: bold;
    border-right: 2px solid var(--primary-color);
    animation: blink 0.7s step-end infinite;
}

@keyframes blink {
    from, to { border-color: transparent }
    50% { border-color: var(--primary-color); }
}

#hero .subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary-color);
    margin-bottom: 2rem;
}

.contact-icons a {
    color: var(--text-color);
    font-size: 1.8rem;
    margin: 0 1rem;
    transition: color 0.3s ease;
}

.contact-icons a:hover {
    color: var(--primary-color);
}

/* --- 關於我 --- */
#about .about-content {
    text-align: center;
}

#about p {
    font-size: 1.1rem;
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

/* --- 工作經歷 (時間軸) --- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 3px;
    background-color: var(--surface-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -1.5px;
}

.timeline-item {
    padding: 10px 40px;
    position: relative;
    width: 50%;
}

.timeline-item:nth-child(odd) {
    left: 0;
}

.timeline-item:nth-child(even) {
    left: 50%;
}

.timeline-dot {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--bg-color);
    border: 3px solid var(--primary-color);
    top: 24px;
    border-radius: 50%;
    z-index: 1;
}
.timeline-item:nth-child(odd) .timeline-dot {
    right: -8px;
}
.timeline-item:nth-child(even) .timeline-dot {
    left: -8px;
}

.timeline-date {
    font-weight: bold;
    color: var(--primary-color);
}

.timeline-content {
    padding: 20px 30px;
    background-color: var(--surface-color);
    border-radius: 8px;
    position: relative;
    text-align: left;
}

.timeline-content h3 {
    margin-top: 0;
    color: var(--secondary-color);
}

.timeline-content .company {
    font-style: italic;
    color: var(--text-secondary-color);
    margin-bottom: 0.5rem;
}
.timeline-content ul {
    list-style-type: none;
    padding-left: 0;
}
.timeline-content ul li {
    padding-left: 1.2em;
    position: relative;
    margin-bottom: 0.5rem;
}
.timeline-content ul li::before {
    content: '▶';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 0.8em;
}

/* --- 技術技能 --- */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.skill-card {
    background-color: var(--surface-color);
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 3px solid transparent;
    cursor: pointer;
    position: relative;
}

.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border-left-color: var(--primary-color);
}

.skill-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.skill-card h3 {
    margin-bottom: 1rem;
}

.skill-card .skill-summary {
    color: var(--text-secondary-color);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.skill-card .skill-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin-top 0.3s ease;
    opacity: 0;
    text-align: left;
    margin-top: 0;
}

.skill-card:hover .skill-details,
.skill-card.expanded .skill-details {
    max-height: 1000px;
    opacity: 1;
    margin-top: 1rem;
}

.skill-card:hover .skill-summary,
.skill-card.expanded .skill-summary {
    display: none;
}

.skill-card .skill-details ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.skill-card .skill-details ul li {
    padding: 0.5rem 0;
    padding-left: 1.2em;
    position: relative;
    color: var(--text-secondary-color);
    font-size: 0.9rem;
    line-height: 1.6;
}

.skill-card .skill-details ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 0.8em;
}

.skill-card .skill-details ul li strong {
    color: var(--text-color);
}

/* --- 專案亮點 --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
}
.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 170, 255, 0.1);
}

.project-card h3 {
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
}
.project-card p {
    flex-grow: 1;
    margin-bottom: 1rem;
    color: var(--text-secondary-color);
}

.project-tech, .project-features {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
    opacity: 0;
    margin-top: 0;
    padding: 0 0.8rem;
    background-color: rgba(0, 170, 255, 0.1);
    border-radius: 5px;
    font-size: 0.9rem;
    color: var(--text-secondary-color);
    line-height: 1.6;
}

.project-card:hover .project-tech,
.project-card:hover .project-features,
.project-card.expanded .project-tech,
.project-card.expanded .project-features {
    max-height: 500px;
    opacity: 1;
    margin-top: 1rem;
    padding: 0.8rem;
}

.project-tech strong, .project-features strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.5rem;
}
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.tags span {
    background-color: #333;
    color: var(--primary-color);
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}


/* --- 聯絡方式 --- */
#contact {
    text-align: center;
}
#contact .container p {
    max-width: 600px;
    margin: 0 auto 1.5rem;
}
.contact-info p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}
.contact-info i {
    color: var(--primary-color);
    margin-right: 10px;
}
.contact-info a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}
.contact-info a:hover {
    color: var(--primary-color);
}

/* --- 頁尾 --- */
.footer {
    background-color: var(--surface-color);
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
}

/* --- 滾動至頂部按鈕 --- */
#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    padding: 15px;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 18px;
    transition: opacity 0.3s, visibility 0.3s;
}
#scrollToTopBtn:hover {
    background-color: var(--secondary-color);
}


/* --- 動畫 --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- 漢堡選單 (手機版) --- */
.hamburger {
    display: none;
    cursor: pointer;
}
.hamburger .bar {
    display: block;
    width: 25px;
    height: 3px;
    margin: 5px auto;
    background-color: #fff;
    transition: all 0.3s ease-in-out;
}


/* --- 響應式設計  --- */
/* 預設狀態 (電腦版) */
.lang-switcher-mobile {
    display: none; /* 手機版切換器在電腦上隱藏 */
}

/* 手機版樣式 */
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    
    .lang-switcher-desktop {
        display: none; /* 電腦版切換器在手機上隱藏 */
    }

    .lang-switcher-mobile {
        display: flex; /* 手機版切換器在手機上顯示 */
        margin-top: auto;
        padding-bottom: 3rem;
        justify-content: center;
        width: 100%;
    }
    
    .nav-links {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--surface-color);
        width: 100%;
        height: calc(100vh - 70px);
        text-align: center;
        transition: 0.3s;
        gap: 0;
        padding: 2rem 0;
        justify-content: flex-start;
    }
    .nav-links.active {
        left: 0;
    }
    .nav-links a {
        padding: 1.2rem;
        width: 100%;
        border-radius: 0;
    }
    
    .hamburger {
        display: block;
        z-index: 1001;
    }

    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
    
    #about p { text-align: center; }

    .timeline::after { left: 15px; }
    .timeline-item { width: 100%; padding-left: 45px; padding-right: 15px; }
    .timeline-item:nth-child(odd) { left: 0; text-align: left; }
    .timeline-item:nth-child(even) { left: 0; }
    .timeline-dot { left: 8px; }
    .timeline-item:nth-child(odd) .timeline-dot { right: auto; left: 8px; }
}
