/* ==========================================================================
   Waqt Al-Hadhara - articles.css
   Article Listing Page — Dynamic Card Grid, Shimmer, Tags, Empty State
   ========================================================================== */

/* ── Page Header ─────────────────────────────────────────────────────── */
.art-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}
html.light-mode .art-header { background-color: rgba(250, 248, 244, 0.92); }

.art-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.art-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    transition: color 0.25s ease;
}
.art-back:hover { color: var(--color-gold); }

.art-header-center { text-align: center; flex: 1; }
.art-header-center h1 {
    font-family: var(--font-headers);
    font-size: clamp(1rem, 2.5vw, 1.3rem);
    color: var(--color-text-primary);
    line-height: 1.3;
}
.art-header-center .art-subtitle {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
}
.art-header-actions { display: flex; align-items: center; gap: 12px; }

/* ── Hero ────────────────────────────────────────────────────────────── */
.art-hero {
    text-align: center;
    padding: 60px 20px 30px;
    max-width: 700px;
    margin: 0 auto;
}
.art-hero h2 {
    font-family: var(--font-headers);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    color: var(--color-text-primary);
    margin-bottom: 12px;
}
.art-hero p {
    font-size: 1rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}

/* ── Article Card Grid ──────────────────────────────────────────────── */
.art-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 60px;
}

/* Filter bar */
.art-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 40px;
    justify-content: center;
}

.art-filter-tag {
    padding: 6px 18px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
    border: 1px solid var(--color-border-grey);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-body);
}
.art-filter-tag:hover,
.art-filter-tag.active {
    border-color: var(--color-gold);
    color: var(--color-gold);
    background: rgba(229, 184, 105, 0.06);
}

.art-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 30px;
}

/* ── Article Card ───────────────────────────────────────────────────── */
.art-card {
    border: 1px solid var(--color-border-grey);
    background: var(--color-bg-card);
    display: flex;
    flex-direction: column;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: artCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    /* Smooth out the height transition when swapping skeleton → real card */
    min-height: 420px;
}

/* Match the skeleton height to prevent CLS during the swap */
.art-shimmer {
    min-height: 420px;
}

/* Staggered reveal: each card animates in with a delay */
.art-card:nth-child(2) { animation-delay: 0.08s; }
.art-card:nth-child(3) { animation-delay: 0.16s; }
.art-card:nth-child(4) { animation-delay: 0.24s; }
.art-card:nth-child(5) { animation-delay: 0.32s; }
.art-card:nth-child(6) { animation-delay: 0.40s; }
.art-card:nth-child(7) { animation-delay: 0.48s; }
.art-card:nth-child(8) { animation-delay: 0.56s; }

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

.art-card:hover {
    border-color: var(--color-gold);
    /* Use transform on a child element (the ::before gold bar) instead of the
       card itself — avoids triggering layout reflow of the grid on hover */
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
    will-change: box-shadow;
}
html.light-mode .art-card:hover {
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
}

.art-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--color-gold), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 2;
}
.art-card:hover::before {
    opacity: 1;
}

.art-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.art-card:hover .art-card-image {
    transform: scale(1.06);
}

.art-card-image-placeholder {
    width: 100%;
    height: 200px;
    background: var(--color-bg-deep);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gold-dim);
    font-size: 2.5rem;
    transition: background 0.3s ease;
}
.art-card:hover .art-card-image-placeholder {
    background: rgba(229, 184, 105, 0.04);
}

.art-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.art-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.art-card-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    background: rgba(229, 184, 105, 0.1);
    border: 1px solid rgba(229, 184, 105, 0.2);
    color: var(--color-gold);
    letter-spacing: 0.5px;
    transition: background 0.3s ease, border-color 0.3s ease;
}
.art-card:hover .art-card-tag {
    background: rgba(229, 184, 105, 0.15);
    border-color: rgba(229, 184, 105, 0.35);
}
html.light-mode .art-card-tag {
    background: rgba(184, 134, 11, 0.06);
    border-color: rgba(184, 134, 11, 0.2);
}

.art-card-title {
    font-family: var(--font-headers);
    font-size: 1.15rem;
    color: var(--color-text-primary);
    margin-bottom: 10px;
    line-height: 1.4;
    text-decoration: none;
    transition: color 0.3s ease;
    position: relative;
}
.art-card-title:hover { color: var(--color-gold); }

/* Stretched link — makes the entire card clickable via the title link only */
.art-card-title::after {
    content: '';
    position: absolute;
    inset: -1000px; /* Extends the click area to cover the whole card */
    z-index: 1;
}

.art-card-excerpt {
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
    flex: 1;
    margin-bottom: 16px;
}

.art-card-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    padding-top: 16px;
    border-top: 1px solid var(--color-border-grey);
    transition: border-color 0.3s ease;
}
.art-card:hover .art-card-meta {
    border-top-color: rgba(229, 184, 105, 0.15);
}

.art-card-meta i {
    color: var(--color-gold-dim);
    margin-inline-end: 5px;
    transition: color 0.3s ease;
}
.art-card:hover .art-card-meta i {
    color: var(--color-gold);
}

/* ── Stretched Link ──────────────────────────────────────────────────── */
/* The entire .art-card is clickable via .art-card-title::after (see above).
   No separate .art-card-link needed — single semantic link for a11y. */

