/*
Theme Name: KonKhao (คนข่าว)
Author: KonKhao
Description: ธีมเว็บไซต์ข่าวสำหรับ KonKhao (คนข่าว) หน้าแรกสไตล์สำนักข่าว ทันข่าวเด่น แถบสถานการณ์พิเศษ ข่าวล่าสุดแบบโหลดเพิ่ม ข่าวยอดนิยม และบล็อกข่าวตามหมวด รองรับมือถือ
Version: 1.0.0
Requires at least: 6.3
Tested up to: 6.8
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: konkhao
*/

/* ==========================================================
   1. Tokens
   ========================================================== */
:root {
	--red: #b80000;
	--red-dk: #8f0000;
	--ink: #1f1f1f;
	--muted: #6a6a6a;
	--line: #e3e1df;
	--bg: #f3f2f1;
	--paper: #fff;
	--f-head: 'Prompt', 'Noto Sans Thai', system-ui, sans-serif;
	--f-body: 'Noto Sans Thai', 'Sarabun', system-ui, sans-serif;
	--wrap: 1240px;
	--mast-h: 64px;
}

/* ==========================================================
   2. Base
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.7 var(--f-body); -webkit-font-smoothing: antialiased; }
img, video, iframe { max-width: 100%; }
img { height: auto; display: block; }
a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dk); }
ul, ol { padding-left: 1.2em; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.4; }
:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
button { font: inherit; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 999; background: #fff; color: var(--red); padding: 10px 16px; font-weight: 700; }
.skip:focus { top: 12px; }

/* ==========================================================
   3. Header
   ========================================================== */
