/* =========================================================
   rakaklang.yotathai.com — ราคากลางงานก่อสร้างราชการ
   Design v2: Kanit ทั้งเว็บ · สีประจำหมวด · ลายกริดเขียนแบบ
   ========================================================= */

:root {
  --bg: #f4f6fb;
  --bg-soft: #e9edf6;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: rgba(15, 23, 42, 0.09);
  --text: #0f172a;
  --text-muted: #46546b;
  --text-faint: #64748b;

  --primary: #4f46e5;
  --primary-strong: #4338ca;
  --primary-soft: #eef2ff;
  --primary-rgb: 79, 70, 229;

  /* สีประจำหมวด */
  --c-blue: #2563eb;      --c-blue-soft: #eff6ff;      --c-blue-rgb: 37, 99, 235;
  --c-emerald: #059669;   --c-emerald-soft: #ecfdf5;   --c-emerald-rgb: 5, 150, 105;
  --c-amber: #d97706;     --c-amber-soft: #fffbeb;     --c-amber-rgb: 217, 119, 6;
  --c-rose: #e11d48;      --c-rose-soft: #fff1f2;      --c-rose-rgb: 225, 29, 72;
  --c-violet: #7c3aed;    --c-violet-soft: #f5f3ff;    --c-violet-rgb: 124, 58, 237;
  --c-sky: #0284c7;       --c-sky-soft: #f0f9ff;       --c-sky-rgb: 2, 132, 199;

  --accent: var(--c-amber);
  --accent-soft: var(--c-amber-soft);
  --emerald: var(--c-emerald);
  --emerald-soft: var(--c-emerald-soft);
  --rose: var(--c-rose);

  --grid-line: rgba(79, 70, 229, 0.07);

  --font-thai: 'Kanit', 'Sarabun', sans-serif;
  --font-num: 'Kanit', sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, .06), 0 18px 50px rgba(15, 23, 42, .14);
  --transition: all .25s cubic-bezier(.4, 0, .2, 1);
  --maxw: 1100px;
}

html[data-theme="dark"] {
  --bg: #0b1120;
  --bg-soft: #0f172a;
  --surface: #111b31;
  --surface-2: #16213a;
  --border: rgba(255, 255, 255, 0.1);
  --text: #e8edf6;
  --text-muted: #9daebf;
  --text-faint: #7c8aa0;

  --primary: #818cf8;
  --primary-strong: #a5b4fc;
  --primary-soft: rgba(99, 102, 241, 0.16);

  --c-blue: #60a5fa;      --c-blue-soft: rgba(37, 99, 235, 0.16);
  --c-emerald: #34d399;   --c-emerald-soft: rgba(5, 150, 105, 0.16);
  --c-amber: #fbbf24;     --c-amber-soft: rgba(217, 119, 6, 0.16);
  --c-rose: #fb7185;      --c-rose-soft: rgba(225, 29, 72, 0.16);
  --c-violet: #a78bfa;    --c-violet-soft: rgba(124, 58, 237, 0.16);
  --c-sky: #38bdf8;       --c-sky-soft: rgba(2, 132, 199, 0.16);

  --grid-line: rgba(129, 140, 248, 0.08);

  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 18px 50px rgba(0, 0, 0, .5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-thai);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

b, strong { font-weight: 600; }
img, svg { max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 14px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none !important; }
.brand img { width: 36px; height: 36px; object-fit: contain; }
.brand-name { font-weight: 700; font-size: 1.05rem; color: var(--text); line-height: 1.2; }
.brand-name small { display: block; font-weight: 300; font-size: .7rem; color: var(--text-faint); letter-spacing: .04em; }

.main-nav { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.main-nav a {
  padding: 8px 13px; border-radius: 999px;
  color: var(--text-muted); font-weight: 400; font-size: .92rem;
  transition: var(--transition); text-decoration: none !important;
}
.main-nav a:hover { color: var(--primary); background: var(--primary-soft); }
.main-nav a.active { color: var(--primary); background: var(--primary-soft); font-weight: 500; }

.theme-toggle {
  margin-left: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; transition: var(--transition);
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--primary); border-color: var(--primary); }

.nav-burger { display: none; }

@media (max-width: 860px) {
  .main-nav {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 12px 16px 16px; box-shadow: var(--shadow-lg);
    display: none;
  }
  .main-nav.open { display: flex; }
  .main-nav a { border-radius: var(--radius-sm); }
  .nav-burger {
    display: inline-flex; align-items: center; justify-content: center;
    margin-left: auto; width: 40px; height: 40px;
    background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
    color: var(--text); font-size: 1.15rem; cursor: pointer;
  }
  .theme-toggle { margin-left: 0; }
}

/* ---------- Blueprint grid (ลายกระดาษเขียนแบบ) ---------- */
.blueprint {
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 52px 0 50px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 80% at 8% -20%, rgba(var(--c-violet-rgb), .13), transparent),
    radial-gradient(ellipse 55% 75% at 92% -15%, rgba(var(--c-sky-rgb), .13), transparent),
    radial-gradient(ellipse 80% 60% at 50% 115%, rgba(var(--primary-rgb), .10), transparent),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}
