/*
 * Styles pour la grille du blog et des archives
 * Version: 1.0.0
 */

.posts-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
    margin: 3rem 0;
}

/* Layout blog + sidebar */
.blog-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 2.5rem;
    align-items: start;
    margin-top: 3rem;
}

.blog-content {
    min-width: 0;
}

.blog-sidebar {
    position: sticky;
    top: 140px;
    align-self: start;
    margin-top: 0;
}

.sidebar-main .widget + .widget {
    margin-top: 1rem;
}

/* Sidebar widgets */
.blog-sidebar .widget {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.blog-sidebar .widget-title {
    margin-bottom: 0.5rem;
}

.blog-sidebar a,
.blog-sidebar a:visited,
.blog-sidebar a:hover,
.blog-sidebar a:focus {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-thickness: 0 !important;
    box-shadow: none !important;
}

.blog-sidebar .widget a,
.blog-sidebar .widget a:visited,
.blog-sidebar .widget a:hover,
.blog-sidebar .widget a:focus {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-thickness: 0 !important;
    box-shadow: none !important;
}

.blog-sidebar .wp-block-categories a,
.blog-sidebar .wp-block-categories a:visited,
.blog-sidebar .wp-block-categories a:hover,
.blog-sidebar .wp-block-archives a,
.blog-sidebar .wp-block-archives a:visited,
.blog-sidebar .wp-block-archives a:hover,
.blog-sidebar .wp-block-latest-posts a,
.blog-sidebar .wp-block-latest-posts a:visited,
.blog-sidebar .wp-block-latest-posts a:hover,
.blog-sidebar .wp-block-latest-comments a,
.blog-sidebar .wp-block-latest-comments a:visited,
.blog-sidebar .wp-block-latest-comments a:hover,
.blog-sidebar .widget_categories a,
.blog-sidebar .widget_categories a:visited,
.blog-sidebar .widget_categories a:hover,
.blog-sidebar .widget_recent_entries a,
.blog-sidebar .widget_recent_entries a:visited,
.blog-sidebar .widget_recent_entries a:hover,
.blog-sidebar .widget_archive a,
.blog-sidebar .widget_archive a:visited,
.blog-sidebar .widget_archive a:hover,
.blog-sidebar .widget_tag_cloud a,
.blog-sidebar .widget_tag_cloud a:visited,
.blog-sidebar .widget_tag_cloud a:hover {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-thickness: 0 !important;
}

.blog-sidebar .wp-block-categories a:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-categories a:visited:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-categories a:hover:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-archives a:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-archives a:visited:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-archives a:hover:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-latest-posts a:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-latest-posts a:visited:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-latest-posts a:hover:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-latest-comments a:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-latest-comments a:visited:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-latest-comments a:hover:not(.wp-block-button__link):not(.wp-block-file__button):not(.button):not(.btn):not(.post-page-numbers),
.blog-sidebar .wp-block-file a:not(.wp-block-file__button) {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-thickness: 0 !important;
}

.blog-sidebar .widget hr {
    display: none;
}

.blog-sidebar .widget ul,
.blog-sidebar .widget ol {
    list-style: none;
    margin: 0;
    padding: 0;
}

.blog-sidebar .widget li {
    margin: 0;
    padding: 0;
    border: 0;
}

/* Categories in sidebar: same pill style as cards */
.blog-sidebar .widget_categories ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blog-sidebar .widget_categories a {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    text-decoration: none !important;
    transition: all var(--transition-fast);
}

.blog-sidebar .widget_categories a:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    text-decoration: none !important;
}

/* Tag cloud in sidebar */
.blog-sidebar .tagcloud a {
    font-size: 0.75rem !important;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    text-decoration: none !important;
    display: inline-flex;
    margin: 0 0.5rem 0.5rem 0;
}

.blog-sidebar .tagcloud a:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    text-decoration: none !important;
}

.blog-layout .posts-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
}

/* Design des cartes d'articles */
.post-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal), background-color var(--transition-normal);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    background: var(--bg-primary);
}

.post-card .post-thumbnail {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
}

.post-card .post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

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

