/* ── Blog Cards (shared by homepage preview + listing) ── */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.blog-card {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color 1.2s cubic-bezier(0.4,0,0.2,1), box-shadow 1.2s cubic-bezier(0.4,0,0.2,1), transform 0.3s ease;
}
.blog-card:hover {
    border-color: var(--primary);
    box-shadow: 0 12px 40px rgba(108,58,237,0.10);
    transform: translateY(-6px);
}

.blog-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

/* ── Animated Blog Illustrations (deep purple theme) ── */
.blog-card-image {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    background: linear-gradient(135deg, #0E0B1A 0%, #161231 50%, #0E0B1A 100%);
}
.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}
.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}

.blog-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0E0B1A 0%, #161231 50%, #0E0B1A 100%);
}

.blog-illust {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.blog-illust::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(108,58,237,0.12) 0%, transparent 65%);
    pointer-events: none;
}
.blog-illust-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(108,58,237,0.08) 0%, transparent 70%);
    animation: blogPulse 4s ease-in-out infinite;
}
@keyframes blogPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
}

/* ─ Neural Network (AI Strategy) ─ */
.blog-illust-neural { position: absolute; inset: 0; }
.blog-nn-svg {
    position: absolute;
    inset: 10%;
    width: 80%;
    height: 80%;
}
.blog-nn-node {
    fill: rgba(129,140,248,0.5);
    filter: drop-shadow(0 0 6px rgba(129,140,248,0.4));
    animation: nnPulseNode 3s ease-in-out infinite;
}
.nn-n0 { animation-delay: 0s; }
.nn-n1 { animation-delay: 0.3s; }
.nn-n2 { animation-delay: 0.6s; }
.nn-n3 { animation-delay: 0.9s; }
.nn-n4 { animation-delay: 1.2s; }
.nn-n5 { animation-delay: 1.5s; }
.nn-n6 { animation-delay: 1.8s; }
.nn-n7 { animation-delay: 2.1s; }

@keyframes nnPulseNode {
    0%, 100% { r: 3; fill: rgba(129,140,248,0.35); filter: drop-shadow(0 0 4px rgba(129,140,248,0.2)); }
    50% { r: 5; fill: rgba(167,139,250,0.8); filter: drop-shadow(0 0 10px rgba(129,140,248,0.6)); }
}

.blog-nn-line {
    animation: nnLinePulse 4s ease-in-out infinite;
}
.nn-l0 { animation-delay: 0.1s; }
.nn-l1 { animation-delay: 0.5s; }
.nn-l2 { animation-delay: 0.9s; }
.nn-l3 { animation-delay: 1.3s; }
.nn-l4 { animation-delay: 0.3s; }
.nn-l5 { animation-delay: 0.7s; }
.nn-l6 { animation-delay: 1.1s; }
.nn-l7 { animation-delay: 1.5s; }
.nn-l8 { animation-delay: 0.2s; }
.nn-l9 { animation-delay: 0.6s; }
.nn-l10 { animation-delay: 1.0s; }
.nn-l11 { animation-delay: 1.4s; }

@keyframes nnLinePulse {
    0%, 100% { stroke: rgba(129,140,248,0.08); }
    50% { stroke: rgba(129,140,248,0.3); }
}

/* ─ Gears (Automation) ─ */
.blog-illust-gears { position: absolute; inset: 0; }
.blog-gear {
    position: absolute;
    border-radius: 50%;
    border: 2px dashed rgba(129,140,248,0.2);
}
.blog-gear.gear-1 {
    width: 80px;
    height: 80px;
    top: calc(50% - 48px);
    left: calc(50% - 56px);
    animation: gearSpin 8s linear infinite;
}
.blog-gear.gear-2 {
    width: 56px;
    height: 56px;
    top: calc(50% - 8px);
    left: calc(50% + 4px);
    animation: gearSpin 6s linear infinite reverse;
}
.gear-inner {
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 1.5px solid rgba(129,140,248,0.15);
}
.blog-gear.gear-1 .gear-inner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    transform: translate(-50%, -50%);
    background: rgba(108,58,237,0.4);
    border-radius: 50%;
    box-shadow: 0 0 12px rgba(108,58,237,0.4);
}
.blog-gear.gear-2 .gear-inner::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 7px;
    height: 7px;
    transform: translate(-50%, -50%);
    background: rgba(167,139,250,0.4);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(167,139,250,0.4);
}

@keyframes gearSpin {
    to { transform: rotate(360deg); }
}

.blog-gear-dot {
    position: absolute;
    width: 4px;
    height: 4px;
    background: #818CF8;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(129,140,248,0.5);
    animation: gearDotFloat 3s ease-in-out infinite;
}
.blog-gear-dot.gd1 { top: 25%; left: 30%; animation-delay: 0s; }
.blog-gear-dot.gd2 { top: 60%; right: 25%; animation-delay: 1s; }
.blog-gear-dot.gd3 { bottom: 25%; left: 45%; animation-delay: 2s; }