.hero-grid-layer {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
}
.hero-inner { position: relative; display: flex; align-items: center; gap: 36px; }
.hero-copy { flex: 1.15; min-width: 0; }
.hero-art { flex: .85; min-width: 0; }
.hero-art svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 30px rgba(15, 23, 42, .12)); }
@media (max-width: 900px) {
  .hero-inner { flex-direction: column; }
  .hero-art { width: 100%; max-width: 480px; }
}

.hero h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.55rem);
  font-weight: 700; line-height: 1.32; letter-spacing: -.2px;
}
.hero h1 .hl {
  background: linear-gradient(100deg, var(--primary), var(--c-violet) 55%, var(--c-sky));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin-top: 14px; max-width: 33em; color: var(--text-muted); font-size: 1.02rem; }
.hero-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; }

.badge-update {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-weight: 500; font-size: .84rem;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
}
.badge-update .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .35; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: 999px;
  font-family: var(--font-thai); font-weight: 500; font-size: .95rem;
  cursor: pointer; transition: var(--transition);
  text-decoration: none !important; border: 1px solid transparent;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--c-violet));
  color: #fff; box-shadow: 0 6px 20px rgba(var(--primary-rgb), .35);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(var(--primary-rgb), .45); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Sections ---------- */
section.block { padding: 54px 0; }
section.block.alt { background: var(--bg-soft); border-block: 1px solid var(--border); }

.section-head { margin-bottom: 28px; }
.section-head .kicker {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--primary); font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .14em;
}
.section-head .kicker::before {
  content: ""; width: 22px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--c-violet));
}
.section-head h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 600; margin-top: 6px; }
.section-head p { color: var(--text-muted); margin-top: 8px; max-width: 46em; }

