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

/* ---------- Section headings ---------- */
.section_title {
    display: flex;
    align-items: center;
    gap: 14px;
    width: calc(100% - 2 * var(--gutter));
    max-width: 1200px;
    margin: clamp(28px, 4vw, 48px) auto 0;
    color: var(--color-primary);
    font-size: clamp(32px, 3.2vw, 40px);
    font-weight: normal;
    line-height: 1.1;
}

/* Pixel marker, like the one above the current tab in the phone tab bar */
.section_title::before {
    content: "";
    flex: none;
    width: 12px;
    height: 12px;
    background-color: var(--color-border);
    box-shadow: 3px 3px 0 var(--color-shadow);
}

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

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

.post_category {
    padding: 1px 10px;
    border: 2px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-border);
}

.post_date {
    align-self: flex-start;
    /* The digits start a quarter of the font size below the top of the text box (room the font keeps for
       taller letters), so the box moves up by that much: the digits then start level with the category frame */
    margin-top: -0.25em;
    color: var(--color-secondary);
}

/* ---------- Latest: the whole window is the link ---------- */
.post_list {
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 2vw, 20px);
    width: calc(100% - 2 * var(--gutter));
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.post_card {
    display: grid;
    grid-template-columns: clamp(160px, 22vw, 260px) 1fr;
    align-items: start;  /* category, date, title and text start at the top edge of the picture */
    gap: clamp(16px, 2.5vw, 28px);
    padding: clamp(12px, 1.6vw, 16px);
    border: 2px solid var(--color-line);
    border-radius: 12px;
    background-color: var(--color-card);
    box-shadow: 6px 6px 0 var(--color-shadow);
    color: var(--color-text-soft);
    text-decoration: none;
    /* Moved with top/left instead of translate: while Firefox animates translate it draws the text slightly
       differently, so the text seemed to move faster than the box. top/left is drawn like a still box. */
    position: relative;
    top: 0;
    left: 0;
    transition: top 0.12s steps(2), left 0.12s steps(2), box-shadow 0.12s steps(2);  /* stepped, like the buttons */
}

.post_thumb {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 2px solid var(--color-line);
    border-radius: 8px;
    background-color: var(--color-screen);
}

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

.post_card h3 {
    margin: 0 0 8px;
    color: var(--color-primary);
    font-size: clamp(24px, 2.4vw, 28px);
    font-weight: normal;
    line-height: 1.1;
    overflow-wrap: anywhere;
}

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

.read_more {
    display: inline-block;
    margin-top: 10px;
    color: var(--color-border);
    font-size: 22px;
}

@media (hover: hover) {
    .post_card:hover {
        top: -2px;
        left: -2px;
        box-shadow: 8px 8px 0 var(--color-shadow);
    }

    .post_card:hover .read_more,
    .big_card:hover .read_more {
        text-decoration: underline;
        text-underline-offset: 4px;
    }
}

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

.post_card:focus-visible {
    outline: 2px solid var(--color-border);
    outline-offset: 4px;
}

/* ---------- Highlight: a row of posts that scrolls sideways ----------
   The arrows are buttons (script at the end of the page); on touch screens the row is swiped. */
.hl_window {
    position: relative;
    max-width: calc(1200px + 2 * 64px);  /* the cards line up with the headings, the arrows sit beside them */
    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: 20px;
    margin: 0;
    padding: 4px 8px 10px 4px;  /* the cards' hard shadows and hover lift stay visible */
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 4px;
    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: 10px;
}

.hl_window .arrow.next {
    right: 10px;
}

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

.hl_window .arrow:focus-visible {
    outline: 2px solid var(--color-border);
    outline-offset: 2px;
}

/* Phones: swipe instead of arrows; the next card peeks in at the edge */
@media screen and (max-width: 600px) {
    /* The row runs to the screen edges; the first card still lines up with the heading */
    .hl_window {
        width: 100%;
        padding: 0;
    }

    .hl_window .arrow {
        display: none;
    }

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

/* ---------- Highlight: arrows and window together are as wide as the heading ----------
   The arrows stay left and right of the window, the window is narrower to make room for them */
.hl_window.hl_inset {
    max-width: 1200px;
}

/* The drawn arrows line up exactly with the left and right edges of the Latest windows below */
.hl_window.hl_inset .arrow.prev {
    left: 0;
    justify-items: start;
}

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

/* ---------- 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;  /* category, title and text start at the top edge of the picture */
    gap: clamp(20px, 3vw, 32px);
    padding: clamp(16px, 2.5vw, 24px);
    border: 2px solid var(--color-line);
    border-radius: 12px;
    background-color: var(--color-card);
    box-shadow: 4px 4px 0 var(--color-shadow);
    color: var(--color-text-soft);
    text-decoration: none;
    position: relative;  /* moved with top/left, see .post_card */
    top: 0;
    left: 0;
    transition: top 0.12s steps(2), left 0.12s steps(2), box-shadow 0.12s steps(2);
}

/* Same black "screen" frame as the screenshots on the portfolio page */
.big_img {
    flex: 0 0 45%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 2px solid var(--color-line);
    border-radius: 8px;
    background-color: var(--color-screen);
}

.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(--color-primary);
    font-size: clamp(30px, 3.2vw, 40px);
    font-weight: normal;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.big_text p {
    margin: 0;
    font-size: 22px;
    line-height: 1.4;
}

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

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

@media (hover: hover) {
    .big_card:hover {
        top: -2px;
        left: -2px;
        box-shadow: 6px 6px 0 var(--color-shadow);
    }
}

.big_card:active {
    top: 2px;
    left: 2px;
    box-shadow: 2px 2px 0 var(--color-shadow);
}

.big_card:focus-visible {
    outline: 2px solid var(--color-border);
    outline-offset: 4px;
}

/* 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: the next post peeks in at the edge */
@media screen and (max-width: 600px) {
    .hl_big .hl_track {
        grid-auto-columns: 88%;
    }
}

/* Phones: picture above the text */
@media screen and (max-width: 600px) {
    .post_card {
        grid-template-columns: 1fr;
        box-shadow: 4px 4px 0 var(--color-shadow);
    }

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

    .section_title {
        margin-top: 8px;
    }
}
