/* ============================================================
   gblognews — main stylesheet
   คอนเซ็ปต์: แผงข่าว/ความรู้ยุคใหม่ อ่านสนุก คัดมาแล้ว
   โทนสว่าง สะอาด + accent น้ำเงินหมึก/ส้มอำพัน
   mobile-first
   ============================================================ */

:root {
  /* palette */
  --ink:        #1a1c2e;   /* น้ำเงินหมึกเข้ม — ตัวอักษรหลัก/หัวข้อ */
  --ink-soft:   #4a4d63;   /* เทาอมน้ำเงิน — เนื้อความรอง */
  --paper:      #fbfaf7;   /* ขาวนวล — พื้นหลัง */
  --card:       #ffffff;   /* การ์ด */
  --line:       #e8e6e0;   /* เส้นคั่น */
  --accent:     #e8703a;   /* ส้มอำพัน — accent หลัก (eyebrow, ลิงค์เด่น) */
  --accent-deep:#c8551f;
  --brand:      #2d3acb;   /* น้ำเงินสด — แบรนด์/ปุ่ม */
  --brand-deep: #1e26a0;
  --gold:       #c79a3b;   /* ทอง — จุดเน้นเล็กๆ */

  /* type */
  --font-display: 'IBM Plex Sans Thai', 'Sarabun', system-ui, sans-serif;
  --font-body:    'Sarabun', 'IBM Plex Sans Thai', system-ui, sans-serif;

  /* layout */
  --maxw: 1140px;
  --gap:  20px;
  --radius: 14px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.75;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 18px;
}

/* ---------- header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand .logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 25px;
  color: var(--ink);
  letter-spacing: -0.5px;
}
.brand .logo b { color: var(--accent); }
.brand .tagline {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 1px;
}

/* nav */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 24px; height: 2px;
  background: var(--ink);
  transition: .25s;
}
.main-nav { display: none; }
.main-nav.open { display: block; }

.main-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
}
.main-nav a {
  display: block;
  padding: 12px 4px;
  color: var(--ink);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
}
.main-nav a:hover { color: var(--accent); text-decoration: none; }

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .main-nav { display: block !important; }
  .main-nav ul { flex-direction: row; gap: 6px; }
  .main-nav a { border: 0; padding: 8px 14px; border-radius: 999px; }
  .main-nav a:hover { background: var(--paper); }
}

/* ---------- eyebrow / labels ---------- */
.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .8px;
  text-transform: uppercase;
  color: var(--accent);
}
.cat-tag {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
  background: #eef0ff;
  padding: 3px 11px;
  border-radius: 999px;
}
.cat-tag:hover { background: #e2e5ff; text-decoration: none; }

/* ---------- hero / section title ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 34px 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
}
.section-head a { font-size: 14px; font-weight: 600; }

/* ---------- post grid / cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}
@media (min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(26,28,46,.10);
}
.card .thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #eef0ff, #fde8dc);
  overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .body { padding: 15px 16px 18px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--accent); text-decoration: none; }
.card p { font-size: 14.5px; color: var(--ink-soft); margin: 0; }
.card .meta {
  margin-top: auto;
  font-size: 12.5px;
  color: var(--ink-soft);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* featured (ใหญ่ขึ้น) */
.featured-card { grid-column: 1 / -1; }
@media (min-width: 600px) {
  .featured-card { display: grid; grid-template-columns: 1.3fr 1fr; }
  .featured-card .thumb { aspect-ratio: auto; height: 100%; min-height: 260px; }
  .featured-card h3 { font-size: 24px; }
}

/* ---------- article page ---------- */
.article {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 22px 34px;
  margin-top: 22px;
}
@media (min-width: 760px) { .article { padding: 40px 48px 48px; } }

.breadcrumb {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.breadcrumb a { color: var(--ink-soft); }
.breadcrumb a:hover { color: var(--accent); }

.article h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  margin: 8px 0 12px;
}
@media (min-width: 760px) { .article h1 { font-size: 36px; } }

.article .lead {
  font-size: 18.5px;
  color: var(--ink-soft);
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 16px 0 22px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--ink-soft);
}
.article-meta .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; overflow: hidden;
}
.article-meta .avatar img { width: 100%; height: 100%; object-fit: cover; }
.article-meta a { color: var(--ink); font-weight: 600; }

