/* ========== Blog Styles ========== */

.blog-hero {
    padding: calc(var(--nav-height) + 60px) 0 40px;
    text-align: center;
}

.blog-hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
}

.blog-hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
}

/* Blog listing grid */
.blog-listing {
    padding: 40px 0 80px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    padding: 32px 28px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    transition: all 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--glass-shine);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
    border-top: 2px solid var(--card-accent, rgba(129, 140, 248, 0.3));
}

/* Animated gradient shimmer on hover */
.blog-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--card-accent, #818cf8), transparent);
    transition: left 0.6s ease;
}

.blog-card:hover::before { left: 100%; }

/* Mouse-tracking glow overlay */
.blog-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-lg);
    opacity: 0;
    transition: opacity 0.4s ease;
    background: radial-gradient(400px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), var(--card-glow, rgba(129, 140, 248, 0.06)), transparent 40%);
    pointer-events: none;
    z-index: 0;
}

.blog-card:hover::after { opacity: 1; }

.blog-card:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: var(--card-accent, rgba(129, 140, 248, 0.4));
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.25),
        0 0 30px var(--card-glow, rgba(129, 140, 248, 0.08)),
        var(--glass-shine);
}

/* Everything inside the card above the overlay */
.blog-card > * { position: relative; z-index: 1; }

.blog-card-category {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    background: var(--cat-bg, rgba(129, 140, 248, 0.08));
    border: 1px solid var(--cat-border, rgba(129, 140, 248, 0.15));
    width: fit-content;
}

/* Category dot indicator */
.blog-card-category::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    flex-shrink: 0;
}

.blog-card-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 12px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.blog-card:hover .blog-card-title {
    background: linear-gradient(135deg, #fff, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.blog-card-summary {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    flex: 1;
    margin-bottom: 20px;
}

.blog-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.blog-card-read {
    color: var(--accent-light);
    font-weight: 600;
    transition: gap 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.blog-card:hover .blog-card-read { gap: 8px; }

/* Blog CTA */
.blog-cta {
    padding: 0 0 80px;
}

.blog-cta-card {
    text-align: center;
    padding: 60px 40px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shine);
}

.blog-cta-card h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 12px;
}

.blog-cta-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 1rem;
}

/* Individual article page */
.article-page {
    padding: calc(var(--nav-height) + 40px) 0 80px;
}

.article-container {
    max-width: 740px;
    margin: 0 auto;
}

/* ===== Reading progress bar ===== */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #6574cd, #818cf8, #a78bfa, #10b981);
    z-index: 9999;
    transition: width 0.1s linear;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.6), 0 0 4px rgba(16, 185, 129, 0.4);
}

/* ===== Header entrance animations ===== */
@keyframes articleFadeUp {
    from { opacity: 0; transform: translateY(28px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes categoryFlash {
    0% { opacity: 0; transform: translateX(-12px); }
    60% { opacity: 1; transform: translateX(3px); }
    100% { opacity: 1; transform: translateX(0); }
}

@keyframes titleReveal {
    0% { opacity: 0; transform: translateY(32px); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@keyframes metaLineExpand {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

.article-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-light);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 32px;
    transition: gap 0.2s;
    opacity: 0;
    animation: articleFadeUp 0.5s ease 0.1s forwards;
}

.article-back:hover { gap: 12px; }

.article-category {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    opacity: 0;
    animation: categoryFlash 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.25s forwards;
}

/* ===== Article hero banner ===== */
@keyframes bannerReveal {
    from { opacity: 0; transform: scale(1.03); }
    to { opacity: 1; transform: scale(1); }
}

.article-hero-banner {
    width: 100%;
    margin-bottom: 28px;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    opacity: 0;
    animation: bannerReveal 0.8s ease 0.3s forwards;
}

.article-hero-banner img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
    filter: brightness(0.7) saturate(1.1);
    transition: filter 0.4s ease;
}

.article-hero-banner:hover img {
    filter: brightness(0.8) saturate(1.2);
}

/* Gradient overlay to blend into dark bg */
.article-hero-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 40%,
        rgba(7, 7, 26, 0.6) 75%,
        rgba(7, 7, 26, 0.95) 100%
    );
    pointer-events: none;
}

/* Colored top-edge glow per category */
.article-hero-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--banner-accent, linear-gradient(90deg, #6574cd, #818cf8));
    z-index: 1;
}

@media (max-width: 768px) {
    .article-hero-banner img { height: 200px; }
}

@media (max-width: 480px) {
    .article-hero-banner img { height: 160px; }
    .article-hero-banner { border-radius: 12px; }
}

.article-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    opacity: 0;
    animation: titleReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
    opacity: 0;
    animation: articleFadeUp 0.5s ease 0.75s forwards;
    position: relative;
}

