/* ================================================================
   post_card_extra.css
   เพิ่มเติมเพื่อให้รูป/คลิปโหลดแบบ lazy + skeleton + video-on-click
   ใส่ไว้ต่อจาก main.css หรือ @import เพิ่มเข้ามา
   ================================================================ */

/* ----------------------------------------------------------------
   SKELETON SHIMMER
   ---------------------------------------------------------------- */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

.media-skeleton {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    var(--bg3) 25%,
    var(--border) 50%,
    var(--bg3) 75%
  );
  background-size: 600px 100%;
  animation: shimmer 1.4s infinite linear;
  z-index: 1;
  transition: opacity .3s ease;
}

/* hide skeleton once image is loaded */
.photo-cell.loaded .media-skeleton,
.post-video-wrap.loaded .media-skeleton {
  opacity: 0;
  pointer-events: none;
}

/* ----------------------------------------------------------------
   LAZY IMAGE
   ---------------------------------------------------------------- */
.photo-cell {
  position: relative;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--bg3);
  /* enforce aspect ratio while loading */
  min-height: 160px;
}

.lazy-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .35s ease;
  position: relative;
  z-index: 2;
}

.lazy-img.loaded {
  opacity: 1;
}

/* single-photo taller */
.post-photos-1 .photo-cell {
  min-height: 280px;
  max-height: 500px;
}

/* ----------------------------------------------------------------
   VIDEO OVERLAY / THUMBNAIL
   ---------------------------------------------------------------- */
.post-video-wrap {
  position: relative;
  background: #000;
  overflow: hidden;
  min-height: 200px;
}

.video-skeleton {
  min-height: 200px;
}

.video-thumb-overlay {
  position: relative;
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  cursor: pointer;
}

/* If there's a poster image for the video overlay */
.video-thumb-overlay img.video-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .85;
}

.video-play-btn {
  position: relative;
  z-index: 10;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease;
  filter: drop-shadow(0 2px 12px rgba(0,0,0,.7));
}

.video-play-btn:hover {
  transform: scale(1.12);
}

.video-play-btn svg circle {
  transition: fill .18s;
}

.video-play-btn:hover svg circle {
  fill: rgba(24,119,242,.75);
}

/* The real video element */
.post-video {
  width: 100%;
  max-height: 480px;
  display: block;
  background: #000;
}

/* smooth fade-in when video appears */
.post-video.visible {
  animation: fadeIn .25s ease both;
}

/* ----------------------------------------------------------------
   VIDEO AUTOPLAY-ON-SCROLL (muted preview)
   ---------------------------------------------------------------- */
.post-video-wrap[data-autoplay="true"] .video-thumb-overlay {
  display: none;
}

/* ----------------------------------------------------------------
   PHOTO CELL HOVER EFFECT
   ---------------------------------------------------------------- */
.photo-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  transition: background .18s ease;
  z-index: 3;
  pointer-events: none;
}

.photo-cell:hover::after {
  background: rgba(0,0,0,.08);
}

.photo-more-count {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  z-index: 4;
}

/* ----------------------------------------------------------------
   AVATAR WRAP (for potential online dot)
   ---------------------------------------------------------------- */
.avatar-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

/* ----------------------------------------------------------------
   REACTION BUBBLES
   ---------------------------------------------------------------- */
.reaction-bubbles {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ----------------------------------------------------------------
   POST CARD ENTER ANIMATION — staggered for feed
   ---------------------------------------------------------------- */
@keyframes postSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.post-card {
  animation: postSlideUp .3s ease both;
}

.post-card:nth-child(1) { animation-delay: .04s; }
.post-card:nth-child(2) { animation-delay: .08s; }
.post-card:nth-child(3) { animation-delay: .12s; }
.post-card:nth-child(4) { animation-delay: .16s; }
.post-card:nth-child(5) { animation-delay: .20s; }