/**
 * Simple CSS - เรียบง่าย เน้นมือถือ
 */

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

/* Screen Reader Text - สำหรับ accessibility */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: 'IBM Plex Sans Thai', -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

a { color: #D35400; text-decoration: none; } /* เปลี่ยนจาก #FF6600 เพื่อ contrast ratio > 4.5:1 */
a:hover { color: #B34700; text-decoration: underline; }

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

/* Header logo fix */
.site-header img {
    height: 45px;
    width: auto;
    max-width: 150px;
}

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

/* Header */
.site-header {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 12px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.site-logo { display: flex; align-items: center; }
.site-logo .custom-logo-link { display: inline-flex; }

/* Logo sizing - specific */
.site-header .site-logo img,
.site-header .custom-logo-link img,
.site-header .custom-logo {
    height: 45px !important;
    width: auto !important;
    max-width: 150px !important;
    object-fit: contain;
}

.site-tagline { font-size: 16px; color: #555; font-weight: 500; }

.site-tagline-mobile {
    display: none;
    font-size: 14px;
    color: #555;
    font-weight: 500;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
}

/* Nav */
.nav-menu {
    display: flex;
    list-style: none;
    gap: 8px;
}

.nav-menu a {
    display: block;
    padding: 8px 12px;
    color: #333;
    border-radius: 6px;
}

.nav-menu a:hover { background: #f5f5f5; color: #FF6600; }

/* Breadcrumb */
.breadcrumb {
    padding: 16px 0;
    font-size: 14px;
    color: #666;
}

.breadcrumb a { color: #666; }
.breadcrumb a:hover { color: #FF6600; }
.breadcrumb .sep { margin: 0 8px; color: #ccc; }
.breadcrumb .current { color: #333; }

/* Single Article */
.single-article {
    background: #fff;
    padding: 20px 0;
}

.article-header { margin-bottom: 20px; }

.article-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 12px;
    color: #222;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 14px;
    color: #666;
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-meta svg { color: #999; }

.article-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.article-image img { width: 100%; display: block; }

.article-content {
    font-size: 16px;
    line-height: 1.8;
}

.article-content p { margin-bottom: 16px; }
.article-content h2, .article-content h3 { margin: 24px 0 12px; }
.article-content ul, .article-content ol { margin: 16px 0; padding-left: 24px; }
.article-content li { margin-bottom: 8px; }
.article-content img { border-radius: 8px; margin: 16px 0; }

/* Share Box */
.share-box {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px;
    margin: 24px 0;
    background: #f5f5f5;
    border-radius: 8px;
}

.share-label { font-weight: 500; color: #666; }

.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    color: #fff;
}

.share-fb { background: #1877f2; }
.share-line { background: #00b900; }
.share-copy { background: #666; }
.share-btn:hover { opacity: 0.9; color: #fff; }

/* Tags */
.article-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.tags-label { color: #666; font-size: 14px; }

.tag {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f0f0;
    color: #333;
    font-size: 13px;
    border-radius: 20px;
}

.tag:hover { background: #FF6600; color: #fff; }

/* Related Section */
.related-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-left: 12px;
    border-left: 4px solid #FF6600;
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.post-card {
    display: block;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.post-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-image {
    aspect-ratio: 16/9;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.card-content { padding: 12px; }

.card-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    line-height: 1.4;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-date {
    font-size: 12px;
    color: #999;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #FF6600 0%, #C850C0 100%);
    padding: 40px 0;
    text-align: center;
    color: #fff;
}

.hero-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.hero-subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 20px;
}

/* Search Box Hero */
.hero-search {
    max-width: 500px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
}

.hero-search form {
    display: flex;
    gap: 8px;
}

.hero-search input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    font-size: 16px;
    border-radius: 6px;
    background: #f5f5f5;
}

.hero-search button {
    padding: 12px 20px;
    background: #FF6600;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

/* Homepage Sections */
.home-section {
    padding: 30px 0;
}

.home-section:nth-child(even) {
    background: #f9f9f9;
}

/* Footer */
.site-footer {
    background: #222;
    color: #fff;
    padding: 30px 0 20px;
    margin-top: 40px;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 16px;
    text-align: center;
}

.footer-logo { margin-bottom: 12px; }
.footer-logo a { display: inline-block; }
.footer-logo img { height: 50px; width: auto; max-width: 200px; }
.footer-logo .custom-logo-link { display: inline-block; }
.footer-logo .custom-logo { height: 50px; width: auto; }

.footer-text {
    font-size: 14px;
    color: #aaa;
    margin-bottom: 16px;
}

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

.footer-links a { color: #aaa; font-size: 14px; }
.footer-links a:hover { color: #fff; }

.footer-copyright {
    font-size: 12px;
    color: #666;
    padding-top: 16px;
    border-top: 1px solid #333;
}

/* Category Grid */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 12px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    text-align: center;
    color: #333;
    transition: all 0.2s;
}

.category-card:hover {
    border-color: #FF6600;
    box-shadow: 0 4px 12px rgba(255,102,0,0.15);
}

.category-card svg { color: #FF6600; margin-bottom: 8px; }
.category-card .cat-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.category-card .cat-count { font-size: 12px; color: #999; }

/* Button More */
.btn-more {
    display: inline-block;
    padding: 12px 24px;
    background: #FF6600;
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
}
.btn-more:hover { background: #e55a00; color: #fff; }

/* Pagination */
.pagination {
    margin-top: 30px;
    text-align: center;
}

.pagination .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #333;
    font-size: 14px;
}

.pagination a:hover {
    background: #FF6600;
    border-color: #FF6600;
    color: #fff;
}

.pagination .current {
    background: #FF6600;
    border-color: #FF6600;
    color: #fff;
}

.pagination .dots {
    background: transparent;
    border: none;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 999;
    padding: 60px 20px 20px;
}

.mobile-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-menu li { border-bottom: 1px solid #eee; }

.mobile-menu a {
    display: block;
    padding: 16px 0;
    font-size: 18px;
    color: #333;
}

.mobile-menu a:hover { color: #FF6600; }

.menu-open .mobile-menu { display: block; }
.menu-open .mobile-menu-toggle svg line:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.menu-open .mobile-menu-toggle svg line:nth-child(2) { opacity: 0; }
.menu-open .mobile-menu-toggle svg line:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== MOBILE FIRST ===== */
@media (max-width: 768px) {
    .site-tagline { display: none; }
    .site-tagline-mobile { display: block; }

    .site-branding {
        flex: 1;
    }

    .main-navigation { display: none; }
    .mobile-menu-toggle { display: block; }

    .article-title { font-size: 20px; }

    .posts-grid { grid-template-columns: 1fr; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }

    .hero-search form { flex-direction: column; }
    .hero-search input,
    .hero-search button { width: 100%; }

    .share-box { justify-content: center; }

    .site-header .site-logo img,
    .site-header .custom-logo { height: 40px !important; }
}

@media (min-width: 769px) {
    .article-title { font-size: 28px; }
    .posts-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .category-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
    .hero-title { font-size: 32px; }
}

/* ===== PC / Desktop ===== */
@media (min-width: 1024px) {
    body { font-size: 17px; }

    .container { max-width: 1400px; padding: 0 30px; }
    .header-container { max-width: 1400px; padding: 0 30px; }

    /* Header ใหญ่ขึ้น */
    .site-header { padding: 16px 0; }
    .site-tagline { font-size: 18px; }
    .nav-menu a { padding: 10px 16px; font-size: 16px; }

    /* Logo ใหญ่ขึ้น */
    .site-header .site-logo img,
    .site-header .custom-logo-link img,
    .site-header .custom-logo,
    .header-logo-img {
        height: 60px !important;
        max-width: 200px !important;
    }

    /* Hero ใหญ่ขึ้น */
    .hero-section { padding: 60px 0; }
    .hero-title { font-size: 42px; }
    .hero-subtitle { font-size: 20px; }
    .hero-search { max-width: 600px; padding: 10px; }
    .hero-search input { padding: 16px 20px; font-size: 18px; }
    .hero-search button { padding: 16px 28px; font-size: 18px; }

    /* Section ใหญ่ขึ้น */
    .home-section { padding: 50px 0; }
    .section-title { font-size: 26px; margin-bottom: 28px; }

    /* Cards - 4 คอลัมน์บน PC (การ์ดใหญ่ อ่านง่าย) */
    .posts-grid { grid-template-columns: repeat(4, 1fr); gap: 24px; }
    .card-content { padding: 16px; }
    .card-title { font-size: 16px; margin-bottom: 10px; line-height: 1.5; }
    .card-date { font-size: 14px; }

    /* Category Grid */
    .category-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
    .category-card { padding: 28px 16px; }
    .category-card .cat-name { font-size: 16px; }
    .category-card .cat-count { font-size: 13px; }

    /* Article */
    .article-title { font-size: 34px; }
    .article-content { font-size: 18px; line-height: 1.9; }
    .article-meta { font-size: 15px; gap: 20px; }

    /* Footer */
    .footer-content { max-width: 800px; }
    .footer-text { font-size: 16px; }
    .footer-links a { font-size: 15px; }
}
/* Logo Fixes */
.header-logo-img {
    height: 50px !important;
    width: auto !important;
    max-width: 200px !important;
    object-fit: contain !important;
    border-radius: 8px;
}

.footer-logo-img {
    height: 60px !important;
    width: auto !important;
    max-width: 200px !important;
    object-fit: contain !important;
    border-radius: 8px;
}

.footer-social {
    margin: 16px 0;
}

.footer-social .social-link {
    display: inline-block;
    margin: 0 8px;
    transition: transform 0.2s ease;
}

.footer-social .social-link:hover {
    transform: scale(1.1);
}

/* Mobile Logo */
@media (max-width: 768px) {
    .header-logo-img {
        height: 40px !important;
    }
    .footer-logo-img {
        height: 50px !important;
    }
}
