/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&display=swap');

/* --- Global Styles --- */
:root {
    --primary-green: #1A472A; /* 主要深綠色 */
    --secondary-green: #2A6F44; /* 次要、用於 hover 的綠色 */
    --accent-gold: #CFA96C; /* 點綴用的金色 */
    --light-text: #F0F0F0; /* 淺色文字 */
    --dark-text: #333333; /* 深色文字 */
    --section-bg: #F5F7F5; /* 區塊背景色 */
}

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

body {
    font-family: 'Noto Sans TC', sans-serif;
    line-height: 1.6;
    color: var(--dark-text);
    background-color: #FFFFFF;
}

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

section {
    padding: 60px 0;
}

section:nth-of-type(odd) {
    background-color: var(--section-bg);
}

section:nth-of-type(even) {
    background-color: #FFFFFF;
}

section h2 {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5rem;
    color: var(--primary-green);
    font-weight: 700;
}

/* --- Fade-in Animation --- */
.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);
}

/* --- Header & Navigation --- */
.main-header {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-green);
    text-decoration: none;
}

.main-nav ul {
    display: flex;
    list-style: none;
}

.main-nav a {
    color: var(--dark-text);
    text-decoration: none;
    padding: 10px 15px;
    transition: color 0.3s;
    font-weight: 700;
}

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

.hamburger {
    display: none;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.hamburger .bar {
    width: 25px;
    height: 3px;
    background-color: var(--dark-text);
    transition: all 0.3s ease-in-out;
}

/* --- Hero Section --- */
#hero {
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('https://mark-house.tw/wp-content/uploads/2025/08/馬榮華-封面照片-scaled.jpg') no-repeat center bottom/cover;
    height: 100vh;
    color: var(--light-text);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding-top: 70px; /* Offset for fixed header */
}

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

.hero-content h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
}

.hero-content p {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    background: var(--accent-gold);
    color: var(--primary-green);
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    border: 2px solid var(--accent-gold);
}

.btn:hover {
    background: transparent;
    color: var(--accent-gold);
}

/* --- About Section --- */
#about .container {
    display: flex;
    align-items: center;
    gap: 50px;
}

.about-img {
    flex: 1;
    text-align: center;
}

.about-img img {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid var(--primary-green);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.about-text {
    flex: 2;
}

/* --- Awards & Services Section --- */
#awards, #services {
    text-align: center;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

/* 新增：用於置中兩個服務項目的樣式 */
.services-grid--two-items {
    grid-template-columns: repeat(2, 1fr);
    max-width: 750px; /* 限制最大寬度以使其置中 */
    margin: 0 auto; /* 水平置中 */
}

.service-item {
    background: #FFFFFF;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.service-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.1);
}

.service-item i {
    font-size: 3rem; /* 48px */
    margin-bottom: 1rem;
    color: var(--primary-green);
}

.service-item h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-green);
}

/* --- Listings Section --- */
#listings {
    background: var(--primary-green);
    color: var(--light-text);
    text-align: center;
}
#listings h2 {
    color: var(--light-text);
}
#listings p {
    margin-bottom: 2rem;
}

/* --- Testimonials Section --- */
.testimonial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
}
.testimonial-item {
    background: #FFFFFF;
    padding: 20px;
    border-left: 5px solid var(--accent-gold);
    border-radius: 5px;
}
.testimonial-item p {
    font-style: italic;
    margin-bottom: 10px;
}
.testimonial-item cite {
    font-weight: bold;
    color: var(--primary-green);
}

/* --- Contact Section --- */
#contact {
    text-align: center;
}

.btn-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #06C755; /* LINE Green */
    color: white;
    padding: 15px 30px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
    transition: background-color 0.3s;
    border: none;
}
.btn-line:hover {
    background-color: #05a546;
}
.btn-line i {
    font-size: 1.5em;
    margin-right: 10px;
}

.contact-info-secondary {
    margin-top: 2rem;
    font-size: 1rem;
}
.contact-info-secondary a {
    color: var(--secondary-green);
    text-decoration: none;
    transition: color 0.3s;
}
.contact-info-secondary a:hover {
    color: var(--accent-gold);
}
.contact-info-secondary i {
    margin-right: 5px;
}

/* --- Footer --- */
footer {
    background: var(--dark-text);
    color: var(--light-text);
    text-align: center;
    padding: 20px 0;
}
footer a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color 0.3s;
}
footer a:hover {
    color: #FFFFFF;
}
footer i {
    margin-right: 5px;
}

/* --- Back to Top Button --- */
#back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--accent-gold);
    color: var(--primary-green);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    text-align: center;
    font-size: 20px;
    cursor: pointer;
    display: none;
    z-index: 999;
    transition: opacity 0.4s, visibility 0.4s, transform 0.3s;
    opacity: 0;
    visibility: hidden;
    border: 2px solid var(--primary-green);
    line-height: 46px; /* Adjust for border */
}
#back-to-top:hover {
    transform: scale(1.1);
}
#back-to-top.show {
    opacity: 1;
    visibility: visible;
}

/* --- Responsive (RWD) --- */
@media (max-width: 768px) {
    .main-header .container {
        height: 60px;
    }
    .main-nav {
        display: none;
        position: absolute;
        top: 60px;
        left: 0;
        width: 100%;
        background: #FFFFFF;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    .main-nav.active {
        display: block;
    }
    .main-nav ul {
        flex-direction: column;
        width: 100%;
    }
    .main-nav ul li {
        text-align: center;
        border-bottom: 1px solid var(--section-bg);
    }
    .main-nav a {
        display: block;
        padding: 15px;
    }
    .hamburger {
        display: flex;
    }
    .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);
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }
    .hero-content p {
        font-size: 1.2rem;
    }

    #about .container {
        flex-direction: column;
    }
    .about-img { margin-bottom: 30px; }

    .services-grid,
    .services-grid--two-items {
        grid-template-columns: 1fr;
        max-width: none; /* 在手機上取消最大寬度限制 */
        margin: 0; /* 在手機上取消置中 */
    }
    .testimonial-grid { grid-template-columns: 1fr; }
}

/* --- Dynamic Listings Styles --- */
.listings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    text-align: left;
}

.listing-item a {
    display: block;
    text-decoration: none;
    color: var(--dark-text);
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    height: 100%;
}

.listing-item a:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

/* [SEO 與效能優化] 修改 .listing-image 的樣式以適應 <img> 標籤 */
.listing-image {
    height: 200px;
    width: 100%; /* 確保圖片填滿容器寬度 */
    object-fit: cover; /* 這會取代 background-size: cover 的效果 */
    object-position: center; /* 這會取代 background-position: center 的效果 */
    display: block; /* 移除圖片底部的預設空間 */
}

.listing-content {
    padding: 20px;
}

.listing-content h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    color: var(--primary-green);
    /* Ensure text doesn't overflow */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.listing-content .price {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--accent-gold);
    margin-bottom: 10px;
}

.listing-content .address {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0;
}

#listings .btn {
    background: var(--light-text);
    color: var(--primary-green);
    border-color: var(--light-text);
}

#listings .btn:hover {
    background: transparent;
    color: var(--light-text);
}

@media (max-width: 768px) {
    .listings-grid {
        grid-template-columns: 1fr;
    }
}
