/* Blog: highlighted posts one at a time in a large card between the pixel arrows, the latest posts as a list below.
   The pixel arrows come from portfolio.css. */

/* ---------- Section headings: a tilted block, like the page titles ---------- */
.section_title {
    display: table;  /* as wide as the text */
    margin: clamp(32px, 4vw, 48px) 0 0;
    padding: 2px 18px 6px;
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--yellow);
    box-shadow: 4px 4px 0 var(--ink);
    color: var(--on-fill);
    font-family: var(--font-display);
    font-size: clamp(36px, 4.4vw, 52px);
    font-weight: normal;
    line-height: 1;
    rotate: -1.5deg;
}

.section_title:nth-of-type(2) {
    background-color: var(--mint);
    rotate: 1deg;
}

.section_title + .project,
.section_title + .hl_window,
.section_title + .post_list {
    margin-top: clamp(20px, 3vw, 28px);
}

/* ---------- Category and date ---------- */
.post_meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 16px;
    margin-bottom: 12px;
}

.post_category {
    padding: 2px 10px;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background-color: var(--pink);
    box-shadow: 2px 2px 0 var(--ink);
    color: var(--on-fill);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.post_date {
    color: var(--ink-muted);
    font-family: var(--font-mono);
    font-size: 14px;
}

/* ---------- Latest: the whole card is the link ---------- */
.post_list {
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 2.5vw, 28px);
    margin: 0;
    padding: 0 0 8px;
    list-style: none;
}

.post_card {
    display: grid;
    grid-template-columns: clamp(160px, 22vw, 260px) 1fr;
    align-items: start;
    gap: clamp(16px, 2.5vw, 28px);
    padding: clamp(12px, 1.6vw, 16px);
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--card);
    box-shadow: var(--shadow) var(--shadow) 0 var(--ink);
    color: var(--ink-soft);
    text-decoration: none;
    /* Moved with top/left instead of translate: Firefox draws text slightly differently while it animates translate */
    position: relative;
    top: 0;
    left: 0;
    transition: top 0.08s, left 0.08s, box-shadow 0.08s;
}

.post_thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--paper);
}

.post_thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top;
}

.post_card h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(30px, 3vw, 38px);
    font-weight: normal;
    line-height: 1;
    overflow-wrap: anywhere;
}

/* Two lines of the excerpt, then "…" */
.post_card p {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    font-size: 17px;
    line-height: 1.5;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.read_more {
    display: inline-block;
    margin-top: 14px;
    padding: 2px 14px 4px;
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--yellow);
    box-shadow: 3px 3px 0 var(--ink);
    color: var(--on-fill);
    font-family: var(--font-display);
    font-size: 24px;
    line-height: 1.1;
}

@media (hover: hover) {
    .post_card:hover {
        top: -3px;
        left: -3px;
        box-shadow: calc(var(--shadow) + 3px) calc(var(--shadow) + 3px) 0 var(--ink);
    }

    .big_card:hover {
        top: -3px;
        left: -3px;
        box-shadow: 9px 9px 0 var(--ink);
    }
}

.post_card:active,
.big_card:active {
    top: 3px;
    left: 3px;
    box-shadow: 2px 2px 0 var(--ink);
}

/* ---------- Highlight: a row of posts that scrolls sideways ----------
   The arrows are buttons (script/blog.js); on touch screens the row is swiped. */
.hl_window {
    position: relative;
    padding: 0 64px;  /* room for the arrows */
    box-sizing: border-box;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
}

.hl_track {
    display: grid;
    grid-auto-flow: column;
    gap: 24px;
    margin: 0;
    padding: 6px 12px 14px 6px;  /* the cards' hard shadows and hover lift stay visible */
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 6px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.hl_track::-webkit-scrollbar {
    display: none;
}

.hl_track li {
    display: flex;
    scroll-snap-align: start;
}

/* Same pixel arrows as the image slider on the portfolio page, as real buttons */
.hl_window .arrow {
    padding: 0;
    border: 0;
    background: none;
}

.hl_window .arrow.prev {
    left: 0;
    justify-items: start;
}

.hl_window .arrow.next {
    right: 0;
    justify-items: end;
}

.hl_window .arrow:disabled {
    opacity: 0.25;
    cursor: default;
    transform: none;
}

/* ---------- Highlight, big: one post per view, picture left, text right ---------- */
.hl_big .hl_track {
    grid-auto-columns: 100%;
}

.big_card {
    display: flex;
    flex: 1;
    align-items: flex-start;
    gap: clamp(20px, 3vw, 32px);
    padding: clamp(16px, 2.5vw, 24px);
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--card);
    box-shadow: var(--shadow) var(--shadow) 0 var(--ink);
    color: var(--ink-soft);
    text-decoration: none;
    position: relative;  /* moved with top/left, see .post_card */
    top: 0;
    left: 0;
    transition: top 0.08s, left 0.08s, box-shadow 0.08s;
}

/* Striped screen, like the screenshots on the portfolio page */
.big_img {
    flex: 0 0 45%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    box-sizing: border-box;
    padding: 12px;
    border: var(--line) solid var(--ink);
    border-radius: var(--radius);
    background-color: var(--blue);
    background-image: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.07) 0 10px, transparent 10px 20px);
    box-shadow: 4px 4px 0 var(--ink);
}

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

.big_text {
    flex: 1;
    min-width: 0;
}

.big_text h3 {
    margin: 0 0 14px;
    color: var(--ink);
    font-family: var(--font-display);
    font-size: clamp(38px, 4vw, 52px);
    font-weight: normal;
    line-height: 1;
    overflow-wrap: anywhere;
}

.big_text p {
    margin: 0;
    font-size: 18px;
    line-height: 1.55;
}

.big_text p + p {
    margin-top: 12px;
}

.big_text .read_more {
    margin-top: 20px;
}

/* Narrow screens: picture above the text */
@media screen and (max-width: 860px) {
    .big_card {
        flex-direction: column;
        align-items: stretch;
    }

    .big_img {
        flex: none;
    }
}

/* Phones: swipe instead of arrows; the next post peeks in at the edge */
@media screen and (max-width: 600px) {
    .hl_window {
        margin-left: calc(-1 * var(--gutter));
        margin-right: calc(-1 * var(--gutter));
        padding: 0;
    }

    .hl_window .arrow {
        display: none;
    }

    .hl_track {
        gap: 16px;
        padding-left: var(--gutter);
        padding-right: var(--gutter);
        scroll-padding-left: var(--gutter);
    }

    .hl_big .hl_track {
        grid-auto-columns: 86%;
    }

    .post_card {
        grid-template-columns: 1fr;
    }

    .post_thumb {
        aspect-ratio: 16 / 9;
    }
}
