/* ========= THEME ========= */
:root {
  --bg: #0b1017;
  --card: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.08);
  --text: #c9d3e3;
  --muted: #9aa7bb;
  --brand: #6c4cff; /* ไฮไลต์หลัก */
  --brand-2: #2ee4a6; /* เสริม */
  --danger: #ff5a7d; /* หัวใจ */
  --shadow-1: 0 10px 32px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 20px 60px rgba(0, 0, 0, 0.45);
}

/* ========= LAYOUT ========= */
body {
  background: radial-gradient(
    1200px 600px at 50% -20%,
    #0f1622 0%,
    #0c121b 50%,
    var(--bg) 100%
  );
}

.feed-wrapper {
  max-width: 860px;
  margin: 24px auto 110px;
  padding: 0 16px;
}

.feed-title {
  margin: 8px 0 0;
  font: 900 clamp(22px, 4vw, 30px) / 1.15 Inter, system-ui, "Kanit", sans-serif;
  background: linear-gradient(90deg, #8ab4ff, #a78bfa, #2ee4a6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: 0.4px;
}
.feed-sub {
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

/* ========= GRID ========= */
.feed-grid {
  display: grid;
  gap: 14px;
}

/* ========= CARD ========= */
.card {
  position: relative;
  border-radius: 16px;
  border: 1px solid var(--stroke);
  background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.06),
        rgba(255, 255, 255, 0.03)
      )
      padding-box,
    radial-gradient(
        120% 160% at 100% -10%,
        rgba(108, 76, 255, 0.2),
        rgba(46, 228, 166, 0.06)
      )
      border-box;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform 0.15s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4);
}

/* header */
.card-hd {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font: 800 14px/1 Inter, "Kanit", sans-serif;
  color: #ffffff;
  background: linear-gradient(135deg, #6c4cff, #9a6bff);
  box-shadow: 0 10px 20px rgba(108, 76, 255, 0.3);
}
.meta {
  flex: 1;
  min-width: 0;
}
.meta .name {
  color: #e7ecff;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 14px;
}
.meta .time {
  color: var(--muted);
  font-size: 12px;
}

/* like button */
.like-btn {
  border: 0;
  background: transparent;
  color: #9fb2d3;
  cursor: pointer;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: filter 0.15s ease, transform 0.12s ease, color 0.15s ease,
    background 0.2s ease;
}
.like-btn:hover {
  filter: brightness(1.1);
  background: rgba(255, 255, 255, 0.05);
}
.like-btn .heart {
  transition: transform 0.2s ease, color 0.15s ease;
  color: #9fb2d3;
}
.like-btn.liked .heart {
  color: var(--danger);
  transform: scale(1.12);
}

/* media */
.media {
  background: #0a0f15;
  border-top: 1px solid var(--stroke);
  border-bottom: 1px solid var(--stroke);
}
.media .img,
.media .v {
  display: block;
  width: 100%;
  height: auto;
  max-height: 540px;
  object-fit: cover;
}
.media .v {
  background: #000;
}

/* body */
.card-bd {
  padding: 12px;
}
.cap {
  margin: 0 0 8px;
  color: rgba(255, 255, 255, 0.589);
  font-size: 20px;
  line-height: 1.55;
}
.social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13.5px;
  text-decoration: none;
  color: #cfe6ff;
  background: linear-gradient(
    90deg,
    rgba(108, 76, 255, 0.25),
    rgba(46, 228, 166, 0.18)
  );
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.12s, box-shadow 0.2s, border-color 0.2s, filter 0.12s;
}
.social:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 10px 24px rgba(108, 76, 255, 0.28);
  filter: brightness(1.05);
}

/* ========= EMPTY / BADGE ========= */
.empty {
  text-align: center;
  padding: 30px 12px;
  color: var(--muted);
  border: 1px dashed var(--stroke);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
#feed-offline.feed-offline-badge {
  /* สไตล์ถูกกำหนดจาก inline <style> ในไฟล์ PHP แล้ว
     ตรงนี้เสริม glow ให้ดูเด่นขึ้น */
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* ========= MICRO INTERACTIONS ========= */
.card::after {
  /* ไฮไลต์นวลๆ เวลาวางเมาส์เหนือการ์ด */
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    400px 200px at var(--mx, 50%) 0%,
    rgba(255, 255, 255, 0.06),
    transparent 55%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, background 0.1s ease;
}
.card:hover::after {
  opacity: 1;
}
.card {
  --mx: 50%;
}
.card-hd,
.media,
.card-bd {
  position: relative;
  z-index: 1;
}

/* ========= ACCESSIBILITY ========= */
.card:focus-within {
  outline: 2px solid rgba(108, 76, 255, 0.45);
  outline-offset: 3px;
  border-color: rgba(108, 76, 255, 0.35);
}

/* ========= SMALL SCREEN ========= */
@media (max-width: 520px) {
  .media .img,
  .media .v {
    max-height: 420px;
  }
}

/* ========= OPTIONAL: shimmer skeleton (ถ้าจะใช้ตอนโหลดเพิ่มภายหลัง) =========  */

.skeleton {
  border-radius: 16px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--stroke);
}
.skel-line {
  height: 12px;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06),
    rgba(255, 255, 255, 0.12),
    rgba(255, 255, 255, 0.06)
  );
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer {
  to {
    background-position-x: -200%;
  }
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* ทำให้รูปเต็มพื้นที่โดยไม่เบี้ยว */
  border-radius: 50%; /* ทำให้รูปเป็นวงกลม (เผื่อไว้) */
}
