/* ========================================
   Blog Post Page Styles
   ======================================== */

.blog-hero {
    position: relative;
    padding: 160px 0 80px;
    background: var(--grad);
    overflow: hidden;
}

.blog-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(6,8,13,0.3) 0%, rgba(6,8,13,0.85) 100%);
}

[data-theme="light"] .blog-hero-overlay {
    background: linear-gradient(to bottom, rgba(248,250,252,0.3) 0%, rgba(248,250,252,0.85) 100%);
}

.blog-hero-content {
    position: relative;
    z-index: 1;
}

.blog-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    transition: color 0.3s ease;
}

.blog-back svg { width: 18px; height: 18px; }
.blog-back:hover { color: var(--accent-cyan); }

.blog-hero-cat {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    padding: 4px 14px;
    border-radius: 100px;
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 212, 255, 0.3);
    margin-bottom: 16px;
}

.blog-hero-title {
    font-family: var(--font-heading);
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 20px;
    max-width: 800px;
}

.blog-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

.blog-hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.blog-hero-meta svg { width: 16px; height: 16px; }

.blog-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.blog-tag {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 3px 12px;
    border-radius: 100px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

/* Article Content */
.blog-main {
    padding: 64px 0;
}

.blog-article {
    max-width: 720px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.9;
    color: var(--text-secondary);
}

.blog-article h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 48px 0 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.blog-article h3 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 32px 0 12px;
}

.blog-article p {
    margin-bottom: 16px;
}

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

.blog-article ul {
    margin: 12px 0 16px 20px;
}

.blog-article li {
    margin-bottom: 8px;
}

.blog-article pre {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    margin: 20px 0;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.7;
}

.blog-article code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: var(--accent-cyan);
}

.blog-article pre code {
    color: var(--text-secondary);
}

/* Author Card */
.author-card {
    display: flex;
    align-items: center;
    gap: 20px;
    max-width: 720px;
    margin: 64px auto;
    padding: 24px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.author-avatar svg { width: 28px; height: 28px; color: white; }

.author-name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.author-bio {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.author-links {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
}

.author-links a {
    color: var(--accent-cyan);
    transition: opacity 0.3s;
}

.author-links a:hover { opacity: 0.8; }

/* Related Posts */
.related-section {
    max-width: 900px;
    margin: 0 auto;
    padding-top: 48px;
    border-top: 1px solid var(--border);
}

.related-title {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.related-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.3);
    border-color: var(--border-hover);
}

.related-image {
    height: 120px;
    background: var(--grad);
    display: flex;
    align-items: flex-end;
    padding: 12px;
}

.related-cat {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 100px;
    background: rgba(0,0,0,0.4);
    color: white;
}

.related-body {
    padding: 16px;
}

.related-body h4 {
    font-family: var(--font-heading);
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
}

.related-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}

/* ========================================
   Project Gallery
   ======================================== */

.project-gallery {
    max-width: 900px;
    margin: 48px auto 0;
}

/* Gallery Header */
.gallery-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.gallery-header-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

.gallery-title {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.gallery-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-cyan);
}

.gallery-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--accent-cyan);
    background: rgba(0, 212, 255, 0.1);
    border: 1px solid rgba(0, 212, 255, 0.2);
    padding: 3px 12px;
    border-radius: 100px;
    white-space: nowrap;
}

[data-theme="light"] .gallery-count {
    background: rgba(8, 145, 178, 0.08);
    border-color: rgba(8, 145, 178, 0.2);
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 14px;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--glass-border);
    background: var(--bg-card);
    cursor: pointer;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.35s ease;
    opacity: 0;
    transform: translateY(20px);
    animation: galleryFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: calc(var(--i) * 60ms);
}

@keyframes galleryFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    border-color: rgba(0, 212, 255, 0.25);
}

[data-theme="light"] .gallery-item:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    border-color: rgba(8, 145, 178, 0.3);
}

.gallery-item img {
    width: 100%;
    display: block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item:hover img {
    transform: scale(1.04);
}

/* Overlay on hover */
.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.1) 40%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 14px;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.gallery-item:hover .gallery-item-overlay {
    opacity: 1;
}

.gallery-item-zoom {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.2);
    border: 1px solid rgba(0, 212, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.35s ease;
}

.gallery-item:hover .gallery-item-zoom {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-item-zoom svg {
    width: 20px;
    height: 20px;
    color: #fff;
}

.gallery-item-num {
    font-family: var(--font-mono);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.4);
    padding: 2px 10px;
    border-radius: 100px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* ========================================
   Lightbox
   ======================================== */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .lightbox-backdrop {
    background: rgba(0, 0, 0, 0.85);
}

.lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s ease;
}

.lightbox.active .lightbox-img {
    transform: scale(1);
    opacity: 1;
}

/* Lightbox transition for image swap */
.lightbox-img.switching {
    opacity: 0;
    transform: scale(0.96);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

/* Navigation buttons */
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
}

.lightbox-close {
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    font-size: 24px;
    line-height: 1;
}

.lightbox-close:hover {
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 22px;
    height: 22px;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-prev:hover { transform: translateY(-50%) translateX(-2px); }
.lightbox-next:hover { transform: translateY(-50%) translateX(2px); }

.lightbox-prev svg,
.lightbox-next svg {
    width: 22px;
    height: 22px;
}

/* Counter */
.lightbox-counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    font-family: var(--font-mono);
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 20px;
    border-radius: 100px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    letter-spacing: 2px;
}

/* Thumbnail strip */
.lightbox-thumbs {
    position: absolute;
    bottom: 64px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-width: 80vw;
    overflow-x: auto;
    scrollbar-width: none;
}

.lightbox-thumbs::-webkit-scrollbar { display: none; }

.lightbox-thumb {
    width: 56px;
    height: 36px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.3s ease, border-color 0.3s ease;
}

.lightbox-thumb.active {
    border-color: var(--accent-cyan);
    opacity: 1;
}

.lightbox-thumb:hover {
    opacity: 0.85;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .blog-hero { padding: 120px 0 60px; }
    .blog-article { font-size: 15px; }
    .author-card { flex-direction: column; text-align: center; }

    .project-gallery { margin-top: 36px; }
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .gallery-header { gap: 10px; }
    .gallery-title { font-size: 16px; }

    .lightbox-prev,
    .lightbox-next {
        width: 38px;
        height: 38px;
    }
    .lightbox-prev { left: 10px; }
    .lightbox-next { right: 10px; }
    .lightbox-close { top: 12px; right: 12px; width: 38px; height: 38px; }
    .lightbox-prev svg,
    .lightbox-next svg,
    .lightbox-close svg { width: 18px; height: 18px; }

    .lightbox-thumbs { bottom: 56px; gap: 4px; padding: 4px; }
    .lightbox-thumb { width: 44px; height: 28px; }

    .lightbox-img {
        max-width: 95vw;
        max-height: 75vh;
        border-radius: 6px;
    }
}
