/* บทความ หมวด หน้าค้นหา หน้าไม่พบ และหน้าทั่วไป: หัวเว็บ ท้ายเว็บ และสีเดียวกับหน้ารีไฟแนนซ์
   สี ปุ่ม หัวเว็บ และท้ายเว็บคัดลอกมาจาก index.html ถ้าแก้ที่นั่น ให้แก้ที่นี่ด้วย */
:root {
  --red: #d7141a;
  --red-dark: #a80f14;
  --red-deep: #7a0b0f;
  --red-soft: #fdeeee;
  --ink: #0f172a;
  --ink-2: #1e293b;
  --muted: #475569;
  --subtle: #556072;
  --line: #e2e8f0;
  --bg: #f5f6f8;
  --focus: #2563eb;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --sh-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.06);
  --sh-md: 0 4px 12px rgba(15,23,42,.07), 0 2px 4px rgba(15,23,42,.04);
  --sh-lg: 0 24px 48px -12px rgba(15,23,42,.18), 0 8px 16px -8px rgba(15,23,42,.08);
  --ease: cubic-bezier(.2,.7,.2,1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-color: #cbd5e1 transparent; }
body {
  margin: 0;
  font-family: "Noto Sans Thai Looped", system-ui, sans-serif;
  font-weight: 400;
  font-size: 16.5px;
  line-height: 1.7;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip; /* รูปเต็มจอในบทความ (alignfull) ไม่ให้เกิดแถบเลื่อนแนวนอน */
}
h1, h2, h3 { line-height: 1.3; letter-spacing: -.01em; text-wrap: balance; }
p, li { text-wrap: pretty; }
a { color: var(--red); text-underline-offset: .2em; }
::selection { background: #fbd5d6; color: var(--red-deep); }
input { caret-color: var(--red); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -64px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: #fff; box-shadow: var(--sh-md); font-weight: 600; }
.skip:focus { top: 12px; }

/* ---------- หัวเว็บ ---------- */
.site-hd {
  position: sticky; top: 0; z-index: 30;
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid rgba(226,232,240,.8);
}
.admin-bar .site-hd { top: 32px; }
@media (max-width: 782px) { .admin-bar .site-hd { top: 46px; } }
@media (max-width: 600px) { .admin-bar .site-hd { top: 0; } } /* จอนี้แถบผู้ดูแลเลื่อนตามหน้า */
.bar { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
.brand { display: flex; align-items: center; flex-shrink: 0; }
.brand img { display: block; height: 48px; width: auto; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; padding: 8px 12px; border-radius: 8px; white-space: nowrap; transition: color .2s, background .2s; }
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current] { color: var(--red-dark); background: var(--red-soft); }

/* ---------- ปุ่ม ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 24px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--red); color: #fff; font: inherit; font-size: 16px; font-weight: 600; text-decoration: none;
  box-shadow: 0 1px 0 rgba(255,255,255,.2) inset, 0 6px 16px -6px rgba(215,20,26,.55);
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
  touch-action: manipulation;
}
.btn:hover { background: var(--red-dark); }
.btn:active { transform: scale(.98); }
.btn.sm { min-height: 44px; padding: 8px 18px; font-size: 15px; border-radius: 10px; }
.btn.outline-red { background: #fff; color: var(--red); border: 1.5px solid var(--red); box-shadow: none; }
.btn.outline-red:hover { background: #fdecec; }

/* ---------- รวมบทความ หมวด และหน้าค้นหา ---------- */
.blog-head { display: grid; gap: 10px; padding: 48px 0 32px; }
.blog-head h1 { margin: 0; font-size: clamp(28px, 3.4vw, 40px); font-weight: 700; }
.blog-head p { margin: 0; max-width: 60ch; color: var(--muted); }
.blog-search { display: flex; gap: 8px; width: 100%; max-width: 460px; margin-top: 6px; }
.blog-search input {
  flex: 1; min-width: 0; min-height: 44px; padding: 10px 14px;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  font: inherit; font-size: 16px; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.blog-search input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 4px rgba(215,20,26,.12); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 24px; }
main > .cards { padding-bottom: 56px; }
.card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--sh-lg); }
.card:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
/* บทความที่ยังไม่มีรูปเด่น: พื้นแดงแบบส่วนบนสุดของหน้าแรก */
.card-img { aspect-ratio: 16 / 9; display: grid; place-items: center; background: linear-gradient(120deg, var(--red-deep), var(--red-dark) 55%, var(--red)); }
.card-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-img span { color: rgba(255,255,255,.8); font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.card-body { flex: 1; display: grid; align-content: start; gap: 8px; padding: 18px 20px 20px; }
.card-cat { justify-self: start; padding: 2px 10px; border-radius: 999px; background: var(--red-soft); color: var(--red-dark); font-size: 12.5px; font-weight: 600; }
.card h2, .card h3 { margin: 0; font-size: 18.5px; font-weight: 700; line-height: 1.4; }
.card h2 a, .card h3 a { color: var(--ink); text-decoration: none; outline: none; transition: color .2s; }
.card h2 a::after, .card h3 a::after { content: ""; position: absolute; inset: 0; } /* กดได้ทั้งการ์ด */
.card:hover h2 a, .card:hover h3 a { color: var(--red); }
.card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card time { margin-top: 4px; color: var(--subtle); font-size: 13.5px; }

.pagination { padding: 0 0 72px; }
.nav-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.page-numbers {
  display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  color: var(--ink); font-weight: 600; text-decoration: none;
}
a.page-numbers:hover { border-color: var(--red); color: var(--red); }
.page-numbers.current { border-color: var(--red); background: var(--red); color: #fff; }
.page-numbers.dots { border: 0; background: none; }

.empty { display: grid; justify-items: center; gap: 10px; margin-bottom: 72px; padding: 48px 24px; text-align: center; background: #fff; border: 1px dashed #cbd5e1; border-radius: var(--r-lg); }
.empty h2 { margin: 0; font-size: 20px; }
.empty p { margin: 0 0 6px; color: var(--muted); }

/* ---------- บทความ ---------- */
.post-head { max-width: 760px; margin: 0 auto; padding: 40px 20px 24px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--subtle); font-size: 14.5px; }
.crumbs a { color: var(--muted); font-weight: 500; text-decoration: none; }
.crumbs a:hover { color: var(--red); }
.post-head h1 { margin: 10px 0; font-size: clamp(28px, 4vw, 42px); font-weight: 700; line-height: 1.25; }
.post-head h1:only-child { margin-bottom: 0; }
.meta { margin: 0; color: var(--subtle); font-size: 14.5px; }
.post-cover { max-width: 1040px; margin: 8px auto 0; padding: 0 20px; }
.post-cover img { display: block; width: 100%; height: auto; border-radius: var(--r-lg); box-shadow: var(--sh-md); }

.prose { display: flow-root; max-width: 760px; margin: 0 auto; padding: 32px 20px 0; font-size: 17.5px; line-height: 1.85; }
.prose > * { margin-top: 0; margin-bottom: 1.1em; }
.prose h2 { margin: 1.8em 0 .6em; font-size: clamp(22px, 2.6vw, 27px); font-weight: 700; }
.prose h3 { margin: 1.5em 0 .5em; font-size: 20.5px; font-weight: 700; }
.prose h4 { margin: 1.3em 0 .4em; font-size: 18px; font-weight: 700; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .35em 0; }
.prose li::marker { color: var(--red); font-weight: 700; }
.prose a { font-weight: 500; }
.prose strong, .prose b { font-weight: 700; }
.prose img { max-width: 100%; height: auto; border-radius: var(--r-md); }
.prose figure { margin: 1.6em 0; }
.prose figcaption, .prose .wp-element-caption { margin-top: 8px; color: var(--subtle); font-size: 14px; text-align: center; }
.prose blockquote { position: relative; margin: 1.8em 0; padding: 0 0 0 44px; color: var(--ink-2); font-size: 19px; font-weight: 500; }
.prose blockquote::before { content: "\201C"; position: absolute; left: 0; top: -.15em; color: var(--red); font-size: 64px; font-weight: 800; line-height: 1; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote cite { display: block; margin-top: 6px; color: var(--subtle); font-size: 14.5px; font-style: normal; }
.prose hr { margin: 2.2em 0; border: 0; border-top: 1px solid var(--line); }
.prose .wp-block-table { overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15.5px; line-height: 1.6; background: #fff; }
.prose table th, .prose table td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose table th { background: var(--bg); font-weight: 600; }
.prose .wp-block-button__link { display: inline-flex; min-height: 48px; align-items: center; padding: 12px 24px; border-radius: 12px; background: var(--red); color: #fff; font-weight: 600; text-decoration: none; }
.prose .wp-block-button__link:hover { background: var(--red-dark); }
.prose .is-style-outline .wp-block-button__link { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.prose .alignleft { float: left; max-width: 50%; margin: .3em 1.4em 1em 0; }
.prose .alignright { float: right; max-width: 50%; margin: .3em 0 1em 1.4em; }
.prose .aligncenter { margin-left: auto; margin-right: auto; text-align: center; }
.prose .alignwide { width: min(1000px, 100vw - 40px); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.prose .alignfull { width: 100vw; max-width: none; margin-left: calc(50% - 50vw); }
.prose .alignfull img { border-radius: 0; }

.post-tags { display: flex; flex-wrap: wrap; gap: 8px; max-width: 760px; margin: 8px auto 0; padding: 0 20px; }
.post-tags a { padding: 4px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 14px; text-decoration: none; }
.post-tags a:hover { border-color: var(--red); color: var(--red); }

.post-cta { max-width: 760px; margin: 40px auto 0; padding: 0 20px; }
.post-cta > div {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; padding: 26px 28px;
  border-radius: var(--r-xl); color: #fff; box-shadow: var(--sh-lg);
  background: linear-gradient(120deg, var(--red-deep), var(--red-dark) 55%, var(--red));
}
.post-cta .txt { flex: 1 1 240px; display: grid; gap: 2px; margin: 0; line-height: 1.45; }
.post-cta .txt b { font-size: 21px; font-weight: 700; }
.post-cta .txt span { color: rgba(255,255,255,.85); font-size: 15.5px; }
.post-cta .btn { background: #fff; color: var(--red-dark); box-shadow: 0 10px 24px -12px rgba(40,0,0,.6); }
.post-cta .btn:hover { background: #fdecec; }
.post-cta .btn.ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.5); box-shadow: none; }
.post-cta .btn.ghost:hover { background: rgba(255,255,255,.12); border-color: #fff; }

.more { padding-top: 64px; padding-bottom: 72px; }
.more h2 { margin: 0 0 20px; font-size: 24px; font-weight: 700; }
main > .prose:last-child { padding-bottom: 72px; }
.post-cta:last-child { margin-bottom: 72px; }

/* ---------- หน้าไม่พบ ---------- */
.lost { display: grid; justify-items: center; gap: 12px; max-width: 560px; margin: 0 auto; padding: 72px 20px 88px; text-align: center; }
.lost-code { margin: 0; font-size: 64px; font-weight: 800; line-height: 1; color: var(--red); letter-spacing: -.02em; }
.lost h1 { margin: 0; font-size: 30px; }
.lost p { margin: 0; color: var(--muted); }
.lost .blog-search { margin: 10px 0 4px; }
.lost-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }

/* ---------- ท้ายเว็บ ---------- */
.site-ft { background: #fff; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; padding: 28px 0; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; }
.foot-brand { display: grid; gap: 2px; }
.foot-brand b { color: var(--ink); font-size: 16px; font-weight: 600; }
.foot a { color: var(--red); }
.socials { display: flex; gap: 10px; margin-top: 10px; }
.foot .socials a { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; transition: transform .15s var(--ease), box-shadow .2s; }
.foot .socials a:hover { transform: translateY(-2px); box-shadow: 0 8px 16px -8px rgba(15,23,42,.5); }
.socials .fb { background: #1877f2; }
.socials .ig { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fd5949 45%, #d6249f 60%, #285aeb 90%); }
.socials .line { background: #06c755; }
.foot-legal { margin: 0; max-width: 48ch; align-self: end; }

/* ปุ่มโทรมุมขวาบนและแถบล่าง: เฉพาะจอแคบ */
.hdr-call, .mbar { display: none; }
.mbar-call {
  width: 48px; height: 48px; flex-shrink: 0; display: grid; place-items: center; border-radius: 12px;
  color: var(--red); background: #fff; border: 1.5px solid #f3c9cb; text-decoration: none;
  transition: background .2s, transform .15s var(--ease); touch-action: manipulation;
}
.mbar-call:active { transform: scale(.94); background: var(--red-soft); }

a:focus-visible, .btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 900px) {
  .nav .hide-sm { display: none; } /* แถบล่างมีปุ่มเช็กวงเงินแล้ว ท้ายเว็บมีช่องทางติดต่อ */
  .bar { gap: 10px; }
  .nav { margin-left: auto; }
  .hdr-call {
    display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 8px 14px; border-radius: 999px;
    color: #fff; background: var(--red); font-size: 15px; font-weight: 700; text-decoration: none; white-space: nowrap;
    box-shadow: 0 6px 14px -6px rgba(215,20,26,.6); touch-action: manipulation;
  }
  .hdr-call:active { transform: scale(.96); background: var(--red-dark); }
  .mbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(15,23,42,.08);
  }
  .mbar .info { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.35; color: var(--subtle); }
  .mbar .info b { display: block; font-size: 17px; color: var(--ink); }
  .mbar .btn { padding: 12px 20px; flex-shrink: 0; }
  body { padding-bottom: 76px; }
}
@media (max-width: 360px) {
  .brand img { height: 42px; }
  .hdr-call span { display: none; }
  .hdr-call { width: 42px; padding: 0; justify-content: center; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 16px; }
  .blog-head { padding: 32px 0 24px; }
  .cards { gap: 16px; }
  .post-head { padding: 28px 16px 18px; }
  .post-cover { padding: 0; }
  .post-cover img { border-radius: 0; box-shadow: none; }
  .prose { padding: 24px 16px 0; font-size: 17px; }
  .prose .alignleft, .prose .alignright { float: none; max-width: 100%; margin: 1.4em 0; }
  .prose .alignwide { width: 100%; margin-left: 0; transform: none; }
  .post-tags, .post-cta { padding: 0 16px; }
  .post-cta > div { padding: 22px 20px; }
  .post-cta .btn { flex: 1 1 100%; }
  .more { padding-top: 48px; padding-bottom: 56px; }
  .foot .socials a { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
