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

/* --- Blog Index Page --- */
.blog-header {
    padding: 120px 0 48px;
    border-bottom: 1px solid var(--border);
}

.blog-header h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(2.2rem, 5vw, 3.5rem);
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.blog-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 520px;
}

/* Card grid */
.blog-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding: 64px 0 120px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface);
    transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.blog-card:hover {
    transform: translate3d(0, -4px, 0);
    box-shadow: 0 8px 40px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}

.blog-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border-light);
}

.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s var(--ease);
}

.blog-card:hover .blog-card-image img {
    transform: scale(1.03);
}

.blog-card-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.blog-card-meta .sep {
    color: var(--border);
}

.blog-card-body h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
    color: var(--text);
}

.blog-card-body p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
    margin-bottom: 24px;
    flex: 1;
}

.blog-card-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    transition: gap 0.3s var(--ease);
}

.blog-card:hover .blog-card-link {
    gap: 12px;
}

.blog-card-link svg {
    width: 14px;
    height: 14px;
    transition: transform 0.3s var(--ease);
}

.blog-card:hover .blog-card-link svg {
    transform: translateX(2px);
}

/* Scroll reveal for cards */
.js .blog-card {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease),
                box-shadow 0.4s var(--ease);
}

.js .blog-card.revealed {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.js .blog-card:nth-child(2) {
    transition-delay: 0.08s;
}

/* --- Blog Post Page --- */

/* Back link */
.blog-back {
    padding: 120px 0 0;
}

.blog-back a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: color 0.2s, gap 0.3s var(--ease);
}

.blog-back a:hover {
    color: var(--text);
    gap: 10px;
}

.blog-back a svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s var(--ease);
}

.blog-back a:hover svg {
    transform: translateX(-2px);
}

/* Post header */
.post-header {
    padding: 40px 0 48px;
    max-width: 720px;
    margin: 0 auto;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin-bottom: 24px;
}

.post-meta .sep {
    color: var(--border);
}

.post-header h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}

.post-header .post-excerpt {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.7;
    max-width: 65ch;
}

/* Post hero image */
.post-hero-image {
    max-width: 720px;
    margin: 0 auto 48px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.post-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Article body */
.post-body {
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 64px;
}

.post-body h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--text);
    margin-top: 48px;
    margin-bottom: 16px;
}

.post-body h3 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 400;
    line-height: 1.3;
    color: var(--text);
    margin-top: 40px;
    margin-bottom: 12px;
}

.post-body p {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 24px;
    max-width: 65ch;
}

.post-body a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--border);
    transition: text-decoration-color 0.2s;
}

.post-body a:hover {
    text-decoration-color: var(--text);
}

/* Lists */
.post-body ul,
.post-body ol {
    margin-bottom: 24px;
    padding-left: 24px;
    max-width: 65ch;
}

.post-body ul {
    list-style: disc;
}

.post-body ol {
    list-style: decimal;
}

.post-body li {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--text);
    margin-bottom: 8px;
    padding-left: 8px;
}

.post-body li::marker {
    color: var(--text-tertiary);
}

/* Blockquote */
.post-body blockquote {
    margin: 32px 0;
    padding: 24px 0 24px 24px;
    border-left: 3px solid var(--text);
    max-width: 65ch;
}

.post-body blockquote p {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 0;
}

.post-body blockquote p + p {
    margin-top: 16px;
}

.post-body blockquote cite {
    display: block;
    margin-top: 12px;
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    font-size: 0.85rem;
    font-style: normal;
    color: var(--text-tertiary);
}

/* Code inline and blocks */
.post-body code {
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    font-size: 0.88em;
    background: var(--accent-soft);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text);
}

.post-body pre {
    margin: 32px 0;
    padding: 24px;
    background: var(--accent-soft);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.post-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85rem;
    line-height: 1.65;
}

/* Images within posts */
.post-body img {
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    margin: 32px 0;
    display: block;
}

