/* articles.css — สไตล์เฉพาะหน้าบทความ (T-0044)
   ใช้สีจากตัวแปร --v3-* ใน style.css เท่านั้น ไม่ใช้สีดำ */

/* แถบ byline ใต้ photoHead ของหน้าบทความ */
.article-head-meta { padding-top: 18px; }
.article-head-meta .article-byline { margin: 0; color: var(--v3-muted); font-size: 0.9rem; }

/* หน้ารวมบทความ — หัวกลุ่มและการ์ด */
.art-group-head { display: flex; align-items: baseline; gap: 12px; }
.art-group-head h2 { margin: 0; color: var(--v3-navy); font-size: clamp(1.4rem, 2.4vw, 1.9rem); }
.art-group-count { color: var(--v3-muted); font-size: 0.95rem; white-space: nowrap; }
.art-group-lead { margin: 8px 0 28px; color: var(--v3-muted); }

/* T-0064: ระยะกลุ่มต่อกลุ่ม — ต้องกำหนดนอก media query ด้วย ไม่งั้นจอ ≥768 ตกไปใช้
   .section{padding:96px 0} ของ style.css จนห่าง 206px เกินเกณฑ์ ≤56px (24+24 = 48px) */
.section.art-group { padding-block: 24px; }

/* T-0064 การ์ดกระชับตามแบบ "ผลงานเด่น" (pjg-card/pjg-photo/pjg-name/pjg-place ใน projects.css):
   รูปมุมมนอยู่ในกรอบการ์ด (มีขอบใน) ใต้รูปมีแค่ชื่อตัวหนาไม่เกิน 3 บรรทัด + meta บรรทัดเล็ก 1 บรรทัด
   ไม่แสดงย่อหน้าสรุปในหน้ารวมแล้ว (ข้อมูล summary ยังอยู่ใน articles.json ใช้ต่อใน SEO) */
.art-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px 24px; }
.art-card { display: flex; flex-direction: column; height: 100%; padding: 10px 10px 16px; }
.art-card-thumb { display: block; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: var(--v3-soft); }
.art-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-card-body { display: flex; flex-direction: column; gap: 4px; padding: 14px 6px 0; flex: 1; }
.art-card-body h3 { margin: 0; font-size: 1.02rem; line-height: 1.45; font-weight: 700; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.art-card-body h3 a { color: var(--v3-navy-deep); text-decoration: none; }
.art-card-body h3 a:hover { color: var(--v3-navy); }
.art-card-meta { color: var(--v3-muted); font-size: 0.82rem; }

/* การ์ดบทความไม่มีภาพ — ใช้แผ่นพื้นนุ่มแทนภาพ ยืดเต็มความสูงเท่าการ์ดอื่นในแถว (T-0049) */
.art-card--plain .art-card-body { margin-top: 2px; padding: 14px 12px 16px; border-radius: 12px; background: var(--v3-soft); }

/* จอแคบ/แท็บเลต 3 คอลัมน์ (ที่ 768 ได้ 3 ตามที่เจ้าของสั่ง) */
@media (max-width: 1023px) {
  .art-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* มือถือ 2 คอลัมน์ ชื่อเล็กลงพอดี + จังหวะกระชับ T-0058 (T-0064: ย้ายขอบ 820→767 ให้ 768 ได้ 3 คอลัมน์,
   กฎการ์ดของ T-0058 รวมมาที่นี่แล้ว scope คลาส art-* หน้าบทความ 11 หน้าไม่โดน) */
@media (max-width: 767px) {
  .art-group-lead { margin: 6px 0 16px; font-size: 15px; }
  .art-group-head h2 { font-size: 1.3rem; }
  .art-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 14px; }
  .art-card { padding: 8px 8px 14px; }
  .art-card-body { padding: 10px 4px 0; gap: 3px; }
  .art-card-body h3 { font-size: 0.92rem; line-height: 1.4; }
  .art-card-meta { font-size: 0.72rem; }
  .art-card--plain .art-card-body { padding: 12px 10px 14px; }
}

/* หน้าบทความ v2 (T-0006) — คอลัมน์อ่าน ~720px ภาพประกอบทุกขั้น */
.article-page { padding-top: 26px; padding-bottom: 8px; }
.article-v2 { max-width: 720px; margin: 0 auto; }
.article-v2 .article-lead { font-size: 1.05rem; line-height: 1.9; color: var(--v3-navy-deep); margin: 0 0 26px; }

.article-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0 0 30px; }
.article-photos .article-figure { margin: 0; }
.article-photos .article-figure img { aspect-ratio: 4 / 3; }

