/* --- 變數與配色方案 --- */
:root {
    --bg-color: #121212;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #39C5BB;
    --section-spacing: 120px;
    --nav-height: 80px;  /* 電腦版高度 */
}

/* --- 全域基礎設定 --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto; }

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul { list-style: none; }

/* --- 導覽列 (Navbar) --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    height: var(--nav-height);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: height 0.3s ease, background 0.4s ease, border-color 0.4s ease;
}

/* Logo 圖片 */
.logo {
    display: flex;
    align-items: center;
    z-index: 1001;
    height: 100%;
}

.logo img {
    height: 50px; /* Logo 高度 */
    width: auto;
    object-fit: contain;
    transition: height 0.3s ease;
}

/* 選單容器 */
.nav-links {
    display: flex;
    gap: 30px; /* 稍微縮小間距以容納新按鈕 */
    align-items: center;
}

.nav-links li a {
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}

/* 一般連結的底線動畫 (排除特殊按鈕) */
.nav-links li a:not(.btn-cta):not(.btn-pricing)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

.nav-links li a:not(.btn-cta):not(.btn-pricing):hover::after { width: 100%; }
.nav-links li a:hover { color: var(--accent-text-light); }
body.light-mode .nav-links li a:hover { color: var(--accent-text-light); }

/* --- 特殊按鈕 1：服務與報價 (導覽列) --- */
.nav-links li a.btn-pricing {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
}

.nav-links li a.btn-pricing svg {
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

body.light-mode .nav-links li a.btn-pricing svg {
    color: var(--accent-text-light);
}

.nav-links li a.btn-pricing:hover {
    background: rgba(57, 197, 187, 0.15);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.nav-links li a.btn-pricing:hover svg {
    transform: scale(1.1) rotate(-10deg);
}

/* --- 特殊按鈕 2：聯絡我 (導覽列) --- */
.nav-links li a.btn-cta {
    border: 2px solid var(--accent-color);
    border-radius: 50px;
    padding: 8px 24px;
    color: var(--accent-color);
}

body.light-mode .nav-links li a.btn-cta {
    border: 2px solid var(--accent-text-light);
    color: var(--accent-text-light);
}

.nav-links li a.btn-cta:hover {
    background-color: var(--accent-color);
    color: #000;
    box-shadow: 0 0 15px rgba(57, 197, 187, 0.4);
}

/* 漢堡按鈕 */
.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 6px;
    z-index: 1001;
}

.hamburger span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--text-primary);
    transition: all 0.3s ease;
}

/* --- 主視覺 Hero --- */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 15%;
    padding-top: var(--nav-height);
    background: radial-gradient(circle at 80% 20%, rgba(57, 197, 187, 0.1) 0%, transparent 40%);
}

.hero h1 {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
    line-height: 1.1;
}

.hero h1 .highlight {
    color: var(--accent-color);
    display: inline-block;
    position: relative;
}

body.light-mode .hero h1 .highlight {
    color: var(--accent-text-light);
}

.hero h1 .highlight::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 8px;
    width: 100%;
    height: 12px;
    background-color: var(--accent-color);
    opacity: 0.2;
    z-index: -1;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 50px;
    min-height: 1.6em;
}

.typed-cursor { color: var(--accent-color); }
body.light-mode .typed-cursor { color: var(--accent-text-light); }

/* --- 呼吸燈按鈕 (Hero 區) --- */
.btn {
    display: inline-block;
    padding: 14px 36px;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
    border-radius: 50px;
    letter-spacing: 1px;
}

body.light-mode .btn {
    border: 1px solid var(--accent-text-light);
    color: var(--accent-text-light);
}

.btn:hover {
    background-color: var(--accent-color);
    color: #000;
    box-shadow: 0 0 20px rgba(57, 197, 187, 0.4);
}

.btn-pulse {
    position: relative;
    background-color: transparent; 
    overflow: visible;
}

.btn-pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50px;
    border: 2px solid var(--accent-color);
    opacity: 0.5;
    animation: pulse-border 2s infinite;
    z-index: -1;
}

@keyframes pulse-border {
    0% { width: 100%; height: 100%; opacity: 0.8; }
    100% { width: 140%; height: 160%; opacity: 0; }
}

.btn-pulse:hover::before { animation: none; }


/* --- 內容區塊 --- */
.section {
    padding: var(--section-spacing) 15%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    transition: color 0.4s ease;
}

.section h2::before {
    content: '';
    display: block;
    width: 30px;
    height: 4px;
    background-color: var(--accent-color);
    margin-right: 15px;
}

.section-desc {
    color: var(--text-secondary); 
    margin-bottom: 40px;
    max-width: 600px;
    transition: color 0.4s ease;
}

.placeholder-content {
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 40px;
    color: var(--text-secondary);
    min-height: 300px;
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}

.placeholder-content:hover { background: rgba(255,255,255,0.05); }

.text-content p { margin-bottom: 1em; }
.service-list li { margin-bottom: 20px; }
.service-list strong { color: var(--text-primary); font-size: 1.1rem; }

/* --- 作品集 Grid 佈局 (放大優化版) --- */
.works-grid {
    display: grid;
    /* 380px 寬度觸發點，螢幕窄時自動換行 */
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); 
    gap: 40px;
    width: 100%;
}

.work-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column; 
}

.work-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    border-color: var(--accent-color);
}

.work-image {
    width: 100%;
    height: 260px; /* 增加高度 */
    overflow: hidden;
}

