/* ═══════════════════════════════════════════════════
   homepage-sections.css — Homepage Dynamic Sections
   ✅ ลบ Overlay "อ่านในเว็บ" (กดรูปเปิดอ่านได้เลย)
   ✅ ปุ่ม "ดาวน์โหลด" เต็มแถบ เขียนชัดเจน
   ═══════════════════════════════════════════════════ */

.hp-section {
  padding: 56px 0;
  border-top: 1px solid var(--border);
}
.hp-section:nth-child(even) {
  background: #fafbfd;
}

/* ─── Section Header ─── */
.hp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.hp-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.hp-section-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(13,59,122,.2);
}
.hp-section-title {
  font-size: 1.5rem;
  color: var(--primary);
  margin: 0;
  line-height: 1.2;
  font-weight: 700;
}
.hp-section-subtitle {
  font-size: .88rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}
.hp-view-all {
  color: var(--primary);
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 16px;
  border: 2px solid var(--primary);
  border-radius: 50px;
  transition: all .2s;
  display: inline-flex;
  align-items: center;
}
.hp-view-all:hover {
  background: var(--primary);
  color: #fff;
}

/* ═══════════════════════════════════════════════════
   Type 1: Quick Links
   ═══════════════════════════════════════════════════ */
.hp-quick-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: all .25s;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.hp-quick-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(13,59,122,.12);
  color: inherit;
}
.hp-quick-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.hp-quick-body {
  flex: 1;
  min-width: 0;
}
.hp-quick-title {
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary-dark);
  line-height: 1.3;
}
.hp-quick-desc {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: 3px;
  line-height: 1.4;
}
.hp-quick-arrow {
  color: #cbd5e1;
  transition: transform .25s, color .25s;
  font-size: .85rem;
}
.hp-quick-card:hover .hp-quick-arrow {
  color: var(--primary);
  transform: translateX(4px);
}

/* ═══════════════════════════════════════════════════
   Type 2/4: Documents Grid
   ═══════════════════════════════════════════════════ */

/* ─── Wrapper ─── */
.hp-doc-card-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all .25s;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.hp-doc-card-wrap:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(13,59,122,.12);
}
.hp-doc-card-wrap-policy:hover {
  border-color: var(--accent);
}

/* ─── Card Link (กดเข้าไปอ่านได้เลย) ─── */
.hp-doc-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  flex: 1;
  transition: none;
}
.hp-doc-card:hover {
  transform: none;
  border-color: transparent;
  box-shadow: none;
  color: inherit;
}

/* ─── Thumbnail ─── */
.hp-doc-thumb {
  height: 200px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 10px;
}
.hp-doc-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  transition: transform .25s;
}
.hp-doc-card-wrap:hover .hp-doc-thumb img {
  transform: scale(1.03);
}
.hp-doc-thumb.is-landscape img {
  max-height: 100%;
  box-shadow: 0 4px 16px rgba(59,130,246,.25);
}
.hp-doc-thumb-empty {
  font-size: 3rem;
  color: #cbd5e1;
}

/* ─── Badge "นอน" ─── */
.hp-doc-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(59,130,246,.9);
  color: #fff;
  font-size: .65rem;
  padding: 3px 8px;
  border-radius: 50px;
  font-weight: 700;
  letter-spacing: .3px;
}

/* ⭐ ซ่อน Overlay "อ่านในเว็บ" (ถ้ามีใน HTML) — กดที่รูปเปิดอ่านได้เลย */
.hp-doc-overlay,
.dl-card-overlay {
  display: none !important;
}

/* ─── Body ─── */
.hp-doc-body {
  padding: 12px 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.hp-doc-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--primary-dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}
.hp-doc-meta {
  display: flex;
  gap: 12px;
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ─── Policy Variant ─── */
.hp-doc-card-policy .hp-doc-title {
  color: #92400e;
}
.hp-doc-card-policy:hover .hp-doc-title {
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════
   ⭐ Action Bar — ปุ่ม "ดาวน์โหลด" เต็มแถบ
   ═══════════════════════════════════════════════════ */
.hp-doc-actions {
  display: flex;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}
.hp-doc-btn-dl-full {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 14px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  transition: all .2s;
  border: 0;
  cursor: pointer;
  letter-spacing: .2px;
}
.hp-doc-btn-dl-full:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.hp-doc-btn-dl-full i {
  font-size: .9rem;
}

/* (สำหรับ backward compat — ซ่อนปุ่ม "อ่าน" เก่า ถ้ามีใน HTML) */
.hp-doc-btn-view {
  display: none !important;
}
.hp-doc-btn-dl {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 14px;
  font-size: .82rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  transition: all .2s;
  border: 0;
  cursor: pointer;
}
.hp-doc-btn-dl:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
}

/* ═══════════════════════════════════════════════════
   Type 3: Video
   ═══════════════════════════════════════════════════ */
.hp-video-wrapper {
  max-width: 960px;
  margin: 0 auto;
}
.hp-video-frame {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(13,59,122,.18);
  background: #000;
}
.hp-video-frame iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}
.hp-video-caption {
  text-align: center;
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: 14px;
  font-style: italic;
}
.hp-video-caption i {
  color: #dc2626;
}

/* ═══════════════════════════════════════════════════
   Type 5: Info Grid
   ═══════════════════════════════════════════════════ */
.hp-info-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 24px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: all .25s;
  height: 100%;
}
.hp-info-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(13,59,122,.12);
  color: inherit;
}
.hp-info-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}
.hp-info-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
  font-family: var(--font-heading);
}
.hp-info-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════
   Dark mode
   ═══════════════════════════════════════════════════ */
html[data-theme="dark"] .hp-section { border-top-color: var(--border); }
html[data-theme="dark"] .hp-section:nth-child(even) { background: #0d1a2e; }

html[data-theme="dark"] .hp-quick-card,
html[data-theme="dark"] .hp-doc-card,
html[data-theme="dark"] .hp-doc-card-wrap,
html[data-theme="dark"] .hp-info-card {
  background: var(--bg-card);
  border-color: var(--border);
}

html[data-theme="dark"] .hp-quick-title,
html[data-theme="dark"] .hp-doc-title,
html[data-theme="dark"] .hp-info-title { color: var(--primary-light); }

html[data-theme="dark"] .hp-doc-thumb { background: #0d1a2e; }
html[data-theme="dark"] .hp-section-title { color: var(--primary-light); }

html[data-theme="dark"] .hp-doc-actions {
  background: #0d1a2e;
  border-top-color: var(--border);
}
html[data-theme="dark"] .hp-doc-btn-dl-full {
  background: linear-gradient(135deg, #1a5bb8 0%, #0d3b7a 100%);
}
html[data-theme="dark"] .hp-doc-btn-dl-full:hover {
  background: linear-gradient(135deg, #0d3b7a 0%, #1a5bb8 100%);
}

/* ═══════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════ */
@media (max-width: 767px) {
  .hp-section { padding: 40px 0; }
  .hp-section-title { font-size: 1.2rem; }
  .hp-section-icon { width: 40px; height: 40px; font-size: 1.1rem; }
  .hp-doc-thumb { height: 160px; }
  .hp-quick-card { padding: 14px 16px; }
  .hp-quick-icon { width: 44px; height: 44px; font-size: 1.1rem; }
  .hp-info-icon { width: 48px; height: 48px; font-size: 1.2rem; }
  .hp-info-title { font-size: 1.1rem; }
  .hp-doc-btn-dl-full { font-size: .78rem; padding: 10px 12px; }
}