/* =========================================================
   yedmang.css — สไตล์คัสตอมของ Blogsy child theme
   ========================================================= */

:root {
  --bg-main: #eef0f3;
  --bg-card: #e5e7eb;
  --text-main: #111827;
  --text-sub: #4b5563;
  --red-main: #e11d48;
  --border-soft: rgba(0, 0, 0, 0.08);
}

.card-layout, .card-layout-w, .card-layout-w.e-con, .card-layout.e-con {
    padding: 10px !important;
}

/* =========================================================
   Fast Grid (เดสก์ท็อป 3 คอลัมน์ / มือถือ 1)
   ========================================================= */
.fast-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start; /* ไม่ยืดแถว (กัน skeleton สูงยักษ์ตอน min-height) */
  gap: 12px;
}

@media (max-width: 768px) {
  .fast-grid { grid-template-columns: 1fr; }
}

.thumb {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 12px;
}

.thumb img {
  width: 100%;
  display: block;
}

/* ----- Title ----- */
.title {
  font-size: 18px;
  text-align: center;
  padding: 10px;
  border-bottom: 1px solid rgba(255, 0, 0, 0.2);
}

.title a {
  color: #111;          /* light mode */
  text-decoration: none;
  display: block;
}

html[scheme="dark"] .title a { color: #fff; }  /* dark mode (Blogsy) */

/* ----- หัวข้อ section ----- */
.section-title {
  margin: 30px 0 10px;
  font-size: 24px;
  font-weight: 700;
  text-align: center;
}

/* =========================================================
   คำอธิบายในแต่ละ post (info-box)
   ========================================================= */
.info-box { padding: 20px 0; }

.item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 15px;
  margin-bottom: 15px;
  border-radius: 40px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 165, 0, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 6px 20px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  color: #1c2e2e;
  font-size: 15px;
}

.icon {
  font-size: 18px;
  opacity: 0.9;
}

/* description (ตัวบนสุด) — เด่นกว่ากล่องอื่น */
.item.desc {
  display: block;
  line-height: 1.7;
  font-size: 14px;
  text-align: center;
  color: #444;
  padding: 20px 12px;
  border-radius: 20px;
  margin-bottom: 30px;
}

/* ----- Dark mode (Blogsy scheme) ----- */
html[scheme="dark"] .item {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 165, 0, 0.4);
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #f5b041;
}

