/* Knowledge Hub — listing (index) page styles.
   Premium, editorial listing aligned to the chat overhaul + design-system tokens.
   Calm static background is handled by content_base.html. Source of truth:
   static/design-spikes/knowledge-hub-premium-reference.html
   (body already has padding-top:90px from components/header.html for nav clearance.) */

    /* ── Design-system bridge (retarget local token names onto design-system.css) ── */
    :root {
        --color-bg-deep: var(--color-bg-primary);
        --color-bg: var(--color-bg-primary);
        --color-bg-elevated: var(--color-bg-secondary);
        --color-surface: var(--blur-bg);          /* dark translucent card surface */
        --color-surface-solid: var(--color-bg-tertiary);
        --color-border-hover: var(--glass-border-hover);
        --color-text: var(--color-text-primary);
        --color-cyan: var(--color-accent-cyan);
        --color-cyan-dim: rgba(0, 242, 254, 0.6);
        --color-purple: #8b5cf6;
        --color-magenta: var(--color-accent-pink);
        --color-orange: var(--color-accent-gold);
        --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
        --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
        --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
        --radius: 14px;                           /* local card radius (between --radius-lg/xl) */
    }

    /* ===== PAGE WRAPPER + CONTAINER ===== */
    .blog-wrapper { position: relative; min-height: 100vh; }
    .blog-container {
        position: relative;
        z-index: 1;
        max-width: 1280px;
        margin: 0 auto;
        padding: 48px 32px 96px;
    }

    /* ===== HERO ===== */
    .blog-hero { text-align: center; max-width: 720px; margin: 8px auto 52px; }
    .hero-badge {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 20px;
        font-family: var(--font-body);
    }
    .hero-badge-dot {
        width: 7px; height: 7px;
        border-radius: 50%;
        background: var(--color-cyan);
        box-shadow: 0 0 10px var(--color-cyan);
        animation: kh-pulse 2.4s ease-in-out infinite;
    }
    @keyframes kh-pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(0.8); } }
    .hero-badge-text {
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.12em;
        color: var(--color-cyan);
    }
    .blog-hero h1 {
        font-family: var(--font-display);
        font-size: clamp(2.4rem, 5vw, 3.6rem);
        font-weight: 800;
        letter-spacing: -0.03em;
        line-height: 1.05;
        margin: 0 0 16px;
        color: var(--color-text-primary); /* fallback if background-clip:text is unsupported */
        background: linear-gradient(135deg, #ffffff 0%, #cdd6ff 55%, var(--color-cyan) 125%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }
    .blog-hero p { font-family: var(--font-body); font-size: 1.125rem; color: var(--color-text-secondary); line-height: 1.7; margin: 0; }

    /* ===== FILTER + SEARCH ===== */
    .filter-section { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; margin-bottom: 44px; }
    .filter-bar {
        display: inline-flex;
        flex-wrap: wrap;
        gap: 6px;
        padding: 6px;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: 999px;
        backdrop-filter: blur(16px);
    }
    .filter-btn {
        font-family: var(--font-body);
        font-size: 0.82rem;
        font-weight: 600;
        color: var(--color-text-secondary);
        text-decoration: none;
        padding: 9px 18px;
        border-radius: 999px;
        border: 1px solid transparent;
        transition: color 0.18s var(--ease-out-expo), background 0.18s var(--ease-out-expo);
    }
    .filter-btn:hover { color: var(--color-text); background: rgba(255, 255, 255, 0.04); }
    .filter-btn.active { color: #03040c; background: linear-gradient(135deg, var(--color-cyan), var(--color-purple)); }

    .blog-search { position: relative; display: flex; align-items: center; }
    .blog-search__icon { position: absolute; left: 16px; color: var(--color-text-muted); font-size: 0.82rem; pointer-events: none; }
    .blog-search__input {
        width: 280px;
        font-family: var(--font-body);
        font-size: 0.9rem;
        color: var(--color-text);
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: 999px;
        padding: 11px 40px;
        backdrop-filter: blur(16px);
        transition: border-color 0.18s var(--ease-out-expo), box-shadow 0.18s var(--ease-out-expo);
    }
    .blog-search__input::placeholder { color: var(--color-text-muted); }
    .blog-search__input:hover { border-color: var(--color-border-hover); }
    .blog-search__input:focus { outline: none; border-color: var(--color-cyan); box-shadow: 0 0 0 3px rgba(0, 242, 254, 0.14); }
    .blog-search__clear { position: absolute; right: 14px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--color-text-muted); text-decoration: none; transition: color 0.15s var(--ease-out-expo), background 0.15s var(--ease-out-expo); }
    .blog-search__clear:hover { color: var(--color-text); background: rgba(255, 255, 255, 0.08); }

    .blog-results-summary { text-align: center; color: var(--color-text-secondary); font-family: var(--font-body); font-size: 0.95rem; margin: 0 0 36px; }

    /* ===== FEATURED LEAD CARD ===== */
    .featured-card {
        position: relative;
        display: grid;
        grid-template-columns: 1.15fr 1fr;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-2xl);
        overflow: hidden;
        margin-bottom: 36px;
        text-decoration: none;
        color: inherit;
        backdrop-filter: blur(16px);
        transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo), border-color 0.4s var(--ease-out-expo);
    }
    .featured-card::after {
        content: 'Featured';
        position: absolute;
        top: 20px; left: 20px;
        z-index: 2;
        font-family: var(--font-body);
        font-size: 0.66rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: #03040c;
        padding: 5px 12px;
        border-radius: 999px;
        background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
    }
    .featured-card:hover { transform: translateY(-4px); border-color: var(--color-border-hover); box-shadow: 0 32px 70px -28px rgba(0, 0, 0, 0.75), 0 0 50px rgba(0, 242, 254, 0.08); }
    .featured-card__img {
        min-height: 320px;
        position: relative;
        overflow: hidden;
        background: linear-gradient(135deg, #1b2350 0%, #2a1d4d 55%, #0c1a3a 100%); /* no-image fallback */
    }
    .featured-card__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
    .featured-card__body { padding: 40px; display: flex; flex-direction: column; }
    .featured-card__cat { font-family: var(--font-body); font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-cyan); margin-bottom: 16px; }
    .featured-card h2 { font-family: var(--font-display); font-size: 1.85rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 0 0 16px; color: var(--color-text); }
    .featured-card p { font-family: var(--font-body); color: var(--color-text-secondary); line-height: 1.7; margin: 0 0 auto; }
    .featured-card__meta { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 28px; font-family: var(--font-body); font-size: 0.82rem; color: var(--color-text-muted); }
    .featured-card__meta span { display: inline-flex; align-items: center; gap: 6px; }
    .featured-card__meta i { color: var(--color-cyan-dim); }

    /* ===== POSTS GRID ===== */
    .posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }

    .post-card {
        position: relative;
        display: flex;
        flex-direction: column;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-xl);
        overflow: hidden;
        text-decoration: none;
        color: inherit;
        backdrop-filter: blur(16px);
        transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo), border-color 0.4s var(--ease-out-expo);
    }
    .post-card:hover { transform: translateY(-6px); border-color: var(--color-border-hover); box-shadow: 0 28px 60px -26px rgba(0, 0, 0, 0.75), 0 0 40px rgba(0, 242, 254, 0.08); }

    .post-card__img {
        height: 184px;
        position: relative;
        overflow: hidden;
        background: linear-gradient(135deg, #182048 0%, #241a44 100%); /* no-image fallback */
    }
    .post-card__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
    .post-card__img::after { content: ''; position: absolute; inset: 0; z-index: 1; background: linear-gradient(transparent 55%, rgba(10, 14, 39, 0.85)); }
    .post-card__cat {
        position: absolute;
        top: 14px; left: 14px;
        z-index: 2;
        font-family: var(--font-body);
        font-size: 0.7rem;
        font-weight: 600;
        color: var(--color-cyan);
        background: rgba(10, 14, 39, 0.6);
        border: 1px solid rgba(0, 242, 254, 0.22);
        padding: 5px 12px;
        border-radius: 999px;
        backdrop-filter: blur(8px);
    }
    .post-card__body { padding: 24px; display: flex; flex-direction: column; flex: 1; }
    .post-card__meta { display: flex; gap: 16px; font-family: var(--font-body); font-size: 0.78rem; color: var(--color-text-secondary); margin-bottom: 12px; }
    .post-card__meta span { display: inline-flex; align-items: center; gap: 5px; }
    .post-card__meta i { color: var(--color-cyan-dim); }
    .post-card h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; margin: 0 0 10px; color: var(--color-text); transition: color 0.2s var(--ease-out-expo); }
    .post-card:hover h2 { color: var(--color-cyan); }
    .post-card p { font-family: var(--font-body); font-size: 0.92rem; color: var(--color-text-secondary); line-height: 1.6; margin: 0 0 20px; flex: 1; }

    .post-card__foot { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; border-top: 1px solid var(--color-border); }
    .author-chip { display: flex; align-items: center; gap: 10px; }
    .avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-body); font-size: 0.8rem; font-weight: 700; color: #03040c; background: linear-gradient(135deg, var(--color-cyan), var(--color-purple)); }
    .author-chip__text b { font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--color-text); display: block; }
    .author-chip__text small { font-size: 0.68rem; color: var(--color-text-muted); }
    .read-link { font-family: var(--font-body); font-size: 0.8rem; font-weight: 600; color: var(--color-cyan); display: inline-flex; align-items: center; gap: 6px; }
    .read-link i { transition: transform 0.25s var(--ease-spring); }
    .post-card:hover .read-link i { transform: translateX(4px); }

    /* ===== PAGINATION ===== */
    .pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 56px; }
    .pagination a, .pagination span {
        font-family: var(--font-body);
        font-size: 0.88rem;
        font-weight: 500;
        padding: 12px 22px;
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: var(--radius);
        color: var(--color-text-secondary);
        text-decoration: none;
        backdrop-filter: blur(10px);
        transition: color 0.18s var(--ease-out-expo), background 0.18s var(--ease-out-expo), border-color 0.18s var(--ease-out-expo);
    }
    .pagination a:hover { background: rgba(0, 242, 254, 0.08); border-color: var(--color-border-hover); color: var(--color-cyan); }
    .pagination .active { background: linear-gradient(135deg, var(--color-cyan), var(--color-purple)); color: #03040c; border-color: transparent; font-weight: 600; }
    .pagination .disabled { opacity: 0.35; cursor: not-allowed; }

    /* ===== EMPTY STATE ===== */
    .empty-state { text-align: center; padding: 96px 40px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-2xl); backdrop-filter: blur(16px); }
    .empty-state-icon { width: 72px; height: 72px; margin: 0 auto 24px; border-radius: 18px; display: grid; place-items: center; font-size: 26px; color: #03040c; background: linear-gradient(135deg, var(--color-cyan), var(--color-purple)); box-shadow: 0 0 40px rgba(0, 242, 254, 0.25); }
    .empty-state h2 { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; color: var(--color-text); margin: 0 0 12px; }
    .empty-state p { font-family: var(--font-body); color: var(--color-text-secondary); font-size: 1rem; max-width: 440px; margin: 0 auto; line-height: 1.6; }
    .empty-state a { color: var(--color-cyan); text-decoration: none; border-bottom: 1px solid rgba(0, 242, 254, 0.32); }
    .empty-state a:hover { border-bottom-color: var(--color-cyan); }

    /* ===== ENTRANCE (flash-free, pure CSS; applies only when motion is allowed,
       so no JS, no flash-of-content, and nothing to undo under reduced motion) ===== */
    @media (prefers-reduced-motion: no-preference) {
        .reveal { opacity: 0; transform: translateY(18px); animation: kh-rise 0.55s var(--ease-out-expo) forwards; }
        .featured-card.reveal { animation-delay: 0.02s; }
        .posts-grid .reveal:nth-child(1) { animation-delay: 0.06s; }
        .posts-grid .reveal:nth-child(2) { animation-delay: 0.12s; }
        .posts-grid .reveal:nth-child(3) { animation-delay: 0.18s; }
        .posts-grid .reveal:nth-child(4) { animation-delay: 0.24s; }
        .posts-grid .reveal:nth-child(5) { animation-delay: 0.30s; }
        .posts-grid .reveal:nth-child(n+6) { animation-delay: 0.36s; }
    }
    @keyframes kh-rise { to { opacity: 1; transform: none; } }

    /* ===== ACCESSIBILITY: keyboard focus ===== */
    .filter-btn:focus-visible,
    .featured-card:focus-visible,
    .post-card:focus-visible,
    .read-link:focus-visible,
    .pagination a:focus-visible,
    .blog-search__input:focus-visible,
    .blog-search__clear:focus-visible {
        outline: 2px solid var(--color-accent-cyan);
        outline-offset: 3px;
    }

    /* ===== ACCESSIBILITY: reduced motion ===== */
    @media (prefers-reduced-motion: reduce) {
        .hero-badge-dot,
        .featured-card,
        .post-card,
        .post-card h2,
        .read-link i,
        .filter-btn,
        .pagination a { animation: none; transition: none; }
        .featured-card:hover, .post-card:hover { transform: none; }
    }
