/**
 * Category Archive - Theme Component
 * Matches timeline-posts block LIST layout with COMPACT spacing
 * Reference: Page 1421 "The Making of Stiefus Lief" - Blog Timeline
 * Theme-centric architecture: visual presentation managed by theme
 */

/* ========================================
   🎯 CORE ARCHIVE CONTAINER
   ======================================== */

.category-archive {
    /* Site-wide color system integration */
    --gap-size: 15px;                   /* COMPACT spacing */
    --border-radius: var(--qm-border-radius, 8px);
    --text-color: var(--qm-text-primary, #1f2937);
    --text-secondary: var(--qm-text-secondary, #4b5563);
    --text-muted: var(--qm-text-muted, #9ca3af);
    --background-white: var(--qm-background-primary, #ffffff);
    --border-light: var(--qm-border-color, #e5e7eb);
    --shadow-light: var(--qm-shadow-light, 0 2px 6px rgba(0,0,0,0.08));
    --shadow-medium: var(--qm-shadow-medium, 0 4px 12px rgba(0,0,0,0.12));
    --transition: var(--qm-transition, all 0.3s ease);

    /* DON'T override margin - let .site-main handle centering */
    /* DON'T override padding - let .site-main handle spacing */
}

/* ========================================
   🍞 BREADCRUMBS - Centered on Category Archives
   ======================================== */

.category-archive .breadcrumbs {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ========================================
   📋 CATEGORY HEADER - Matches Standard Page Titles
   ======================================== */

.category-archive .category-header {
    text-align: center;
    padding: 1rem 0 1.5rem 0;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 2rem;
}

.category-archive .category-header-inner {
    max-width: 100%;
}

.category-archive .category-title {
    font-size: 2.8rem;             /* Matches .entry-title */
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem 0;
    color: var(--text-color);
}

.category-archive .category-description {
    font-style: italic;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: 1rem;
    text-align: center;           /* Explicitly center */
}

.category-archive .category-meta {
    display: flex;
    align-items: center;
    justify-content: center;      /* CENTER the flex items */
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-top: 1rem;
    color: var(--text-muted);
}

.category-archive .category-separator {
    color: var(--text-muted);
}

.category-archive .parent-category a {
    color: var(--qm-accent-primary, #4A90E2);
    text-decoration: none;
    transition: var(--transition);
}

.category-archive .parent-category a:hover {
    text-decoration: underline;
}

/* ========================================
   📝 LIST LAYOUT - Matches .qm-layout-list
   ======================================== */

.category-posts-grid {
    display: block;                /* NOT grid, simple block container */
    margin-top: 3rem;              /* Space after header */
}

/* ========================================
   🎴 POST CARDS - Matches .qm-timeline-post + .qm-compact
   ======================================== */

.category-post-card {
    background: var(--background-white);
    border-radius: var(--border-radius);
    padding: 1rem;                     /* COMPACT: 1rem (not 1.5rem) */
    transition: var(--transition);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-light);
    position: relative;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: var(--gap-size);    /* COMPACT: 15px gap */
}

.category-post-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

/* Featured Image - 150px SQUARE (1:1 ratio) */
/* Matches: .qm-layout-list .qm-post-thumbnail */
.category-post-card .post-thumbnail {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
    margin-top: 0;
}

.category-post-card .post-thumbnail a {
    display: block;
    line-height: 0;
}

.category-post-card .post-thumbnail img {
    width: 100%;
    aspect-ratio: 1/1;                 /* SQUARE (NOT 4:3!) */
    object-fit: cover;
    border-radius: calc(var(--border-radius) - 2px);
}

/* Card Content - Right side */
.category-post-card .post-content {
    position: relative;
    flex: 1;
    min-width: 0;
    text-align: left;                  /* Explicit left alignment for all content */
}

/* Entry Header */
.category-post-card .entry-header {
    margin-bottom: 0.75rem;
    text-align: left;                  /* Explicit left alignment */
}

/* Phase Badge - Inline after title */
.category-post-card .post-phase {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--phase-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;                    /* Don't shrink badge */
}

.category-post-card .post-phase > span {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: rgba(var(--phase-color-rgb, 0, 124, 186), 0.1);
    border-radius: 12px;
}

.category-post-card .entry-title {
    font-size: 1.1rem;                 /* COMPACT: smaller title */
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
    display: flex;                     /* Flex for inline phase badge */
    align-items: center;               /* Vertically center badge with title */
    gap: 0.75rem;                      /* Space between title and badge */
    flex-wrap: wrap;                   /* Allow wrapping on small screens */
}

.category-post-card .entry-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.category-post-card .entry-title a:hover {
    color: var(--qm-accent-primary, #4A90E2);
}

/* Meta Information */
.category-archive .category-post-card .entry-meta {
    font-size: 0.8rem;                 /* COMPACT: smaller meta */
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: flex-start !important;  /* Force LEFT - overriding other rules */
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    text-align: left;                  /* Explicit left alignment */
}

.category-post-card .meta-separator {
    color: var(--text-muted);
}

.category-post-card .timeline-context {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    font-weight: normal;
    white-space: nowrap;
}

/* Excerpt */
.category-post-card .entry-summary {
    font-size: 0.875rem;               /* COMPACT: smaller excerpt */
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Footer Actions */
.category-post-card .entry-footer {
    margin-top: auto;
}

.category-post-card .read-more {
    color: var(--qm-accent-primary, #4A90E2);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.category-post-card .read-more:hover {
    text-decoration: underline;
    transform: translateX(2px);
}

/* ========================================
   📄 PAGINATION
   ======================================== */

.category-pagination {
    margin-top: 3rem;
    text-align: center;
}

.category-pagination .nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.category-pagination .page-numbers {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--background-white);
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: var(--transition);
}

.category-pagination .page-numbers:hover {
    background: var(--qm-accent-primary, #4A90E2);
    color: white;
    border-color: var(--qm-accent-primary, #4A90E2);
}

.category-pagination .page-numbers.current {
    background: var(--qm-accent-primary, #4A90E2);
    color: white;
    border-color: var(--qm-accent-primary, #4A90E2);
    font-weight: 600;
}

/* ========================================
   🚫 EMPTY STATE
   ======================================== */

.no-posts {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--qm-bg-secondary, #f8fafc);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.no-posts h2 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.no-posts p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.no-posts .button {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: var(--qm-accent-primary, #4A90E2);
    color: white;
    text-decoration: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

.no-posts .button:hover {
    background: #357ABD;
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

/* ========================================
   📱 RESPONSIVE DESIGN - Matches timeline-posts mobile behavior
   ======================================== */

@media (max-width: 768px) {
    .category-archive .category-title {
        font-size: 2rem;              /* Matches standard responsive */
    }

    .category-posts-grid {
        gap: var(--gap-size);
    }

    /* Switch to vertical layout on mobile */
    .category-post-card {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    /* Full-width square image on mobile */
    .category-post-card .post-thumbnail {
        width: 100%;
        height: auto;
    }

    .category-post-card .post-thumbnail img {
        aspect-ratio: 1/1;            /* Keep square on mobile */
    }

    .category-post-card .entry-title {
        font-size: 1.1rem;
    }

    .category-post-card .entry-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}

/* Cache bust: <?php echo time(); ?> */
