/* ═══════════════════════════════════════════════════════════════
   FeedsMonitor — Design System Stylesheet
   Companion to TailwindCSS CDN (custom animations & utilities)
   ═══════════════════════════════════════════════════════════════ */

/* ─── ANIMATION KEYFRAMES ─── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}
@keyframes pulseSoft {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* ─── UTILITY ANIMATIONS ─── */
.anim-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}
.anim-slide-up {
    animation: slideUp 0.5s ease-out forwards;
}
.anim-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}
.anim-pulse-soft {
    animation: pulseSoft 2s infinite ease-in-out;
}

/* ─── STAGGER CHILDREN (Framer Motion staggerChildren equivalent) ─── */
.stagger-container > * {
    opacity: 0;
    animation: slideUp 0.45s ease-out forwards;
}
.stagger-container > *:nth-child(1)  { animation-delay: 0.04s; }
.stagger-container > *:nth-child(2)  { animation-delay: 0.08s; }
.stagger-container > *:nth-child(3)  { animation-delay: 0.12s; }
.stagger-container > *:nth-child(4)  { animation-delay: 0.16s; }
.stagger-container > *:nth-child(5)  { animation-delay: 0.20s; }
.stagger-container > *:nth-child(6)  { animation-delay: 0.24s; }
.stagger-container > *:nth-child(7)  { animation-delay: 0.28s; }
.stagger-container > *:nth-child(8)  { animation-delay: 0.32s; }
.stagger-container > *:nth-child(9)  { animation-delay: 0.36s; }
.stagger-container > *:nth-child(10) { animation-delay: 0.40s; }
.stagger-container > *:nth-child(11) { animation-delay: 0.44s; }
.stagger-container > *:nth-child(12) { animation-delay: 0.48s; }
.stagger-container > *:nth-child(n+13) { animation-delay: 0.52s; }

/* ─── CARD HOVER (Framer Motion whileHover equivalent) ─── */
.card-hover {
    transition: transform 0.25s cubic-bezier(0.33, 1, 0.68, 1),
                box-shadow 0.25s cubic-bezier(0.33, 1, 0.68, 1);
}
.card-hover:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
}
.dark .card-hover:hover {
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
}

/* ─── GLASS MORPHISM HEADER ─── */
.glass-header {
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

/* ─── BRAND GRADIENT TEXT ─── */
.text-gradient {
    background: linear-gradient(135deg, #5c21a7, #9f1880, #ff5514);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ─── SKELETON LOADER ─── */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 37%, #e2e8f0 63%);
    background-size: 800px 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
}
.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 37%, #1e293b 63%);
    background-size: 800px 100%;
}

/* ─── SCROLLBAR HIDING (pill bars) ─── */
.pill-scroll::-webkit-scrollbar { height: 0; width: 0; }
.pill-scroll { -ms-overflow-style: none; scrollbar-width: none; }

/* ─── CLICKABLE CARD TILES ─── */
a.card-hover { color: inherit; text-decoration: none; }

/* ─── SOURCE PILLS ─── */
.source-pill {
    transition: all 0.2s ease;
}
.source-pill:hover {
    transform: scale(1.05);
}

/* ─── FILTER DROPDOWN ANIMATION ─── */
.filter-fade-enter {
    animation: scaleIn 0.3s ease-out forwards;
}

/* ─── LINE CLAMPING ─── */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 2;
}
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-clamp: 3;
}

/* ─── SEARCH RESULT HIGHLIGHT ─── */
mark.search-highlight {
    background-color: #fef08a;
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}
.dark mark.search-highlight {
    background-color: #854d0e;
    color: #fef9c3;
}

/* ─── SMOOTH IMAGE ZOOM ON HOVER ─── */
.card-hover img {
    transition: transform 0.5s cubic-bezier(0.33, 1, 0.68, 1);
}
.card-hover:hover img {
    transform: scale(1.05);
}

/* ─── FOCUS VISIBLE (keyboard a11y) ─── */
*:focus-visible {
    outline: 2px solid #5c21a7;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ─── LOGO DARK MODE ─── */
/* Logo uses dark gray wordmark (#1E1B4B) + indigo icon — invisible on dark bg.
   brightness(0) makes every pixel black, invert(1) flips to white. */
.dark .site-logo {
    filter: brightness(0) invert(1);
}

/* ─── ACTIVE SOURCE PILL (dark mode boost) ─── */
/* Override subtle brand-900/30 bg + brand-700/50 border with clearly visible values */
.dark .source-pill-active {
    background-color: rgba(99, 102, 241, 0.18) !important; /* indigo-500 at 18% */
    border-color: rgba(129, 140, 248, 0.65) !important;    /* indigo-400 at 65% */
}

/* ─── NO-IMAGES MODE ─── */
/* Toggled via JS: articleGrid.classList.add('hide-images') */
#articleGrid.hide-images .card-image {
    display: none !important;
}

/* ─── COMPACT MODE ─── */
/* Compact always hides images and reduces padding/gaps for a denser view */
#articleGrid.compact {
    gap: 0.375rem !important;
}
#articleGrid.compact > a,
#articleGrid.compact > article {
    border-radius: 0.625rem !important;
}
#articleGrid.compact .card-image {
    display: none !important;
}
#articleGrid.compact .card-body {
    padding: 0.625rem 0.875rem !important;
}
#articleGrid.compact .card-title {
    font-size: 0.875rem !important;
    line-height: 1.35 !important;
    margin-bottom: 0.125rem !important;
    -webkit-line-clamp: 1 !important;
}
#articleGrid.compact .card-summary {
    display: none !important;
}
#articleGrid.compact .card-footer {
    margin-top: 0.375rem !important;
    padding-top: 0.375rem !important;
}
#articleGrid.compact .card-read-time {
    display: none !important;
}

/* ─── RESPONSIVE TWEAKS ─── */
@media (max-width: 640px) {
    .glass-header .max-w-\\[1440px\\] {
        padding-left: 12px;
        padding-right: 12px;
    }
}