/* ---------- Cards + สีประจำหมวด ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.card {
  --card-accent: var(--primary);
  --card-accent-soft: var(--primary-soft);
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); transition: var(--transition);
  display: flex; flex-direction: column;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--card-accent), color-mix(in srgb, var(--card-accent) 45%, transparent));
  opacity: 0; transition: var(--transition);
}
a.card { color: var(--text); text-decoration: none !important; }
a.card:hover, .card.hoverable:hover {
  transform: translateY(-4px); box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--card-accent) 40%, var(--border));
}
a.card:hover::before, .card.hoverable:hover::before { opacity: 1; }

.card .icon {
  width: 48px; height: 48px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: var(--card-accent-soft); color: var(--card-accent);
}
.card .icon svg { width: 26px; height: 26px; }
.card h3 { font-size: 1.06rem; font-weight: 600; margin-bottom: 6px; }
.card p { color: var(--text-muted); font-size: .92rem; flex: 1; }
.card .cta { margin-top: 14px; color: var(--card-accent); font-weight: 500; font-size: .9rem; }

.accent-blue    { --card-accent: var(--c-blue);    --card-accent-soft: var(--c-blue-soft); }
.accent-emerald { --card-accent: var(--c-emerald); --card-accent-soft: var(--c-emerald-soft); }
.accent-amber   { --card-accent: var(--c-amber);   --card-accent-soft: var(--c-amber-soft); }
.accent-rose    { --card-accent: var(--c-rose);    --card-accent-soft: var(--c-rose-soft); }
.accent-violet  { --card-accent: var(--c-violet);  --card-accent-soft: var(--c-violet-soft); }
.accent-sky     { --card-accent: var(--c-sky);     --card-accent-soft: var(--c-sky-soft); }

/* kicker ตามสีหมวด */
.section-head.k-blue .kicker    { color: var(--c-blue); }    .section-head.k-blue .kicker::before    { background: var(--c-blue); }
.section-head.k-emerald .kicker { color: var(--c-emerald); } .section-head.k-emerald .kicker::before { background: var(--c-emerald); }
.section-head.k-amber .kicker   { color: var(--c-amber); }   .section-head.k-amber .kicker::before   { background: var(--c-amber); }
.section-head.k-rose .kicker    { color: var(--c-rose); }    .section-head.k-rose .kicker::before    { background: var(--c-rose); }
.section-head.k-sky .kicker     { color: var(--c-sky); }     .section-head.k-sky .kicker::before     { background: var(--c-sky); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; position: relative; padding-left: 30px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 3px; border-radius: 2px;
  background: linear-gradient(180deg, var(--c-sky), var(--primary), var(--c-violet), var(--c-amber));
}
.timeline li { position: relative; padding-bottom: 22px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
  content: ""; position: absolute; left: -27.5px; top: 7px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--surface); border: 3.5px solid var(--primary);
}
.timeline li:nth-child(1)::before { border-color: var(--c-sky); }
.timeline li:nth-child(2)::before { border-color: var(--primary); }
.timeline li:nth-child(3)::before { border-color: var(--c-violet); }
.timeline li:nth-child(4)::before { border-color: var(--c-amber); }
.timeline .t-date { font-weight: 600; color: var(--primary); font-size: .88rem; }
.timeline li:nth-child(1) .t-date { color: var(--c-sky); }
.timeline li:nth-child(3) .t-date { color: var(--c-violet); }
.timeline li:nth-child(4) .t-date { color: var(--c-amber); }
.timeline .t-title { font-weight: 500; }
.timeline p { color: var(--text-muted); font-size: .92rem; }

/* ---------- อินโฟกราฟิกสูตรราคากลาง ---------- */
.formula-diagram { display: flex; flex-direction: column; gap: 10px; }
.fd-row { display: flex; align-items: stretch; gap: 10px; }
.fd-op {
  align-self: center; flex: 0 0 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 1.15rem; color: var(--text-faint);
  background: var(--surface); border: 1px solid var(--border); border-radius: 50%;
}
.fd-box {
  --fd: var(--primary); --fd-soft: var(--primary-soft);
  flex: 1; background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--fd) 30%, var(--border));
  border-left: 5px solid var(--fd);
  border-radius: var(--radius-sm); padding: 13px 16px;
  box-shadow: var(--shadow); position: relative;
}
.fd-box .fd-part {
  font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fd);
}
.fd-box .fd-main { font-weight: 500; font-size: 1rem; line-height: 1.45; }
.fd-box .fd-note { font-size: .8rem; color: var(--text-muted); font-weight: 300; }
.fd-flag {
  position: absolute; top: 10px; right: 12px;
  font-size: .68rem; font-weight: 500; padding: 2px 10px; border-radius: 999px;
  background: var(--fd-soft); color: var(--fd); white-space: nowrap;
}
.fd-box.fd-blue    { --fd: var(--c-blue);    --fd-soft: var(--c-blue-soft); }
.fd-box.fd-emerald { --fd: var(--c-emerald); --fd-soft: var(--c-emerald-soft); }
.fd-box.fd-amber   { --fd: var(--c-amber);   --fd-soft: var(--c-amber-soft); }
.fd-result {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(120deg, var(--primary), var(--c-violet));
  color: #fff; border-radius: var(--radius-sm); padding: 15px 18px;
  box-shadow: 0 10px 26px rgba(var(--primary-rgb), .35);
}
.fd-result .fd-eq { font-size: 1.5rem; font-weight: 600; }
.fd-result .fd-label { font-weight: 600; font-size: 1.12rem; }
.fd-result .fd-sub { font-size: .8rem; opacity: .85; font-weight: 300; }
@media (max-width: 560px) {
  .fd-flag { position: static; display: inline-block; margin-top: 4px; }
}