.work-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.work-card:hover .work-image img { transform: scale(1.1); }

.work-content {
    padding: 25px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.work-content h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    transition: color 0.4s ease;
}

.work-content p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
    flex-grow: 1;
    transition: color 0.4s ease;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.tags span {
    font-size: 0.8rem;
    padding: 4px 12px;
    background: rgba(57, 197, 187, 0.1);
    color: var(--accent-color);
    border-radius: 20px;
}

.work-links { display: flex; gap: 15px; }
.work-links a {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: underline;
    text-underline-offset: 4px;
}
.work-links a:hover { color: var(--accent-text-light); }

/* --- 底部聯絡按鈕 --- */
.contact-section {
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center; 
    text-align: center;
}

.mail-btn {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 35%;     
    min-width: 280px;
    padding: 1.5rem 2rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color), #39b0bb);
    color: #000000;
    font-size: 1.4rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: none;
    overflow: hidden;
    box-shadow: 0 10px 40px -10px rgba(57, 197, 187, 0.6);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mail-btn:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 60px -15px rgba(57, 197, 187, 1);
    color: #000;
}

.mail-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    transition: all 0.7s ease;
    z-index: 1;
}

.mail-btn:hover::before { left: 100%; }

footer {
    padding: 50px 15%;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    transition: color 0.4s ease, border-color 0.4s ease;
}

/* --- 淺色主題變數 --- */
body.light-mode {
    --bg-color: #f5f5f5;
    --text-primary: #121212;
    --text-secondary: #555555; /* 稍微加深一點 */
    --accent-text-light: #00796B; /* 淺色模式下較深的綠色 */
}

body.light-mode .navbar {
    background: rgba(245, 245, 245, 0.85);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .placeholder-content {
    background: rgba(0, 0, 0, 0.03);
    border: 1px dashed rgba(0, 0, 0, 0.1);
}

body.light-mode .placeholder-content:hover {
    background: rgba(0, 0, 0, 0.06);
}

body.light-mode .work-card {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .work-card:hover {
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.15);
}

body.light-mode footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

body.light-mode .hamburger span {
    background-color: var(--text-primary);
}

/* 淺色主題下的導覽列按鈕hover效果 */
body.light-mode .nav-links li a.btn-pricing {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

body.light-mode .nav-links li a.btn-pricing:hover {
    background: rgba(57, 197, 187, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 淺色主題下的郵件按鈕 */
body.light-mode .mail-btn {
    background: linear-gradient(135deg, var(--accent-color), #39b0bb);
    box-shadow: 0 10px 40px -10px rgba(57, 197, 187, 0.4);
}

body.light-mode .mail-btn:hover {
    box-shadow: 0 20px 60px -15px rgba(57, 197, 187, 0.6);
}

/* --- 主題切換按鈕 --- */
.theme-toggle-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(57, 197, 187, 0.3);
    transition: all 0.3s ease;
    z-index: 999;
    color: #000;
}

.theme-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(57, 197, 187, 0.5);
}

.theme-toggle-btn:active {
    transform: scale(0.95);
}

.theme-icon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

body.light-mode .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

body.light-mode .moon-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* --- RWD 響應式設定 --- */
@media screen and (max-width: 1024px) {
    .hero, .section { padding-left: 8%; padding-right: 8%; }
}

@media screen and (max-width: 768px) {
    :root { 
        --section-spacing: 80px;
    }

    /* 導覽列與 Logo 縮小 */
    .navbar { 
        height: 60px; 
        padding: 0 20px; 
    }
    .logo img { 
        height: 35px; 
    }

    .hamburger { display: flex; }

    /* 手機版選單 */
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 100%;
        background-color: rgba(18, 18, 18, 0.98);
        flex-direction: column;
        justify-content: center;
        gap: 30px;
        transition: right 0.4s ease;
        padding-top: 60px;
    }

    body.light-mode .nav-links {
        background-color: rgba(245, 245, 245, 0.98);
    }

    .nav-links.active { right: 0; }
    .nav-links li a { font-size: 1.5rem; }
    .nav-links li a.btn-cta { font-size: 1.3rem; padding: 12px 30px; }

    /* 手機版選單內的服務報價按鈕 */
    .nav-links li a.btn-pricing {
        width: 100%;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
        font-size: 1.2rem;
        padding: 12px;
        margin-top: 10px; 
    }

    /* 漢堡動畫 */
    .hamburger.toggle span:nth-child(1) { transform: rotate(45deg) translate(5px, 6px); }
    .hamburger.toggle span:nth-child(2) { opacity: 0; }
    .hamburger.toggle span:nth-child(3) { transform: rotate(-45deg) translate(5px, -6px); }

    .hero { padding-left: 20px; padding-right: 20px; align-items: flex-start; }
    .hero h1 { font-size: 2.8rem; }
    .hero-subtitle { font-size: 1.1rem; }
    
    .section { padding: 60px 20px; }
    .section h2 { font-size: 2rem; }

    .works-grid {
        grid-template-columns: 1fr; /* 手機強制單欄 */
        gap: 30px;
    }
    .work-image { height: 220px; }

    .mail-btn {
        max-width: 80%;
        font-size: 1.2rem;
        padding: 1.2rem;
    }

    .theme-toggle-btn {
        width: 48px;
        height: 48px;
        bottom: 20px;
        right: 20px;
    }

    .theme-toggle-btn svg {
        width: 18px;
        height: 18px;
    }
}