.article-sec > h2 { color: var(--v3-navy); font-size: clamp(1.35rem, 2.6vw, 1.7rem); line-height: 1.4; margin: 34px 0 14px; }
.article-sec > p, .article-step > p { line-height: 1.95; color: #425670; margin: 0 0 16px; }
.article-mini { color: var(--v3-clay); font-size: 1.02rem; margin: 22px 0 8px; }
.article-list { margin: 0 0 18px; padding-left: 22px; }
.article-list li { line-height: 1.9; margin: 6px 0; color: #425670; }

.article-step { padding: 24px 0 30px; border-top: 1px solid var(--v3-line); scroll-margin-top: 100px; }
.step-number { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em; color: var(--v3-clay); }
.article-step h2 { font-size: clamp(1.25rem, 2.4vw, 1.55rem); line-height: 1.4; color: var(--v3-navy-deep); margin: 8px 0 14px; }
.step-figure { margin: 0 0 14px; }
.step-figure img { width: 100%; height: auto; border-radius: 14px; display: block; }
.step-labels { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.step-labels .v3-chip { pointer-events: none; cursor: default; color: var(--v3-navy-deep); border-color: var(--v3-line); background: var(--v3-soft); padding: 3px 12px; font-size: 0.85rem; }

.checklist-list { list-style: none; margin: 0; padding: 0; }
.checklist-list li { position: relative; padding-left: 34px; line-height: 1.85; margin: 10px 0; }
.checklist-list li::before { content: ""; position: absolute; left: 0; top: 0.4em; width: 17px; height: 17px; border: 2px solid rgba(255, 255, 255, 0.75); border-radius: 5px; }

.article-table-wrap { overflow-x: auto; margin: 18px 0 26px; }
.article-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; line-height: 1.7; }
.article-table th { background: var(--v3-navy); color: #fff; text-align: left; padding: 10px 12px; }
.article-table td { border: 1px solid var(--v3-line); padding: 10px 12px; vertical-align: top; color: #425670; }
.article-table tbody tr:nth-child(even) { background: var(--v3-soft); }

@media (max-width: 640px) {
  .article-photos { grid-template-columns: 1fr; }
  .article-table thead { display: none; }
  .article-table, .article-table tbody, .article-table tr, .article-table td { display: block; width: 100%; }
  .article-table tr { border: 1px solid var(--v3-line); border-radius: 12px; margin-bottom: 12px; padding: 8px 12px; background: var(--v3-soft); }
  .article-table td { border: 0; padding: 6px 0; }
  .article-table td::before { content: attr(data-label) ": "; font-weight: 700; color: var(--v3-navy); }
  .article-table td:first-child { font-weight: 700; color: var(--v3-navy-deep); font-size: 1rem; }
  .article-table td:first-child::before { content: ""; }
}

/* ท้ายบทความ: แถบแชร์ + การ์ด "อ่านต่อ" 3 เรื่อง (T-0055)
   .article-foot-inner กว้างเท่าคอลัมน์อ่าน .article-v2 (T-0060: ขอบตาม --gutter) */
.article-foot { border-top: 1px solid var(--v3-line); margin-top: 26px; }
.article-foot-inner { width: min(720px, calc(100% - 2*var(--gutter))); margin: 0 auto; padding-top: 22px; }
/* T-0060: หน้ารวม — กล่องน้ำเงินตามหลังตารางการ์ด ให้ชิดขึ้น (เคยห่าง 96+88 เกินช่องไฟส่วนอื่น)
   T-0064: padding กลุ่มสุดท้ายเหลือ 24px จึงตั้ง margin 24 ให้รวม 48px เท่าช่องว่างระหว่างกลุ่ม */
.art-group ~ .cta-band { margin-top: 24px; }

.article-share { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; padding-bottom: 36px; }
.article-share-label { color: var(--v3-navy); font-weight: 700; font-size: 0.9rem; }
.article-share-row { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.share-btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border: 0; border-radius: 999px; background: var(--v3-navy); color: #fff; font-size: 0.88rem; font-weight: 500; line-height: 1.4; text-decoration: none; cursor: pointer; font-family: inherit; transition: background-color 0.15s ease, transform 0.1s ease; }
.share-btn:hover { background: var(--v3-navy-deep); color: #fff; }
.share-btn:active { background: var(--v3-navy-deep); transform: scale(0.94); }
.share-btn svg { flex: none; }
.share-btn.is-copied { background: var(--v3-clay); }
.share-check { display: none; }
.share-copy.is-copied .share-icon { display: none; }
.share-copy.is-copied .share-check { display: block; }

.article-related-title { color: var(--v3-navy); font-size: 1.25rem; line-height: 1.4; margin: 0 0 14px; }
.article-related-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; list-style: none; margin: 0; padding: 0; }
.art-rel-card { display: flex; flex-direction: column; height: 100%; text-decoration: none; background: var(--v3-soft); border-radius: 12px; overflow: hidden; }
.art-rel-thumb { display: block; aspect-ratio: 3 / 2; overflow: hidden; }
.art-rel-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-rel-body { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; }
.art-rel-meta { color: var(--v3-blue); font-size: 0.75rem; }
.art-rel-title { color: var(--v3-navy-deep); font-size: 0.92rem; line-height: 1.5; font-weight: 600; }
.art-rel-card:hover .art-rel-title { color: var(--v3-navy); }

@media (max-width: 640px) {
  .article-foot-inner { padding-top: 18px; }
  .article-share { padding-bottom: 32px; }
  .article-share-label { flex: 1 1 100%; }
  .article-share-row { gap: 12px; }
  .article-share-row .share-btn { width: 48px; height: 48px; padding: 0; justify-content: center; gap: 0; }
  .article-share-row .share-btn span { display: none; }
  .article-related-list { grid-template-columns: 1fr; gap: 10px; }
  .art-rel-card { flex-direction: row; align-items: stretch; }
  .art-rel-thumb { width: 112px; flex: none; aspect-ratio: 4 / 3; }
  .art-rel-body { justify-content: center; padding: 10px 14px 10px 12px; }
}