@keyframes gearDotFloat {
    0%, 100% { opacity: 0.3; transform: scale(0.6); }
    50% { opacity: 1; transform: scale(1.3); }
}

/* ─ Shield (AI Security) ─ */
.blog-illust-shield { position: absolute; inset: 0; }
.blog-shield-shape {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 72px;
    animation: shieldBreath 4s ease-in-out infinite;
}
@keyframes shieldBreath {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.05); }
}

.blog-shield-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.blog-shield-scan {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(129,140,248,0.5), transparent);
    animation: shieldScan 3s ease-in-out infinite;
    box-shadow: 0 0 12px rgba(129,140,248,0.3);
}
@keyframes shieldScan {
    0% { top: 15%; opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { top: 85%; opacity: 0; }
}

.blog-shield-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(129,140,248,0.15);
    transform: translate(-50%, -50%);
    animation: shieldRingPulse 4s ease-out infinite;
    opacity: 0;
}
.blog-shield-ring.r1 {
    width: 60px;
    height: 60px;
    animation-delay: 0s;
}
.blog-shield-ring.r2 {
    width: 60px;
    height: 60px;
    animation-delay: 2s;
}
@keyframes shieldRingPulse {
    0% { width: 60px; height: 60px; opacity: 0.4; }
    100% { width: 140px; height: 140px; opacity: 0; }
}

.blog-card-category {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
}

.blog-card-body {
    padding: 1.5rem;
}
.blog-card-body h3 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}
.blog-card-body p {
    font-size: 0.95rem;
    color: var(--text-2);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-3);
    font-weight: 500;
}
.blog-meta-dot {
    width: 3px;
    height: 3px;
    background: var(--text-3);
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Homepage Blog Preview ── */
.blog-preview {
    padding: 6rem 0;
    background-image:
        linear-gradient(45deg, rgba(108,58,237,0.02) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(108,58,237,0.02) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(108,58,237,0.02) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(108,58,237,0.02) 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.blog-preview-cta {
    text-align: center;
    margin-top: 2.5rem;
}

/* ── Blog Hero (listing + post pages) ── */
.blog-hero {
    padding: 8rem 0 3rem;
    background: #08080F;
    text-align: center;
    position: relative;
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}

/* ─ Hero Neural Network Animation ─ */
.blog-hero-anim {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.blog-hero-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.hero-nn-node {
    fill: rgba(129,140,248,0.4);
    filter: drop-shadow(0 0 8px rgba(129,140,248,0.3));
    animation: heroNodePulse 3s ease-in-out infinite;
}
.hn0  { animation-delay: 0s; }
.hn1  { animation-delay: 0.25s; }
.hn2  { animation-delay: 0.5s; }
.hn3  { animation-delay: 0.75s; }
.hn4  { animation-delay: 1.0s; }
.hn5  { animation-delay: 1.25s; }
.hn6  { animation-delay: 1.5s; }
.hn7  { animation-delay: 1.75s; }
.hn8  { animation-delay: 2.0s; }
.hn9  { animation-delay: 2.25s; }
.hn10 { animation-delay: 0.35s; }
.hn11 { animation-delay: 0.85s; }
.hn12 { animation-delay: 1.35s; }

@keyframes heroNodePulse {
    0%, 100% { r: 3; fill: rgba(129,140,248,0.25); filter: drop-shadow(0 0 4px rgba(129,140,248,0.15)); }
    50% { r: 6; fill: rgba(167,139,250,0.7); filter: drop-shadow(0 0 14px rgba(129,140,248,0.5)); }
}

.hero-nn-line {
    stroke: rgba(129,140,248,0.06);
    stroke-width: 1;
    animation: heroLinePulse 4s ease-in-out infinite;
}
.hl0  { animation-delay: 0.1s; }
.hl1  { animation-delay: 0.4s; }
.hl2  { animation-delay: 0.7s; }
.hl3  { animation-delay: 1.0s; }
.hl4  { animation-delay: 0.2s; }
.hl5  { animation-delay: 0.5s; }
.hl6  { animation-delay: 0.8s; }
.hl7  { animation-delay: 1.1s; }
.hl8  { animation-delay: 0.3s; }
.hl9  { animation-delay: 0.6s; }
.hl10 { animation-delay: 0.9s; }
.hl11 { animation-delay: 1.2s; }
.hl12 { animation-delay: 0.15s; }
.hl13 { animation-delay: 0.45s; }
.hl14 { animation-delay: 0.75s; }
.hl15 { animation-delay: 1.05s; }
.hl16 { animation-delay: 0.35s; }
.hl17 { animation-delay: 0.65s; }
.hl18 { animation-delay: 0.95s; }
.hl19 { animation-delay: 1.25s; }

@keyframes heroLinePulse {
    0%, 100% { stroke: rgba(129,140,248,0.04); }
    50% { stroke: rgba(129,140,248,0.2); }
}

/* Hero gradient glows */
.blog-hero-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}
.blog-hero-glow.g1 {
    width: 400px;
    height: 400px;
    background: rgba(108,58,237,0.08);
    top: -100px;
    left: 10%;
    animation: heroGlowDrift 12s ease-in-out infinite;
}
.blog-hero-glow.g2 {
    width: 300px;
    height: 300px;
    background: rgba(129,140,248,0.06);
    bottom: -80px;
    right: 15%;
    animation: heroGlowDrift 10s ease-in-out infinite reverse;
}
@keyframes heroGlowDrift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.1); }
    66% { transform: translate(-20px, 15px) scale(0.95); }
}
.blog-hero .badge {
    background: rgba(108,58,237,0.15);
    color: #A78BFA;
}
.blog-hero h1 {
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}
.blog-hero p {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.6);
    max-width: 560px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ── Filter Bar ── */
