/*
 * Component: Post Card  (pcard)
 * Unified card design used on: front page, category, tag, author, index
 * Depends on: tokens.css
 */

/* ── Grid ────────────────────────────────────────────────────────── */

.pcard-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  padding: 20px 0 32px;
}

/* 3-col on category / tag / archive pages — not front page, not pagination */
.category .pcard-grid,
.tag .pcard-grid,
.author .pcard-grid,
.archive .pcard-grid,
.search-results .pcard-grid {
  grid-template-columns: repeat(3, 1fr);
  width: 75%;
  margin: 20px auto;
}

@media (max-width: 900px) {
  .category .pcard-grid,
  .tag .pcard-grid,
  .author .pcard-grid,
  .archive .pcard-grid,
  .search-results .pcard-grid {
    grid-template-columns: repeat(2, 1fr);
    width: 90%;
  }
}

@media (max-width: 600px) {
  .pcard-grid { grid-template-columns: 1fr; gap: 14px; padding: 16px 0 24px; }
}

/* ── Card shell ──────────────────────────────────────────────────── */

.pcard {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  transition: transform 0.24s ease, box-shadow 0.24s ease;
  display: flex;
  position: relative;
  flex-direction: column;
}

.pcard:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.12);
}

/* ── Image ───────────────────────────────────────────────────────── */

.pcard-img-wrap {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  text-decoration: none;
  background: #f3f4f6;
}

.pcard-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.pcard:hover .pcard-img-wrap img { transform: scale(1.05); }

.pcard-img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f0f0f0, #e4e4e4);
}

/* ── Body ────────────────────────────────────────────────────────── */

.pcard-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 9px;
}

/* ── Meta: date • read-time + views ─────────────────────────────── */

.pcard-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #999;
  flex-wrap: wrap;
}

.pcard-dot { opacity: 0.45; }

.pcard-views {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 11.5px;
  color: #bbb;
}

/* ── Category pill ───────────────────────────────────────────────── */

.pcard-cat {
    display: inline-block;
    background: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    align-self: flex-start;
    transition: background 0.18s, color 0.18s;
    position: absolute;
    top: 10px;
}

.pcard-cat:hover {
  background: var(--color-primary, #11b863);
  color: #fff;
}

/* ── Title ───────────────────────────────────────────────────────── */

.pcard-title {
  font-size: 17px !important;
  font-weight: 700 !important;
  color: #111 !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.45 !important;
  text-transform: none !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pcard-title a {
  color: inherit !important;
  text-decoration: none;
}

.pcard-title a:hover { color: var(--color-primary, #11b863) !important; }

/* ── Excerpt ─────────────────────────────────────────────────────── */

.pcard-excerpt {
  font-size: 13.5px;
  color: #666;
  line-height: 1.65;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-transform: none !important;
}

/* ── Footer: author + action buttons ────────────────────────────── */

.pcard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #f2f2f2;
}

.pcard-author {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.pcard-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid #eee;
}

.pcard-author-name {
  font-size: 12.5px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ── Action buttons ──────────────────────────────────────────────── */

.pcard-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.pcard-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 6px;
  color: #bbb;
  font-size: 11.5px;
  font-family: inherit;
  line-height: 1;
  transition: color 0.18s, background 0.18s;
}

.pcard-btn:hover {
  color: var(--color-primary, #11b863);
  background: rgba(17, 184, 99, 0.07);
}

/* Like state */
.pcard-btn.sp-liked { color: var(--color-primary, #11b863); }
.pcard-btn.sp-liked .sp-like-heart {
  fill: var(--color-primary, #11b863);
  stroke: var(--color-primary, #11b863);
}
.sp-like-heart { transition: fill 0.2s, stroke 0.2s; }
@keyframes spHeartBounce {
  0%   { transform: scale(1); }
  20%  { transform: scale(0.75); }
  55%  { transform: scale(1.35); }
  80%  { transform: scale(0.92); }
  100% { transform: scale(1); }
}
.pcard-btn.sp-pop .sp-like-heart {
  animation: spHeartBounce 0.45s cubic-bezier(0.36,0.07,0.19,0.97) both;
}

/* Bookmark state */
.pcard-btn .bk-on { display: none; }
.pcard-btn.lp-bookmarked { color: var(--color-primary, #11b863); }
.pcard-btn.lp-bookmarked .bk-off { display: none !important; }
.pcard-btn.lp-bookmarked .bk-on  { display: block !important; }
