/**
 * Timeline Posts Block - Theme Component
 * Archaeological recovery: Sophisticated Instagram-style timeline styling
 * Migrated from plugin to theme per theme-centric architecture
 * Original source: commit eb2443e (1,225 lines of refined UX)
 */

.qm-timeline-posts {
    /* Site-wide color system integration */
    --columns-mobile: 1;
    --columns-tablet: 2;
    --columns-desktop: 3;
    --gap-size: var(--qm-gap-default);
    --border-radius: var(--qm-border-radius);
    --bg-color: var(--qm-bg-muted);
    --text-color: var(--qm-text-primary);
    --phase-color: var(--qm-accent-primary);
    --timeline-line: var(--qm-border-color);
    --shadow: var(--qm-shadow);
    --hover-shadow: var(--qm-hover-shadow);
    --transition: var(--qm-transition);
    
    margin: 0;
    background-color: var(--bg-color);
    border-radius: var(--border-radius);
    position: relative;
}

.qm-timeline-posts-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 2rem 0;
    text-align: center;
    color: var(--text-color);
}

/* Integrated Filter Interface */
.qm-timeline-filters {
    background: var(--qm-bg-secondary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--qm-border-color);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* View Toggle - Categories tab hidden but logic preserved */
.tf-view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    justify-content: center;
}

/* Hide both view toggle buttons - keep logic but hide UI */
.tf-toggle-btn[data-view="categories"],
.tf-toggle-btn[data-view="timeline"] {
    display: none;
}

/* Hide entire view toggle section when both buttons are hidden */
.tf-view-toggle {
    display: none;
}

.tf-toggle-btn {
    background: white;
    border: 1px solid var(--qm-border-color);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
}

.tf-toggle-btn:hover {
    background: var(--qm-bg-hover);
    border-color: var(--qm-accent-primary);
}

.tf-toggle-btn.active {
    background: var(--qm-accent-primary);
    color: white;
    border-color: var(--qm-accent-primary);
}

