/* ============================================================
   CARD WRAPPER 
   Uses Flexbox to ensure the body stretches to fill the card
============================================================ */
.post-card {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 14px rgba(0,0,0,0.06);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%; /* Ensures cards in a grid row are equal height */
}

.post-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* ============================================================
   IMAGE + BADGE OVERLAY
   Updated to use aspect-ratio for perfect responsiveness
============================================================ */
.post-image {
    width: 100%;
    aspect-ratio: 4 / 3; /* Maintains shape on all screens */
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
}

.post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Base Badge Style */
.badge-overlay {
    position: absolute;
    top: 10px;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* Right Side Badges */
.badge-overlay:not(.boosted) {
    right: 10px;
}

.badge-overlay.featured { background: #f59e0b; }
.badge-overlay.spotlight { background: #3b82f6; }
.badge-overlay.urgent { background: #ef4444; }

/* Left Side Badge */
.badge-overlay.boosted {
    left: 10px;
    background: #ff9800;
}

/* ============================================================
   BODY
============================================================ */
.post-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1; /* Pushes content to fill the card */
}

/* Title: Now allows 2 lines before truncating */
.post-title {
    font-size: 1rem;
    line-height: 1.3;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.6em; /* Keeps titles aligned across cards */
}

.post-area {
    font-size: 0.85rem;
    font-weight: 500;
    color: #64748b;
    margin-bottom: 12px;
}

/* ============================================================
   PRICE + HEART ROW
   Pushed to bottom of card using margin-top: auto
============================================================ */
.post-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto; /* Aligns price row to bottom regardless of title length */
    padding-top: 10px;
}

.post-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: #16a34a;
}

/* ============================================================
   HEART BUTTON
============================================================ */
.heart-btn {
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.heart-btn:hover {
    transform: scale(1.1);
}

.heart-btn:active {
    transform: scale(0.9);
}

.heart-btn svg path {
    stroke: #94a3b8;
    fill: transparent;
    stroke-width: 2;
    transition: all 0.2s ease;
}

.heart-btn.saved svg path {
    stroke: #ef4444;
    fill: #ef4444;
}

/* ============================================================
   GRID LAYOUT
============================================================ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
}

@media (min-width: 768px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 20px;
    }
}