/* ---------- แผนภาพขั้นตอน (stepper) ---------- */
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; counter-reset: step; }
@media (max-width: 1020px) { .steps { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px)  { .steps { grid-template-columns: repeat(2, 1fr); } }
.step {
  --st: var(--primary); --st-soft: var(--primary-soft);
  position: relative; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 40px 14px 14px; box-shadow: var(--shadow);
  transition: var(--transition);
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--st) 40%, var(--border)); }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: -14px; left: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--st); color: #fff; font-weight: 600; font-size: .9rem;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--st) 45%, transparent);
}
.step .st-icon {
  position: absolute; top: 8px; right: 10px;
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--st-soft); color: var(--st);
}
.step .st-icon svg { width: 19px; height: 19px; }
.step h4 { font-size: .92rem; font-weight: 600; line-height: 1.4; }
.step p { font-size: .8rem; color: var(--text-muted); margin-top: 3px; line-height: 1.55; }
.step.s1 { --st: var(--c-sky);     --st-soft: var(--c-sky-soft); }
.step.s2 { --st: var(--c-blue);    --st-soft: var(--c-blue-soft); }
.step.s3 { --st: var(--primary);   --st-soft: var(--primary-soft); }
.step.s4 { --st: var(--c-violet);  --st-soft: var(--c-violet-soft); }
.step.s5 { --st: var(--c-amber);   --st-soft: var(--c-amber-soft); }
.step.s6 { --st: var(--c-emerald); --st-soft: var(--c-emerald-soft); }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
table.data { width: 100%; border-collapse: collapse; min-width: 560px; }
table.data th {
  text-align: left; font-size: .8rem; letter-spacing: .05em; font-weight: 600;
  color: var(--text-faint); text-transform: uppercase;
  padding: 14px 18px; border-bottom: 2px solid var(--border);
  background: var(--surface-2);
}
table.data td { padding: 13px 18px; border-bottom: 1px solid var(--border); vertical-align: top; font-weight: 300; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
table.data tr:last-child td { border-bottom: none; }
table.data td .src-name { font-weight: 500; }
table.data td .src-desc { color: var(--text-muted); font-size: .88rem; }
.tag {
  display: inline-block; font-size: .72rem; font-weight: 500;
  padding: 2px 10px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary); white-space: nowrap;
}
.tag.official { background: var(--c-emerald-soft); color: var(--c-emerald); }
.tag.yotathai { background: var(--c-amber-soft); color: var(--c-amber); }
.tag.blue     { background: var(--c-blue-soft); color: var(--c-blue); }
.tag.rose     { background: var(--c-rose-soft); color: var(--c-rose); }
.tag.violet   { background: var(--c-violet-soft); color: var(--c-violet); }

/* แถบสีหัวคอลัมน์เปรียบเทียบ */
table.data th.th-primary { color: var(--primary); border-bottom-color: var(--primary); }
table.data th.th-amber   { color: var(--c-amber); border-bottom-color: var(--c-amber); }

