/* ============================================================
   PrateepKhao.com — shared site styles
   Used by category pages and (if linked) other pages.
   ============================================================ */

:root {
  --bg: #faf8f3;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-muted: #888888;
  --line: #e8e4d8;
  --line-strong: #d6d0bc;

  --gold: #d4a045;
  --gold-warm: #b8851f;
  --gold-light: #f4d896;

  --tag-society: #c0392b;
  --tag-politics: #1f4e8c;
  --tag-foreign: #1f6f8c;
  --tag-economy: #1f6f5c;
  --tag-life: #8c4a1f;
  --tag-tech: #5e3f8c;
  --tag-articles: #5e3f8c;
  --tag-latest: #b8851f;

  --beige: #f8f3ed;
  --on-beige: #3a2a14;
  --on-beige-soft: #6a5234;
  --blue: #1e3a5f;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; zoom: 0.8; }
body {
  margin: 0; min-height: 100vh;
  font-family: "Sarabun", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #ffffff;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: "Prompt", "Sarabun", sans-serif; font-weight: 700; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(944px, 80vw); margin: 0 auto; }

/* === Topbar === */
.topbar { background: var(--blue); border-bottom: 1px solid rgba(255, 255, 255, 0.10); font-size: 14px; color: #ffffff; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 6px 0; }
.date-pill { display: inline-flex; align-items: center; gap: 8px; }
.date-pill svg { width: 16px; height: 16px; color: var(--gold-light); }
.top-actions { display: flex; align-items: center; gap: 16px; }
.top-actions a { display: inline-flex; align-items: center; gap: 6px; color: #ffffff; transition: color .2s; }
.top-actions a:hover { color: var(--gold-light); }
.top-actions .icon { width: 18px; height: 18px; }
.top-actions .fb { color: #1877f2; }
.top-actions .yt { color: #ff0000; }

/* === Logo bar === */
.logo-bar { background: var(--beige); padding: 24px 0 20px; border-bottom: 1px solid var(--line); }
.logo-bar .container { display: flex; align-items: center; justify-content: center; }
.brand-link { display: inline-block; line-height: 0; }
.brand-logo { display: block; width: 100%; max-width: 460px; height: auto; filter: drop-shadow(0 0 28px rgba(212, 160, 69, .25)); }

/* === Main nav === */
.mainnav { background: var(--beige); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.mainnav .container { display: flex; flex-wrap: wrap; gap: 4px 6px; justify-content: center; padding: 4px 0; }
.mainnav a { position: relative; padding: 16px 18px; color: var(--ink-soft); font-weight: 600; font-family: "Prompt", sans-serif; font-size: 16px; transition: color .2s; }
.mainnav a:hover { color: var(--ink); }
.mainnav a.active { color: var(--ink); }
.mainnav a.active::after { content: ""; position: absolute; left: 18px; right: 18px; bottom: 6px; height: 3px; background: var(--gold); border-radius: 2px; }

/* === Breadcrumb === */
.breadcrumb { background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--ink-muted); }
.breadcrumb .container { padding: 12px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb .sep { color: var(--line-strong); }
.breadcrumb .current { color: var(--ink); font-weight: 600; }

/* === Category page hero === */
.cat-hero {
  padding: 22px 0 18px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212,160,69,.10), transparent 55%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}
.cat-hero .container { display: flex; align-items: center; gap: 22px; flex-wrap: nowrap; }
.cat-hero .container > div:not(.cat-bar) { flex: 1; min-width: 0; }
.cat-hero .cat-bar { width: 6px; align-self: stretch; min-height: 48px; border-radius: 3px; background: var(--gold); }
.cat-hero.society  .cat-bar { background: var(--tag-society); }
.cat-hero.politics .cat-bar { background: var(--tag-politics); }
.cat-hero.foreign  .cat-bar { background: var(--tag-foreign); }
.cat-hero.economy  .cat-bar { background: var(--tag-economy); }
.cat-hero.life     .cat-bar { background: var(--tag-life); }
.cat-hero.tech     .cat-bar { background: var(--tag-tech); }
.cat-hero.articles .cat-bar { background: var(--tag-articles); }
.cat-hero.latest   .cat-bar { background: var(--gold); }
.cat-hero h1 { margin: 0; font-size: clamp(24px, 3vw, 32px); letter-spacing: -.01em; color: var(--ink); }
.cat-hero p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14.5px; max-width: 720px; line-height: 1.55; }

/* === Layout === */
main { padding: 32px 0 64px; }
.cat-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 36px;
  align-items: start;
}

/* === News cards === */
.cat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-content: start; }
.news-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform .2s, box-shadow .2s;
}
.news-card:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(0,0,0,.08); }
.news-card .thumb { aspect-ratio: 16/10; background: #ddd; overflow: hidden; }
.news-card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tag { align-self: flex-start; font-size: 12px; font-weight: 700; padding: 2px 0; letter-spacing: .04em; }
.tag.society  { color: var(--tag-society); }
.tag.politics { color: var(--tag-politics); }
.tag.foreign  { color: var(--tag-foreign); }
.tag.economy  { color: var(--tag-economy); }
.tag.life     { color: var(--tag-life); }
.tag.tech     { color: var(--tag-tech); }
.tag.articles { color: var(--tag-articles); }
.news-card h3 { margin: 0; font-size: 16px; line-height: 1.45; color: var(--ink); font-weight: 700; }
.news-card .meta { margin-top: auto; font-size: 12.5px; color: var(--ink-muted); }

/* === Pagination === */
.pagination { grid-column: 1 / -1; margin: 28px 0 0; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pagination a {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; color: var(--ink-soft); font-weight: 600; font-family: "Prompt", sans-serif;
  transition: background .2s, color .2s, border-color .2s;
}
.pagination a:hover { background: var(--surface); color: var(--ink); border-color: var(--gold); }
.pagination a.active { background: var(--gold); color: #fff; border-color: var(--gold); }
.pagination a.disabled { opacity: .4; pointer-events: none; }

/* === Sidebar === */
.cat-aside { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 80px; }
.aside-block { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.aside-block h3 { margin: 0 0 14px; padding-bottom: 12px; border-bottom: 2px solid var(--gold); font-size: 17px; color: var(--ink); }

/* === Popular list === */
.popular-list { list-style: none; padding: 0; margin: 0; counter-reset: pop; }
.popular-list li {
  counter-increment: pop;
  display: grid; grid-template-columns: 28px 1fr; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  align-items: start;
}
.popular-list li:last-child { border-bottom: none; padding-bottom: 4px; }
.popular-list li::before {
  content: counter(pop);
  font-family: "Prompt", sans-serif;
  font-size: 22px; font-weight: 800;
  color: var(--gold-warm); line-height: 1;
}
.popular-list a { font-size: 14px; line-height: 1.45; color: var(--ink); font-weight: 600; transition: color .2s; }
.popular-list a:hover { color: var(--gold-warm); }

/* === Sidebar category list === */
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { border-bottom: 1px solid var(--line); }
.cat-list li:last-child { border-bottom: none; }
.cat-list a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; color: var(--ink); font-weight: 600;
  font-family: "Prompt", sans-serif; font-size: 15px; transition: color .2s;
}
.cat-list a:hover { color: var(--gold-warm); }
.cat-list a::after { content: "›"; color: var(--ink-muted); font-size: 18px; }
.cat-list .name { display: inline-flex; align-items: center; gap: 10px; }
.cat-list .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.cat-list .dot.society  { background: var(--tag-society); }
.cat-list .dot.politics { background: var(--tag-politics); }
.cat-list .dot.foreign  { background: var(--tag-foreign); }
.cat-list .dot.economy  { background: var(--tag-economy); }
.cat-list .dot.life     { background: var(--tag-life); }
.cat-list .dot.tech     { background: var(--tag-tech); }
.cat-list .dot.articles { background: var(--tag-articles); }
.cat-list .dot.latest   { background: var(--gold); }

/* === Footer === */
.footer-band { background: var(--beige); color: var(--on-beige-soft); }
.footer-band .container { display: grid; grid-template-columns: 1.4fr 1.6fr 1fr; gap: 40px; padding: 48px 0 36px; }
.foot-brand { display: flex; align-items: center; gap: 16px; }
.foot-logo { display: block; width: 100%; max-width: 260px; height: auto; }
.foot-col h5 { margin: 0 0 16px; font-size: 16px; color: var(--on-beige); font-family: "Prompt", sans-serif; }
.foot-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; list-style: none; padding: 0; margin: 0; }
.foot-menu a, .foot-social a { color: var(--on-beige-soft); transition: color .2s; font-size: 14.5px; }
.foot-menu a:hover, .foot-social a:hover { color: var(--on-beige); }
.foot-social { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; }
.foot-social a { display: inline-flex; align-items: center; gap: 10px; }
.social-circle { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.social-circle.fb { background: #1877f2; }
.social-circle.yt { background: #ff0000; }
.social-circle.line { background: #06c755; }
.social-circle svg { width: 16px; height: 16px; }

.footer-bottom { background: var(--blue); color: #ffffff; font-size: 13px; }
.footer-bottom .container { padding: 18px 0; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; text-align: center; }
.footer-bottom .sep { color: rgba(255, 255, 255, .45); }

/* === Responsive === */
/* ============================================================
   Article page styles
   ============================================================ */

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 36px;
  align-items: start;
}

.article-main {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px clamp(20px, 4vw, 44px) 44px;
}

.article-tag {
  display: inline-block;
  padding: 5px 14px;
  background: var(--tag-economy);
  color: #fff;
  font-size: 12.5px; font-weight: 700;
  border-radius: 999px; letter-spacing: .04em;
}
.article-tag.society  { background: var(--tag-society); }
.article-tag.politics { background: var(--tag-politics); }
.article-tag.foreign  { background: var(--tag-foreign); }
.article-tag.economy  { background: var(--tag-economy); }
.article-tag.life     { background: var(--tag-life); }
.article-tag.tech     { background: var(--tag-tech); }
.article-tag.articles { background: var(--tag-articles); }

.article-title {
  margin: 16px 0 18px;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--ink);
}

.article-meta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--ink-muted);
}
.article-meta .date { display: inline-flex; align-items: center; gap: 8px; }
.article-meta .date svg { width: 16px; height: 16px; color: var(--gold-warm); }

.share-row { display: inline-flex; align-items: center; gap: 8px; }
.share-row .label { color: var(--ink-muted); font-size: 13px; margin-right: 4px; }
.share-btn {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  transition: transform .15s, opacity .15s;
}
.share-btn svg { width: 15px; height: 15px; }
.share-btn:hover { transform: translateY(-2px); }
.share-btn.fb   { background: #1877f2; }
.share-btn.x    { background: #000000; }
.share-btn.line { background: #06c755; }
.share-btn.copy { background: var(--ink-soft); }

.article-hero {
  margin: 26px 0 8px;
  border-radius: 12px; overflow: hidden;
  background: #1a1815;
}
.article-hero img { width: 100%; height: auto; display: block; aspect-ratio: 16/9; object-fit: cover; }
.article-caption {
  padding: 8px 0 22px;
  font-size: 13px; color: var(--ink-muted); line-height: 1.6;
}

.article-body { color: var(--ink); }
.article-body p { margin: 0 0 18px; font-size: 17px; line-height: 1.85; }
.article-body p.lead { font-size: 19px; font-weight: 600; color: var(--ink); margin-bottom: 24px; }
.article-body h2 {
  margin: 32px 0 14px;
  font-size: 22px;
  color: var(--ink);
  padding-left: 12px;
  border-left: 4px solid var(--gold);
}
.article-body blockquote {
  margin: 28px 0;
  padding: 20px 24px;
  border-left: 4px solid var(--gold);
  background: var(--bg);
  font-family: "Prompt", sans-serif;
  font-size: 18px; line-height: 1.6; color: var(--ink);
  border-radius: 0 10px 10px 0;
}
.article-body ul { margin: 0 0 18px; padding-left: 20px; }
.article-body li { font-size: 16.5px; line-height: 1.85; margin-bottom: 6px; }
.article-body strong { color: var(--ink); font-weight: 700; }

.article-tags {
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 8px;
}
.article-tags .label { color: var(--ink-muted); font-size: 13.5px; margin-right: 6px; align-self: center; }
.chip {
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  transition: background .2s, border-color .2s, color .2s;
}
.chip:hover { background: #fff; border-color: var(--gold); color: var(--ink); }

.share-bottom {
  margin-top: 28px;
  padding: 18px 20px;
  background: var(--bg);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.share-bottom .text { font-weight: 700; color: var(--ink); font-family: "Prompt", sans-serif; }

/* === Related item (article/category sidebar) === */
.related-item {
  display: grid; grid-template-columns: 90px 1fr; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  align-items: start;
}
.related-item:last-of-type { border-bottom: none; padding-bottom: 4px; }
.related-item .thumb {
  width: 90px; aspect-ratio: 4/3;
  border-radius: 6px; overflow: hidden; background: #ddd;
}
.related-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.related-item .body { display: flex; flex-direction: column; gap: 4px; }
.related-item .tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 0; }
.related-item h4 {
  margin: 0;
  font-size: 14px; line-height: 1.45; color: var(--ink); font-weight: 600;
  font-family: "Sarabun", sans-serif;
}
.related-item .date { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }

/* Article responsive */
/* === Search bar in topbar === */
.search-bar {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #ffffff;
  border-radius: 999px;
  padding: 4px 4px 4px 14px;
  gap: 8px;
  transition: background .2s, border-color .2s;
}
.search-bar:focus-within { box-shadow: 0 0 0 3px rgba(212, 160, 69, 0.30); border-color: var(--gold); }
.search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  width: 200px;
  padding: 4px 0;
}
.search-bar input::placeholder { color: var(--ink-muted); }
.search-bar button {
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: transparent;
  color: var(--ink-muted);
  display: grid; place-items: center;
  cursor: pointer;
  transition: background .2s, color .2s;
  flex: 0 0 auto;
}
.search-bar button:hover { background: var(--beige); color: var(--gold-warm); }
.search-bar button svg { width: 14px; height: 14px; }

/* ============================================================
   Responsive (Standard breakpoints)
   ============================================================ */

/* iPad landscape & below */
@media (max-width: 1024px) {
  .mainnav .container { gap: 3px; flex-wrap: nowrap; }
  .mainnav a { padding: 12px 8px; font-size: 13.5px; white-space: nowrap; }
  .mainnav a.active::after { left: 8px; right: 8px; }

  html { zoom: 0.9; }
  .container { width: min(944px, 92vw); }
  .cat-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; }
  .article-grid { grid-template-columns: minmax(0, 1fr) 280px; gap: 24px; }
  .cat-cards { grid-template-columns: repeat(2, 1fr); }
  .footer-band .container { grid-template-columns: 1fr 1fr; }
  .foot-brand { grid-column: 1 / -1; }
}

/* iPad portrait */
@media (max-width: 768px) {
  .mainnav .container { gap: 2px; }
  .mainnav a { padding: 10px 6px; font-size: 12.5px; }
  .mainnav a.active::after { left: 6px; right: 6px; }

  html { zoom: 0.95; }
  .cat-grid { grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; }
  .article-grid { grid-template-columns: minmax(0, 1fr) 240px; gap: 18px; }
  .footer-band .container { grid-template-columns: 1fr; }
}

/* Phones */
@media (max-width: 640px) {
  html { zoom: 1; }
  .cat-grid { grid-template-columns: 1fr; gap: 24px; }
  .article-grid { grid-template-columns: 1fr; gap: 24px; }
  .cat-aside { position: static; }
  .container { width: min(944px, 94vw); }
  .topbar .container { flex-direction: column; gap: 8px; padding: 8px 0; }
  .search-bar { width: 100%; }
  .search-bar input { flex: 1; width: auto; min-width: 0; }
  .logo-bar { padding: 16px 0 14px; }
  .brand-logo { max-width: 280px; }
  .mainnav .container { padding: 2px 0; }
  .mainnav a { padding: 10px 12px; font-size: 14px; }
  .mainnav a.active::after { left: 12px; right: 12px; }
  .breadcrumb { font-size: 12.5px; }
  .breadcrumb .container { padding: 10px 0; }
  .cat-hero { padding: 16px 0 12px; }
  .cat-hero h1 { font-size: 22px; }
  .cat-hero p { font-size: 13.5px; }
  .cat-cards { grid-template-columns: 1fr; }
  .article-main { padding: 22px 16px 26px; }
  .article-meta { flex-direction: column; align-items: flex-start; gap: 10px; }
  .article-title { font-size: clamp(22px, 5.5vw, 28px); }
  .article-body p { font-size: 15.5px; }
  .article-body h2 { font-size: 19px; }
  .footer-band .container { padding: 32px 0 24px; gap: 24px; }
  .foot-menu { grid-template-columns: 1fr 1fr; }
  .footer-bottom .container { padding: 14px 0; flex-direction: column; gap: 4px; }
  .footer-bottom .sep { display: none; }
  .related-item { grid-template-columns: 80px 1fr; }
  .related-item .thumb { width: 80px; }
  .pagination a { padding: 6px 10px; font-size: 13px; }
}
