/* ============================================
   Blog / Writing Page Styles
   Requires ../styles.css to be loaded first
   ============================================ */

/* ── Narrower container for reading layout ── */

.blog-header .section-container,
.blog-list .section-container,
.blog-footer .section-container {
    max-width: 900px;
}

/* ── Page Header ─────────────────────────── */

.blog-header {
    padding-top: calc(var(--space-xl) + 60px);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--color-border);
}

.blog-header .section-label {
    color: var(--color-accent-muted);
    margin-bottom: var(--space-sm);
}

.blog-header h1 {
    font-family: var(--font-serif);
    font-size: clamp(2.75rem, 5vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.blog-header-desc {
    font-size: 1.05rem;
    color: var(--color-text-muted);
}

/* ── Post List ───────────────────────────── */

.blog-list {
    padding: var(--space-lg) 0 var(--space-xl);
}

.post-list {
    list-style: none;
    display: flex;
    flex-direction: column;
}

.post-item {
    border-bottom: 1px solid var(--color-border);
}

.post-item article {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 2rem;
    padding: 2.5rem 0;
    align-items: start;
}

/* ── Post Meta (date + tag) ──────────────── */

.post-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.35rem;
}

.post-meta time {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    letter-spacing: 0.03em;
}

.post-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--color-text);
    background: var(--color-accent);
    border: 1px solid var(--color-accent);
    border-radius: 999px;
    padding: 0.25rem 0.7rem;
    width: fit-content;
}

/* ── Post Body ───────────────────────────── */

.post-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-title {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
}

.post-link {
    color: var(--color-text);
    text-decoration: none;
    background-image: linear-gradient(var(--color-accent), var(--color-accent));
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    transition: background-size 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
                color 0.2s ease;
    padding-bottom: 2px;
}

.post-link:hover {
    background-size: 100% 2px;
}

.post-excerpt {
    font-size: 0.975rem;
    line-height: 1.65;
    color: var(--color-text-muted);
    max-width: 60ch;
    margin: 0;
}

.post-read-more {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: color 0.2s ease;
    display: inline-block;
}

.post-item:hover .post-read-more {
    color: var(--color-text);
}

/* ── Listing: linked card (Mise pattern) ─── */

.post-item > .post-item-link {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 2rem;
    padding: 2.5rem 0;
    align-items: start;
    text-decoration: none;
    color: inherit;
}

.post-item-link .post-body {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: start;
}

.post-body-text {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-thumbnail {
    width: 120px;
    height: 90px;
    border-radius: 8px;
    background: var(--color-border);
    flex-shrink: 0;
    overflow: hidden;
    object-fit: cover;
}

/* Underline slide-in on whole-card hover */
.post-item > .post-item-link .post-title {
    background-image: linear-gradient(var(--color-accent), var(--color-accent));
    background-size: 0% 2px;
    background-repeat: no-repeat;
    background-position: left bottom;
    padding-bottom: 2px;
    transition: background-size 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.post-item > .post-item-link:hover .post-title {
    background-size: 100% 2px;
}

/* ── Post Page ───────────────────────────── */

.post-page {
    padding-top: calc(var(--space-xl) + 60px);
    padding-bottom: var(--space-xl);
}

.post-page .section-container {
    max-width: 760px;
}

.post-page-header {
    margin-bottom: var(--space-sm);
}

.post-page-meta {
    margin-bottom: 0.875rem;
}

.post-page-back {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.post-page-back:hover {
    color: var(--color-text);
}

.post-page-byline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.post-page-byline time {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.post-page-byline-dot {
    font-size: 0.6rem;
    color: var(--color-border);
    line-height: 1;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.post-page-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.post-page-dek {
    font-size: 1.1rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

/* ── Post Prose ──────────────────────────── */

.post-prose {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--color-text);
}


.post-prose h2 {
    font-family: var(--font-serif);
    font-size: clamp(1.4rem, 2.5vw, 1.85rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
    margin-top: 2.5rem;
    margin-bottom: 0.75rem;
}

.post-prose p {
    color: var(--color-text);
    max-width: none;
    margin-bottom: 1.5rem;
}

.post-prose p:last-child {
    margin-bottom: 0;
}

.post-prose a {
    color: var(--color-text);
    text-decoration: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='4' viewBox='0 0 100 4' preserveAspectRatio='none'%3E%3Cpath d='M0,2.5 C8,1 16,3.5 25,2 C34,0.5 42,3.8 52,2.2 C62,0.6 70,3.5 80,2 C88,0.8 94,3 100,2' stroke='%23EDFF00' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: 100% 4px;
    background-repeat: no-repeat;
    background-position: left bottom 1px;
    padding-bottom: 4px;
    transition: opacity 0.15s ease;
}

.post-prose a:hover {
    opacity: 0.65;
}

/* ── Post Images ─────────────────────────── */

.post-figure {
    margin: var(--space-md) 0;
}

.post-figure--hero {
    margin-top: var(--space-md);
    margin-bottom: var(--space-md);
}

.post-img-placeholder,
.post-figure img {
    width: 100%;
    display: block;
    border-radius: 12px;
}

.post-figure a {
    display: block;
    border-radius: 12px;
    overflow: hidden;
}

.post-figure a img {
    border-radius: 0; /* clipped by parent */
    transition: opacity 0.2s ease;
}

.post-figure a:hover img {
    opacity: 0.88;
}

.post-img-placeholder {
    aspect-ratio: 16 / 9;
    background: var(--color-border);
    position: relative;
    overflow: hidden;
}

.post-figure--hero .post-img-placeholder {
    aspect-ratio: 21 / 9;
}

.post-figure--hero img {
    border-radius: 16px;
}

.post-img-placeholder::after {
    content: 'image';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    opacity: 0.4;
}

/* ── Footer ──────────────────────────────── */

.blog-footer {
    border-top: 1px solid var(--color-border);
    padding: var(--space-md) 0;
}

.blog-footer-back {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.blog-footer-back:hover {
    color: var(--color-text);
}

/* ── Responsive ──────────────────────────── */

@media (max-width: 640px) {
    .post-item article,
    .post-item > .post-item-link {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 2rem 0;
    }

    .post-meta {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        padding-top: 0;
    }

    .post-item-link .post-body {
        grid-template-columns: 1fr;
    }

    .post-thumbnail {
        display: none;
    }

    .blog-header {
        padding-bottom: var(--space-md);
    }

    .post-page-title {
        font-size: clamp(1.75rem, 7vw, 2.5rem);
    }

    .post-figure--hero .post-img-placeholder {
        aspect-ratio: 4 / 3;
    }

    .post-figure--hero img {
        border-radius: 10px;
    }
}

/* ── Reduced motion ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .post-link,
    .post-page-back,
    .blog-footer-back,
    .post-read-more,
    .post-prose a,
    .post-figure a img {
        transition: none;
    }

    /* Show underline statically instead of animating in */
    .post-link,
    .post-item > .post-item-link .post-title {
        background-size: 100% 2px;
    }
}