/* เนื้อหาบทความ */
.content { font-size: 17.5px; }
.content > * + * { margin-top: 1.05em; }
.content h2 {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700;
  margin-top: 1.6em; color: var(--ink);
}
.content h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; margin-top: 1.4em; }
.content p { color: #25273a; }
.content a { color: var(--brand); text-decoration: underline; }
.content ul, .content ol { padding-left: 1.4em; }
.content li { margin: .4em 0; }
.content img { border-radius: 10px; margin: 1.4em 0; }
.content blockquote {
  border-left: 4px solid var(--gold);
  background: #fbf6ea;
  padding: 14px 18px;
  border-radius: 6px;
  color: var(--ink-soft);
}
.content table { width: 100%; border-collapse: collapse; }
.content th, .content td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.content th { background: var(--paper); }
.content code {
  background: #f1f0ec; padding: 2px 6px; border-radius: 5px;
  font-size: .9em;
}

/* ---------- related ---------- */
.related { margin-top: 40px; }

/* ---------- author box ---------- */
.author-box {
  display: flex;
  gap: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 34px;
}
.author-box .avatar {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--brand); color: #fff; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; overflow: hidden;
}
.author-box .avatar img { width:100%; height:100%; object-fit: cover; }
.author-box h4 { font-family: var(--font-display); font-size: 17px; }
.author-box .exp { font-size: 13px; color: var(--accent); font-weight: 600; margin: 2px 0 6px; }
.author-box p { font-size: 14.5px; color: var(--ink-soft); }

/* ---------- pagination ---------- */
.pagination {
  display: flex; gap: 8px; justify-content: center;
  margin: 36px 0;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 9px 15px; border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font-size: 14px; font-weight: 600;
}
.pagination a:hover { background: var(--brand); color: #fff; border-color: var(--brand); text-decoration: none; }
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- footer ---------- */
.site-footer {
  background: var(--ink);
  color: #c9cbe0;
  margin-top: 60px;
  padding: 40px 0 28px;
}
.site-footer a { color: #c9cbe0; }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
}
@media (min-width: 700px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand .logo { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: #fff; }
.footer-brand .logo b { color: var(--accent); }
.footer-brand p { font-size: 14px; margin-top: 8px; max-width: 340px; }
.footer-col h5 { font-size: 14px; color: #fff; margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; }
.footer-col ul { list-style: none; }
.footer-col li { margin: 7px 0; font-size: 14.5px; }
.footer-bottom {
  border-top: 1px solid #2c2f48;
  margin-top: 28px; padding-top: 18px;
  font-size: 13px; color: #888bb0;
  text-align: center;
}

/* ---------- search box ---------- */
.searchbar { display: flex; gap: 8px; margin: 20px 0; }
.searchbar input {
  flex: 1; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit; font-size: 16px;
}
.searchbar button {
  padding: 12px 22px; border: 0; border-radius: 10px;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer;
}
.searchbar button:hover { background: var(--brand-deep); }

/* ---------- empty state ---------- */
.empty {
  text-align: center; padding: 60px 20px; color: var(--ink-soft);
}
.empty h3 { font-family: var(--font-display); font-size: 20px; color: var(--ink); margin-bottom: 8px; }

/* ---------- page (about/contact) ---------- */
.page-body {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 24px;
  margin-top: 22px;
}
@media (min-width: 760px) { .page-body { padding: 44px 48px; } }
.page-body h1 { font-family: var(--font-display); font-size: 30px; margin-bottom: 16px; }

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

/* ============================================================
   รูปในบทความ (figure จัดวาง) + lightbox คลิกขยาย
   ============================================================ */
.content figure.post-img { margin: 1.5em 0; }
.content figure.post-img img { border-radius: 10px; cursor: zoom-in; }
.content figure.post-img figcaption {
  font-size: 14px; color: var(--ink-soft);
  text-align: center; margin-top: 7px; font-style: italic;
}
.content figure.align-center { text-align: center; }
.content figure.align-center img { margin-left: auto; margin-right: auto; }
.content figure.align-full img { width: 100%; }
.content figure.align-left  { float: left;  max-width: 50%; margin: .3em 1.6em 1em 0; }
.content figure.align-right { float: right; max-width: 50%; margin: .3em 0 1em 1.6em; }
.content figure.align-left figcaption,
.content figure.align-right figcaption { text-align: left; }
@media (max-width: 600px) {
  .content figure.align-left, .content figure.align-right {
    float: none; max-width: 100%; margin: 1.3em 0;
  }
}

/* lightbox */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(15,16,28,.92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; cursor: zoom-out; opacity: 0; transition: opacity .2s;
}
.lightbox-overlay.show { opacity: 1; }
.lightbox-overlay img { max-width: 96vw; max-height: 92vh; border-radius: 8px; }

/* ============================================================
   digest ข่าวรายวัน (สรุปหลายข่าวในบทความเดียว)
   ============================================================ */
.content .digest-item { margin: 1.6em 0; }
.content .digest-item h2 { margin-bottom: .4em; }
.content .digest-source { font-size: 14.5px; }
.content .digest-source a {
  display: inline-block; color: var(--brand); font-weight: 600;
  text-decoration: none; border-bottom: 1px solid transparent;
}
.content .digest-source a:hover { border-bottom-color: var(--brand); }
.content hr.digest-sep {
  border: 0; border-top: 1px dashed var(--line); margin: 1.8em 0;
}
