/* Archive Post Grid Styles */
.archive-post-grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.archive-post-grid-header {
    text-align: center;
    margin-bottom: 3rem;
}

.archive-post-grid-title {
    font-size: clamp(1.875rem, 4vw, 2.5rem);
    font-weight: bold;
    color: #1a202c;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.archive-post-grid-description {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: #718096;
    max-width: 32rem;
    margin: 0 auto;
    line-height: 1.6;
}

/* Archive Posts Grid */
.archive-posts-grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.archive-posts-grid.columns-2 {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
}

.archive-posts-grid.columns-3 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.archive-posts-grid.columns-4 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.archive-post-card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.2s ease;
    transform: translateY(0);
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

/* Archive Image with Date Stamp */
.archive-post-card-image {
    position: relative;
    overflow: hidden;
    height: 12rem;
    flex-shrink: 0;
    background-color: #f7fafc;
}

.archive-post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    cursor: pointer;
}

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

/* Date Stamp - Positioned like in the image */
.archive-post-date-stamp {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: #2563eb;
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Archive Content */
.archive-post-card-content {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.archive-post-card-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: #1a202c;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    flex-shrink: 0;
}

.archive-post-card-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-post-card-title a:hover {
    color: #3182ce;
}

.archive-post-card-excerpt {
    color: #718096;
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 4.8rem;
}

/* Archive Modal Styles */
.archive-post-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    backdrop-filter: blur(2px);
}

.archive-post-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.archive-post-modal {
    background: white;
    border-radius: 0.5rem;
    max-width: min(900px, 90vw);
    width: 100%;
    max-height: 95vh;
    height: 95vh;
    overflow: hidden;
    position: relative;
    transform: scale(0.95);
    transition: transform 0.2s ease;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.archive-post-modal-overlay.active .archive-post-modal {
    transform: scale(1);
}

.archive-post-modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000000;
    background: #dc2626;
    border: none;
    border-radius: 50%;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
    transition: box-shadow 0.2s ease;
    font-size: 1.75rem;
    color: #ffffff;
}

.archive-post-modal-close:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.25);
    background: #b91c1c;
}

.archive-post-modal-content {
    max-height: 100%;
    height: 100%;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.archive-post-modal-header {
    padding: 3rem 3rem 2rem 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: relative;
}

.archive-post-modal-title {
    font-size: clamp(1.5rem, 3vw, 1.875rem);
    font-weight: bold;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.3;
    text-align: center;
}

.archive-post-modal-meta {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    flex-wrap: wrap;
    text-align: center;
}

.archive-meta-latest,
.archive-meta-categories,
.archive-meta-tags {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.archive-meta-separator {
    color: rgba(255, 255, 255, 0.6);
    font-weight: normal;
}

.archive-meta-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
    padding: 5px 5px 5px 5px;
}

.archive-meta-link:hover {
    color: rgba(255, 255, 255, 1);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.archive-post-modal-meta-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
    flex-wrap: wrap;
    text-align: center;
    margin-top: 1rem;
    padding-top: 0;
}

.archive-meta-action-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
}

.archive-meta-action-link:hover {
    color: rgba(255, 255, 255, 1);
    text-decoration: none;
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.archive-post-modal-body {
    padding: 2rem 3rem 3rem 3rem;
    color: #4a5568;
    line-height: 1.7;
    background: white;
    flex: 1;
}

/* Archive Modal Body Typography */
.archive-post-modal-body h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: bold;
    color: #1a202c;
    margin: 2rem 0 1rem 0;
}

.archive-post-modal-body h3 {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    font-weight: 600;
    color: #2d3748;
    margin: 1.5rem 0 0.75rem 0;
}

.archive-post-modal-body p {
    margin-bottom: 1rem;
}

.archive-post-modal-body ul,
.archive-post-modal-body ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.archive-post-modal-body li {
    margin-bottom: 0.5rem;
}

.archive-post-modal-body blockquote {
    border-left: 4px solid #3182ce;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    color: #4a5568;
    background-color: #f7fafc;
    padding: 1rem;
    border-radius: 0.25rem;
}

.archive-post-modal-body code {
    background-color: #f7fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.archive-post-modal-body pre {
    background-color: #f7fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1rem 0;
}

.archive-post-modal-body pre code {
    background-color: transparent;
    padding: 0;
}

.archive-post-modal-body a {
    color: #3182ce;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.archive-post-modal-body a:hover {
    color: #2c5aa0;
}

.archive-post-modal-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* Archive Loading and Error States */
.archive-modal-loading,
.archive-modal-error,
.archive-no-posts-found {
    padding: 2rem;
    text-align: center;
    color: #4a5568;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.archive-modal-error {
    color: #e53e3e;
}

.archive-modal-loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #3182ce;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* Archive Pagination */
.archive-pagination-wrapper {
    margin-top: 3rem;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 768px) {
    .archive-post-modal-overlay {
        padding: 1rem;
    }
    
    .archive-posts-grid.columns-2,
    .archive-posts-grid.columns-3,
    .archive-posts-grid.columns-4 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .archive-post-modal {
        max-width: 95vw;
        max-height: 90vh;
        height: 90vh;
    }
    
    .archive-post-modal-header {
        padding: 2rem 2rem 1.5rem 2rem;
    }
    
    .archive-post-modal-body {
        padding: 1.5rem 2rem 2rem 2rem;
    }
    
    .archive-post-modal-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .archive-post-modal-meta-actions {
        flex-direction: row;
        gap: 0.75rem;
        margin-top: 0.75rem;
    }
    
    .archive-meta-action-link {
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }
    
    .archive-post-card-image {
        height: 10rem;
    }
    
    .archive-post-modal-close {
        top: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
        font-size: 1.5rem;
    }
    
    .archive-post-date-stamp {
        top: 0.5rem;
        left: 0.5rem;
        padding: 0.25rem 0.5rem;
        font-size: 0.8125rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .archive-post-grid-container {
        color: #e2e8f0;
    }
    
    .archive-post-card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .archive-post-modal {
        background: #2d3748;
        color: #e2e8f0;
    }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body.archive-modal-open {
    overflow: hidden;
}