/* ============================================================
   Challenge Circle — blog.css
   Public blog listing, post viewer, admin editor, member application
   ============================================================ */

/* ── Blog public listing page ────────────────────────────── */
.blog-hero {
    max-width: 760px;
    margin: 0 auto;
    padding: 64px 32px 48px;
    text-align: center;
}
.blog-hero h1 {
    font-size: clamp(2rem,5vw,3rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 14px;
}
.blog-hero h1 span { color: #a78bfa; }
.blog-hero-sub {
    font-size: 15px;
    color: #9ca3af;
    max-width: 500px;
    margin: 0 auto 24px;
    line-height: 1.7;
}
.blog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 40px;
}
.blog-filter-btn {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
    text-decoration: none;
    display: inline-block;
}
.blog-filter-btn:hover,
.blog-filter-btn.active {
    background: rgba(139,92,246,0.12);
    border-color: rgba(139,92,246,0.35);
    color: #a78bfa;
}

/* ── Blog card grid ──────────────────────────────────────── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 32px 80px;
}
.blog-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s, transform 0.2s;
    text-decoration: none;
    color: inherit;
}
.blog-card:hover {
    border-color: rgba(139,92,246,0.3);
    transform: translateY(-2px);
}
.blog-card-cover {
    aspect-ratio: 16/9;
    background: rgba(139,92,246,0.08);
    overflow: hidden;
    position: relative;
}
.blog-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}
.blog-card:hover .blog-card-cover img { transform: scale(1.04); }
.blog-card-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(109,40,217,0.05));
}
.blog-card-cat {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    background: rgba(0,0,0,0.7);
    color: #a78bfa;
    padding: 3px 10px;
    border-radius: 6px;
    backdrop-filter: blur(4px);
}
.blog-card-body {
    padding: 18px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.blog-card-title {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: #ffffff;
}
.blog-card-excerpt {
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.6;
    flex: 1;
}
.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: #6b7280;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.04);
    flex-wrap: wrap;
}
.blog-card-author {
    display: flex;
    align-items: center;
    gap: 6px;
}
.blog-card-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(139,92,246,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #a78bfa;
    flex-shrink: 0;
}
.blog-card-guest-badge {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: rgba(52,211,153,0.1);
    color: #34d399;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(52,211,153,0.2);
}

/* ── Blog post viewer ────────────────────────────────────── */
.blog-post-wrap {
    max-width: 740px;
    margin: 0 auto;
    padding: 48px 32px 80px;
}
.blog-post-cat-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #a78bfa;
    text-decoration: none;
    margin-bottom: 16px;
}
.blog-post-cat-link::before {
    content: '←';
    font-size: 12px;
}
.blog-post-cat-link:hover { color: #fff; }
.blog-post-title {
    font-size: clamp(1.8rem,4vw,2.6rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 16px;
    color: #ffffff;
}
.blog-post-meta {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.blog-post-author-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.blog-post-author-av {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(139,92,246,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 800;
    color: #a78bfa;
    flex-shrink: 0;
}
.blog-post-cover {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 20px;
    margin-bottom: 36px;
}
/* Post body — rich text */
.blog-body {
    font-size: 16px;
    line-height: 1.85;
    color: #d1d5db;
}
.blog-body h1,.blog-body h2,.blog-body h3 {
    color: #ffffff;
    font-weight: 900;
    letter-spacing: -0.02em;
    margin: 32px 0 12px;
    line-height: 1.25;
}
.blog-body h1 { font-size: 26px; }
.blog-body h2 { font-size: 21px; }
.blog-body h3 { font-size: 18px; }
.blog-body p  { margin: 0 0 18px; }
.blog-body ul,.blog-body ol { margin: 0 0 18px 20px; }
.blog-body li { margin-bottom: 6px; }
.blog-body blockquote {
    border-left: 3px solid #7c3aed;
    padding: 14px 20px;
    margin: 24px 0;
    background: rgba(139,92,246,0.06);
    border-radius: 0 12px 12px 0;
    color: #a78bfa;
    font-style: italic;
}
.blog-body code {
    background: rgba(255,255,255,0.07);
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 13px;
    color: #c084fc;
    font-family: monospace;
}
.blog-body pre {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 16px 20px;
    overflow-x: auto;
    margin: 18px 0;
}
.blog-body a { color: #a78bfa; text-decoration: underline; text-underline-offset: 3px; }
.blog-body a:hover { color: #fff; }
.blog-body img { max-width: 100%; border-radius: 12px; margin: 16px 0; }
.blog-body hr { border: none; border-top: 1px solid rgba(255,255,255,0.08); margin: 32px 0; }
.blog-body strong { color: #fff; }
/* Author bio box */
.blog-author-bio {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 20px;
    padding: 20px 24px;
    margin-top: 40px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.blog-author-bio-av {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(139,92,246,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    color: #a78bfa;
    flex-shrink: 0;
}
.blog-author-bio-name {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.blog-author-bio-text {
    font-size: 13px;
    color: #9ca3af;
    line-height: 1.65;
}

/* ── Admin blog editor ───────────────────────────────────── */
.blog-editor-wrap {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
    align-items: start;
}
/* Toolbar */
.blog-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-bottom: none;
    border-radius: 14px 14px 0 0;
    flex-wrap: wrap;
    gap: 2px;
}
.blog-toolbar-group { display: flex; align-items: center; }
.blog-toolbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255,255,255,0.08);
    margin: 0 5px;
}
.blog-toolbar-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--font);
    position: relative;
}
.blog-toolbar-btn:hover { background: rgba(255,255,255,0.06); color: #fff; }
.blog-toolbar-btn.active { background: rgba(139,92,246,0.15); color: #a78bfa; }
.blog-toolbar-select {
    padding: 4px 8px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    color: #9ca3af;
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
}
/* Editable area */
.blog-editor-area {
    min-height: 420px;
    padding: 24px 28px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 0 0 14px 14px;
    outline: none;
    font-size: 15px;
    line-height: 1.8;
    color: #e5e7eb;
    font-family: var(--font);
    cursor: text;
}
.blog-editor-area:empty::before {
    content: 'Start writing your post here…';
    color: #4b5563;
    pointer-events: none;
}
.blog-editor-area h1 { font-size: 24px; font-weight: 900; color: #fff; margin: 20px 0 8px; }
.blog-editor-area h2 { font-size: 20px; font-weight: 800; color: #fff; margin: 16px 0 6px; }
.blog-editor-area h3 { font-size: 17px; font-weight: 700; color: #fff; margin: 12px 0 5px; }
.blog-editor-area p  { margin: 0 0 14px; }
.blog-editor-area ul,.blog-editor-area ol { padding-left: 22px; margin: 0 0 14px; }
.blog-editor-area blockquote {
    border-left: 3px solid #7c3aed;
    padding: 10px 16px;
    margin: 14px 0;
    color: #a78bfa;
    font-style: italic;
    background: rgba(139,92,246,0.05);
    border-radius: 0 8px 8px 0;
}
.blog-editor-area a { color: #a78bfa; text-decoration: underline; }
.blog-editor-area strong { color: #fff; }
/* Metrics bar */
.blog-metrics {
    display: flex;
    gap: 14px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-top: none;
    border-radius: 0 0 10px 10px;
    font-size: 11px;
    color: #6b7280;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.blog-metric { display: flex; align-items: center; gap: 4px; }
.blog-metric-val { color: #9ca3af; font-weight: 700; }
.blog-metric-val.good { color: #34d399; }
.blog-metric-val.warn { color: #fbbf24; }
/* AI bar */
.blog-ai-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    flex-wrap: wrap;
}
.blog-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: var(--font);
}
.blog-ai-btn:hover {
    background: rgba(139,92,246,0.1);
    border-color: rgba(139,92,246,0.3);
    color: #a78bfa;
}
.blog-ai-btn.primary {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}
.blog-ai-btn.primary:hover { filter: brightness(1.1); }

/* ── Member guest writer application ─────────────────────── */
.blog-apply-card {
    background: linear-gradient(135deg, rgba(139,92,246,0.08), rgba(109,40,217,0.04));
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 28px;
    padding: 32px;
    text-align: center;
}
.blog-apply-icon { font-size: 40px; margin-bottom: 16px; }
.blog-apply-title { font-size: 20px; font-weight: 900; margin-bottom: 8px; }
.blog-apply-sub { font-size: 14px; color: #9ca3af; line-height: 1.7; max-width: 480px; margin: 0 auto 24px; }

/* ── Blog index section on landing page ──────────────────── */
.blog-preview-section {
    padding: 80px 32px;
    max-width: 1100px;
    margin: 0 auto;
}
.blog-preview-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 32px;
    gap: 16px;
    flex-wrap: wrap;
}
.blog-preview-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 16px;
}
/* Featured (first) card */
.blog-preview-grid .blog-card:first-child {
    grid-row: span 1;
}
@media (max-width: 900px) {
    .blog-preview-grid { grid-template-columns: 1fr; }
    .blog-editor-wrap { grid-template-columns: 1fr; }
    .blog-grid { grid-template-columns: 1fr; padding: 0 20px 80px; }
    .blog-post-wrap { padding: 32px 20px 80px; }
}
@media (max-width: 640px) {
    .blog-hero { padding: 48px 20px 36px; }
    .blog-preview-section { padding: 60px 20px; }
}