/**
 * Frontend Styles for Greater Zion Article Catalog
 */

.gz-article-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

.gz-article-catalog-grid.gz-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.gz-article-catalog-grid.gz-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.gz-article-catalog-grid.gz-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* Article Card */
.gz-article-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid #e5e7eb;
    position: relative;
    will-change: transform, box-shadow;
}

/* Make entire card clickable for external links */
.gz-article-card:has(a[target="_blank"]) {
    cursor: pointer;
}

.gz-article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #eb6b40, #d45a2f);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.gz-article-card:hover::before {
    transform: scaleX(1);
}

.gz-article-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.08);
    border-color: #eb6b40;
}

/* Performance optimization */
.gz-article-card,
.gz-article-image .gz-image {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.gz-article-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: #f3f4f6;
}

.gz-article-image a {
    display: block;
    width: 100%;
    height: 100%;
}

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

.gz-article-card:hover .gz-image {
    transform: scale(1.08);
}

.gz-article-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.gz-article-title {
    margin: 0 0 12px 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    color: #1f2937;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gz-article-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.2s ease;
}

.gz-article-title a:hover {
    color: #eb6b40;
}

.gz-article-excerpt {
    color: #6b7280;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.gz-article-excerpt p {
    margin: 0 0 8px 0;
}

.gz-article-excerpt p:last-child {
    margin-bottom: 0;
}

.gz-article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: #6b7280;
}

.gz-article-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gz-article-meta svg {
    flex-shrink: 0;
}

.gz-article-date,
.gz-article-author,
.gz-article-source {
    color: #6b7280;
}

.gz-article-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #eb6b40;
    font-weight: 500;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-top: auto;
    position: relative;
}

.gz-article-link[target="_blank"]::after {
    content: '↗';
    font-size: 12px;
    margin-left: 4px;
    opacity: 0.7;
}

.gz-article-link:hover {
    color: #d45a2f;
    gap: 12px;
}

.gz-article-link svg {
    transition: transform 0.2s ease;
}

.gz-article-link:hover svg {
    transform: translateX(4px);
}

.gz-article-link[target="_blank"]:hover::after {
    opacity: 1;
}

/* Pagination */
.gz-pagination {
    margin-top: 40px;
    display: flex;
    justify-content: center;
}

.gz-pagination .page-numbers {
    display: inline-flex;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.gz-pagination .page-numbers li {
    margin: 0;
}

.gz-pagination .page-numbers a,
.gz-pagination .page-numbers span {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #374151;
    background: white;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
    font-weight: 500;
}

.gz-pagination .page-numbers a:hover {
    border-color: #eb6b40;
    color: #eb6b40;
    background: #fff5f2;
}

.gz-pagination .page-numbers .current {
    background: #eb6b40;
    color: white;
    border-color: #eb6b40;
}

/* No Articles */
.gz-no-articles {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

/* Accessibility improvements */
.gz-article-card a:focus {
    outline: 2px solid #eb6b40;
    outline-offset: 2px;
    border-radius: 4px;
}

.gz-article-link:focus {
    outline: 2px solid #eb6b40;
    outline-offset: 2px;
}

/* Image loading state */
.gz-article-image {
    position: relative;
    overflow: hidden;
}

.gz-article-image img {
    transition: opacity 0.3s ease;
}

.gz-article-image img[loading="lazy"] {
    opacity: 0;
}

.gz-article-image img.loaded {
    opacity: 1;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Print styles */
@media print {
    .gz-article-catalog-grid {
        grid-template-columns: 1fr !important;
    }
    
    .gz-article-card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

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

/* Responsive */
@media (max-width: 1024px) {
    .gz-article-catalog-grid.gz-columns-4 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .gz-article-catalog-grid.gz-columns-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .gz-article-catalog-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .gz-article-catalog-grid.gz-columns-2,
    .gz-article-catalog-grid.gz-columns-3,
    .gz-article-catalog-grid.gz-columns-4 {
        grid-template-columns: 1fr;
    }
    
    .gz-article-content {
        padding: 20px;
    }
    
    .gz-article-title {
        font-size: 18px;
    }
    
    .gz-article-meta {
        flex-direction: column;
        gap: 8px;
    }
}

