/* --- 全局樣式 --- */
:root {
    --brown-color: #7e3d00;
    --brown2-color: #c2a182;
    --text-color: #333;
    --light-text-color: #666;
    --background-color: #F8F8F8;
    --white-color: #ece9e4;
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Noto Sans TC', sans-serif;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
    scroll-behavior: smooth;
}

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

section {
    padding: 80px 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

section.in-view {
    opacity: 1;
    transform: translateY(0);
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    margin-bottom: 20px;
    color: var(--text-color);
}

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

h2::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background-color: var(--brown-color);
    border-radius: 2px;
}

/* 按鈕 */
.btn {
    display: inline-block;
    background-color: var(--brown-color);
    color: #ffffff;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.btn:hover {
    background-color: var(--brown2-color);
    color: #000;
    transform: translateY(-2px);
}

.navbar {
    background-color: var(--white-color);
}



/* 控制選單項目之間的間距 */
.navbar-nav .nav-item {
    margin-left: 50px;
    /* 你可以調成 30px 看感覺 */
}

/* 導覽列選單底線效果 */
.navbar-nav .nav-link {
    position: relative;
    display: inline-block;
    padding-bottom: 6px;
    /* 預留底線空間 */
    color: var(--text-color);
    font-weight: 700;
    text-decoration: none;
}

.navbar-nav .nav-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background-color: var(--brown-color);
    /* 換成有定義的顏色 */

    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-nav .nav-link:hover {
    color: var(--brown-color);
}

.navbar-nav .nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.navbar-nav .nav-link:not(:hover)::after {
    transform: scaleX(0);
    transform-origin: right;
}

/* --- 導覽列 LOGO --- */
.logo {
    display: inline-block;
    color: var(--brown-color);
    font-size: 2em;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
    letter-spacing: 0.5px;
}

.logo:hover {
    color: #000;
    transform: translateY(-2px)
}


/* --- 漢堡選單動畫 --- */
.line {
    fill: none;
    stroke: var(--brown-color);
    stroke-width: 10;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-linecap: round;
    border: none;

    /* 🔑 設定旋轉基準在中間 */
    transform-origin: 50% 50%;
}

/* --- 點擊後動畫 --- */
.menu-btn.active .line1 {
    transform: rotate(45deg) translateY(21px);
    stroke: #000000;
}

.menu-btn.active .line2 {
    opacity: 0;
    /* 中間線消失 */
}

.menu-btn.active .line3 {
    transform: rotate(-45deg) translateY(-20px);
    stroke: #000000;
}

.menu-btn {
    transition: transform 0.5s ease;
    border: none;
    /* 移除邊框 */
    outline: none;
    /* 移除點擊時的外框 */
    box-shadow: none;
    /* 移除陰影 */
}

.menu-btn:focus {
    outline: none;
    box-shadow: none;
}

.menu-btn.active {
    transform: rotate(180deg) scale(1);
}

/* --- Hero --- */
.hero {
    background: linear-gradient(135deg, #b6862d, #502b00);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--white-color);
    position: relative;
}

.hero-content {
    max-width: 800px;
    padding: 20px;
}

.hero-content h1 {
    font-size: em;
    margin-bottom: 20px;
    line-height: 1.2;
    color: var(--white-color);
}

.hero-content p {
    font-size: 1.5em;
    margin-bottom: 40px;
    font-weight: 300;
    opacity: 0.9;
}

.hero-content .btn {
    background-color: #bb824d;
    color: var(--white-color);
    font-size: 1.1em;
    padding: 15px 30px;
}

.hero-content .btn:hover {
    background-color: var(--brown2-color);
    color: #000;
}

.scroll-down-arrow {
    position: absolute;
    margin-top: 20px;
    bottom: 40px;
    left: 50%;
    transform: translateX(-60%);
    color: var(--white-color);
    font-size: 2em;
    cursor: pointer;
}

.scroll-down-arrow a {
    color: #fff;
    text-decoration: none;
    font-size: 2rem;
}

.scroll-down-arrow a:hover {
    color: #ccc;
}

/* --- 關於我 --- */
#about {
    min-height: 100vh;
    /* 讓關於我至少等於一個螢幕高 */
    display: flex;
    align-items: center;
    /* 讓內容置中 */
}

.about-me {
    background-color: var(--white-color);
}