.post-body figure {
    margin: 32px 0;
}

.post-body figure img {
    margin: 0 0 12px;
}

.post-body figcaption {
    font-size: 0.82rem;
    color: var(--text-tertiary);
    line-height: 1.5;
    text-align: center;
}

/* Horizontal rule */
.post-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 48px 0;
    max-width: 120px;
}

/* Post divider between body and CTA */
.post-divider {
    max-width: 720px;
    margin: 0 auto;
    border: none;
    border-top: 1px solid var(--border);
}

/* --- Post CTA Section --- */
.post-cta {
    max-width: 720px;
    margin: 0 auto;
    padding: 64px 0 120px;
    text-align: center;
}

.post-cta h2 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin-bottom: 12px;
}

.post-cta p {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.post-cta .btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--bg);
    background: var(--text);
    padding: 14px 32px;
    border-radius: 50px;
    transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), gap 0.3s var(--ease);
}

.post-cta .btn:hover {
    opacity: 0.85;
    gap: 14px;
    transform: translateY(-1px);
}

/* --- Tags on post page --- */
.post-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-width: 720px;
    margin: 0 auto;
    padding-bottom: 48px;
}

.post-tags a,
.post-tags span {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    background: var(--accent-soft);
    padding: 6px 14px;
    border-radius: 50px;
    transition: background 0.2s, color 0.2s;
}

.post-tags a:hover {
    background: var(--border);
    color: var(--text);
}

/* --- Responsive: Tablet (max-width: 968px) --- */
@media (max-width: 968px) {
    .blog-grid {
        gap: 24px;
    }

    .blog-card-body h2 {
        font-size: 1.3rem;
    }
}

/* --- Responsive: Mobile (max-width: 768px) --- */
@media (max-width: 768px) {
    .blog-header {
        padding: 96px 0 32px;
    }

    .blog-header p {
        font-size: 0.9rem;
    }

    .blog-grid {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 32px 0 48px;
    }

    .blog-card-body {
        padding: 20px;
    }

    .blog-card-body h2 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .blog-card-body p {
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    /* Post page */
    .blog-back {
        padding: 96px 0 0;
    }

    .post-header {
        padding: 32px 0 32px;
    }

    .post-meta {
        margin-bottom: 16px;
    }

    .post-header .post-excerpt {
        font-size: 1rem;
    }

    .post-hero-image {
        margin-bottom: 32px;
        border-radius: var(--radius);
    }

    .post-body {
        padding-bottom: 48px;
    }

    .post-body h2 {
        margin-top: 40px;
        margin-bottom: 12px;
    }

    .post-body h3 {
        margin-top: 32px;
        margin-bottom: 8px;
    }

    .post-body p {
        margin-bottom: 20px;
    }

    .post-body ul,
    .post-body ol {
        margin-bottom: 20px;
    }

    .post-body blockquote {
        margin: 24px 0;
        padding: 20px 0 20px 20px;
    }

    .post-body blockquote p {
        font-size: 1.1rem;
    }

    .post-body pre {
        margin: 24px 0;
        padding: 16px;
        border-radius: var(--radius);
    }

    .post-body img {
        margin: 24px 0;
    }

    .post-body figure {
        margin: 24px 0;
    }

    .post-body hr {
        margin: 32px 0;
    }

    .post-cta {
        padding: 48px 0 48px;
    }

    .post-cta p {
        margin-bottom: 24px;
    }

    .post-tags {
        padding-bottom: 32px;
    }
}

/* --- Responsive: Small mobile (max-width: 420px) --- */
@media (max-width: 420px) {
    .blog-card-body h2 {
        font-size: 1.2rem;
    }
}

/* --- Blog: Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .js .blog-card {
        opacity: 1;
        transform: none;
    }
}

/* --- Blog: Print --- */
@media print {
    .blog-back,
    .post-cta {
        display: none;
    }

    .js .blog-card {
        opacity: 1;
        transform: none;
    }

    .post-body a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #555;
    }
}
