/**
 * Posts Grid Component Styles
 * Стильная сетка постов под основным контентом
 * 
 * @package EHF
 * @since 1.0.0
 */

/* Posts Grid Section */
.posts-grid-section {
    background-color: var(--ehf-white);
    padding: var(--ehf-spacing-lg) 0;
}

.posts-grid-container {
    max-width: var(--ehf-container-xl);
    margin: 0 auto;
    padding: 0 var(--ehf-spacing-lg);
}

/* Posts Grid Layout - 3 columns uniform */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--ehf-spacing-xl);
    margin-bottom: var(--ehf-spacing-4xl);
}

/* Post Card */
.post-card {
    background-color: var(--ehf-card-background);
    border-radius: var(--ehf-border-radius-lg);
    overflow: hidden;
    transition: all var(--ehf-transition-normal);
    box-shadow: var(--ehf-shadow-sm);
    border: var(--ehf-border-width) solid var(--ehf-border-light);
    display: flex;
    flex-direction: column;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ehf-shadow-lg);
    border-color: var(--ehf-primary-color);
}

.post-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.post-card-link:hover {
    text-decoration: none;
}

/* Post Card Image - Preserves natural aspect ratio */
.post-card-image {
    position: relative;
    overflow: hidden;
    background-color: var(--ehf-gray-100);
    flex-shrink: 0;
}

/* Default: 3:4 aspect ratio for all cards */
.post-card-image {
    aspect-ratio: 3 / 4;
}

/* Portrait images — same 3:4 ratio */
.post-card.portrait-image .post-card-image {
    aspect-ratio: 3 / 4;
}

.post-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform var(--ehf-transition-normal);
}

.post-card:hover .post-card-img {
    transform: scale(1.05);
}

.post-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--ehf-gray-100);
    color: var(--ehf-gray-400);
}

/* Post Card Category */
.post-card-category {
    position: absolute;
    top: var(--ehf-spacing-md);
    left: var(--ehf-spacing-md);
    background-color: var(--ehf-primary-color);
    color: var(--ehf-text-on-primary);
    font-family: var(--ehf-font-family);
    font-size: var(--ehf-font-size-xs);
    font-weight: var(--ehf-font-weight-medium);
    padding: var(--ehf-spacing-xs) var(--ehf-spacing-sm);
    border-radius: var(--ehf-border-radius-md);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Post Card Content */
.post-card-content {
    padding: var(--ehf-spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--ehf-spacing-md);
    flex-grow: 1;
}

.post-card-title {
    font-family: var(--ehf-font-family-headings);
    font-size: var(--ehf-font-size-xl);
    font-weight: var(--ehf-font-weight-semibold);
    line-height: var(--ehf-line-height-tight);
    color: var(--ehf-text-color);
    margin: 0;
}

.post-card-excerpt {
    font-family: var(--ehf-font-family);
    font-size: var(--ehf-font-size-base);
    line-height: var(--ehf-line-height-normal);
    color: var(--ehf-text-light);
    margin: 0;
    flex-grow: 1;
}

/* Post Card Meta */
.post-card-meta {
    display: flex;
    align-items: center;
    gap: var(--ehf-spacing-md);
    font-family: var(--ehf-font-family);
    font-size: var(--ehf-font-size-sm);
    color: var(--ehf-text-muted);
}

.post-card-author {
    font-weight: var(--ehf-font-weight-medium);
}

.post-card-date {
    position: relative;
    padding-left: var(--ehf-spacing-md);
}

.post-card-date::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--ehf-gray-400);
}

/* Read More Link */
.post-card-readmore {
    display: inline-flex;
    align-items: center;
    gap: var(--ehf-spacing-xs);
    font-family: var(--ehf-font-family);
    font-size: var(--ehf-font-size-sm);
    font-weight: var(--ehf-font-weight-medium);
    color: var(--ehf-primary-color);
    transition: all var(--ehf-transition-normal);
    margin-top: auto;
}

.post-card:hover .post-card-readmore {
    color: var(--ehf-primary-hover);
    gap: var(--ehf-spacing-sm);
}

.post-card-readmore i {
    transition: transform var(--ehf-transition-normal);
}

.post-card:hover .post-card-readmore i {
    transform: translateX(4px);
}

/* Posts Grid Footer */
.posts-grid-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: var(--ehf-spacing-2xl);
}

/* View All Posts Button */
.btn-view-all-posts {
    display: inline-flex;
    align-items: center;
    gap: var(--ehf-spacing-sm);
    padding: var(--ehf-spacing-md) var(--ehf-spacing-2xl);
    background-color: var(--ehf-primary-color);
    color: var(--ehf-text-on-primary);
    font-family: var(--ehf-font-family);
    font-size: var(--ehf-font-size-base);
    font-weight: var(--ehf-font-weight-medium);
    border: none;
    border-radius: var(--ehf-border-radius-lg);
    text-decoration: none;
    transition: all var(--ehf-transition-normal);
    cursor: pointer;
}

.btn-view-all-posts:hover {
    background-color: var(--ehf-primary-hover);
    color: var(--ehf-text-on-primary);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: var(--ehf-shadow-md);
    gap: var(--ehf-spacing-md);
}

.btn-view-all-posts i {
    transition: transform var(--ehf-transition-normal);
}

.btn-view-all-posts:hover i {
    transform: translateX(4px);
}

/* === Responsive Design === */

/* Tablet (768px and down) */
@media (max-width: 768px) {
    .posts-grid-container {
        padding: 0 var(--ehf-spacing-md);
    }
    
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--ehf-spacing-lg);
        margin-bottom: var(--ehf-spacing-3xl);
    }
    
    /* Reset portrait spans on tablet */
    .post-card.portrait-image {
        grid-row: span 1;
    }
    
    /* Tablet: uniform 3:4 */
    .post-card-image {
        aspect-ratio: 3 / 4;
        height: auto;
    }
    
    .post-card.portrait-image .post-card-image {
        aspect-ratio: 3 / 4;
        height: auto;
    }
    
    .post-card-content {
        padding: var(--ehf-spacing-lg);
        gap: var(--ehf-spacing-sm);
    }
    
    .posts-grid-section {
        padding: var(--ehf-spacing-3xl) 0;
    }
}

/* Mobile (480px and down) */
@media (max-width: 480px) {
    .posts-grid-container {
        padding: 0 var(--ehf-spacing-sm);
    }
    
    .posts-grid {
        grid-template-columns: 1fr;
        gap: var(--ehf-spacing-md);
        margin-bottom: var(--ehf-spacing-2xl);
    }
    
    .post-card-content {
        padding: var(--ehf-spacing-md);
    }
    
    /* Mobile: uniform 3:4 */
    .post-card-image {
        aspect-ratio: 3 / 4;
        height: auto;
    }
    
    .post-card.portrait-image .post-card-image {
        aspect-ratio: 3 / 4;
        height: auto;
    }
    
    .post-card-title {
        font-size: var(--ehf-font-size-lg);
    }
    
    .btn-view-all-posts {
        padding: var(--ehf-spacing-sm) var(--ehf-spacing-xl);
    }
    
    .posts-grid-section {
        padding: var(--ehf-spacing-2xl) 0;
    }
}

/* Small Mobile (360px and down) */
@media (max-width: 360px) {
    .posts-grid-container {
        padding: 0 var(--ehf-spacing-sm);
    }
    
    .post-card-image {
        aspect-ratio: 3 / 4;
    }
}