/* 通用樣式與變數 - 淺色模式 (預設，即夕陽漸變) */
:root {
    --bg-color-start: #ff7e5f; /* 暖橘色 */
    --bg-color-end: #feb47b;   /* 淺橘色 */
    --card-bg-color: #fcefe9;  /* 淺色卡片背景 */
    --accent-color: #d1512c;   /* 深橘紅作為強調色 */
    --text-color: #333333;     /* 主要文字色 */
    --secondary-text-color: #666666; /* 次要文字色 */
    --border-color: #f0d8c8;   /* 邊框顏色 */

    /* 深色模式變數 (會在 .dark-mode class 中覆寫) */
    --dark-bg-color-start: #1a202c; /* 深藍色 */
    --dark-bg-color-end: #2d3748;   /* 紫藍色 */
    --dark-card-bg-color: #3f4762;  /* 深色卡片背景 */
    --dark-accent-color: #8bbcd4;   /* 淺藍色強調色 */
    --dark-text-color: #f0f8ff;     /* 淺色文字 */
    --dark-secondary-text-color: #c0d9e8; /* 淺色次要文字 */
    --dark-border-color: #5a6482;   /* 淺藍邊框 */
}

/* 深色模式樣式 */
body.dark-mode {
    --bg-color-start: var(--dark-bg-color-start);
    --bg-color-end: var(--dark-bg-color-end);
    --card-bg-color: var(--dark-card-bg-color);
    --accent-color: var(--dark-accent-color);
    --text-color: var(--dark-text-color);
    --secondary-text-color: var(--dark-secondary-text-color);
    --border-color: var(--dark-border-color);

    background: linear-gradient(180deg, var(--bg-color-start) 0%, var(--bg-color-end) 100%);
}

body.dark-mode .navbar {
    background-color: rgba(30, 35, 50, 0.95);
}

body.dark-mode .navbar .logo {
    color: var(--accent-color);
}

body.dark-mode .hero-section {
    color: var(--text-color);
    text-shadow: none;
}

body.dark-mode .hero-section h1 {
    color: var(--accent-color);
}

body.dark-mode .hero-section p {
    color: var(--secondary-text-color);
}