.article-meta::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, #6574cd, #a78bfa, transparent);
    transform-origin: left;
    transform: scaleX(0);
    animation: metaLineExpand 0.8s ease 1.1s forwards;
}

/* ===== Scroll reveal system ===== */
.article-body .reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-body .reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* H2 headings - slide in from left with accent bar */
.article-body h2.reveal {
    transform: translateX(-30px);
    padding-left: 16px;
    border-left: 3px solid transparent;
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.6s ease;
}

.article-body h2.reveal.visible {
    transform: translateX(0);
    border-left-color: #818cf8;
}

/* H3 headings - subtle scale pop */
.article-body h3.reveal {
    transform: translateY(16px) scale(0.97);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.article-body h3.reveal.visible {
    transform: translateY(0) scale(1);
}

/* List items - stagger in from left */
.article-body li.reveal {
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.article-body li.reveal.visible {
    transform: translateX(0);
}

/* CTA entrance - scale up with glow */
@keyframes ctaGlow {
    0% { box-shadow: var(--glass-shine); }
    50% { box-shadow: var(--glass-shine), 0 0 40px rgba(129, 140, 248, 0.15), 0 0 80px rgba(129, 140, 248, 0.05); }
    100% { box-shadow: var(--glass-shine); }
}

.article-cta.reveal {
    opacity: 0;
    transform: translateY(32px) scale(0.96);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.article-cta.reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: ctaGlow 2s ease 0.7s;
}

/* Article body rich text */
.article-body h2 {
    font-size: 1.35rem;
    font-weight: 800;
    margin-top: 36px;
    margin-bottom: 14px;
    color: var(--text-primary);
}

.article-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-top: 28px;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.article-body p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 16px;
}

.article-body ul, .article-body ol {
    padding-left: 24px;
    margin-bottom: 16px;
}

.article-body li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 6px;
    list-style: disc;
}

.article-body strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Article bottom CTA */
.article-cta {
    margin-top: 48px;
    padding: 40px 32px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--glass-shine);
    position: relative;
    overflow: hidden;
}

/* Animated gradient border shimmer on CTA */
.article-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #818cf8, #a78bfa, #10b981, transparent);
    animation: ctaShimmer 4s ease-in-out infinite;
}

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

.article-cta h3 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 8px;
    margin-top: 0;
    color: var(--text-primary);
}

.article-cta p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

/* ===== Reduce motion for accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    .reading-progress { transition: none; }
    .article-back,
    .article-category,
    .article-title,
    .article-meta { animation: none; opacity: 1; }
    .article-meta::after { animation: none; transform: scaleX(1); }
    .article-body .reveal { transition: none; opacity: 1; transform: none; }
    .article-cta.reveal { transition: none; opacity: 1; transform: none; animation: none; }
    .article-cta::before { animation: none; display: none; }
}

/* Responsive */
@media (max-width: 768px) {
    .blog-grid { grid-template-columns: 1fr; max-width: 500px; margin: 0 auto; }
    .blog-cta-card { padding: 40px 24px; }
    .article-meta { flex-wrap: wrap; }
}

@media (max-width: 480px) {
    .blog-hero { padding-top: calc(var(--nav-height) + 40px); }
    .article-container { padding: 0 16px; }
}
