/* 基礎重置與字體設定 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    background-color: #fbfcf7;
    color: #333333;
    transition: background-color 0.3s, color 0.3s;
    line-height: 1.6;
}

/* 佈局與通用樣式 */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 100px 0;
    text-align: center;
}

.bg-light {
    background-color: #ffffff;
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

h1, h2, h3 {
    margin-bottom: 1rem;
    font-weight: 600;
    font-family: 'Comic Relief', 'Caveat Brush', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h2 {
    font-size: 2.2rem;
}

h2 .subtitle-zh {
    font-size: 0.7em;
    color: #666666;
    margin-left: 8px;
}

p {
    color: #666666;
    margin-bottom: 1rem;
}

/* 左右圖文並排容器 */
.flex-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    text-align: left;
}
.text-content {
    flex: 1;
}
.img-content {
    flex: 1;
    display: flex;
    justify-content: center;
}

/* 工作流程插畫佔位框 */
.workflow-illustration {
    width: 300px;
    height: 300px;
    background-color: #ffffff;
    border: 2px dashed #e8e5df;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #666666;
}

/* 按鈕樣式 */
.btn {
    display: inline-block;
    padding: 10px 24px;
    background-color: #C98D91;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
    transition: opacity 0.3s;
}

.btn:hover {
    opacity: 0.8;
}

/* 導覽列 */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: rgba(54, 54, 54, 0.98); /* 炭黑色背景 */
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    border-bottom: none;
    z-index: 1000;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px 20px;
    gap: 15px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    font-family: 'Comic Relief', 'Caveat Brush', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #ffffff;
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 60px;
}

.nav-links a {
    text-decoration: none;
    color: #f5f5f5;
    font-weight: 500;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: color 0.3s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 2px;
    background-color: #C98D91;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease-in-out, background-color 0.3s;
}

.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-links a.active-link::after {
    transform: scaleX(1);
    background-color: #C98D91;
}

/* 漢堡選單按鈕 */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
    z-index: 1001; /* 確保選單展開時按鈕仍在最上方 */
}

.bar {
    width: 25px;
    height: 3px;
    background-color: #ffffff;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

/* 主視覺區塊 */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    padding-top: 60px; /* 抵銷導覽列高度 */
}

.hero h1 {
    font-size: 3rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* 主視覺區塊 (左文右圖與動畫) */
.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
    text-align: left;
}
.hero-content {
    flex: 1;
}
.hero-content p {
    margin: 0; /* 覆蓋外部 CSS 置中設定並移除底部空間 */
    max-width: 100%;
}
.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
}
.animated-img {
    max-width: 300px;
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    will-change: transform;
    animation: float 3s ease-in-out infinite;
}
@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

/* 技能標籤 */
.skills-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.skills-list li {
    background-color: #fbfcf7;
    border: 1px solid #e8e5df;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.text-content .skills-list {
    justify-content: flex-start;
}

/* 作品集篩選按鈕 */
.filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 1.5rem;
}

.filter-btn {
    padding: 8px 20px;
    background-color: transparent;
    border: 1px solid #C98D91;
    color: #333333;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    font-size: 0.9rem;
}

.filter-btn:hover,
.filter-btn.active-filter {
    background-color: #C98D91;
    color: #ffffff;
}

/* 精選作品輪播與卡片 */
.slider-container {
    position: relative;
    display: flex;
    align-items: center;
}

.slider-viewport {
    overflow: hidden;
    width: 100%;
    padding: 10px 0; /* 預留卡片陰影空間 */
}

.slider-track {
    display: flex;
    gap: 30px;
    transition: transform 0.4s ease-in-out;
}

/* 停用輪播時的網格狀態 (篩選模式) */
.slider-track.disable-slider {
    flex-wrap: wrap;
    transform: translateX(0) !important; /* 強制覆蓋 JS 的位移 */
    justify-content: center;
}

.slider-item {
    flex: 0 0 auto;
    /* 桌面版預設顯示 3 張，扣除兩個 gap (30px * 2 = 60px) */
    width: calc((100% - 60px) / 3);
}

.card {
    background-color: transparent;
    border: none;
    transition: transform 0.3s, opacity 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

/* 用於過渡動畫的隱藏狀態 */
.card.hide {
    opacity: 0;
    transform: scale(0.9);
    pointer-events: none;
}

/* 用於移除佔位空間 */
.card.d-none {
    display: none;
}

/* 圖片樣式設定 */
.card-img-wrapper {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
}

.card-img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease-in-out;
}