/* Filter Controls */
.tf-filter-controls {
    display: grid;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (min-width: 768px) {
    .tf-filter-controls {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

.tf-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tf-filter-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--qm-text-muted);
    margin-bottom: 0.25rem;
}

/* Search Input */
.tf-search-wrapper {
    grid-column: 1 / -1;
}

.tf-search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--qm-border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.tf-search-input:focus {
    outline: none;
    border-color: var(--qm-accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* 📱 MOBILE: Instagram-style horizontal scrolling filters */
@media (max-width: 768px) {
    /* UNIVERSAL Instagram scrolling for all filter buttons */
    .tf-filter-buttons,
    .tf-phase-buttons,
    .tf-character-buttons {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        gap: 0.75rem !important;
        padding: 0.5rem 1.5rem 0.75rem 1.5rem !important; /* Extra padding for better scroll access */
        margin: 0 -1.5rem !important; /* Extend to screen edges */
        scroll-behavior: smooth !important;
        display: flex !important;
        scroll-padding: 1.5rem !important; /* Ensures first/last items are fully visible */

        /* Hide scrollbars completely */
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    .tf-filter-buttons::-webkit-scrollbar,
    .tf-phase-buttons::-webkit-scrollbar,
    .tf-character-buttons::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    /* Instagram-style button styling for categories, phases AND characters */
    .tf-filter-btn,
    .tf-phase-btn,
    .tf-character-btn {
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        padding: 0.5rem 1rem !important;
        border-radius: 20px !important; /* Pill shape like Instagram */
        font-size: 0.875rem !important;
        font-weight: 500 !important;
        border: 1.5px solid #d1d5db !important;
        background: #ffffff !important;
        color: #6b7280 !important;
        transition: all 0.2s ease !important;
        min-width: auto !important;
        cursor: pointer !important;
    }

    /* Active state - Instagram blue */
    .tf-filter-btn.active,
    .tf-phase-btn.active,
    .tf-character-btn.active {
        background: var(--qm-accent-color) !important;
        color: white !important;
        border-color: var(--qm-accent-color) !important;
        font-weight: 600 !important;
    }

    /* Hover effect for mobile touch */
    .tf-filter-btn:active,
    .tf-phase-btn:active,
    .tf-character-btn:active {
        transform: scale(0.95) !important;
        transition: transform 0.1s ease !important;
    }

    /* Hide ALL dropdowns on mobile, show buttons instead */
    .tf-category-filter .tf-select,
    .tf-phase-filter .tf-select,
    .tf-character-filter .tf-select {
        display: none !important;
    }

    .tf-category-filter .tf-filter-buttons,
    .tf-phase-filter .tf-phase-buttons,
    .tf-character-filter .tf-character-buttons {
        display: flex !important;
    }

    /* Subtle fade ONLY when content is scrolled */
    .tf-filter-buttons:not(:hover)::before,
    .tf-filter-buttons:not(:hover)::after,
    .tf-phase-buttons:not(:hover)::before,
    .tf-phase-buttons:not(:hover)::after,
    .tf-character-buttons:not(:hover)::before,
    .tf-character-buttons:not(:hover)::after {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        width: 15px;
        pointer-events: none;
        z-index: 1;
        opacity: 0.6;
    }

    .tf-filter-buttons:not(:hover)::before,
    .tf-phase-buttons:not(:hover)::before,
    .tf-character-buttons:not(:hover)::before {
        left: -2px;
        background: linear-gradient(to right, var(--background-light, #f9fafb), transparent);
    }

    .tf-filter-buttons:not(:hover)::after,
    .tf-phase-buttons:not(:hover)::after,
    .tf-character-buttons:not(:hover)::after {
        right: -2px;
        background: linear-gradient(to left, var(--background-light, #f9fafb), transparent);
    }

    /* Container positioning for fade effect */
    .tf-filter-group {
        position: relative !important;
    }
}

/* 🖥️ DESKTOP: Dropdown-style filters (consistent design) */
@media (min-width: 769px) {
    /* Hide category buttons on desktop, show dropdown instead */
    .tf-category-filter .tf-filter-buttons {
        display: none !important;
    }

    .tf-category-filter .tf-select {
        display: block !important;
    }

    /* Hide phase buttons on desktop, show dropdown instead */
    .tf-phase-filter .tf-phase-buttons {
        display: none !important;
    }

    .tf-phase-filter .tf-select {
        display: block !important;
    }

    /* Hide character buttons on desktop, show dropdown instead */
    .tf-character-filter .tf-character-buttons {
        display: none !important;
    }

    .tf-character-filter .tf-select {
        display: block !important;
    }

    /* DESKTOP: Standard button styling when not hidden */
    .tf-filter-btn,
    .tf-phase-btn,
    .tf-character-btn {
        background: white;
        border: 1px solid var(--qm-border-color);
        border-radius: 6px;
        padding: 0.4rem 0.8rem;
        cursor: pointer;
        transition: all 0.2s ease;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .tf-filter-btn:hover,
    .tf-phase-btn:hover,
    .tf-character-btn:hover {
        background: var(--qm-bg-hover);
        border-color: var(--qm-accent-primary);
    }

    .tf-filter-btn.active,
    .tf-phase-btn.active,
    .tf-character-btn.active {
        background: var(--qm-accent-primary);
        color: white;
        border-color: var(--qm-accent-primary);
    }
}

/* Select Dropdowns */
.tf-select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--qm-border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.tf-select:focus {
    outline: none;
    border-color: var(--qm-accent-primary);
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

/* New Posts Filter - positioned alongside other filters */
.tf-new-posts-filter {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tf-new-posts-filter .tf-filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tf-new-posts-filter .tf-filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    margin-bottom: 0;
}

.tf-new-posts-checkbox {
    margin: 0;
    cursor: pointer;
}

/* Hide Clear Button and Result Count for minimal design */
.tf-clear-wrapper,
.tf-result-count {
    display: none;
}

/* Hide Phase Filter by Default */
.tf-phase-filter {
    display: none;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .qm-timeline-filters {
        padding: 1rem;
    }
    
    .tf-view-toggle {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tf-toggle-btn {
        text-align: center;
    }
    
    .tf-filter-buttons {
        justify-content: center;
    }
}

/* Timeline Grid Layout */
.qm-timeline-grid {
    display: grid;
    gap: var(--gap-size);
    grid-template-columns: repeat(var(--columns-mobile), 1fr);
}

@media (min-width: 768px) {
    .qm-timeline-grid {
        grid-template-columns: repeat(var(--columns-tablet), 1fr);
    }
}

@media (min-width: 1024px) {
    .qm-timeline-grid {
        grid-template-columns: repeat(var(--columns-desktop), 1fr);
    }
}

/* Timeline Layout - Special vertical timeline */
.qm-layout-timeline .qm-timeline-grid {
    display: block;
    max-width: 800px;
    margin: 0 auto;
    position: relative;
}

.qm-layout-timeline .qm-timeline-grid::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--timeline-line);
    z-index: 1;
}

/* Individual Timeline Posts */
.qm-timeline-post {
    background: var(--qm-background-primary, #ffffff);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
    box-shadow: var(--qm-shadow-light, 0 2px 6px rgba(0,0,0,0.08));
    border: 1px solid var(--qm-border-color, rgba(0,0,0,0.05));
    position: relative;
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.qm-timeline-post:hover {
    transform: translateY(-1px);
    box-shadow: var(--qm-shadow-medium, 0 4px 12px rgba(0,0,0,0.12));
}

/* Nieuwe Fase Highlighting - Subtiele lichte achtergrond */
.qm-timeline-post.qm-phase-new {
    background: var(--qm-new-phase-bg, #E8F5E9);
    border: 1px solid var(--qm-new-phase-border, #C8E6C9);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.qm-timeline-post.qm-phase-new .qm-post-title a {
    color: var(--qm-text-primary, #333333);
}

.qm-timeline-post.qm-phase-new .qm-post-excerpt,
.qm-timeline-post.qm-phase-new .qm-timeline-context,
.qm-timeline-post.qm-phase-new .qm-post-date,
.qm-timeline-post.qm-phase-new .qm-post-characters {
    color: var(--qm-text-secondary, #555555);
}

/* New Post Highlighting - Subtiele lichte achtergrond (lower priority than nieuwe fase) */
.qm-timeline-post.qm-post-new:not(.qm-phase-new) {
    background: var(--qm-new-post-bg, #E3F2FD);
    border: 1px solid var(--qm-new-post-border, #BBDEFB);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.qm-timeline-post.qm-post-new:not(.qm-phase-new) .qm-post-title a {
    color: var(--qm-text-primary, #333333);
}

.qm-timeline-post.qm-post-new:not(.qm-phase-new) .qm-post-excerpt,
.qm-timeline-post.qm-post-new:not(.qm-phase-new) .qm-timeline-context,
.qm-timeline-post.qm-post-new:not(.qm-phase-new) .qm-post-date,
.qm-timeline-post.qm-post-new:not(.qm-phase-new) .qm-post-characters {
    color: var(--qm-text-secondary, #555555);
}

/* No hover effect for nieuwe fase posts - they have permanent highlight */
.qm-timeline-post.qm-phase-new:hover {
    transform: none !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1) !important;
    background: var(--qm-new-phase-bg, #E8F5E9) !important;
}

/* No hover effect for new posts - they have permanent highlight */
.qm-timeline-post.qm-post-new:not(.qm-phase-new):hover {
    transform: none !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1) !important;
    background: var(--qm-new-post-bg, #E3F2FD) !important;
}


.qm-phase-colors .qm-timeline-post {
    border-left: 4px solid var(--phase-color);
}

/* Timeline Item - Special styling for timeline layout */
.qm-timeline-item {
    margin-bottom: var(--gap-size);
    margin-left: 2rem;
    position: relative;
}

.qm-timeline-item .qm-timeline-connector {
    position: absolute;
    left: -2.5rem;
    top: 1.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--phase-color);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--timeline-line);
    z-index: 2;
}

/* Featured Image */
.qm-post-thumbnail {
    flex-shrink: 0;
    width: 150px;
    height: 150px;
}

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

.qm-post-thumbnail img,
.qm-featured-image {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: calc(var(--border-radius) - 2px);
}

/* ARCHAEOLOGICAL RESTORATION: Use exact selector from perfect commit eb2443e */
.qm-post-thumbnail img {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: calc(var(--border-radius) - 2px);
}

/* Post Content */
.qm-post-content {
    position: relative;
    flex: 1;
    min-width: 0;
}

/* Phase Badge */
.qm-post-phase {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--phase-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.qm-phase-colors .qm-post-phase {
    background: var(--phase-color);
    color: white;
    border-radius: 12px;
    padding: 0.25rem 0.5rem;
}

/* Post Title */
.qm-post-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.qm-post-title a:hover {
    color: var(--qm-title-hover, var(--phase-color));
}

/* Post Categories Display */
.qm-post-categories {
    display: inline-flex;
    gap: 0.5rem;
    font-size: 0.6rem;
    font-weight: 500;
    flex-wrap: wrap;
}

.qm-post-category {
    padding: 0.25rem 0.5rem;
    background: var(--background-light, #f5f5f5);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    color: var(--text-secondary, #666);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    word-break: break-word;
    max-width: 100%;
}

/* Post Meta (Date, Author & Timeline Context) */
.qm-post-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.qm-post-date {
    font-size: 0.875rem;
    color: var(--qm-text-secondary, #666);
    font-weight: 500;
}

.qm-meta-separator {
    color: var(--qm-text-tertiary, #999);
    font-weight: 300;
}

.qm-post-author {
    font-size: 0.875rem;
    color: var(--qm-text-secondary, #666);
    font-weight: 500;
}

.qm-timeline-context {
    font-size: 0.7rem;
    color: var(--qm-text-tertiary, #888);
    font-style: italic;
    font-weight: normal;
    text-transform: none;
    letter-spacing: normal;
    white-space: nowrap;
}

.qm-timeline-context::before {
    content: "📅 ";
    margin-right: 0.25rem;
}

/* Post Excerpt */
.qm-post-excerpt {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--qm-text-secondary, #555);
    margin-bottom: 1rem;
}

/* Featured Characters */
.qm-post-characters {
    font-size: 0.8rem;
    color: var(--qm-text-muted, #666);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qm-characters-icon {
    opacity: 0.7;
}

/* Read More Link */
.qm-post-actions {
    margin-top: auto;
}

.qm-read-more {
    color: var(--phase-color);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

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

/* Post Image (for card/grid layouts) */
.qm-post-image {
    margin-top: 1rem;
    border-radius: calc(var(--border-radius) - 2px);
    overflow: hidden;
    aspect-ratio: 16/9;
    background: var(--qm-background-secondary, #f5f5f5);
}

.qm-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.qm-post-image:hover img {
    transform: scale(1.02);
}

/* Layout Variations */

/* List Layout */
.qm-layout-list .qm-timeline-grid {
    display: block;
}

.qm-layout-list .qm-timeline-post {
    margin-bottom: var(--gap-size);
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
}

.qm-layout-list .qm-post-image,
.qm-layout-list .qm-post-thumbnail {
    flex: 0 0 150px;
    width: 150px;
    height: 150px;
    margin-top: 0;
}

.qm-layout-list .qm-post-content {
    flex: 1;
}

.qm-layout-list .qm-post-title {
    margin-top: 0;
}

/* Cards Layout */
.qm-layout-cards .qm-timeline-post {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.qm-layout-cards .qm-post-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.qm-layout-cards .qm-post-actions {
    margin-top: auto;
    padding-top: 1rem;
}

/* Compact View */
.qm-compact .qm-timeline-post {
    padding: 1rem;
}

.qm-compact .qm-post-title {
    font-size: 1.1rem;
}

.qm-compact .qm-post-excerpt {
    font-size: 0.875rem;
}

.qm-compact .qm-post-phase {
    font-size: 0.7rem;
}

.qm-compact .qm-post-date,
.qm-compact .qm-post-characters {
    font-size: 0.8rem;
}

/* Spacing Variations */
.qm-spacing-compact {
    --gap-size: 15px;
}

.qm-spacing-wide {
    --gap-size: 30px;
}

/* Empty State */
.qm-timeline-posts-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--qm-text-muted, #666);
    font-style: italic;
}

/* Responsive Adjustments */
@media (max-width: 767px) {
    .qm-timeline-post {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }
    
    .qm-post-thumbnail {
        width: 100%;
    }
    
    .qm-post-thumbnail img {
        aspect-ratio: 1/1;
    }
    
    .qm-post-meta {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .qm-layout-timeline .qm-timeline-item {
        margin-left: 1.5rem;
    }
    
    .qm-layout-timeline .qm-timeline-item .qm-timeline-connector {
        left: -2rem;
    }
    
    .qm-layout-list .qm-timeline-post {
        flex-direction: column;
    }
    
    .qm-layout-list .qm-post-image {
        flex: none;
        width: 100%;
        aspect-ratio: 16/9;
    }
    
    .qm-post-title {
        font-size: 1.1rem;
    }
}

/* Phase Color Variants */
.qm-phase-colors .qm-timeline-post[style*="--phase-color: #2ECC71"] {
    --phase-color-rgb: 46, 204, 113;
}

.qm-phase-colors .qm-timeline-post[style*="--phase-color: #F39C12"] {
    --phase-color-rgb: 243, 156, 18;
}

.qm-phase-colors .qm-timeline-post[style*="--phase-color: #9B59B6"] {
    --phase-color-rgb: 155, 89, 182;
}

.qm-phase-colors .qm-timeline-post[style*="--phase-color: #3498DB"] {
    --phase-color-rgb: 52, 152, 219;
}

/* Dark Mode Support - DISABLED */
/* 
@media (prefers-color-scheme: dark) {
    .qm-timeline-posts {
        --text-color: #fff;
        --timeline-line: #444;
    }
    
    .qm-timeline-post {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .qm-post-date {
        color: #ccc;
    }
    
    .qm-post-excerpt {
        color: #ddd;
    }
    
    .qm-post-characters {
        color: #ccc;
    }
}
*/

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .qm-timeline-post {
        border-width: 2px;
        border-color: #000;
    }
    
    .qm-post-date,
    .qm-post-characters {
        color: #000;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .qm-timeline-post,
    .qm-post-title a,
    .qm-read-more,
    .qm-post-image img {
        transition: none;
    }
    
    .qm-timeline-post:hover {
        transform: none;
    }
    
    .qm-read-more:hover {
        transform: none;
    }
    
    .qm-post-image:hover img {
        transform: none;
    }
}

/* Timeline Posts Pagination */
.timeline-posts-pagination {
    margin-top: 2rem;
    border-top: 1px solid var(--qm-border-color, #e0e0e0);
    padding-top: 2rem;
}

.timeline-posts-pagination .pagination-info {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--qm-text-muted);
}

.timeline-posts-pagination .page-info {
    padding: 0.5rem 1rem;
    background: #f9f9f9;
    border-radius: 4px;
    display: inline-block;
}

.timeline-posts-pagination a,
.timeline-posts-pagination span {
    display: inline-block;
    padding: 0.5rem 1rem;
    margin: 0 0.25rem;
    text-decoration: none;
    border: 1px solid var(--qm-border-color);
    border-radius: 4px;
    transition: var(--transition);
}

.timeline-posts-pagination .current {
    background: var(--qm-accent-color, #007cba);
    color: white;
    border-color: var(--qm-accent-color, #007cba);
}

.timeline-posts-pagination a:hover {
    background: #f5f5f5;
    border-color: var(--qm-accent-color, #007cba);
    color: var(--qm-accent-color, #007cba);
}

.timeline-posts-pagination .prev,
.timeline-posts-pagination .next {
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    background: var(--qm-bg-secondary);
    border-color: var(--qm-accent-color, #007cba);
}

.timeline-posts-pagination .prev:hover,
.timeline-posts-pagination .next:hover {
    background: var(--qm-accent-color, #007cba);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.25);
}

/* ===== LOAD MORE SYSTEM ===== */
.timeline-posts-load-more {
    margin-top: 2rem;
    border-top: 1px solid var(--qm-border-color, #e0e0e0);
    padding-top: 2rem;
    text-align: center;
}

.timeline-posts-load-more .load-more-info {
    margin-bottom: 1.5rem;
}

.timeline-posts-load-more .posts-info {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--qm-bg-secondary);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--qm-text-muted);
    border: 1px solid var(--qm-border-color);
}

.timeline-load-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Safari fallback: no gap property */
    padding: 1rem 2rem;
    /* Safari fallback: solid background first, gradient second */
    background: var(--qm-timeline-button-bg, #007cba);
    background: linear-gradient(135deg, var(--qm-timeline-button-bg, #007cba), var(--qm-timeline-button-hover, #005a8b));
    color: var(--qm-timeline-button-text, #ffffff);
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
    position: relative;
    overflow: hidden;
    /* Safari specific fixes */
    -webkit-appearance: none;
    -webkit-border-radius: 12px;
    -webkit-box-shadow: 0 4px 12px rgba(0, 124, 186, 0.15);
}

/* Safari gap fallback - add margin to children instead */
.timeline-load-more-btn > * + * {
    margin-left: 0.5rem;
}

.timeline-load-more-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.timeline-load-more-btn:hover:before {
    left: 100%;
}

.timeline-load-more-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 124, 186, 0.25);
    /* Safari fallback */
    background: var(--qm-timeline-button-hover, #0084d1);
    background: linear-gradient(135deg, var(--qm-timeline-button-hover, #0084d1), #006494);
    -webkit-box-shadow: 0 6px 16px rgba(0, 124, 186, 0.25);
    -webkit-transform: translateY(-2px);
}

.timeline-load-more-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.2);
}

.timeline-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.1) !important;
}

.timeline-load-more-btn .load-more-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.load-more-complete {
    padding: 1rem;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 500;
}

.load-more-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

/* Responsive Load More */
@media (max-width: 768px) {
    .timeline-load-more-btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
        width: 100%;
        max-width: 300px;
    }

    .timeline-posts-load-more .posts-info {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
}

/* ===== ULTRA COMPACT LAYOUT ===== */
.qm-layout-ultra-compact .qm-timeline-posts-container {
    gap: 0.5rem;
}

.qm-layout-ultra-compact .qm-timeline-post {
    background: white;
    border: 1px solid var(--qm-border-color);
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
}

.qm-layout-ultra-compact .qm-timeline-post:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-color: var(--qm-accent-color, #007cba);
}

.qm-layout-ultra-compact .qm-post-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.qm-layout-ultra-compact .qm-post-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 200px;
    line-height: 1.3;
}

.qm-layout-ultra-compact .qm-post-title a {
    color: var(--qm-text-primary, #2c3e50);
    text-decoration: none;
    transition: color 0.2s ease;
}

.qm-layout-ultra-compact .qm-post-title a:hover {
    color: var(--qm-accent-color, #007cba);
}

.qm-layout-ultra-compact .qm-post-phase {
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--phase-color);
    color: var(--phase-color);
    background: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    flex-shrink: 0;
}

.qm-layout-ultra-compact .qm-post-excerpt.qm-ultra-short {
    font-size: 0.85rem;
    color: var(--qm-text-muted);
    margin: 0.25rem 0 0 0;
    flex-basis: 100%;
    line-height: 1.3;
}

.qm-layout-ultra-compact .qm-post-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #888;
    flex-shrink: 0;
}

.qm-layout-ultra-compact .qm-post-characters {
    font-size: 0.8rem;
    color: var(--qm-text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.qm-layout-ultra-compact .qm-characters-icon {
    font-size: 0.7rem;
}

.qm-layout-ultra-compact .qm-post-read-more {
    font-size: 0.8rem;
    margin-left: auto;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: var(--qm-accent-color, #007cba);
    color: white;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.qm-layout-ultra-compact .qm-post-read-more:hover {
    background: var(--qm-wordpress-secondary, #005a87);
    transform: translateY(-1px);
}

/* New post badge positioning for ultra-compact */
.qm-layout-ultra-compact .qm-badge--corner {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    z-index: 2;
}

/* Mobile responsiveness for ultra-compact */
@media (max-width: 768px) {
    .qm-layout-ultra-compact .qm-post-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .qm-layout-ultra-compact .qm-post-title {
        min-width: auto;
        width: 100%;
    }
    
    .qm-layout-ultra-compact .qm-post-meta {
        align-self: flex-end;
        margin-left: auto;
    }
}

/* iPad specific optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
    .qm-layout-ultra-compact .qm-timeline-post {
        padding: 0.5rem 0.75rem;
    }
    
    .qm-layout-ultra-compact .qm-post-title {
        font-size: 0.9rem;
    }
    
    .qm-layout-ultra-compact .qm-post-content {
        gap: 0.5rem;
    }
}

/* Cache bust: 1756885201 */