/*
Theme Name: HuayNews
Description: ธีมเว็บข่าวหวยโทนเขียว-ขาว การ์ดข่าวพร้อมภาพปก หน้าแรกแบบข่าวเด่น รองรับมือถือ ใช้คู่กับปลั๊กอิน HuayNews Tools และ NameKingSeo ได้
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Author: HuayNews
License: GPL-2.0-or-later
Text Domain: huaynews
*/
:root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f4f5f7;
    --line: #e4e6eb;
    --text: #16181d;
    --muted: #667085;
    --accent: #00a651;
    --accent-dark: #007a3d;
    --accent-soft: #e6f6ed;
    --gutter: clamp(16px, 4vw, 40px);
    --width: 1200px;
    --radius: 10px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Prompt", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; }
.muted { color: var(--muted); }
code { background: var(--surface-2); padding: 2px 8px; border-radius: 4px; font-size: .9em; }

/* ---------- nav ---------- */
.nav { position: sticky; top: 0; z-index: 50; background: var(--accent); transition: box-shadow .2s; }
.nav.solid { box-shadow: 0 4px 18px rgba(16, 24, 40, .08); }
.nav-inner { display: flex; align-items: center; gap: 26px; height: 64px; max-width: var(--width); margin: 0 auto; padding: 0 var(--gutter); }
.logo { font-size: 24px; font-weight: 700; color: #fff; white-space: nowrap; }
.logo-img { display: flex; align-items: center; }
.logo-img img { height: 36px; width: auto; max-width: 200px; object-fit: contain; }
.nav-links { display: flex; gap: 20px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: rgba(255, 255, 255, .88); font-size: 15px; padding: 6px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav-links a:hover, .nav-links a.active { color: #fff; border-color: #fff; }
.search {
    display: flex; align-items: center; gap: 8px; padding: 0 14px; height: 40px; width: min(240px, 34vw);
    border: 1px solid transparent; border-radius: 999px; background: #fff; color: var(--muted);
}
.search:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, .35); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; font-size: 14px; }
.nav-toggle { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; margin: 5px 0; background: #fff; border-radius: 2px; }

main { min-height: 70vh; }

/* ---------- buttons / chips ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 8px 22px; border: 1px solid transparent; border-radius: 999px;
    font: inherit; font-weight: 500; font-size: 15px; cursor: pointer; transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
nav.chips { margin-bottom: 20px; }
.chip { padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: #344054; font-size: 14px; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- page ---------- */
.page { max-width: var(--width); margin: 0 auto; padding: 26px var(--gutter) 40px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: clamp(24px, 3vw, 34px); }
.home-title { font-size: clamp(22px, 2.6vw, 30px); margin-bottom: 18px; padding-left: 12px; border-left: 5px solid var(--accent); }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 20px; }
.filters input[type=search] {
    flex: 1; min-width: min(280px, 100%); height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 999px;
    background: #fff; color: var(--text); font: inherit; font-size: 15px;
}
.filters input[type=search]:focus { outline: 0; border-color: var(--accent); }
.empty-note { padding: 60px 0; text-align: center; color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 32px; }
.pager a, .pager span {
    min-width: 40px; height: 40px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 14px;
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .disabled { opacity: .4; }

.empty { padding: 90px 0; text-align: center; }
.empty h1 { font-size: clamp(40px, 8vw, 80px); color: var(--accent); }
.empty h2 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 10px; }
.empty .btn { margin-top: 18px; }

/* ---------- news cards ---------- */
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.row-head h2 { position: relative; font-size: clamp(19px, 2vw, 24px); }
.row-head h2::after { content: ""; position: absolute; left: 0; bottom: -10px; width: 100%; height: 2px; background: var(--accent); }
.row-more { color: var(--muted); font-size: 14px; white-space: nowrap; }
.row-more:hover { color: var(--accent); }
.section-title { font-size: clamp(19px, 2vw, 24px); margin-bottom: 16px; padding-left: 12px; border-left: 5px solid var(--accent); }
.home-section { margin-top: 36px; }

.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.post-card {
    display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    background: #fff; transition: box-shadow .2s, border-color .2s;
}
.post-card:hover { border-color: #cfd4dc; box-shadow: 0 10px 26px rgba(16, 24, 40, .1); }
.post-card:hover b { color: var(--accent); }
.post-cover { display: block; aspect-ratio: 16 / 9; background: linear-gradient(140deg, #f4f5f7, #e9ebf0); overflow: hidden; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; }
.post-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.post-body b { font-weight: 600; font-size: 17px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-cat { align-self: flex-start; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 500; }
.post-excerpt { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.post-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: auto; padding-top: 4px; color: var(--muted); font-size: 12px; }

.lead-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; }
.post-card-lead .post-body { padding: 18px 20px 20px; }
.post-card-lead .post-body b { font-size: clamp(20px, 2.3vw, 28px); line-height: 1.35; }
.post-card-lead .post-excerpt { font-size: 15px; -webkit-line-clamp: 3; }
.lead-side { display: grid; gap: 12px; align-content: start; }
.post-card-row { flex-direction: row; }
.post-card-row .post-cover { flex: 0 0 38%; aspect-ratio: 4 / 3; }
.post-card-row .post-body { padding: 10px 14px; gap: 4px; }
.post-card-row .post-body b { font-size: 15px; }
.post-card-row .post-excerpt { display: none; }

/* ---------- article ---------- */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 18px; color: var(--muted); font-size: 13px; }
.crumbs a:hover { color: var(--accent); }
.crumbs i { font-style: normal; opacity: .6; }
.crumbs span { color: #344054; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.post { max-width: 860px; }
.post-head h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.3; margin-top: 8px; }
.post-head p { margin: 10px 0 20px; font-size: 14px; }
.post-hero { margin: 0 0 22px; }
.post-hero img { width: 100%; border-radius: var(--radius); }
.post-hero figcaption { margin-top: 6px; color: var(--muted); font-size: 12px; text-align: right; }
.post-lead { font-size: 1.12em; font-weight: 500; margin: 0 0 18px; }
.post-lead a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.post-tags { margin-top: 26px; }
.source-box {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin: 26px 0 0; padding: 16px 18px; border: 1px solid var(--line); border-left: 5px solid var(--accent);
    border-radius: var(--radius); background: var(--surface-2);
}

/* ---------- editor content ---------- */
.seo-box { margin: 40px 0 10px; padding: clamp(18px, 3vw, 32px); border: 1px solid var(--line); border-top: 4px solid var(--accent); border-radius: var(--radius); background: #fff; }
.prose { line-height: 1.85; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose h1 { font-size: clamp(24px, 2.6vw, 32px); margin: 0 0 14px; }
.prose h2 { font-size: clamp(20px, 2.1vw, 26px); margin: 26px 0 10px; }
.prose h3 { font-size: clamp(17px, 1.7vw, 21px); margin: 22px 0 8px; }
.prose h4 { font-size: 16px; margin: 18px 0 6px; }
.prose p { margin: 0 0 14px; }
.prose a { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent); }
.prose ul, .prose ol { margin: 0 0 14px; padding-left: 26px; }
.prose li { margin: 4px 0; }
.prose blockquote { margin: 16px 0; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--muted); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; }
.prose mark { background: #fde047; color: #111; padding: 0 3px; border-radius: 3px; }
.prose .color { color: var(--color); }
.prose .lead { font-size: 1.15em; }
.prose small { font-size: .85em; color: var(--muted); }
.prose pre { padding: 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; margin: 16px 0; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); }
.prose details { margin: 12px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; }
.prose summary { cursor: pointer; font-weight: 500; }
.prose .grid-layout { display: grid; gap: 18px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }

/* ---------- banners ---------- */
.bn {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px;
    margin: 28px 0; padding: 26px 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.bn-label { position: absolute; top: 7px; left: 14px; font-size: 10px; letter-spacing: .14em; color: var(--muted); }
.bn-item { display: block; max-width: min(970px, 100%); border-radius: 8px; overflow: hidden; }
.bn-item img { width: 100%; height: auto; }

/* ---------- footer ---------- */
.footer { margin-top: 30px; border-top: 1px solid var(--line); background: var(--surface-2); font-size: 14px; color: #475467; }
.footer-inner { max-width: var(--width); margin: 0 auto; padding: 30px var(--gutter) 36px; }
.footer p { margin: 6px 0; max-width: 820px; }
.footer-brand { font-weight: 700; font-size: 20px; color: var(--accent); margin-bottom: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 14px; }
.footer-links a:hover { color: var(--accent); }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
    .nav-inner { gap: 12px; height: 58px; }
    .logo { font-size: 20px; flex: 1; overflow: hidden; text-overflow: ellipsis; }
    .nav-toggle { display: block; order: 3; }
    .search { width: 38vw; }
    .nav-links {
        display: none; position: absolute; top: 58px; left: 0; right: 0; flex-direction: column; gap: 0;
        padding: 4px var(--gutter) 12px; background: var(--accent-dark); box-shadow: 0 12px 24px rgba(16, 24, 40, .08);
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, .18); }
    .lead-grid { grid-template-columns: 1fr; }
    .prose .grid-layout { grid-template-columns: 1fr; }
    .source-box .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- WordPress ---------- */
.custom-logo-link { display: flex; align-items: center; }
.custom-logo { height: 36px; width: auto; max-width: 200px; object-fit: contain; }
.post-hero img { height: auto; }
.term-intro { margin-bottom: 20px; color: var(--muted); }
.pager .dots { border: 0; background: none; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.prose .aligncenter { display: block; margin-left: auto; margin-right: auto; text-align: center; }
.prose .alignleft { float: left; margin: 4px 18px 10px 0; }
.prose .alignright { float: right; margin: 4px 0 10px 18px; }
.prose figure { margin: 18px 0; max-width: 100%; }
.prose figcaption, .prose .wp-caption-text { margin-top: 6px; color: var(--muted); font-size: 13px; text-align: center; }
.prose strong { font-weight: 600; }
.prose::after { content: ""; display: table; clear: both; }
.admin-bar .nav { top: 32px; }
@media (max-width: 782px) { .admin-bar .nav { top: 46px; } }
@media (max-width: 600px) { .admin-bar .nav { top: 0; } }
.comment-respond, .comments-area { margin-top: 20px; }
.comment-form textarea, .comment-form input[type=text], .comment-form input[type=email], .comment-form input[type=url] {
    width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.comment-form .submit { min-height: 44px; padding: 8px 22px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; cursor: pointer; }