html[scheme="dark"] .item.desc { color: #ddd; }

/* =========================================================
   Video Preview (hover/scroll autoplay)
   ========================================================= */
.preview-container {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  aspect-ratio: 16 / 9;
  /* shimmer ระหว่างรอโหลด */
  background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Video meta bar (แถบล่างรูปใน grid: หมวด/วิว/เวลา/ไลก์) ===== */
.video-meta-bar {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 0;
  padding: 8px 12px 3px;
  background: linear-gradient(transparent, rgba(0,0,0,0.55) 35%, rgba(0,0,0,0.88));
  backdrop-filter: blur(2px);
  font-size: 14px; color: #fff; flex-wrap: nowrap; overflow: hidden;
}
.video-meta-bar span { display: flex; align-items: center; gap: 5px; padding: 0 10px; white-space: nowrap; }
.video-meta-bar span + span { border-left: 1px solid rgba(255,255,255,0.1); }

/* ===== Skeleton loading ===== */
.skeleton-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.skeleton-item { aspect-ratio: 16/9; border-radius: 12px; background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@media (max-width: 768px) { .skeleton-grid { grid-template-columns: 1fr; } }

/* ===== Pagination เลขหน้า ===== */
.pagination-wrap { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 20px 0; }
.page-btn { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 36px; padding: 0 10px; background: rgba(0,0,0,0.06); color: #333; border: 1px solid rgba(0,0,0,0.1); border-radius: 8px; cursor: pointer; font-size: 14px; line-height: 1; text-decoration: none; transition: 0.2s; }
.page-btn:hover { background: #e11d48; color: #fff; border-color: #e11d48; }
.page-btn.active { background: #e11d48; color: #fff; border-color: #e11d48; font-weight: 700; }
.page-dots { color: #999; font-size: 14px; }
html[scheme="dark"] .page-btn { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.15); }

.static-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.3s ease;
}

.preview-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.thumb.is-playing .preview-video { opacity: 1; }

/* แถบความคืบหน้า */
.preview-progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s;
}

.thumb.is-playing .preview-progress { opacity: 1; }

.progress-bar {
  width: 0%;
  height: 100%;
  background: #ff0000;
  transition: width 0.1s linear;
}

/* =========================================================
   Video Category Grid
   ========================================================= */
.video-cat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  gap: 12px;
}

.video-cat-item { position: relative; margin-bottom: 10px; }

@media (max-width: 768px) {
  .video-cat-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   ซ่อนกล่องท้าย single post
   - single-author-box-container  = กล่อง Author / Follow Me
   - single-next-prev-posts-container = Other Articles (Previous/Next)
   ========================================================= */
.single-author-box-container,
.single-next-prev-posts-container {
  display: none;
}

/* =========================================================
   Single post: video + meta bar + card (port จากตำหมอย)
   ========================================================= */
:root {
  --accent: #00e5ff;
  --card-bg: rgba(14, 17, 24, 0.55);
  --card-border: rgba(0, 229, 255, 0.18);
  --tm-text: #ffffff;
  --text-dim: #aab2c5;
  --text-key: #9aa3b8;
}

/* ลดช่องว่าง title (hero) ↔ excerpt (content) */
.single-hero-inside { padding-bottom: 0 !important; margin-bottom: 0 !important; }
.single-content-inner { padding-top: 0 !important; }
.video-container { margin-top: 0; margin-bottom: 18px; }
.video-container .wrap { width: 100%; max-width: 1200px; margin: 16px auto 0; display: flex; flex-direction: column; gap: 16px; }

/* title (single hero) — clamp: คอม 1 บรรทัด / มือถือ 2 บรรทัด + ... */
/* เดสก์ท็อป: 1 บรรทัด ตัดด้วย ellipsis — ไม่มี max-height เลย → ไทยไม่โดนตัดหัว/ท้าย */
.single-hero-title .title {
  display: block !important;
  white-space: nowrap;
  overflow: hidden !important;
  text-overflow: ellipsis;
  line-height: 1.6 !important;
}
.single-hero-title .title .title-span { display: inline; }
/* มือถือ: 2 บรรทัด ใช้ line-clamp (max-height เผื่อสูงพอ ไม่บีบจนตัด) */
@media (max-width: 768px) {
  .single-hero-title .title {
    display: -webkit-box !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    max-height: 3.2em !important;
  }
}

/* breadcrumb — ลดช่องว่างบน (คอม) + มือถือเว้นล่าง 10px */
.blogsy-breadcrumb { margin-top: -12px !important; margin-bottom: 12px; }
@media (max-width: 768px) {
  .blogsy-breadcrumb { margin-top: -35px !important; margin-bottom: 30px !important; } /* บน: ลดช่อง / ล่าง: เว้นจากการ์ด title */
}

/* วิดีโอ 16:9 */
.video-frame { width: 100%; margin: 0 auto; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
.video-frame .presto-player__wrapper,
.video-frame video { width: 100% !important; height: 100% !important; object-fit: contain; }

/* short desc ใต้ title — clamp: คอม 1 บรรทัด / มือถือ 2 บรรทัด + ... */
.vd-short-desc {
  font-size: 14.5px; line-height: 1.55; color: #888;
  margin: 0 0 14px; padding: 3px 0 3px 12px; border-left: 3px solid #ff7a12;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;
}
@media (max-width: 768px) {
  .vd-short-desc { -webkit-line-clamp: 1; }
}

/* ===== Tags (ย้ายขึ้นบน ในการ์ด) ===== */
/* ซ่อน tag ก้นหน้าของ Blogsy เฉพาะโพสต์ใหม่ (มี body.yd-video-post) — โพสต์เก่ายังโชว์ปกติ */
.yd-video-post .single-post-tags { display: none !important; }

.vd-tags {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 14px 0 4px;
}
.vd-tags-label {
  font-weight: 700; color: #1c2e2e; font-size: 14px; margin-right: 2px;
}
/* ชิปทึบสีส้ม — เด่น เข้าชุดกับธีมส้มของเว็บ */
.vd-tags a {
  display: inline-flex; align-items: center; line-height: 1;
  padding: 7px 14px; min-height: 34px;
  background: #f57c00; border: 1px solid #e06d00; border-radius: 999px;
  color: #fff; font-size: 13px; font-weight: 600; text-decoration: none;
  box-shadow: 0 4px 12px rgba(245, 124, 0, 0.25);
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.vd-tags a::before { content: "#"; opacity: 0.65; margin-right: 3px; }
.vd-tags a:hover {
  background: #e06d00;
  transform: translateY(-1px); box-shadow: 0 6px 16px rgba(224, 109, 0, 0.4);
}
html[scheme="dark"] .vd-tags-label { color: #f5b041; }
html[scheme="dark"] .vd-tags a {
  background: #e07b00; border-color: #c96e00; color: #fff;
}
html[scheme="dark"] .vd-tags a:hover { background: #f59000; }

/* ===== หัวข้อ section (คลิปอื่นของนักแสดง / เกี่ยวข้อง) ===== */
.vd-section-title {
  font-size: 20px; font-weight: 700; color: #1c2e2e;
  margin: 26px 0 14px; padding-left: 12px;
  border-left: 4px solid #f57c00; line-height: 1.3;
}
html[scheme="dark"] .vd-section-title { color: #f5b041; }
@media (max-width: 768px) { .vd-section-title { font-size: 17px; margin: 20px 0 10px; } }

/* ===== แถบ META (engagement) ===== */
.custom-post-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0; }
.custom-post-meta > span,
.custom-post-meta > a {
  text-decoration: none; display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 52px; padding: 8px 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 165, 0, 0.3); border-radius: 14px;
  font-size: 17px; font-weight: 700; color: #1c2e2e; white-space: nowrap;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.meta-comments { color: #1c2e2e; }
.meta-like, .meta-like * { margin: 0 !important; padding: 0 !important; }
.meta-like { display: inline-flex !important; align-items: center !important; line-height: 1 !important; }
.meta-like .count-box, .meta-like .wp_ulike_counter_up { margin-left: 6px !important; }
.custom-post-meta > span.meta-share { padding: 0; }
.custom-post-meta > span.meta-share > .meta-share { display: flex; width: 100%; }
.share-btn { flex: 1; width: 100%; min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: none; color: #e11d48; font: inherit; font-weight: 700; font-size: 17px; border-radius: 14px; cursor: pointer; }
.share-btn:active { background: rgba(225, 29, 72, 0.12); }

/* dark mode (Blogsy scheme) — แถบ engagement */
html[scheme="dark"] .custom-post-meta > span,
html[scheme="dark"] .custom-post-meta > a,
html[scheme="dark"] .meta-comments {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 165, 0, 0.4);
  color: #f5b041;
}
.custom-post-meta .pm-ico { width: 24px; height: 24px; flex: 0 0 auto; }
.custom-post-meta.meta-row2 { grid-template-columns: repeat(2, 1fr); margin-top: 8px; }
.custom-post-meta.meta-row2 > span { font-size: 15px; font-weight: 600; }
@media (max-width: 430px) {
  .custom-post-meta { gap: 6px; }
  .custom-post-meta > span { font-size: 15px; min-height: 50px; padding: 6px 3px; gap: 4px; }
  .share-btn { font-size: 15px; }
  .custom-post-meta .pm-ico { width: 20px; height: 20px; }
}

/* ===== การ์ดรายละเอียด (โทน yedmang เดิม: ขาว/ส้ม) ===== */
.desc-card {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 20px;
  padding: 20px 22px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: #1c2e2e;
}
.desc-card .badge { display: none; }
.desc-card .desc-body { color: #444; font-size: 15px; line-height: 1.85; margin: 0; }
@media (max-width: 480px) { .desc-card { padding: 18px; } }

/* ===== การ์ดข้อมูล (พิลล์ขาว ขอบส้ม แบบ .item เดิม) ===== */
.info-card { display: flex; flex-direction: column; gap: 12px; }
.info-card .row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 165, 0, 0.3);
  border-radius: 40px;
  padding: 12px 20px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  color: #1c2e2e;
}
.info-card .ico { font-size: 18px; opacity: 0.9; flex-shrink: 0; }
.info-card .k { color: #5a6b6b; font-size: 14.5px; font-weight: 500; }
.info-card .val { color: #1c2e2e; font-weight: 500; font-size: 14.5px; }

/* dark mode (Blogsy scheme) */
html[scheme="dark"] .desc-card,
html[scheme="dark"] .info-card .row {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border-color: rgba(255, 165, 0, 0.4);
  color: #f5b041;
}
html[scheme="dark"] .desc-card .desc-body { color: #ddd; }
html[scheme="dark"] .info-card .k { color: #c9a86a; }
html[scheme="dark"] .info-card .val { color: #f5b041; }
