body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f4f1ea; /* สีครีมอ่อนๆ */
    margin: 0;
    color: #333;
    line-height: 1.6;
}

/* --- Global Layout --- */
.container {
    max-width: 1000px;
    margin: 30px auto;
    padding: 0 20px;
}

h2 {
    text-align: center;
    color: #5d4037;
    border-bottom: 2px solid #d4af37;
    display: block;
    width: fit-content;
    margin: 20px auto 40px auto;
    padding-bottom: 10px;
}

/* --- Header & Navigation --- */
header {
    background-color: #3e2723; /* สีน้ำตาลเข้ม */
    color: #d4af37; /* สีทอง */
    padding: 40px 20px 20px 20px;
    text-align: center;
}

header h1 { margin: 0; font-size: 2.5em; }

.navigation {
    margin-top: 15px;
}

.nav-link {
    color: #d4af37;
    text-decoration: none;
    font-weight: 500;
    margin: 0 10px;
    padding: 5px 10px;
    transition: color 0.3s;
}

.nav-link:hover {
    color: white;
}

/* --- Portfolio Grid (ผลงานซ่อม) --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
}

.card h3 { margin-top: 0; color: #3e2723; text-align: center; }

.compare-box {
    display: grid;
    grid-template-columns: 1fr 1fr; /* แบ่งครึ่งซ้ายขวา */
    gap: 10px;
    margin-top: 15px;
}

.img-box {
    position: relative;
    overflow: hidden;
    min-height: 150px; /* สำหรับ Placeholder */
}

/* สไตล์สำหรับรูปภาพให้สูงเท่ากันและสามารถคลิกได้ (ใช้ร่วมกับ Modal) */
.img-box img {
    width: 100%;
    height: 250px; /* ความสูงคงที่ */
    object-fit: cover; 
    cursor: pointer; 
    transition: opacity 0.3s;
}

/* สไตล์สำหรับ Placeholder ใน Portfolio */
.image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    font-weight: bold;
    border-radius: 5px;
    box-sizing: border-box;
    line-height: 1.3;
}
.before-placeholder {
    background-color: #fce4e4; 
    color: #d32f2f;
    border: 1px dashed #d32f2f;
}
.after-placeholder {
    background-color: #e8f5e9; 
    color: #388e3c;
    border: 1px dashed #388e3c;
}


.badge {
    position: absolute;
    top: 5px;
    left: 5px;
    padding: 3px 8px;
    color: white;
    font-size: 0.75em;
    border-radius: 3px;
    font-weight: bold;
    z-index: 10;
}