.about-me-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
    background-color: #e2d1c2;
    padding: 30px 0;
    border-radius: 30px;
}

.about-me-image {
    flex: 1;
    min-width: 300px;
    align-items: center;
}

.about-me-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);

}

.about-me-text {
    flex: 2;
    min-width: 50%;

}

.about-me-text h3 {
    font-size: 3em;
    margin-bottom: 20px;
}

.about-me-text p {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.8;
}

/* --- 技能 --- */

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.skill-item {
    background-color: var(--white-color);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.skill-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.skill-item i {
    font-size: 10em;
    color: var(--brown-color);
    margin-bottom: 15px;
}

.skill-item h4 {
    font-size: 1.5em;
    margin-bottom: 10px;
}

.skill-item p {
    margin-bottom: 15px;
    color: var(--light-text-color);
}



/* --- 作品集 --- */
#portfolio {
    background-color: var(--brown2-color);
    color: #000;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    align-items: stretch; /* ⭐ 讓每一格的高度一致 */
}


.portfolio-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--white-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;

}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.15);
}

.portfolio-item img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.portfolio-item:hover img {
    transform: scale(1.03);
}

.portfolio-info {
    padding: 20px;
    text-align: center;
    margin-top: auto;
}

.portfolio-info h3 {
    font-size: 1.5em;
    margin-top: 5px;
    /* 控制標題與圖片的距離 */
    margin-bottom: 10px;
    font-weight: 900;
}

.portfolio-info p {
    font-size: 0.9em;
    color: var(--light-text-color);
    margin-bottom: 40px;
}

.btn-small {
    padding: 8px 25px;
    font-size: 0.9em;
    border-radius: 30px;
}

/* --- 聯絡我 --- */
#contact {
    background-color: var(--brown-color-color);
}

.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background-color: var(--white-color);
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.contact-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: var(--font-body);
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.contact-form input[type="text"]:focus,
.contact-form input[type="email"]:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--brown-color);
}

.contact-form textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-form button {
    width: 100%;
    border: none;
    cursor: pointer;
}

/* --- Footer --- */
.main-footer {
    background-color: var(--brown2-color);
    color: var(--light-text-color);
    text-align: center;
    padding-bottom: 1px;
    font-size: 0.9em;
}

.main-footer .legal {
    margin-top: 1px;
    margin-bottom: 0px;
}

.main-footer .social-icons a {
    color: #757474;
    font-size: 2.5em;
    margin: 0 10px;
    transition: color 0.3s ease;
}

.main-footer .social-icons a:hover {
    color: #fcfcfc;
}

/* --- 響應式設計 --- */
/* 桌機版 (≥992px) */
/* ========================= */
@media (min-width: 992px) {
    .navbar-collapse {
        max-height: none !important;
        /* 不限制高度 */
        overflow: visible !important;
        /* 顯示內容 */
        transition: none !important;
        /* 移除動畫 */
    }
}

/* ========================= */
/* 手機版 (<992px) */
/* ========================= */
@media (max-width: 991px) {

    /* 收起時 */
    .navbar-collapse {
        max-height: 0;
        overflow: hidden;
        /* 防止內容超出 */
        transition: max-height 0.6s ease;
    }

    /* 展開時 */
    .navbar-collapse.show {
        max-height: 500px;
        /* 固定高度 (依內容調整) */
    }

    /* 覆蓋 Bootstrap 預設 collapsing 狀態 */
    .collapsing {
        max-height: 0 !important;
        overflow: hidden;
        transition: max-height 0.1s ease;
    }

    .collapsing.show {
        max-height: 500px !important;
    }
}

@media (max-width: 768px) {
    .main-header .container {
        flex-direction: column;
        gap: 15px;
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .main-nav ul li {
        margin: 0 15px 10px 15px;
    }

    .hero-content h1 {
        font-size: 2.8em;
    }

    .hero-content p {
        font-size: 1.2em;
    }

    .about-me-content {
        flex-direction: column;
    }

    .about-me-image {
        width: 80%;
    }

    h2 {
        font-size: 2em;
        margin-bottom: 40px;
    }

    h3 {
        width: auto;
    }

    section {
        padding: 60px 0;
    }
}

@media (max-width: 480px) {
    .hero-content h1 {
        font-size: 2.2em;
    }

    .hero-content p {
        font-size: 1em;
    }

    .main-nav ul li {
        margin: 0 10px 8px 10px;
    }
}