/* ---------- Callouts ---------- */
.callout {
  border-radius: var(--radius-sm); padding: 16px 20px;
  border: 1px solid; font-size: .95rem; margin: 18px 0;
  font-weight: 300;
}
.callout.warn { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.callout.warn strong { color: var(--accent); }
.callout.info { background: var(--primary-soft); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.callout.info strong { color: var(--primary); }
.callout.good { background: var(--c-emerald-soft); border-color: color-mix(in srgb, var(--c-emerald) 35%, transparent); }
.callout.good strong { color: var(--c-emerald); }

/* ---------- Prose ---------- */
.prose h2 { font-size: 1.4rem; font-weight: 600; margin: 42px 0 14px; display: flex; align-items: center; gap: 10px; }
.prose h2:first-child { margin-top: 0; }
.prose h2 .num {
  flex: 0 0 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary); font-size: 1rem; font-weight: 600;
}
.prose h3 { font-size: 1.1rem; font-weight: 600; margin: 26px 0 10px; }
.prose p { margin-bottom: 14px; }
.prose ul, .prose ol { margin: 0 0 16px 1.4em; }
.prose li { margin-bottom: 7px; }
.prose li::marker { color: var(--primary); font-weight: 600; }

.page-head {
  position: relative; overflow: hidden;
  padding: 46px 0 38px; border-bottom: 1px solid var(--border);
  background:
    radial-gradient(ellipse 55% 90% at 90% -20%, rgba(var(--ph-rgb, var(--primary-rgb)), .12), transparent),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}
.page-head .hero-grid-layer { mask-image: linear-gradient(180deg, #000, transparent); -webkit-mask-image: linear-gradient(180deg, #000, transparent); }
.page-head .container { position: relative; }
.page-head h1 { font-size: clamp(1.5rem, 3.6vw, 2.05rem); font-weight: 700; }
.page-head p { color: var(--text-muted); margin-top: 8px; max-width: 48em; }
.breadcrumb { font-size: .84rem; color: var(--text-faint); margin-bottom: 10px; font-weight: 300; }
.breadcrumb a { color: var(--text-faint); }
.page-head.ph-blue    { --ph-rgb: var(--c-blue-rgb); }
.page-head.ph-emerald { --ph-rgb: var(--c-emerald-rgb); }
.page-head.ph-amber   { --ph-rgb: var(--c-amber-rgb); }
.page-head.ph-rose    { --ph-rgb: var(--c-rose-rgb); }

/* ---------- FAQ ---------- */
details.faq-item {
  --fq: var(--primary);
  background: var(--surface); border: 1px solid var(--border);
  border-left: 4px solid var(--fq);
  border-radius: var(--radius-sm); margin-bottom: 12px;
  box-shadow: var(--shadow); overflow: hidden;
}
details.faq-item:nth-of-type(6n+1) { --fq: var(--c-sky); }
details.faq-item:nth-of-type(6n+2) { --fq: var(--c-blue); }
details.faq-item:nth-of-type(6n+3) { --fq: var(--primary); }
details.faq-item:nth-of-type(6n+4) { --fq: var(--c-violet); }
details.faq-item:nth-of-type(6n+5) { --fq: var(--c-amber); }
details.faq-item:nth-of-type(6n+6) { --fq: var(--c-emerald); }
details.faq-item summary {
  cursor: pointer; padding: 16px 20px; font-weight: 500;
  list-style: none; display: flex; justify-content: space-between; gap: 14px;
  transition: var(--transition);
}
details.faq-item summary::-webkit-details-marker { display: none; }
details.faq-item summary::after { content: "+"; color: var(--fq); font-weight: 600; font-size: 1.25rem; line-height: 1.25; }
details.faq-item[open] summary::after { content: "−"; }
details.faq-item summary:hover { color: var(--fq); }
details.faq-item .faq-body { padding: 0 20px 18px; color: var(--text-muted); font-weight: 300; }
details.faq-item .faq-body p { margin-bottom: 10px; }

/* ---------- Ad slots ---------- */
.ad-slot { margin: 34px auto; text-align: center; }
.ad-slot .ad-label {
  font-size: .66rem; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: .12em; margin-bottom: 4px;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 60px; border-top: 1px solid var(--border);
  background: var(--bg-soft); padding: 44px 0 28px;
  font-size: .92rem;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h4 { font-size: .95rem; margin-bottom: 10px; font-weight: 600; }
.site-footer ul { list-style: none; }
.site-footer li { margin-bottom: 7px; }
.site-footer a { color: var(--text-muted); font-weight: 300; }
.site-footer a:hover { color: var(--primary); }
.footer-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.footer-brand img { width: 34px; height: 34px; }
.footer-brand span { font-weight: 700; }
.footer-note { color: var(--text-faint); font-size: .85rem; max-width: 34em; font-weight: 300; }
.footer-bottom {
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--text-faint); font-size: .82rem; font-weight: 300;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between;
}

/* =========================================================
   ป้ายประชาสัมพันธ์อบรมโยธาไทย (สร้างโดย promo.js)
   ========================================================= */
.train-promo {
  position: relative; overflow: hidden;
  margin: 44px 0 8px; border-radius: var(--radius);
  background:
    radial-gradient(ellipse 70% 100% at 100% 0%, color-mix(in srgb, var(--c-amber) 22%, transparent), transparent),
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 92%, #000), var(--c-violet));
  box-shadow: 0 14px 40px color-mix(in srgb, var(--primary) 30%, transparent);
  color: #fff; padding: 30px 32px;
}
.train-promo::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(140deg, #000, transparent 70%);
  -webkit-mask-image: linear-gradient(140deg, #000, transparent 70%);
}
.tp-head { position: relative; max-width: 46em; }
.tp-badge {
  display: inline-block; font-size: .74rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  background: var(--c-amber); color: #2a1a00;
  padding: 4px 13px; border-radius: 999px; margin-bottom: 12px;
}
.train-promo h3 { font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 600; line-height: 1.45; }
.train-promo .tp-head p { margin-top: 7px; font-size: .93rem; opacity: .88; font-weight: 300; line-height: 1.7; }

.tp-courses {
  position: relative; margin-top: 20px;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px;
}
@media (max-width: 720px) { .tp-courses { grid-template-columns: 1fr; } }
.tp-course {
  display: flex; flex-direction: column; gap: 3px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius-sm); padding: 13px 16px;
  color: #fff; text-decoration: none !important;
  transition: var(--transition); backdrop-filter: blur(4px);
}
.tp-course:hover {
  background: rgba(255, 255, 255, .21); border-color: rgba(255, 255, 255, .45);
  transform: translateY(-2px);
}
.tp-c-name { font-size: .92rem; font-weight: 500; line-height: 1.5; }
.tp-c-note { font-size: .79rem; opacity: .8; font-weight: 300; }
.tp-tag {
  display: inline-block; font-size: .68rem; font-weight: 600;
  background: var(--c-amber); color: #2a1a00;
  padding: 1px 8px; border-radius: 999px; vertical-align: middle;
}

.tp-foot {
  position: relative; margin-top: 20px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.tp-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: #fff; color: var(--primary-strong);
  font-weight: 600; font-size: .92rem;
  padding: 11px 24px; border-radius: 999px;
  text-decoration: none !important; transition: var(--transition);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.tp-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0, 0, 0, .26); color: var(--primary-strong); }
.tp-btn.ghost {
  background: transparent; color: #fff; box-shadow: none;
  border: 1.5px solid rgba(255, 255, 255, .55); font-weight: 500;
}
.tp-btn.ghost:hover { background: rgba(255, 255, 255, .15); color: #fff; }
.tp-line { font-size: .87rem; opacity: .9; font-weight: 300; margin-left: auto; }
.tp-line b { font-weight: 600; }
@media (max-width: 620px) {
  .train-promo { padding: 24px 20px; }
  .tp-line { margin-left: 0; width: 100%; }
}

/* ช่องโฆษณาที่ยังไม่ได้ตั้งรหัสหน่วย → ไม่โชว์ป้าย "โฆษณา" เปล่า (Auto ads จัดการเอง) */
.ad-slot.ad-auto .ad-label { display: none; }
.ad-slot.ad-auto { min-height: 0; margin: 20px auto; }

@media print { .train-promo { display: none !important; } }