/* ── Shimmer Loading Skeleton ───────────────────────────────────────── */
.art-shimmer {
    border: 1px solid var(--color-border-grey);
    background: var(--color-bg-card);
    overflow: hidden;
}
.art-shimmer-image {
    width: 100%;
    height: 200px;
    background: var(--color-bg-deep);
    position: relative;
    overflow: hidden;
}
.art-shimmer-body {
    padding: 24px;
}
.art-shimmer-line {
    height: 14px;
    background: var(--color-bg-deep);
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}
.art-shimmer-line:last-child { width: 60%; }
.art-shimmer-line-45 { width: 45%; }
.art-shimmer-line-50 { width: 50%; }
.art-shimmer-line-55 { width: 55%; }
.art-shimmer-line-65 { width: 65%; }
.art-shimmer-line-70 { width: 70%; }
.art-shimmer-line-75 { width: 75%; }

.art-shimmer-image::after,
.art-shimmer-line::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    animation: shimmerSweep 1.5s infinite;
}
html.light-mode .art-shimmer-image::after,
html.light-mode .art-shimmer-line::after {
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.04), transparent);
}

@keyframes shimmerSweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* ── Empty State ────────────────────────────────────────────────────── */
.art-empty {
    text-align: center;
    padding: 80px 20px;
    grid-column: 1 / -1;
}
.art-empty-icon {
    font-size: 3rem;
    color: var(--color-gold-dim);
    margin-bottom: 20px;
}
.art-empty h3 {
    font-family: var(--font-headers);
    font-size: 1.4rem;
    margin-bottom: 10px;
    color: var(--color-text-primary);
}
.art-empty p {
    color: var(--color-text-secondary);
    margin-bottom: 24px;
}

/* ── Error / Retry State ────────────────────────────────────────────── */
.art-error {
    text-align: center;
    padding: 60px 20px;
    grid-column: 1 / -1;
}
.art-error-icon {
    font-size: 2.5rem;
    color: #ff4a4a;
    margin-bottom: 16px;
}
.art-error h3 {
    font-family: var(--font-headers);
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--color-text-primary);
}
.art-error p {
    color: var(--color-text-secondary);
    margin-bottom: 20px;
}

.art-retry-btn {
    background: transparent;
    border: 1px solid var(--color-gold);
    color: var(--color-gold);
    padding: 10px 24px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}
.art-retry-btn:hover {
    background: rgba(229, 184, 105, 0.08);
    transform: translateY(-2px);
}

/* ── Bottom CTA ─────────────────────────────────────────────────────── */
.art-bottom-cta {
    text-align: center;
    padding: 50px 20px 60px;
    border-top: 1px solid var(--color-border-grey);
}
.art-bottom-cta h3 {
    font-family: var(--font-headers);
    font-size: clamp(1.4rem, 3vw, 2rem);
    margin-bottom: 10px;
}
.art-bottom-cta p { margin-bottom: 24px; }

.art-footer {
    border-top: 1px solid var(--color-border-grey);
    padding: 20px 0;
    text-align: center;
    background: var(--color-bg-deep);
}
.art-footer p { font-size: 0.85rem; color: var(--color-text-secondary); }

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .art-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .art-card-body { padding: 18px; }
    .art-header-center .art-subtitle { display: none; }
    .art-back span { display: none; }
    .art-filters { gap: 8px; }
    .art-filter-tag { font-size: 0.78rem; padding: 5px 14px; }
}

@media (max-width: 480px) {
    .art-card-image,
    .art-shimmer-image { height: 160px; }
}

/* ── Language Toggle Flags ──────────────────────────────────────────── */
.art-header-actions .lang-toggle {
    position: relative;
    width: 28px;
    height: 20px;
    cursor: pointer;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.art-header-actions .lang-toggle:hover {
    transform: scale(1.08);
}
.art-header-actions .lang-flag {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
    outline: none;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    transform: scale(0.92);
    pointer-events: none;
}
.art-header-actions .lang-flag.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* ── Page Transition Preloader ─────────────────────────────────────── */
.page-preloader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    height: 3px;
    pointer-events: none;
}
.preloader-bar {
    width: 100%;
    height: 100%;
    background: transparent;
    position: relative;
    overflow: hidden;
}
.preloader-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-gold-dim), var(--color-gold), var(--color-gold-bright));
    transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 8px rgba(229, 184, 105, 0.4);
}
.page-preloader.loaded .preloader-fill {
    width: 100%;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.page-preloader.hidden {
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
html.light-mode .preloader-fill {
    box-shadow: 0 0 8px rgba(184, 134, 11, 0.3);
}

/* ── Theme Toggle Button (article pages) ───────────────────────────── */
.art-header-actions .btn-icon {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(229, 184, 105, 0.15);
    color: var(--color-gold);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.art-header-actions .btn-icon:hover {
    background: rgba(229, 184, 105, 0.1);
    border-color: var(--color-gold);
    transform: translateY(-2px);
}
html.light-mode .art-header-actions .btn-icon {
    background: rgba(184, 134, 11, 0.06);
    border-color: rgba(184, 134, 11, 0.25);
}
html.light-mode .art-header-actions .btn-icon:hover {
    background: rgba(184, 134, 11, 0.12);
}

/* ── Reduced Motion ─────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .art-card { transition: none; animation: none; opacity: 1; transform: none; }
    .art-card:hover { transform: none; }
    .art-card::before { display: none; }
    .art-card-image { transition: none; }
    .art-card:hover .art-card-image { transform: none; }
    .art-shimmer-image::after,
    .art-shimmer-line::after { animation: none; }
}