.topbar { background: #fff; border-bottom: 1px solid var(--line); font-size: .8125rem; color: var(--muted); }
.topbar__in { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 34px; }
.topbar .menu { display: flex; gap: 18px; list-style: none; margin: 0; padding: 0; }
.topbar .menu a { color: var(--muted); }
.topbar .menu a:hover { color: var(--red); }

.masthead { background: var(--red); color: #fff; }
.masthead__in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 84px; }
.logo, .custom-logo-link { display: inline-flex; margin-right: auto; }
.logo img, .custom-logo { height: 56px; width: auto; max-width: none; }
.menu-toggle { display: none; }

.icon-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; border: 0; color: #fff; cursor: pointer; padding: 10px; border-radius: 2px; font: 500 .95rem var(--f-head); }
.icon-btn:hover { background: rgba(255, 255, 255, .14); }
.burger, .burger::before, .burger::after { display: block; width: 22px; height: 2.5px; background: currentColor; position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -7px; }
.burger::after { top: 7px; }

.search-panel { background: var(--red-dk); padding: 14px 0; }
.search-panel[hidden] { display: none; }
.searchform { display: flex; gap: 8px; max-width: 720px; }
.searchform input[type="search"] { flex: 1; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 2px; font: inherit; }
.search-panel .btn { background: #fff; color: var(--red); }

.mainnav { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.admin-bar .mainnav { top: 32px; }
.mainnav .menu { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav .menu::-webkit-scrollbar { display: none; }
.mainnav .menu a { display: block; padding: 14px 16px 11px; font: 600 .95rem/1.4 var(--f-head); color: var(--ink); white-space: nowrap; border-bottom: 3px solid transparent; }
.mainnav .menu a:hover,
.mainnav .menu .current-menu-item > a,
.mainnav .menu .current-cat > a,
.mainnav .menu .current-menu-item { color: var(--red); border-bottom-color: var(--red); }
.mainnav .menu .current-menu-item > a { border-bottom-color: var(--red); }

.ticker { background: var(--bg); border-bottom: 1px solid var(--line); }
.ticker__in { display: flex; align-items: center; gap: 14px; min-height: 42px; }
.ticker__label { flex: none; background: var(--red); color: #fff; font: 600 .8rem/1.6 var(--f-head); padding: 0 10px; border-radius: 2px; }
.ticker__list { flex: 1; min-width: 0; list-style: none; margin: 0; padding: 0; font-size: .9375rem; }
.ticker__list li { display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker__list li:first-child { display: block; }
.ticker__list.is-js li { display: none; }
.ticker__list.is-js li.is-active { display: block; animation: tick-in .35s ease; }
.ticker__list a { color: var(--ink); }
.ticker__list a:hover { color: var(--red); }
@keyframes tick-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================
   4. Section headings (the K-notch mark echoes the logo)
   ========================================================== */
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sec-title { display: flex; align-items: center; gap: 10px; margin: 0; font: 700 1.375rem/1.4 var(--f-head); }
.sec-title::before { content: ""; flex: none; width: .78em; height: .78em; background: var(--red); clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 0 62%, 24% 62%, 24% 40%, 0 40%); }
.widget > .sec-title { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.sec-more { font: 500 .9rem var(--f-head); white-space: nowrap; }

/* ==========================================================
   5. Story cards
   ========================================================== */
.card { position: relative; min-width: 0; }
.card__media { display: block; aspect-ratio: 16 / 9; background: var(--bg); overflow: hidden; border-radius: 2px; }
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.ph { display: grid; place-items: center; width: 100%; height: 100%; background: var(--red); color: rgba(255, 255, 255, .85); }
.card__title { margin: 10px 0 6px; font: 600 1.0625rem/1.5 var(--f-head); }
.card__title a { color: var(--ink); }
.card__title a:hover { color: var(--red); }
.card__meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: .8125rem; color: var(--muted); }
.card__cat { color: var(--red); font-weight: 500; }
.card__excerpt { display: none; }

/* lead: headline over image */
.card--lead .card__body { position: absolute; left: 0; right: 0; bottom: 0; padding: 72px 24px 22px; color: #fff; background: linear-gradient(to top, rgba(0, 0, 0, .86), rgba(0, 0, 0, 0)); border-radius: 0 0 2px 2px; }
.card--lead .card__title { margin: 0 0 8px; font-size: clamp(1.35rem, 2.6vw, 2.125rem); line-height: 1.4; }
.card--lead .card__title a { color: #fff; }
.card--lead .card__meta { color: rgba(255, 255, 255, .88); }
.card--lead .card__cat { background: var(--red); color: #fff; padding: 0 8px; border-radius: 2px; }

/* grid card */
.card--card .card__title { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* thumbnail beside text */
.card--row, .card--side { display: grid; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.card--row { grid-template-columns: 220px minmax(0, 1fr); }
.card--side { grid-template-columns: 128px minmax(0, 1fr); gap: 14px; padding: 14px 0; }
.card--row .card__media, .card--side .card__media { aspect-ratio: 3 / 2; }
.card--row .card__title { margin-top: 0; font-size: 1.2rem; }
.card--side .card__title { margin: 0 0 4px; font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.list > .card--row:first-child, .hero__side > .card--side:first-child, .special__list > .card--side:first-child { padding-top: 0; }

/* text only */
.card--text { padding: 10px 0; border-top: 1px solid var(--line); }
.card--text .card__title { margin: 0 0 2px; font-size: 1rem; }

/* ==========================================================
   6. Home
   ========================================================== */
.hero-sec { padding-top: 24px; }
.hero-sec__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; margin-bottom: 16px; }
.trending { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; font: 500 .9rem var(--f-head); }
.trending a { color: var(--ink); }
.trending a:hover { color: var(--red); }
.hero { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; margin-top: 32px; }

.special { background: var(--red); color: #fff; margin: 44px 0 0; padding: 32px 0 36px; }
.special .sec-head { border-color: rgba(255, 255, 255, .35); }
.special .sec-title::before { background: #fff; }
.special .sec-more { color: #fff; text-decoration: underline; }
.special__grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 28px; }
.special .card--side { border-color: rgba(255, 255, 255, .28); }
.special .card__title a { color: #fff; }
.special .card__meta { color: rgba(255, 255, 255, .85); }
.special .card--lead .card__cat { background: #fff; color: var(--red); }
.special .card--lead .card__body { background: linear-gradient(to top, rgba(60, 0, 0, .9), rgba(60, 0, 0, 0)); }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; padding-top: 32px; padding-bottom: 48px; align-items: start; }
.more-wrap { text-align: center; padding-top: 24px; }
.sidebar { position: sticky; top: 76px; }
.admin-bar .sidebar { top: 108px; }
.widget { margin-bottom: 32px; }
.ranked { list-style: none; margin: 0; padding: 0; counter-reset: rank; }
.ranked li { counter-increment: rank; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font: 500 1rem/1.5 var(--f-head); }
.ranked li::before { content: counter(rank); color: var(--red); font: 700 1.75rem/1.1 var(--f-head); }
.ranked a { color: var(--ink); }
.ranked a:hover { color: var(--red); }

.catgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px 48px; padding-bottom: 56px; }
.catblock__list { margin-top: 14px; }

.empty { padding: 40px 0; color: var(--muted); }

/* ==========================================================
   7. Archive, search, pages
   ========================================================== */
.archive-head { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 3px solid var(--red); }
.archive-head__title { margin: 0 0 8px; font: 700 clamp(1.6rem, 3vw, 2.25rem)/1.4 var(--f-head); }
.archive-head__desc { margin: 0; color: var(--muted); }
.archive-head .searchform { margin-top: 14px; }
.layout__main > .card--lead { margin-bottom: 8px; }

.page-wrap { padding-top: 32px; padding-bottom: 56px; max-width: 820px; }
.notfound .searchform { margin: 20px 0; }

.navigation.pagination { margin-top: 32px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 6px; }
.page-numbers { padding: 8px 14px; border: 1px solid var(--line); color: var(--ink); font: 500 .95rem var(--f-head); border-radius: 2px; }
.page-numbers.current, a.page-numbers:hover { background: var(--red); border-color: var(--red); color: #fff; }
.page-numbers.dots { border-color: transparent; }

.btn { display: inline-block; background: var(--red); color: #fff; border: 1px solid var(--red); padding: 11px 24px; font: 600 1rem/1.5 var(--f-head); border-radius: 2px; cursor: pointer; }
.btn:hover { background: var(--red-dk); border-color: var(--red-dk); color: #fff; }
.btn--ghost { background: #fff; color: var(--red); }
.btn--ghost:hover { background: var(--red); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }

/* ==========================================================
   8. Single article
   ========================================================== */
.entry { min-width: 0; }
.entry--page .entry__title { margin-bottom: 24px; }
.entry__cat { display: inline-block; background: var(--red); color: #fff; font: 600 .85rem/1.6 var(--f-head); padding: 2px 12px; border-radius: 2px; margin-bottom: 14px; }
.entry__cat:hover { background: var(--red-dk); color: #fff; }
.entry__title { margin: 0 0 14px; font: 700 clamp(1.7rem, 3.4vw, 2.6rem)/1.4 var(--f-head); }
.entry__lede { margin: 0 0 16px; font-size: 1.2rem; color: #444; }
.entry__meta { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: .875rem; color: var(--muted); }
.entry__meta a { color: var(--ink); font-weight: 500; }
.share { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 14px 0 22px; padding: 0; }
.share a, .share button { display: inline-block; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: 500 .85rem/1.5 var(--f-head); cursor: pointer; }
.share a:hover, .share button:hover { border-color: var(--red); color: var(--red); }
.entry__figure { margin: 0 0 28px; }
.entry__figure img { width: 100%; border-radius: 2px; }
.entry__figure figcaption { margin-top: 8px; font-size: .85rem; color: var(--muted); }

.entry-content { max-width: 720px; font-size: 1.125rem; line-height: 1.9; overflow-wrap: break-word; }
.entry-content > * { margin-top: 0; margin-bottom: 1.4em; }
.entry-content h2 { margin: 1.8em 0 .6em; font-size: 1.6rem; }
.entry-content h3 { margin: 1.6em 0 .5em; font-size: 1.3rem; }
.entry-content a { text-decoration: underline; text-underline-offset: 3px; }
.entry-content blockquote { margin: 1.8em 0; padding: 4px 0 4px 20px; border-left: 4px solid var(--red); font-size: 1.2rem; color: #333; }
.entry-content blockquote p { margin: 0 0 .6em; }
.entry-content figure { margin-left: 0; margin-right: 0; }
.entry-content img { border-radius: 2px; }
.entry-content table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.entry-content th, .entry-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.entry-content iframe { max-width: 100%; }
.page-links { font-size: .95rem; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 24px 0; padding: 0; }
.tags a { display: block; padding: 4px 14px; background: var(--bg); color: var(--ink); border-radius: 999px; font: 500 .875rem var(--f-head); }
.tags a:hover { background: var(--red); color: #fff; }
.related { padding-bottom: 56px; }

.comments { max-width: 720px; margin-top: 40px; }
.comment-list { list-style: none; padding: 0; }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-body { padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 2px; font: inherit; }
.comment-form .submit { background: var(--red); color: #fff; border: 0; padding: 11px 24px; font: 600 1rem var(--f-head); border-radius: 2px; cursor: pointer; }

/* WordPress core classes */
.alignleft { float: left; margin: .3em 1.5em 1em 0; }
.alignright { float: right; margin: .3em 0 1em 1.5em; }
.aligncenter { display: block; margin-left: auto; margin-right: auto; }
.alignwide, .alignfull { max-width: 100%; }
.wp-caption { max-width: 100%; }
.wp-caption-text, .wp-element-caption, .gallery-caption { font-size: .85rem; color: var(--muted); }
.sticky, .bypostauthor { display: block; }

/* ==========================================================
   9. Footer
   ========================================================== */
.site-footer { margin-top: 0; background: #222; border-top: 4px solid var(--red); color: #d6d6d6; font-size: .9375rem; }
.site-footer a { color: #fff; }
.site-footer a:hover { text-decoration: underline; }
.footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr; gap: 40px; padding-top: 44px; padding-bottom: 44px; }
.footer__brand .logo img, .footer__brand .custom-logo { height: 56px; width: auto; }
.footer__brand p { max-width: 36ch; margin: 14px 0 0; }
.footer__h { margin: 0 0 12px; font: 600 1rem var(--f-head); color: #fff; }
.footer__contact p { margin: 0 0 6px; }
.social { display: flex; flex-wrap: wrap; gap: 8px 20px; list-style: none; margin: 0; padding: 0; }
.footer__bar { border-top: 1px solid rgba(255, 255, 255, .14); font-size: .85rem; }
.footer__bar-in { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding-top: 16px; padding-bottom: 16px; }
.footer__menu .menu { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }

.to-top { position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 44px; height: 44px; display: grid; place-items: center; background: var(--red); color: #fff; border: 0; border-radius: 2px; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
.to-top[hidden] { display: none; }
.to-top:hover { background: var(--red-dk); }

/* ==========================================================
   10. Responsive
   ========================================================== */
@media (max-width: 1100px) {
	.grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
	.sidebar { position: static; }
}

@media (max-width: 900px) {
	.hero, .special__grid, .catgrid { grid-template-columns: minmax(0, 1fr); }
	.footer__grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }

	.topbar { display: none; }
	.site-header { position: sticky; top: 0; z-index: 60; }
	.admin-bar .site-header { top: 46px; }
	.masthead__in { display: grid; grid-template-columns: 48px 1fr auto; min-height: var(--mast-h); gap: 8px; }
	.logo, .custom-logo-link { justify-self: center; margin: 0; }
	.logo img, .custom-logo { height: 40px; }
	.menu-toggle { display: inline-flex; }
	.search-toggle__label { display: none; }

	.mainnav { display: none; position: fixed; left: 0; right: 0; top: var(--mast-h); bottom: 0; z-index: 55; overflow-y: auto; border: 0; }
	body.menu-open .mainnav { display: block; }
	body.menu-open { overflow: hidden; }
	.mainnav .menu { flex-direction: column; overflow: visible; padding: 8px 0 40px; }
	.mainnav .menu a { padding: 15px 8px; border-bottom: 1px solid var(--line); font-size: 1.05rem; }
	.mainnav .menu a:hover, .mainnav .menu .current-menu-item > a { border-bottom-color: var(--line); }
}

@media (max-width: 600px) {
	.wrap { padding: 0 16px; }
	.grid4 { grid-template-columns: minmax(0, 1fr); gap: 22px; }
	.card--row { grid-template-columns: 124px minmax(0, 1fr); gap: 12px; }
	.card--row .card__title { font-size: 1rem; }
	.card--side { grid-template-columns: 112px minmax(0, 1fr); }
	.card--lead .card__body { padding: 48px 16px 16px; }
	.ticker__label { display: none; }
	.entry-content { font-size: 1.0625rem; }
	.alignleft, .alignright { float: none; display: block; margin: 0 auto 1em; }
}

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