/* Blog index and posts. Builds on site.css and time.css tokens; only blog pieces live here.
   Posts are long reading, so the article sits in a narrow column with generous line height. */

/* Index */

.blog-index {
    padding-top: clamp(48px, 7vw, 88px);
}

.blog-head {
    max-width: 760px;
    margin-bottom: clamp(32px, 4vw, 48px);
}

.blog-head .lede {
    margin-top: 18px;
}

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

.post-card a {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card a:hover {
    border-color: var(--signal);
    box-shadow: 0 18px 36px -24px rgba(20, 33, 61, 0.35);
}

.post-card-image {
    display: block;
    aspect-ratio: 16 / 9;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
}

.post-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 8px;
    padding: 20px 22px 22px;
}

.post-card time {
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--ink-soft);
}

.post-card-title {
    font-variation-settings: "wdth" 110;
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.3;
}

.post-card-summary {
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.post-card-more {
    margin-top: auto;
    padding-top: 6px;
    font-weight: 650;
    color: var(--signal);
}

/* The newest post leads the index across the full width */
.post-card-lead {
    grid-column: 1 / -1;
}

.post-card-lead a {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
}

.post-card-lead .post-card-image {
    aspect-ratio: auto;
    height: 100%;
    min-height: 280px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
}

.post-card-lead .post-card-body {
    justify-content: center;
    padding: clamp(24px, 4vw, 44px);
}

.post-card-lead .post-card-title {
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    line-height: 1.2;
}

.post-card-lead .post-card-summary {
    font-size: 1.05rem;
}

/* Post */

.post {
    padding-top: clamp(40px, 6vw, 72px);
}

.post-wrap {
    max-width: calc(780px + 2 * var(--gutter));
}

.post-back {
    margin-bottom: 18px;
    font-weight: 600;
}

.post-head h1 {
    font-size: clamp(1.9rem, 3.6vw, 2.8rem);
}

.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    margin-top: 18px;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.post-author {
    font-weight: 600;
    color: var(--ink);
}

.post-meta time {
    font-variant-numeric: tabular-nums;
}

.post-hero {
    margin-top: clamp(28px, 4vw, 40px);
}

.post-hero img,
.post-body figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.post-body {
    margin-top: clamp(28px, 4vw, 40px);
    font-size: 1.1rem;
    line-height: 1.7;
}

.post-body > * + * {
    margin-top: 1.1em;
}

.post-body h2 {
    margin-top: 1.8em;
    font-size: clamp(1.45rem, 2.4vw, 1.8rem);
    line-height: 1.2;
}

.post-body h3 {
    margin-top: 1.6em;
    font-variation-settings: "wdth" 110;
    font-size: 1.25rem;
    line-height: 1.3;
}

.post-body h4 {
    margin-top: 1.4em;
    font-size: 1.1rem;
}

.post-body h2 + *,
.post-body h3 + *,
.post-body h4 + * {
    margin-top: 0.6em;
}

.post-body ul,
.post-body ol {
    padding-left: 1.4em;
}

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

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

.post-body li + li {
    margin-top: 0.4em;
}

.post-body li > p {
    margin: 0;
}

.post-body a:not(.btn) {
    color: var(--signal);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-body blockquote {
    padding: 4px 0 4px 20px;
    border-left: 4px solid var(--green);
    color: var(--ink-soft);
}

.post-body figure {
    margin-top: 1.6em;
    margin-bottom: 1.6em;
}

.post-video video {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    background: #000000;
}

.post-body figcaption {
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--ink-soft);
}

.post-body hr {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 2em 0;
}

.post-cta {
    margin-top: 1.6em;
}

.post-cta .btn {
    max-width: 100%;
    white-space: normal;
    text-align: center;
}

/* Newer and older posts */
.post-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: clamp(48px, 6vw, 72px);
    padding-top: 32px;
    border-top: 1px solid var(--line);
}

.post-pager a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    font-weight: 650;
    line-height: 1.35;
}

.post-pager a:hover {
    border-color: var(--signal);
}

.post-pager span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink-soft);
}

.post-pager-older {
    grid-column: 2;
    text-align: right;
}

@media (max-width: 1080px) {
    .post-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .post-card-lead a {
        grid-template-columns: minmax(0, 1fr);
    }

    .post-card-lead .post-card-image {
        aspect-ratio: 16 / 9;
        height: auto;
        min-height: 0;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
}

@media (max-width: 640px) {
    .post-cards,
    .post-pager {
        grid-template-columns: minmax(0, 1fr);
    }

    .post-pager-older {
        grid-column: auto;
        text-align: left;
    }

    .post-body {
        font-size: 1.05rem;
    }
}