body.dark-mode .section {
    background-color: rgba(45, 55, 72, 0.9);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

body.dark-mode .project-card {
    background-color: var(--card-bg-color);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .footer {
    background-color: rgba(30, 35, 50, 0.95);
}

/* 模式切換按鈕樣式 */
.theme-toggle-btn {
    background: var(--accent-color);
    color: #ffffff;
    padding: 8px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease;
    margin-left: 20px;
}

.theme-toggle-btn:hover {
    background: #ad3d1f;
    transform: translateY(-1px);
}

body.dark-mode .theme-toggle-btn {
    background: var(--dark-accent-color);
    color: #333333;
}

body.dark-mode .theme-toggle-btn:hover {
    background: #6a9ac3;
}


html {
    scroll-behavior: smooth;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background: linear-gradient(180deg, var(--bg-color-start) 0%, var(--bg-color-end) 100%);
    background-attachment: fixed;
    transition: background-color 0.5s ease;
}

h1, h2, h3 {
    font-family: 'Montserrat', sans-serif;
    color: var(--text-color);
    margin-bottom: 1rem;
    font-weight: 700;
    transition: color 0.5s ease;
}

h2 {
    font-size: 2.8rem;
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    padding-bottom: 10px;
}

h2::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 80px;
    height: 4px;
    background-color: var(--accent-color);
    border-radius: 2px;
    transition: background-color 0.5s ease;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #ad3d1f;
}
body.dark-mode a:hover {
    color: #6a9ac3;
}


.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 按鈕樣式 */
.btn {
    display: inline-block;
    background: var(--accent-color);
    color: #ffffff;
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: background 0.3s ease, transform 0.2s ease, color 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn:hover {
    background: #ad3d1f;
    transform: translateY(-2px);
}
body.dark-mode .btn {
    color: #333333;
}
body.dark-mode .btn:hover {
    background: #6a9ac3;
}


/* 導覽列 */
.navbar {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 1.2rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: background-color 0.5s ease;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar .logo {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-color);
    transition: color 0.5s ease;
}

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

.nav-links a {
    color: var(--secondary-text-color);
    font-size: 1.05rem;
    font-weight: 400;
    padding: 5px 0;
    position: relative;
    transition: color 0.5s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease-in-out, background-color 0.5s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover {
    color: var(--accent-color);
}

/* 英雄區塊 */
.hero-section {
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 20px;
    color: #ffffff;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    transition: color 0.5s ease, text-shadow 0.5s ease;
    position: relative;
    overflow: hidden;
}

.hero-section h1 {
    font-size: 4.5rem;
    margin-bottom: 15px;
    color: #ffffff;
    line-height: 1.1;
    transition: color 0.5s ease;
    z-index: 2;
    position: relative;
}

.hero-section p {
    font-size: 1.8rem;
    color: #ffe0b2;
    font-weight: 300;
    transition: color 0.5s ease;
    z-index: 2;
    position: relative;
}

/* 天空物體 (太陽/月亮) 樣式 */
.sky-object {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* 【關鍵修正】使用 clamp() 實現平滑縮放 */
    font-size: clamp(180px, 25vw, 280px);
    opacity: 0.15;
    z-index: 1;
    transition: font-size 0.3s ease;
}

/* ================================== */
/*     【精細化】動態光暈動畫效果     */
/* ================================== */

@keyframes sunGlow {
    0%, 100% {
        text-shadow:
            0 0 20px #fff,
            0 0 60px #fefcbf,
            0 0 100px #f5d491,
            0 0 150px #ff9900;
        transform: scale(1);
    }
    50% {
        text-shadow:
            0 0 30px #fff,
            0 0 80px #fefcbf,
            0 0 140px #f5d491,
            0 0 200px #ff9900,
            0 0 280px #ff6600;
        transform: scale(1.05);
    }
}

@keyframes moonGlow {
    0%, 100% {
        text-shadow:
            0 0 20px #fff,
            0 0 50px #e0f7fa,
            0 0 90px #b3e5fc,
            0 0 140px #81d4fa;
        transform: scale(1);
    }
    50% {
        text-shadow:
            0 0 30px #fff,
            0 0 70px #e0f7fa,
            0 0 120px #b3e5fc,
            0 0 180px #81d4fa,
            0 0 250px #4fc3f7;
        transform: scale(1.03);
    }
}


/* ================================== */
/*        太陽 & 月亮 圖示樣式        */
/* ================================== */

.sky-object i {
    color: #fffbef;
    animation: sunGlow 10s infinite ease-in-out;
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.dark-mode .sky-object i {
    color: #f0f8ff;
    animation: moonGlow 8s infinite ease-in-out;
}

/* 區塊通用樣式 */
.section {
    padding: 100px 0;
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    margin: 40px auto;
    max-width: 1000px;
    padding: 60px 40px;
    transition: background-color 0.5s ease, box-shadow 0.5s ease, border-color 0.5s ease;
}

.section:last-of-type {
    border-bottom: none;
}

/* 關於我 */
#about p {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.15rem;
    color: var(--secondary-text-color);
    transition: color 0.5s ease;
}

/* 專案 */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.project-card {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease, border-color 0.5s ease;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.project-card h3 {
    color: var(--accent-color);
    font-size: 1.7rem;
    margin-bottom: 15px;
    transition: color 0.5s ease;
}

.project-card p {
    color: var(--secondary-text-color);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 20px;
    transition: color 0.5s ease;
}

/* 聯絡方式卡片化 (三行式版本) */
#contact p {
    font-size: 1.15rem;
    color: var(--secondary-text-color);
    margin-bottom: 40px;
    transition: color 0.5s ease;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.contact-card {
    background-color: #ffffff;
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.5s ease, border-color 0.5s ease;
    color: var(--text-color);
    display: flex;
    align-items: center;
    text-align: left;
}

.contact-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
    color: var(--accent-color);
}

.contact-card i {
    font-size: 2.5rem;
    color: var(--accent-color);
    margin-right: 25px;
    transition: color 0.3s ease;
    width: 40px;
    text-align: center;
}

.contact-card h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    margin-bottom: 5px;
    font-weight: 700;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.contact-card span {
    color: var(--secondary-text-color);
    font-size: 1rem;
    transition: color 0.3s ease;
}

.contact-card:hover .contact-text h4,
.contact-card:hover .contact-text span {
    color: inherit;
}

body.dark-mode .contact-card {
    background-color: var(--card-bg-color);
}
body.dark-mode .contact-card:hover {
    color: var(--dark-accent-color);
}


/* 頁尾 */
.footer {
    background-color: #f7f7f7;
    color: var(--secondary-text-color);
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.footer .social-links {
    margin-bottom: 20px;
}

.footer .social-links a {
    color: var(--accent-color);
    margin: 0 15px;
    font-size: 1.2rem;
    transition: color 0.3s ease;
}

.footer .social-links a:hover {
    color: #ad3d1f;
}
body.dark-mode .footer .social-links a:hover {
    color: #6a9ac3;
}


/* ================================== */
/*         響應式設計 (手機優先)        */
/* ================================== */

/* 平板與大型手機 (寬度 992px 以下) */
@media (max-width: 992px) {
    .hero-section h1 {
        font-size: 3.8rem;
    }
    .hero-section p {
        font-size: 1.6rem;
    }
    h2 {
        font-size: 2.5rem;
    }
    .section {
        padding: 80px 30px;
    }
    .project-card {
        padding: 25px;
    }
}

/* 一般手機 (寬度 768px 以下) */
@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 15px;
    }
    .nav-links {
        justify-content: center;
        width: 100%;
    }
    .hero-section {
        min-height: 80vh;
        padding: 60px 20px;
    }
    .hero-section h1 {
        font-size: 3rem;
    }
    .hero-section p {
        font-size: 1.3rem;
    }
    h2 {
        font-size: 2.2rem;
        margin-bottom: 2rem;
    }
    .section {
        padding: 60px 20px;
        margin: 20px auto;
    }
    .project-grid {
        grid-template-columns: 1fr;
    }
    .contact-card {
        padding: 15px 20px;
    }
}

/* 小型手機 (寬度 480px 以下) */
@media (max-width: 480px) {
    .navbar .logo {
        font-size: 1.5rem;
    }
    .nav-links {
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .nav-links li {
        padding: 0 5px;
    }
    .theme-toggle-btn {
        margin-left: 10px;
    }
    .hero-section h1 {
        font-size: 2.5rem;
    }
    .hero-section p {
        font-size: 1.1rem;
    }
    h2 {
        font-size: 1.9rem;
    }
    .section {
        padding: 50px 15px;
    }
    .project-card h3 {
        font-size: 1.4rem;
    }
    .project-card p {
        font-size: 0.9rem;
    }
    .contact-card i {
        font-size: 2rem;
        margin-right: 15px;
    }
    .contact-card h4 {
        font-size: 1.1rem;
    }
    .contact-card span {
        font-size: 0.9rem;
    }
}