.blog-filters {
    padding: 2rem 0;
    border-bottom: 1px solid var(--border);
}
.filter-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}
.filter-btn {
    padding: 0.4rem 1rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: transparent;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.2s;
}
.filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ── Blog Listing Grid ── */
.blog-listing {
    padding: 3rem 0 6rem;
}
.blog-grid-full {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Featured card — full width, side-by-side */
.blog-card.featured {
    grid-column: 1 / -1;
}
.blog-card.featured .blog-card-link {
    display: grid;
    grid-template-columns: 1fr 1fr;
}
.blog-card.featured .blog-card-image {
    aspect-ratio: auto;
    min-height: 300px;
}
.blog-card.featured .blog-card-body {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.blog-card.featured .blog-card-body h3 {
    font-size: 1.5rem;
}

/* ── Post Page ── */
.post-hero {
    padding: 8rem 0 3rem;
    background: #08080F;
    text-align: center;
    position: relative;
    overflow: hidden;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
}
/* Reuse hero animation for post hero */
.post-hero .blog-hero-anim { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.post-category {
    display: inline-flex;
    padding: 0.3rem 0.85rem;
    border-radius: var(--radius-full);
    background: rgba(108,58,237,0.15);
    color: #A78BFA;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
}
.post-hero h1 {
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.02em;
    max-width: 800px;
    margin: 0 auto 1.25rem;
}
.post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
}
.post-meta-dot {
    width: 3px;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    flex-shrink: 0;
}

/* Featured image overlapping hero */
.post-featured-image {
    max-width: 900px;
    margin: -2rem auto 0;
    padding: 0 2.5rem;
    position: relative;
    z-index: 2;
}
.post-featured-image img {
    width: 100%;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

/* Post Content Typography */
.container-narrow { max-width: 780px; }

.post-content {
    padding: 4rem 0;
    background-image: radial-gradient(circle, rgba(108,58,237,0.03) 1px, transparent 1px);
    background-size: 24px 24px;
}
.post-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.01em;
    color: var(--text);
}
.post-content h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 2rem 0 0.75rem;
    color: var(--text);
}
.post-content p {
    font-size: 1.05rem;
    color: var(--text-2);
    line-height: 1.8;
    margin-bottom: 1.5rem;
}
.post-content ul, .post-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
}
.post-content li {
    font-size: 1.05rem;
    color: var(--text-2);
    line-height: 1.8;
    margin-bottom: 0.5rem;
}
.post-content blockquote {
    border-left: 3px solid var(--primary);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--primary-light);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
    color: var(--text);
    font-size: 1.05rem;
    line-height: 1.7;
}
.post-content img {
    width: 100%;
    border-radius: var(--radius-lg);
    margin: 2rem 0;
}
.post-content code {
    background: var(--bg-alt);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-size: 0.92em;
}
.post-content pre {
    background: var(--bg-dark);
    color: #E2E8F0;
    padding: 1.5rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin: 2rem 0;
}
.post-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: rgba(108,58,237,0.3);
    text-underline-offset: 2px;
    transition: text-decoration-color 0.2s;
}
.post-content a:hover {
    text-decoration-color: var(--primary);
}

/* Back link */
.post-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-3);
    margin-bottom: 2rem;
    transition: color 0.2s;
}
.post-back:hover { color: var(--primary); }
.post-back svg { width: 16px; height: 16px; }

/* Related Posts */
.related-posts {
    padding: 4rem 0 6rem;
    background: var(--bg-alt);
}

/* ── Responsive ── */
@media (max-width: 1024px) {
    .blog-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .blog-preview { padding: 4rem 0; }
    .blog-grid { grid-template-columns: 1fr; }
    .blog-grid-full { grid-template-columns: 1fr; }
    .blog-card.featured .blog-card-link { grid-template-columns: 1fr; }
    .blog-card.featured .blog-card-image { min-height: 200px; }
    .blog-hero { padding: 6rem 0 2rem; }
    .post-hero { padding: 6rem 0 2rem; }
    .post-content { padding: 2.5rem 0; }
    .related-posts { padding: 3rem 0 4rem; }
    .post-featured-image { padding: 0 1.5rem; }
}
