/*
 * style-article.css — หน้าบทความ (member/article.php) ใช้ได้ทั้งธีม default และ wm356
 * โหลดเฉพาะหน้าบทความผ่าน $page_extra_head (ไม่เพิ่มน้ำหนักให้หน้าอื่น)
 * breakpoint ร่วม: ≤860px มือถือ (ตาม wm356) · 861–1199 แท็บเล็ต · ≥1200 PC
 * บล็อกหน้าแรก (.art-home) อยู่ใน style-deferred.css / wm356-app.css เพราะหน้าแรกไม่โหลดไฟล์นี้
 */
.art-page {
  --art-panel: rgba(18, 21, 29, .78);
  --art-panel-2: rgba(28, 32, 42, .9);
  --art-border: rgba(212, 175, 55, .26);
  --art-border-soft: rgba(255, 255, 255, .08);
  --art-text: #eef0f4;
  --art-muted: #a4acbb;
  --art-gold: #d4af37;
  --art-gold-2: #e0c587;
  --art-link: #f2cf7f;
  --art-radius: 14px;
  --art-shadow: 0 10px 30px -18px rgba(0, 0, 0, .7);
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 48px;
  color: var(--art-text);
  line-height: 1.7;
}
.art-page-list { width: min(1180px, calc(100% - 28px)); }
.wm-static-body .wm-static-wrap { max-width: 1220px; }
.wm-static-body .art-page { width: 100%; padding-top: 6px; }
.art-page a { color: var(--art-link); }
.art-page h1, .art-page h2, .art-page h3 { color: #fff; text-wrap: balance; }

/* breadcrumb */
.art-breadcrumb ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--art-muted); }
.art-breadcrumb li + li::before { content: '›'; margin-right: 8px; color: rgba(255, 255, 255, .35); }
.art-breadcrumb a { color: var(--art-muted); text-decoration: none; }
.art-breadcrumb a:hover { color: var(--art-link); }
.art-breadcrumb span[aria-current] { color: var(--art-text); }

