/* ==========================================================================
   ศูนย์ข้อมูลสารสนเทศ — หน้าแรก: แผงเต็มจอ โทนขาวดำ ปุ่มคู่ (โหลดต่อจาก pao.css)
   ========================================================================== */

/* ---------- header โปร่งใสบนฉากหลัก ---------- */
.index-page .site-header {
  position: fixed; left: 0; right: 0;
  background: transparent;
  -webkit-backdrop-filter: none; backdrop-filter: none;
  transition: background-color 240ms var(--ease);
}
body.index-page.scrolled .site-header { background: rgba(255, 255, 255, 0.97); border-bottom-color: transparent; }

.index-page .brand,
.index-page .brand:hover { color: #fff; transition: color 240ms var(--ease); }
.index-page .brand-text { line-height: 1.42; }
.index-page .brand-text span { color: rgba(255, 255, 255, 0.78); transition: color 240ms var(--ease); }
.index-page .site-nav a { color: #fff; }
.index-page .site-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.index-page .site-nav a.active { color: #fff; background: rgba(255, 255, 255, 0.14); }
.index-page .nav-toggle { background: transparent; border-color: rgba(255, 255, 255, 0.4); color: #fff; }

body.index-page.scrolled .brand,
body.index-page.scrolled .brand:hover { color: var(--text); }
body.index-page.scrolled .brand-text span { color: var(--muted); }
body.index-page.scrolled .site-nav a { color: var(--text); }
body.index-page.scrolled .site-nav a:hover,
body.index-page.scrolled .site-nav a.active { color: var(--text); background: var(--raised); }
body.index-page.scrolled .nav-toggle { border-color: var(--line-strong); color: var(--text); }

.index-page .lang-switch { color: #fff; }
.index-page .lang-switch:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
body.index-page.scrolled .lang-switch,
body.index-page.scrolled .lang-switch:hover { color: var(--text); }
body.index-page.scrolled .lang-switch:hover { background: var(--raised); }

@media (min-width: 1360px) {
  .index-page .site-header .wrap { max-width: none; padding: 0 32px; display: grid; grid-template-columns: 1fr auto 1fr; }
  .index-page .brand { margin-right: 0; }
  .index-page .lang-switch { justify-self: end; }
}
@media (max-width: 991px) {
  .index-page .site-nav a,
  .index-page .site-nav a:hover,
  .index-page .site-nav a.active { color: var(--text); }
  .index-page .site-nav a:hover,
  .index-page .site-nav a.active { background: var(--raised); }
}

/* ---------- ฉากหลัก ---------- */
.dc-hero {
  position: relative; isolation: isolate; overflow: hidden;
  height: 100vh; height: 100svh; min-height: 600px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(var(--header-h) + 40px) 24px 56px;
  text-align: center; color: #fff; background: #08090b;
}
#dc-canvas { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; display: block; }
.dc-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(8, 9, 11, 0.86) 0, rgba(8, 9, 11, 0.5) 30%, transparent 48%, transparent 72%, rgba(8, 9, 11, 0.62) 100%);
}
.dc-hero h1 { color: #fff; font-size: clamp(34px, 3.6vw, 48px); font-weight: 500; line-height: 1.3; }
.dc-hero h1 span { display: block; margin-top: 4px; font-size: clamp(17px, 1.6vw, 22px); font-weight: 400; line-height: 1.5; }
.dc-hero .tag { margin-top: 8px; font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.82); }
.dc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; width: 100%; }
.dc-actions .btn-pao { width: 264px; height: 40px; font-size: 14px; }
.dc-actions .btn-pao.light { background: rgba(255, 255, 255, 0.92); color: var(--text); }
.dc-actions .btn-pao.light:hover { background: #fff; color: var(--text); }
@media (max-width: 575px) {
  .index-page .brand-text span { font-size: 11px; }
  .dc-hero h1 span { font-size: 15px; }
  .dc-actions { flex-direction: column; align-items: center; gap: 12px; }
  .dc-actions .btn-pao { width: 100%; max-width: 342px; }
}

/* ปุ่มบนแบนเนอร์ป๊อปอัป ใช้ขนาดเดียวกับปุ่มฉากหลัก */
#autoPopup .btn-pao { width: 264px; max-width: 100%; height: 40px; font-size: 14px; }

/* ---------- ส่วนเนื้อหา ---------- */
.index-page .section.alt { background: var(--raised); border: 0; }
.index-page .sec-head { flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.index-page .sec-head h2 { font-size: clamp(28px, 2.8vw, 40px); font-weight: 500; }
.index-page .sec-head p { margin-left: auto; margin-right: auto; }
.index-page .faq-layout { grid-template-columns: 1fr; gap: 32px; justify-items: center; }
.index-page .faq { width: 100%; max-width: 760px; }

.index-page .about-body p { text-indent: 0; }
.index-page .about-body p + p { margin-top: 32px; }
html[lang="th"] .index-page .about-body p { text-indent: 2.5em; }
.about-card { background: var(--raised); border: 0; box-shadow: none; }

/* เส้นทางข้อมูล */
.flow { list-style: none; margin: 0; padding: 0; position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.flow::before,
.flow::after { content: ""; position: absolute; left: 20px; right: 0; top: 19px; height: 2px; }
.flow::before { background: var(--line-strong); }
.flow::after { background: var(--text); transform: scaleX(var(--p, 0)); transform-origin: left center; will-change: transform; }
.flow-step { position: relative; z-index: 1; }
.flow-node {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line-strong);
  transition: background-color 420ms var(--ease), color 420ms var(--ease), border-color 420ms var(--ease);
}
.flow-step.on .flow-node { background: var(--text); border-color: var(--text); color: #fff; }
.flow-step h3 { font-size: 18px; font-weight: 500; margin-top: 16px; }
.flow-step p { margin-top: 4px; font-size: 14px; color: var(--text-2); max-width: 24ch; }
.flow-step h3,
.flow-step p { transition: opacity 420ms var(--ease); }
html.js .flow-step:not(.on) h3,
html.js .flow-step:not(.on) p { opacity: 0.6; }
@media (max-width: 767px) {
  .flow { grid-template-columns: 1fr; }
  .flow::before,
  .flow::after { left: 19px; right: auto; top: 20px; bottom: 0; width: 2px; height: auto; }
  .flow::after { transform: scaleY(var(--p, 0)); transform-origin: center top; }
  .flow-step { display: grid; grid-template-columns: 40px 1fr; column-gap: 16px; }
  .flow-step h3 { margin-top: 0; }
  .flow-step p { grid-column: 2; max-width: none; }
}

/* การ์ดระบบ */
.sys-search { display: block; width: min(420px, 100%); margin: -8px auto 24px; }
.index-page .sys-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 991px) { .index-page .sys-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .index-page .sys-grid { grid-template-columns: minmax(0, 1fr); } }

.sys-card, .sys-card.rise { flex-direction: row; align-items: center; gap: 16px; height: auto; min-height: 96px; padding: 12px 16px; border: 0; box-shadow: none; }
.sys-card[hidden] { display: none; }
.sys-card.rise { transition: opacity 450ms var(--ease), transform 450ms var(--ease), background-color 150ms var(--ease); }
.sys-card:hover { background: #fafafa; box-shadow: none; }
.sys-card .ico, .sys-card:hover .ico { flex: none; width: 32px; height: auto; background: transparent; color: var(--text); font-size: 24px; }
.sys-text { flex: 1; min-width: 0; }
.sys-card h3 {
  font-size: 15px; font-weight: 500; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.sys-card p { margin-top: 2px; font-size: 13px; line-height: 1.5; -webkit-line-clamp: 1; }
.sys-go { flex: none; font-size: 15px; color: var(--muted); transition: color 150ms var(--ease), transform 150ms var(--ease); }
.sys-card:hover .sys-go { color: var(--brand-ink); transform: translate(2px, -2px); }

/* แผนแม่บท: แถบเต็มความกว้าง ข้อความซ้าย ปกเอกสารขวา */
#call-to-action { padding: 0; }
#call-to-action .wrap { max-width: none; padding: 0; }
.plan {
  border-radius: 0; background: var(--deep);
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); align-items: center; gap: 48px;
  padding: 56px max(24px, calc((100% - 1152px) / 2)) 0;
}
.plan > div:first-child { padding-bottom: 56px; }
.plan h2 { font-size: clamp(24px, 2.4vw, 32px); font-weight: 500; }
.plan .btn-pao { width: 264px; height: 40px; margin-bottom: 0; font-size: 14px; }
.plan-doc { align-self: end; justify-content: center; }
.plan-doc img, .plan:hover .plan-doc img { max-width: 280px; border-radius: 4px 4px 0 0; transform: none; box-shadow: none; }
/* ชี้เมาส์ที่ปกเอกสาร: ปกยกขึ้นและเอียงเล็กน้อย ขอบล่างซ่อนใต้แถบเพื่อไม่ให้เห็นช่องว่าง */
@media (hover: hover) {
  .plan-doc img, .plan:hover .plan-doc img {
    transform: translateY(20px);
    transform-origin: bottom center;
    transition: transform 380ms var(--ease), box-shadow 380ms var(--ease);
  }
  .plan-doc img:hover, .plan:hover .plan-doc img:hover {
    transform: translateY(6px) rotate(-1.5deg);
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.45);
  }
}
@media (max-width: 767px) {
  .plan { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 48px 24px 0; }
  .plan > div:first-child { padding-bottom: 32px; }
  .plan-doc img, .plan:hover .plan-doc img { max-width: 220px; }
}
@media (max-width: 575px) {
  .plan .btn-pao { width: 100%; }
}

/* ข่าวหน้าแรก: แท็บซ้าย ดูทั้งหมดขวา และการ์ด 4 หรือ 2 คอลัมน์ให้ไม่เหลือใบเดี่ยว */
#portfolio .sec-head { margin-bottom: 24px; }
#portfolio .sec-head > .d-flex { width: 100%; justify-content: space-between; }
#home-news { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 991px) { #home-news { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) {
  #home-news { gap: 16px 12px; }
  #home-news .news-body h3 { font-size: 14px; }
}
/* แสดงโปสเตอร์ครบทั้งแผ่น ไม่ตัดขอบ */
#home-news .news-thumb { aspect-ratio: 5 / 7; background: var(--raised); }
#home-news .news-thumb img { object-fit: contain; object-position: center; }

/* ข่าว */
.news-card { background: transparent; border: 0; border-radius: 4px; }
.news-card:hover { box-shadow: none; }
.news-thumb { border-radius: 4px; }
.news-body { padding: 16px 0 0; }
.news-body h3 { font-weight: 500; }

/* สถิติ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; text-align: center; }
.kpi strong { display: block; font-size: clamp(36px, 4vw, 56px); font-weight: 500; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi span { display: block; margin-top: 4px; font-size: 14px; color: var(--text-2); }
@media (max-width: 767px) { .kpis { grid-template-columns: 1fr 1fr; gap: 32px 16px; } }

.pulse-grid { display: grid; grid-template-columns: 1.4fr 0.6fr; gap: 48px; margin-top: 64px; }
@media (max-width: 991px) { .pulse-grid { grid-template-columns: 1fr; gap: 32px; } }
.pulse-col { min-width: 0; }
.pulse-col h3 { font-size: 16px; font-weight: 500; }
.pulse-col > p { color: var(--muted); font-size: 13px; margin-top: 2px; }

.chart { position: relative; margin-top: 16px; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 12px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart text.peak { fill: var(--text); font-weight: 500; }
.chart .bar {
  fill: #a2a3a7;
  transform-box: fill-box; transform-origin: bottom; transform: scaleY(0);
  transition: transform 700ms var(--ease), fill 120ms var(--ease);
}
.chart.in .bar { transform: none; }
.chart .bar.lead { fill: var(--brand); }
.chart .bar.partial { fill-opacity: 0.45; }
.chart .bar.hot { fill: var(--text-2); }
.chart-tip {
  position: absolute; left: 0; top: 0; z-index: 2; padding: 4px 8px; border-radius: 4px;
  background: var(--text); color: #fff; font-size: 13px; line-height: 1.45; white-space: nowrap;
  transform: translate(-50%, -100%); pointer-events: none;
  opacity: 0; transition: opacity 120ms var(--ease);
}
.chart-tip.show { opacity: 1; }
.chart-tip b { font-weight: 500; font-variant-numeric: tabular-nums; }
.chart-note { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.chart-note i { width: 10px; height: 10px; border-radius: 2px; background: #a2a3a7; opacity: 0.45; flex: none; }

.data-table { margin-top: 12px; font-size: 13px; color: var(--muted); }
.data-table summary { cursor: pointer; width: fit-content; }
.data-table summary:hover { color: var(--text); }
.data-table table { width: 100%; margin-top: 8px; border-collapse: collapse; color: var(--text-2); }
.data-table th, .data-table td { padding: 4px 0; border-bottom: 1px solid var(--line); font-weight: 400; text-align: left; }
.data-table td:last-child, .data-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

.rank { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.rank li { font-size: 14px; line-height: 1.45; }
.rank-top { display: flex; justify-content: space-between; gap: 16px; }
.rank-top span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-top .num { font-variant-numeric: tabular-nums; }
.rank-bar { margin-top: 4px; height: 4px; background: var(--line); overflow: hidden; }
.rank-bar i {
  display: block; height: 100%; width: var(--w); background: #a2a3a7;
  transform: scaleX(0); transform-origin: left center; transition: transform 700ms var(--ease);
}
.rank li:first-child .rank-bar i { background: var(--brand); }
.rank.in .rank-bar i { transform: none; }
.pulse-foot { margin-top: 16px; font-size: 13px; color: var(--muted); }

/* ติดต่อ */
.index-page .card { border: 0; box-shadow: none; }
.info-card { background: var(--raised); }
.info-row .ico { background: var(--surface); color: var(--text); }
.form-card { padding: 0 0 0 24px; background: transparent; }
@media (max-width: 991px) { .form-card { padding: 0; } }
.index-page .field input,
.index-page .field textarea { background: var(--raised); border-color: transparent; }
.index-page .field input:focus,
.index-page .field textarea:focus { background: var(--surface); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  html.js body:not(.dc-go) .intro { opacity: 0; }
  body.dc-go .intro { animation: dc-in 700ms var(--ease) both; animation-delay: var(--d, 0ms); }
  .index-page .rise { transform: translateY(16px); transition-duration: 600ms; }
  .index-page .rise.in { transform: none; }
}
/* รีโหลด/กดย้อนกลับ/เปิดลิงก์เจาะจงส่วน: แสดงผลทันที ไม่เล่นอนิเมชันเปิดตัวซ้ำ */
html.no-rise .rise,
html.no-rise .intro { opacity: 1 !important; transform: none !important; transition: none !important; animation: none !important; }
html.no-rise .chart .bar,
html.no-rise .rank-bar i { transform: none; transition: none; }
html.no-rise body:not(.settled) .site-header,
html.no-rise body:not(.settled) .brand,
html.no-rise body:not(.settled) .brand-text span,
html.no-rise body:not(.settled) .flow-node,
html.no-rise body:not(.settled) .flow-step h3,
html.no-rise body:not(.settled) .flow-step p { transition: none; }

@keyframes dc-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .chart .bar, .rank-bar i { transform: none; }
}
