/**
 * Modern Archive Grid Styles
 * Lightweight, modern design with smooth animations
 */

/* ========================================
   CSS Variables - Modern Color Palette
   ======================================== */
:root {
    /* Primary colors - vibrant gaming aesthetic */
    --primary: #FF4655;
    --primary-light: #FF6B78;
    --primary-dark: #E63946;

    /* Neutrals - clean and minimal */
    --bg-main: #FAFBFC;
    --bg-card: #FFFFFF;
    --text-primary: #1A1D29;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;

    /* Accent & borders */
    --border-light: #E5E7EB;
    --border-medium: #D1D5DB;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px 0 rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px 0 rgba(0, 0, 0, 0.12);
    --shadow-hover: 0 16px 48px 0 rgba(0, 0, 0, 0.15);

    /* Typography */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;

    /* Spacing */
    --container-padding: clamp(1rem, 4vw, 3rem);
    --grid-gap: clamp(1rem, 2.5vw, 2rem);
}

/* ========================================
   Global Overrides - Remove Sidebar
   ======================================== */
.archive .sidebar,
.category .sidebar,
.archive .widget-area,
.category .widget-area,
.archive aside,
.category aside {
    display: none !important;
}

.archive .site-content,
.category .site-content,
.archive .content-area,
.category .content-area,
.archive main,
.category main {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
}

/* Hide entry meta and comments */
.entry-meta,
.entry-footer,
.post-meta,
.byline,
.posted-on,
.cat-links,
.tags-links,
.comments-area,
#comments,
.comment-respond {
    display: none !important;
}

/* ========================================
   Archive Container
   ======================================== */
.archive-grid-container {
    width: 100%;
    max-width: 1600px;
    margin: 0 auto;
    padding: var(--container-padding);
    background: var(--bg-main);
    min-height: 100vh;
}

/* ========================================
   Archive Header
   ======================================== */
.archive-header {
    text-align: center;
    margin-bottom: 4rem;
    padding: 3rem 0;
    animation: fadeInDown 0.8s ease-out;
}

.archive-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    letter-spacing: -0.03em;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.archive-description {
    font-family: var(--font-body);
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ========================================
   Posts Grid - Adaptive Layout
   ======================================== */
.posts-grid {
    display: grid;
    gap: var(--grid-gap);
    margin-bottom: 4rem;

    /* Responsive columns: 4-3-2-1 */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

/* Desktop: 4 columns */
@media (min-width: 1400px) {
    .posts-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Laptop: 3 columns */
@media (min-width: 1024px) and (max-width: 1399px) {
    .posts-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet: 2 columns */
@media (min-width: 640px) and (max-width: 1023px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 1 column */
@media (max-width: 639px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Grid Item - Card Design
   ======================================== */
.grid-item {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease-out forwards;
    animation-delay: calc(var(--item-index) * 0.05s);
}

.grid-item-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    border: 1px solid var(--border-light);
}

.grid-item-link:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-light);
}

.grid-item-link:hover .grid-item-image img {
    transform: scale(1.08);
}

.grid-item-link:hover .image-overlay {
    opacity: 0.15;
}

.grid-item-link:hover .grid-item-title {
    color: var(--primary);
}

.grid-item-link:hover .read-more {
    opacity: 1;
    transform: translateX(0);
}

/* ========================================
   Grid Item - Image
   ======================================== */
.grid-item-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
}

.grid-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* Placeholder for posts without images */
.grid-item-image.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.placeholder-icon {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    opacity: 0.5;
}

.placeholder-icon svg {
    width: 100%;
    height: 100%;
}

/* ========================================
   Grid Item - Content
   ======================================== */
.grid-item-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.grid-item-title {
    font-family: var(--font-display);
    font-size: clamp(1.125rem, 2vw, 1.375rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem 0;
    line-height: 1.3;
    transition: color 0.3s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-item-excerpt {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    opacity: 0.7;
    transform: translateX(-5px);
    transition: all 0.3s ease;
}

/* ========================================
   Pagination
   ======================================== */
.pagination-wrapper {
    display: flex;
    justify-content: center;
    margin: 4rem 0 2rem;
    animation: fadeIn 1s ease-out 0.3s backwards;
}

.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 1rem;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.pagination .page-numbers:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pagination .page-numbers.current {
    color: white;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.pagination .page-numbers svg {
    width: 20px;
    height: 20px;
    display: block;
}

.pagination .dots {
    color: var(--text-muted);
    background: transparent;
    border: none;
    box-shadow: none;
    cursor: default;
}

.pagination .dots:hover {
    transform: none;
    box-shadow: none;
}

/* ========================================
   No Posts Message
   ======================================== */
.no-posts {
    text-align: center;
    padding: 6rem 2rem;
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ========================================
   Performance Optimizations
   ======================================== */
.grid-item-link,
.grid-item-image img,
.image-overlay,
.grid-item-title,
.read-more,
.pagination .page-numbers {
    will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Print Styles
   ======================================== */
@media print {
    .archive-header,
    .pagination-wrapper {
        page-break-after: avoid;
    }

    .grid-item {
        page-break-inside: avoid;
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }
}