.card:hover .card-img {
    transform: scale(1.1);
}

.card-img-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: none;
}

.card:hover .card-img-overlay {
    opacity: 1;
}

.card-content {
    padding: 15px 0 0 0;
    text-align: center;
}

.card-content h3 {
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.tags {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.tags span {
    font-size: 0.75rem;
    background-color: #ffffff;
    padding: 4px 12px;
    border-radius: 20px;
    color: #666666;
    border: 1px solid #e8e5df;
    display: inline-block;
}

/* 頁尾 */
.footer {
    text-align: center;
    padding: 20px 20px;
    background-color: #363636;
    font-size: 0.9rem;
    color: #ffffff;
}

.footer p {
    margin-bottom: 0;
    color: #ffffff;
}

/* 動畫樣式 */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Lightbox 燈箱樣式 */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox（燈箱）的圖片樣式 */
.lightbox-img {
    max-width: 90%;
    max-height: 80vh; /* 限制圖片最多佔螢幕高度的 80% */
    width: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s;
}

.lightbox-img.loaded {
    opacity: 1;
}

.lightbox-close {
    position: absolute;
    top: 5px;         /* 調整位置以補償 padding，保持視覺位置不變 */
    right: 15px;      /* 調整位置以補償 padding，保持視覺位置不變 */
    padding: 15px;    /* 增加點擊熱區 */
    display: flex;    /* 使用 flex 確保內容居中 */
    align-items: center;
    justify-content: center;
    line-height: 1;   /* 移除字體預設行高干擾 */
    font-size: 40px;
    color: #ffffff;
    cursor: pointer;
    transition: color 0.3s;
}

.lightbox-close:hover {
    color: #cccccc;
}

/* 回到頂部按鈕 */
.back-to-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 45px;
    height: 45px;
    background-color: #C98D91;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    transform: translateY(-5px);
}

.back-to-top svg {
    transition: transform 0.3s;
}

.back-to-top:hover svg {
    transform: translateY(-3px);
}

/* ==== 響應式設計 (Responsive Web Design) 針對螢幕寬度 992px 以下 ==== */
@media (max-width: 992px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .menu-toggle {
        display: flex;
    }

    /* 手機版側邊欄樣式 */
    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        height: 100vh;
        width: 180px;
        background-color: #363636;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        transform: translateX(100%);
        transition: transform 0.4s ease-in-out;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.1);
    }

    .nav-links a {
        font-size: 1.05rem;
    }

    .nav-links.active {
        transform: translateX(0);
    }

    /* 漢堡按鈕點擊後變成 X 動畫 */
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
}

/* ==== 響應式設計 (Responsive Web Design) 針對螢幕寬度 768px 以下 ==== */
@media (max-width: 768px) {

    .section {
        padding-top: 130px; /* 增加頂部間距，確保標題不被固定導覽列遮擋 */
        padding-bottom: 60px;
    }

    .filter-container {
        gap: 20px 10px; /* 增加上下排垂直間距，縮小左右間距 */
    }

    .filter-btn {
        padding: 8px 15px; /* 稍微縮減手機版按鈕內距 */
        font-size: 0.85rem;
    }

    /* 主視覺手機版 */
    .hero-container {
        flex-direction: column-reverse; /* 手機版改為圖片在上、文字在下 */
        text-align: center;
        margin-top: 2rem;
    }
    .hero-content p {
        margin: 0 auto;
    }

    /* 左右圖文並排手機版：改為垂直排列 */
    .flex-container {
        flex-direction: column;
        text-align: center;
    }
    .text-content .skills-list {
        justify-content: center;
    }

    /* 精選作品輪播圖手機版：改為顯示單張 */
    .slider-item {
        width: 100%; /* 一次顯示 1 張 */
    }
    .slider-track {
        gap: 15px; /* 縮小手機版間距 */
    }

    .lightbox-close {
        font-size: 32px;  /* 稍微縮小叉叉符號 */
        padding: 12px;   /* 稍微調整點擊熱區 */
        top: 10px;       /* 調整邊距，避免太靠近螢幕邊框 */
        right: 10px;
    }

}