.badge.before { background-color: #d32f2f; } 
.badge.after { background-color: #388e3c; }  

.desc { margin-top: 15px; font-size: 0.9em; color: #555; }

/* --- Sale Grid (พระสำหรับบูชา) --- */
.sale-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.sale-card {
    background: white;
    border: 2px solid #d4af37;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    text-align: center;
}

.sale-card img {
    width: 100%;
    height: 250px; /* ความสูงคงที่ */
    object-fit: cover;
    border-bottom: 2px solid #d4af37;
}

.sale-info {
    padding: 15px;
}

.sale-card h3 {
    color: #3e2723;
    margin-top: 0;
    margin-bottom: 5px;
}

.sale-card p.detail {
    font-size: 0.9em;
    color: #555;
    height: 40px;
    overflow: hidden;
    margin-bottom: 10px;
}

.price-tag {
    font-size: 1.5em;
    font-weight: bold;
    color: #b71c1c; 
    margin: 10px 0;
    display: block;
}

.status-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    margin-top: 10px;
}

.available { background-color: #4CAF50; color: white; }
.sold { background-color: #f44336; color: white; }

.contact-btn {
    display: block;
    background-color: #d4af37;
    color: #3e2723;
    padding: 10px;
    text-decoration: none;
    border-radius: 5px;
    margin-top: 15px;
    font-weight: bold;
}
.contact-btn:hover {
    background-color: #c09a26;
}

/* --- Blog List Styles (Index Page Card) --- */
.blog-latest-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 20px;
    margin-top: 20px;
}
.blog-card-item {
    display: block; 
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.blog-img-box {
    width: 100%;
    height: 150px; 
    overflow: hidden;
}
.blog-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* **NEW: Placeholder Style for Blog Card** */
.blog-no-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
    color: #a0a0a0;
    font-weight: bold;
    text-align: center;
    line-height: 1.3;
}
.blog-text-content {
    padding: 15px;
    text-align: left;
}
.blog-text-content a {
    font-size: 1.1em;
    color: #3e2723;
    text-decoration: none;
    font-weight: 600;
    display: block;
    margin-bottom: 5px;
}
.blog-text-content a:hover {
    color: #d4af37;
}
.blog-text-content span {
    font-size: 0.8em;
    color: #999;
    display: block;
}


/* --- Modal (Popup) Styles --- */
.modal {
    display: none; /* **สำคัญ: ต้องเป็น none เพื่อซ่อนตอนโหลดหน้า** */
    position: fixed; 
    z-index: 9999; 
    padding-top: 0; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgb(0,0,0); 
    background-color: rgba(0,0,0,0.9); 
    display: flex; 
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.modal-content {
    margin: 0; 
    display: block;
    width: 90%;
    max-width: 800px;
    max-height: 95vh; 
    height: auto;
    object-fit: contain; 
}
#caption {
    margin: 10px auto; 
    display: block;
    width: 90%;
    max-width: 800px;
    text-align: center;
    color: #ccc;
    padding: 10px 0;
    height: auto;
}
.close { 
    position: absolute; top: 15px; right: 35px; color: #f1f1f1; 
    font-size: 40px; font-weight: bold; transition: 0.3s; cursor: pointer; 
    z-index: 10000; 
}
.close:hover, .close:focus { color: #bbb; text-decoration: none; }
@keyframes zoom { from {transform:scale(0)} to {transform:scale(1)} }
.modal-content, #caption { animation-name: zoom; animation-duration: 0.6s; }


/* --- Footer Styles (Final Version) --- */
footer {
    background-color: #242930; 
    color: #f4f1ea; 
    padding: 30px 20px 10px 20px;
    font-family: 'Sarabun', sans-serif;
    margin-top: 50px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 50px; 
    padding-bottom: 30px;
}

.footer-col {
    flex: 1; 
    min-width: 250px; 
}

/* Col 1: About */
.footer-col.about {
    flex: 1.5; 
}

.footer-logo {
    margin-bottom: 20px;
}

.logo-text {
    font-size: 1.5em;
    font-weight: 700;
    color: #ffd700; 
}

.description {
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 20px;
    opacity: 0.9;
}

.footer-links a {
    color: #f4f1ea;
    text-decoration: none;
    font-size: 0.9em;
    padding-right: 15px; 
    border-right: 1px solid rgba(255, 255, 255, 0.5); 
    margin-right: 15px;
}
.footer-links a:last-child {
    border-right: none;
    margin-right: 0;
}
.footer-links a:hover {
    color: #ffd700;
}

/* Col 2 & 3: Contact & Follow Us */
.footer-col h3 {
    font-size: 1.1em;
    color: white;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 25px; 
}

.contact-item {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.contact-item .icon {
    font-size: 1em;
    margin-right: 15px;
    color: #ffd700; 
    width: 20px; 
    text-align: center;
}

.contact-item a, .contact-item span {
    color: #f4f1ea;
    text-decoration: none;
    font-size: 0.95em;
    opacity: 0.9;
}
.contact-item a:hover {
    color: #ffd700;
}

/* Col 3: Social Icons */
.social-icons {
    margin-top: 15px;
    display: flex;
    gap: 10px; 
}

.social-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 35px;
    height: 35px;
    border-radius: 50%; 
    background-color: rgba(255, 255, 255, 0.1); 
    color: #f4f1ea;
    text-decoration: none;
    font-weight: bold;
    font-size: 1em; 
    transition: background-color 0.3s, color 0.3s;
}

.social-icon:hover {
    background-color: #ffd700; 
    color: #242930;
}


/* Copyright and Divider */
.footer-divider {
    border: 0;
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15); 
    margin: 20px auto;
    max-width: 1200px;
}

.copyright-bar {
    text-align: left; 
    font-size: 0.85em;
    padding: 10px 0;
    max-width: 1200px;
    margin: 0 auto;
    opacity: 0.7;
}

/* --- Responsive Layout --- */
@media (max-width: 850px) {
    /* Footer */
    .footer-container {
        flex-direction: column; 
        align-items: flex-start; 
        gap: 30px;
    }
    
    .footer-col {
        min-width: 100%; 
        text-align: left;
    }
    
    .contact-item {
        justify-content: flex-start; 
    }

    .footer-col h3 {
        text-align: left;
    }
    
    .social-icons {
        justify-content: flex-start; 
    }
    
    /* Portfolio */
    .compare-box {
        grid-template-columns: 1fr; /* รูป Before/After เรียงซ้อนกันบนมือถือ */
    }

    /* Blog Cards (Responsive) */
    .blog-latest-container {
        grid-template-columns: 1fr;
    }
}

/* --- ส่วนเพิ่มเติมต่อจากของเดิม --- */

/* 1. บังคับสี Link ใน Footer ให้เป็นสีขาว/ครีม */
footer a, 
.footer-container a, 
.contact-item a, 
.footer-links a {
    color: #f4f1ea !important;
    text-decoration: none !important;
    opacity: 0.9;
    transition: 0.3s;
}

footer a:hover {
    color: #ffd700 !important;
    opacity: 1;
}

/* 2. ปรับปรุง Social Icons ให้สวยงาม */
.social-icons {
    display: flex;
    gap: 12px;
    margin-top: 15px;
}

.social-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 38px;
    height: 38px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50% !important; /* บังคับให้กลม */
    font-size: 1.2em;
    transition: 0.3s;
}

/* ==================================================== */
/* === ปรับปรุง RESPONSIVE สำหรับมือถือ (หน้าจอ < 768px) === */
/* ==================================================== */
@media (max-width: 768px) {
    header {
        padding: 20px 10px;
    }

    header h1 {
        font-size: 1.8em; /* ย่อขนาดชื่อร้าน */
    }

    /* ปรับเมนู Navigation ให้เรียงเป็น 2 คอลัมน์ หรือเรียงเดี่ยวเพื่อให้กดง่าย */
    .navigation {
        display: grid;
        grid-template-columns: 1fr 1fr; /* แบ่ง 2 ฝั่ง */
        gap: 8px;
        padding: 10px;
    }

    .nav-link {
        margin: 0;
        padding: 8px 5px;
        background: rgba(255, 255, 255, 0.05);
        border-radius: 4px;
        font-size: 0.85em; /* ย่อขนาดตัวอักษรเมนู */
        border: 1px solid rgba(212, 175, 55, 0.3);
    }

    /* เกี่ยวกับเรา: ปรับการ์ดให้รูปอยู่บน ข้อความอยู่ล่าง */
    .about-us {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }

    /* Footer: ปรับให้เรียงต่อกันเป็นแนวตั้ง */
    .footer-container {
        flex-direction: column;
        gap: 30px;
        text-align: center;
    }

    .contact-item {
        justify-content: center; /* จัดกลางไอคอนติดต่อในมือถือ */
    }

    .social-icons {
        justify-content: center;
    }
}