.post-card .post-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.post-card .post-header {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.post-card .post-categories {
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body .post-card .cat-link {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    text-decoration: none !important;
    transition: all var(--transition-fast);
}

body .post-card .cat-link:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    text-decoration: none !important;
}

body .post-card .post-title a {
    color: var(--text-primary);
    text-decoration: none !important;
    transition: color var(--transition-fast);
}

.post-card a,
.post-card a:visited,
.post-card a:hover,
.post-card a:focus {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-thickness: 0 !important;
    box-shadow: none !important;
}

.post-card .post-title {
    margin: 0;
    line-height: 1.25;
}

body .post-card .post-title a:hover {
    color: var(--primary-color);
    text-decoration: none !important;
}

body .post-card .post-meta a {
    color: var(--text-secondary);
    text-decoration: none !important;
    transition: color var(--transition-fast);
}

.post-card .post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.post-card .post-updated,
.single-post-article .post-updated {
    color: var(--text-secondary);
}

.post-card .post-excerpt {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

body .post-card .post-meta a:hover {
    color: var(--primary-color);
    text-decoration: none !important;
}

.post-card .post-card-content a:hover,
.post-card .post-footer a:hover,
.post-card .post-title a:hover {
    text-decoration: none !important;
    text-decoration-line: none !important;
    text-decoration-thickness: 0 !important;
}

body .post-card .post-footer .btn {
    text-decoration: none !important;
}

.post-card .post-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: auto;
}

.post-card .post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

body .post-card .post-footer .btn:hover {
    text-decoration: none !important;
}

body .post-card .tag-link {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none !important;
}

body .post-card .tag-link:hover {
    color: var(--primary-color);
    text-decoration: none !important;
}

/* Dark Mode support */
[data-theme="dark"] .post-card {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .post-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .post-card .post-title a {
    color: var(--text-primary);
}

[data-theme="dark"] .post-card .post-excerpt {
    color: var(--text-secondary);
}

/* Responsive Tablette */
@media (max-width: 1024px) {
    .blog-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .blog-sidebar {
        position: static;
        margin-top: 2rem;
    }

    .blog-layout .posts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.5rem;
        padding: 0 1.5rem;
    }

    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        padding: 0 1.5rem;
    }
}

/* Responsive Mobile */
@media (max-width: 640px) {
    .blog-layout .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0;
    }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .post-card .post-title {
        font-size: 1.125rem;
    }
}

/* --- Styles Article Seul (Single Post) --- */
.single-post-article {
    max-width: 800px;
    margin: 4rem auto;
    padding-bottom: 4rem;
}

.single-post-article .post-header {
    text-align: center;
    margin-bottom: 3rem;
}

.single-post-article .post-categories {
    justify-content: center;
    margin-bottom: 1.5rem;
    display: flex;
    gap: 0.5rem;
}

.single-post-article .cat-link {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    text-decoration: none !important;
    transition: all var(--transition-fast);
}

.single-post-article .cat-link:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    text-decoration: none !important;
}

.single-post-article .post-title {
    font-size: var(--font-size-4xl);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.single-post-article .post-meta {
    justify-content: center;
    color: var(--text-muted);
    gap: 1rem;
    display: flex;
    align-items: center;
}

.single-post-article .post-meta a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.single-post-article .post-meta a:hover {
    text-decoration: none !important;
}

.single-post-article .post-thumbnail {
    margin-bottom: 3rem;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.single-post-article .post-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}

.single-post-article .post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.single-post-article .post-content h2,
.single-post-article .post-content h3,
.single-post-article .post-content h4 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
}

.single-post-article .post-content h2:first-child,
.single-post-article .post-content h3:first-child,
.single-post-article .post-content h4:first-child {
    margin-top: 0;
}

.single-post-article .post-content p {
    margin-bottom: 1.5rem;
}

.single-post-article .post-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.single-post-article .tag-link {
    display: inline-block;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.4rem 1rem;
    border-radius: 50px;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.single-post-article .tag-link:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
}

/* Responsive Single Post */
@media (max-width: 768px) {
    .single-post-article .post-title {
        font-size: var(--font-size-3xl);
    }
    
    .single-post-article {
        margin: 2rem auto;
    }
}
