/* TrueMedLife.com - Master Style Sheet
   Focus: Performance (PageSpeed 95+), SEO, and Conversion
*/

/* 1. CSS Variables - จัดการสีและค่าคงที่ที่เดียว */
:root {
    --primary: #0A58CA;      /* Medical Blue */
    --bg: #FFFFFF;           /* White */
    --text: #334155;         /* Dark Slate Gray */
    --cta: #FF6B00;          /* Vibrant Orange */
    --cta-hover: #E65C00;
    --light-bg: #F8FAFC;     /* สำหรับแยก Section */
    --border: #E2E8F0;
    --footer-bg: #1E293B;
    --max-width: 1200px;
    --transition: all 0.3s ease;
}

/* 2. Reset & Base - ลดการทำงานของเบราว์เซอร์เพื่อให้โหลดเร็ว */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    /* System Font: ไม่ต้องโหลดไฟล์เพิ่ม โหลดเร็วที่สุด */
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* 3. Typography (ขนาด Heading ที่ปรับลดลงแล้ว) */
h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem); 
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.25rem, 3vw, 1.75rem); 
    line-height: 1.3;
}

h3 {
    font-size: 1.25rem; 
    line-height: 1.4;
}

/* 4. Layout Essentials - โครงสร้างหลักแบบ Responsive */
.container {
    width: 90%;
    max-width: var(--max-width);
    margin: 0 auto;
}

header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo img {
    height: 50px;
    width: auto;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 20px;
    align-items: center;
}

nav a {
    font-weight: 500;
    font-size: 15px;
}

nav a:hover, .about-link {
    color: var(--primary);
}

/* 5. Layout Type 1: Homepage / Category Grid */
.hero {
    padding: 80px 0;
    background: var(--light-bg);
    text-align: center;
}

.hero h1 {
    color: var(--primary);
    margin-bottom: 20px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 60px 0;
}

.card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    background: #fff;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.05);
}

.card h3 {
    color: var(--primary);
    margin-bottom: 15px;
}

/* 6. Layout Type 2 & 3: Article, Blog Page & Landing Page */
.article-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.article-content h2, .article-content h3 {
    color: var(--primary);
    margin: 30px 0 15px;
}

.article-content p {
    margin-bottom: 20px;
    font-size: 18px;
}

/* Utility Class สำหรับล้างค่า Float เพื่อป้องกันเลย์เอาต์พัง */
.clearfix::after { 
    content: ""; 
    clear: both; 
    display: table; 
}

/* =========================================
   Image Layouts & Affiliate Classes (สำหรับ Landing Page)
   ========================================= */
.img-center {
    display: block; 
    margin: 30px auto; 
    max-width: 100%; 
    height: auto; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    transition: transform 0.3s;
}
.img-center:hover { 
    transform: scale(1.02); 
}

.img-float-left {
    float: left; 
    margin: 10px 25px 15px 0; 
    max-width: 45%; 
    height: auto; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    transition: transform 0.3s;
}
.img-float-left:hover { 
    transform: scale(1.03); 
}

.img-float-right {
    float: right; 
    margin: 10px 0 15px 25px; 
    max-width: 45%; 
    height: auto; 
    border-radius: 12px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); 
    transition: transform 0.3s;
}
.img-float-right:hover { 
    transform: scale(1.03); 
}

/* คลาสสำหรับเน้นข้อความที่เป็น Link Affiliate กลางบทความ */
.aff-link-text { 
    color: var(--cta); 
    font-weight: 700; 
    text-decoration: underline; 
    transition: color 0.3s; 
}
.aff-link-text:hover { 
    color: var(--cta-hover); 
}

/* 7. Buttons (CTA) */
.btn-cta {
    display: inline-block;
    background: var(--cta);
    color: #fff !important;
    padding: 15px 35px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 18px;
    text-align: center;
    border: none;
    cursor: pointer;
}

.btn-cta:hover {
    background: var(--cta-hover);
    transform: scale(1.02);
}

/* 8. Social Share Section */
.social-share {
    padding: 40px 0;
    text-align: center;
    border-top: 1px solid var(--border);
}

.share-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.share-btn {
    padding: 8px 15px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    border: 1px solid var(--border);
}

/* 9. Footer & Compliance (E-E-A-T) */
footer {
    background: var(--footer-bg);
    color: #fff;
    padding: 50px 0 20px;
    font-size: 14px;
}

.disclaimer {
    opacity: 0.8;
    margin-bottom: 30px;
    line-height: 1.8;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 10. Mobile Responsive Optimization */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    nav ul {
        gap: 10px;
        font-size: 13px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding: 50px 20px;
    }
    
    /* บังคับรูปภาพที่จัดซ้าย/ขวา ให้กลับมาอยู่ตรงกลางเมื่อเปิดบนมือถือ */
    .img-float-left, 
    .img-float-right { 
        float: none; 
        margin: 20px auto; 
        max-width: 100%; 
        display: block; 
    }
}

/* 11. SEO & Performance Helper Classes */
.screen-reader-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}