/* หัวหน้ารวม */
.art-list-head { margin-bottom: 14px; }
.art-list-head h1 { font-size: clamp(24px, 3vw, 32px); margin: 0 0 6px; line-height: 1.25; }
.art-list-intro { margin: 0; color: var(--art-muted); max-width: 72ch; font-size: 15px; }
.art-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 18px; }
.art-chip {
  display: inline-flex; align-items: center; min-height: 32px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid var(--art-border); background: rgba(212, 175, 55, .08); color: var(--art-gold-2) !important;
  font-size: 13px; text-decoration: none !important; line-height: 1.2; white-space: nowrap;
}
.art-chip:hover, .art-chip.is-active { background: linear-gradient(135deg, #e0c587, #b8933f); color: #201806 !important; border-color: transparent; }
@media (max-width: 860px) { .art-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; } .art-chips::-webkit-scrollbar { display: none; } }

/* การ์ด */
.art-cards { display: grid; gap: 16px; }
.art-cards-grid.art-cols-1 { grid-template-columns: 1fr; }
.art-cards-grid.art-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.art-cards-grid.art-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.art-cards-grid.art-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1199px) { .art-cards-grid.art-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) {
  .art-cards-grid.art-cols-3, .art-cards-grid.art-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .art-cards { gap: 12px; }
}
@media (max-width: 480px) { .art-cards-grid.art-cols-2, .art-cards-grid.art-cols-3, .art-cards-grid.art-cols-4 { grid-template-columns: 1fr; } }
/* มือถือจอกว้าง/แท็บเล็ต (UA มือถือแต่จอ ≥ 600px): 1 คอลัมน์จะใหญ่เกิน → 2 คอลัมน์ */
@media (min-width: 600px) { .art-cards-grid.art-cols-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.art-cards-scroll { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 10px; scrollbar-width: thin; }
.art-cards-scroll .art-card { flex: 0 0 min(78vw, 320px); scroll-snap-align: start; }
.art-cards-list { grid-template-columns: 1fr; }
.art-cards-list .art-card { display: grid; grid-template-columns: 160px minmax(0, 1fr); }
.art-cards-list .art-card-cover { aspect-ratio: 4 / 3; height: 100%; }
@media (max-width: 480px) { .art-cards-list .art-card { grid-template-columns: 1fr; } .art-cards-list .art-card-cover { aspect-ratio: 16 / 9; } }

.art-card {
  display: flex; flex-direction: column; overflow: hidden; border-radius: var(--art-radius);
  border: 1px solid var(--art-border); background: var(--art-panel); box-shadow: var(--art-shadow);
  transition: transform .18s ease, border-color .18s ease;
}
.art-card:hover { transform: translateY(-2px); border-color: rgba(212, 175, 55, .5); }
.art-card-cover { position: relative; display: block; aspect-ratio: 16 / 9; background: #151a26; overflow: hidden; }
.art-card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.art-card-cover-empty { display: grid; place-items: center; width: 100%; height: 100%; color: rgba(212, 175, 55, .45); font-size: 34px; }
.art-badge { position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: rgba(0, 0, 0, .62); color: #fff; backdrop-filter: blur(4px); }
.art-badge-member { left: auto; right: 10px; background: rgba(31, 79, 216, .85); }
.art-badge-pin { background: rgba(212, 175, 55, .92); color: #201806; }
.art-card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 16px; }
.art-card-body .art-chip { align-self: flex-start; min-height: 26px; padding: 2px 10px; font-size: 12px; }
.art-card-title { margin: 0; font-size: 17px; line-height: 1.4; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art-card-title a { color: #fff; text-decoration: none; }
.art-card-title a:hover { color: var(--art-link); }
.art-card-excerpt { margin: 0; color: var(--art-muted); font-size: 14px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.art-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: auto; padding-top: 4px; font-size: 12.5px; color: var(--art-muted); }
.art-meta i { margin-right: 3px; color: var(--art-gold-2); }

/* การ์ดใหญ่ (featured) */
.art-card-featured { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); margin-bottom: 18px; }
.art-card-featured .art-card-cover { aspect-ratio: 16 / 9; height: 100%; }
.art-card-featured .art-card-body { padding: 22px 24px; justify-content: center; }
.art-card-featured .art-card-title { font-size: clamp(20px, 2.4vw, 26px); -webkit-line-clamp: 3; }
.art-card-featured .art-card-excerpt { -webkit-line-clamp: 4; font-size: 15px; }
@media (max-width: 860px) { .art-card-featured { grid-template-columns: 1fr; } .art-card-featured .art-card-body { padding: 16px; } }

/* ว่าง / 410 */
.art-empty { text-align: center; padding: 48px 20px; border: 1px dashed var(--art-border); border-radius: var(--art-radius); color: var(--art-muted); }
.art-empty i { font-size: 40px; color: var(--art-gold); margin-bottom: 10px; display: block; }
.art-empty h1 { font-size: 22px; margin: 0 0 6px; }
.art-empty p { margin: 0 0 16px; }
.art-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 20px; border-radius: 999px;
  background: linear-gradient(135deg, #e0c587, #b8933f); color: #201806 !important; font-weight: 700; text-decoration: none !important;
  border: 1px solid transparent;
}
.art-btn:hover { filter: brightness(1.06); }
.art-btn-ghost { background: transparent; color: var(--art-gold-2) !important; border-color: var(--art-border); }

/* pagination */
.art-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 24px; }
.art-page-link { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--art-border-soft); background: var(--art-panel); color: var(--art-text); text-decoration: none; font-size: 14px; }
.art-page-link:hover { border-color: var(--art-border); color: var(--art-link); }
.art-page-link.is-current { background: linear-gradient(135deg, #e0c587, #b8933f); color: #201806; border-color: transparent; font-weight: 700; }
.art-page-gap { align-self: center; color: var(--art-muted); padding: 0 4px; }

/* ---------- หน้าอ่าน ---------- */
.art-page-detail { width: min(1100px, calc(100% - 28px)); }
.art-preview-ribbon { margin-bottom: 12px; padding: 10px 14px; border-radius: 10px; background: rgba(255, 193, 7, .14); border: 1px solid rgba(255, 193, 7, .45); color: #ffd76a; font-size: 13.5px; }
.art-detail { display: block; }
.art-detail-head { max-width: 820px; margin: 0 auto 18px; text-align: center; }
.art-detail-head .art-chip { margin-bottom: 12px; }
.art-detail-head h1 { font-size: clamp(24px, 3.4vw, 38px); line-height: 1.25; margin: 0 0 10px; }
.art-lead { color: var(--art-muted); font-size: 16.5px; margin: 0 0 10px; }
.art-detail-head .art-meta { justify-content: center; margin-top: 0; }
.art-cover { margin: 0 auto 22px; max-width: 880px; border-radius: var(--art-radius); overflow: hidden; border: 1px solid var(--art-border); box-shadow: var(--art-shadow); }
.art-cover img { width: 100%; height: auto; display: block; }
.art-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 26px; max-width: 820px; margin: 0 auto; }
.has-toc .art-layout { max-width: 1100px; grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
.has-toc .art-side { position: sticky; top: 84px; }
.art-main { min-width: 0; }
@media (max-width: 1199px) {
  .has-toc .art-layout { grid-template-columns: minmax(0, 1fr); max-width: 820px; }
  .has-toc .art-side { position: static; }
}

/* สารบัญ */
.art-toc { border: 1px solid var(--art-border); border-radius: 12px; background: var(--art-panel); padding: 6px 14px 10px; font-size: 14px; }
.art-toc summary { cursor: pointer; font-weight: 700; color: var(--art-gold-2); padding: 8px 0; list-style: none; display: flex; align-items: center; gap: 8px; }
.art-toc summary::-webkit-details-marker { display: none; }
.art-toc summary::before { content: '☰'; font-size: 13px; }
.art-toc ol { list-style: none; margin: 0; padding: 4px 0 0; counter-reset: toc; }
.art-toc li { margin: 0; padding: 5px 0; border-top: 1px solid var(--art-border-soft); }
.art-toc li.art-toc-l3 { padding-left: 16px; font-size: 13px; }
.art-toc a { color: var(--art-text); text-decoration: none; display: block; }
.art-toc a:hover { color: var(--art-link); }

/* เนื้อหา */
.art-body { font-size: 16.5px; line-height: 1.85; word-break: break-word; overflow-wrap: anywhere; }
.art-font-s .art-body { font-size: 15px; }
.art-font-l .art-body { font-size: 18.5px; }
.art-body p { margin: 0 0 1.05em; }
.art-body h2 { font-size: 1.45em; margin: 1.6em 0 .6em; padding-left: 12px; border-left: 4px solid var(--art-gold); line-height: 1.3; scroll-margin-top: 84px; }
.art-body h3 { font-size: 1.2em; margin: 1.3em 0 .5em; scroll-margin-top: 84px; }
.art-body h4 { font-size: 1.05em; margin: 1.1em 0 .4em; color: var(--art-gold-2); }
.art-body img { max-width: 100%; height: auto; display: block; margin: 1.2em auto; border-radius: 12px; }
.art-body a { text-decoration: underline; text-underline-offset: 3px; }
.art-body ul, .art-body ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.art-body li { margin: .3em 0; }
.art-body blockquote { margin: 1.2em 0; padding: 12px 18px; border-left: 4px solid var(--art-gold); background: rgba(212, 175, 55, .07); border-radius: 0 10px 10px 0; color: #d8dbe3; }
.art-body pre, .art-body .ql-code-block-container { background: #0d1017; border: 1px solid var(--art-border-soft); border-radius: 10px; padding: 12px 14px; overflow-x: auto; font-size: .9em; margin: 0 0 1.1em; }
.art-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.art-body hr { border: 0; border-top: 1px solid var(--art-border); margin: 1.6em 0; }
.art-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95em; }
.art-body th, .art-body td { border: 1px solid var(--art-border-soft); padding: 8px 10px; text-align: left; vertical-align: top; }
.art-body th { background: rgba(212, 175, 55, .12); color: var(--art-gold-2); }
.art-body .ql-align-center { text-align: center; }
.art-body .ql-align-right { text-align: right; }
.art-body .ql-align-justify { text-align: justify; }
.art-body .ql-indent-1 { padding-left: 2em; }
.art-body .ql-indent-2 { padding-left: 4em; }
.art-body .ql-indent-3 { padding-left: 6em; }
.art-video { position: relative; aspect-ratio: 16 / 9; margin: 1.2em 0; border-radius: 12px; overflow: hidden; background: #000; }
.art-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* เฉพาะสมาชิก */
.art-paywall { position: relative; max-height: 220px; overflow: hidden; filter: blur(4px); opacity: .55; user-select: none; pointer-events: none; -webkit-mask-image: linear-gradient(#000 20%, transparent); mask-image: linear-gradient(#000 20%, transparent); }
.art-lock { margin: -40px 0 24px; position: relative; text-align: center; padding: 28px 18px; border-radius: var(--art-radius); border: 1px solid var(--art-border); background: var(--art-panel-2); box-shadow: var(--art-shadow); }
.art-lock i { font-size: 30px; color: var(--art-gold); }
.art-lock h2 { font-size: 20px; margin: 8px 0 4px; }
.art-lock p { color: var(--art-muted); margin: 0 0 14px; }
.art-lock-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* FAQ */
.art-faq { margin: 32px 0 8px; }
.art-faq h2 { font-size: 1.35em; margin: 0 0 12px; }
.art-faq-item { border: 1px solid var(--art-border-soft); border-radius: 10px; background: var(--art-panel); margin-bottom: 8px; }
.art-faq-item summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.art-faq-item summary::-webkit-details-marker { display: none; }
.art-faq-item summary::after { content: '+'; color: var(--art-gold); font-size: 20px; line-height: 1; flex: 0 0 auto; }
.art-faq-item[open] summary::after { content: '−'; }
.art-faq-answer { padding: 0 16px 14px; color: var(--art-muted); font-size: 15px; }

/* แท็ก / แชร์ / CTA */
.art-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 26px 0 0; color: var(--art-muted); }
.art-tag { padding: 3px 10px; border-radius: 8px; border: 1px solid var(--art-border-soft); background: rgba(255, 255, 255, .04); color: var(--art-text) !important; font-size: 13px; text-decoration: none !important; }
.art-tag:hover { border-color: var(--art-border); color: var(--art-link) !important; }
.art-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 18px 0 0; }
.art-share-label { font-size: 13px; color: var(--art-muted); margin-right: 4px; }
.art-share-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--art-border-soft); background: var(--art-panel); color: var(--art-text) !important; font: inherit; font-size: 13.5px; cursor: pointer; text-decoration: none !important; }
.art-share-btn:hover { border-color: var(--art-border); }
.art-share-line { border-color: rgba(6, 199, 85, .5); }
.art-share-line i { color: #06c755; }
.art-share-fb i { color: #4b8bff; }
.art-cta { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 28px 0 0; padding: 18px 20px; border-radius: var(--art-radius); border: 1px solid var(--art-border); background: linear-gradient(135deg, rgba(212, 175, 55, .16), rgba(212, 175, 55, .04)); }
.art-cta-text { display: grid; gap: 2px; }
.art-cta-text strong { font-size: 17px; color: #fff; }
.art-cta-text span { color: var(--art-muted); font-size: 14px; }
.art-cta-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 46px; padding: 8px 22px; border-radius: 999px; background: linear-gradient(135deg, #e0c587, #b8933f); color: #201806 !important; font-weight: 700; text-decoration: none !important; white-space: nowrap; }
.art-cta-btn:hover { filter: brightness(1.06); }

/* เกี่ยวข้อง */
.art-related { max-width: 1100px; margin: 36px auto 0; }
.art-related h2 { font-size: 1.3em; margin: 0 0 14px; padding-left: 12px; border-left: 4px solid var(--art-gold); }

/* สลับเวอร์ชัน */
.art-view-switch { text-align: center; margin-top: 26px; font-size: 13px; }
.art-view-switch a { color: var(--art-muted); text-decoration: none; }
.art-view-switch a:hover { color: var(--art-link); }

/* CTA ลอยล่าง (มือถือ) */
.art-sticky-cta { display: none; }
@media (max-width: 860px) {
  /* pill เล็กกลางจอ เว้นที่ให้ปุ่ม "ติดตั้งแอป" (ซ้ายล่าง) และปุ่มแชท (ขวาล่าง) ของธีม */
  .art-sticky-cta { display: block; position: fixed; left: 112px; right: 72px; bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 60; }
  .art-sticky-cta a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 14px; border-radius: 999px; background: linear-gradient(135deg, #e0c587, #b8933f); color: #201806 !important; font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none !important; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, .8); }
  .wm-static-body .art-sticky-cta { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .art-page-detail { padding-bottom: 90px; }
}

/* wm356: ฟอนต์/สีของ .wm-static-wrap ครอบ p/li ไว้ — ให้ของบทความชนะ */
.wm-static-body .art-page p, .wm-static-body .art-page li { color: inherit; font-size: inherit; line-height: inherit; }
.wm-static-body .art-body p, .wm-static-body .art-body li { color: var(--art-text); }
.wm-static-body .art-page h1, .wm-static-body .art-page h2, .wm-static-body .art-page h3 { color: #fff; }
.wm-static-body .art-page h1::before { display: none; }
.wm-static-body .art-page small { color: var(--art-muted); }
.wm-static-body .art-page section { border: 0; padding: 0; background: none; }

@media (prefers-reduced-motion: reduce) { .art-card { transition: none; } .art-card:hover { transform: none; } }

/* ก่อนหน้า/ถัดไป + ลิงก์อัตโนมัติ (เฟส 3) */
.art-adjacent { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0 0; }
.art-adj { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--art-border-soft); background: var(--art-panel); text-decoration: none !important; color: var(--art-text) !important; min-width: 0; }
.art-adj:hover { border-color: var(--art-border); }
.art-adj span { font-size: 12px; color: var(--art-muted); }
.art-adj strong { font-size: 14.5px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.art-adj-next { text-align: right; align-items: flex-end; }
@media (max-width: 480px) { .art-adjacent { grid-template-columns: 1fr; } .art-adj-next { text-align: left; align-items: flex-start; } }
.art-body a.art-autolink { text-decoration-style: dotted; }
