/* ==========================================================================
   Blog: index, archives and single posts
   archive.php / single.php   |   Depends on css/tokens.css

   No Figma design exists for the blog, so this reuses the site's own card,
   kicker and heading treatments.
   ========================================================================== */

.blog,
.post,
.post-related {
    font-family: var(--font-body);
}

.blog {
    padding: var(--space-9) 0;
}

.blog__inner,
.post__inner,
.post-related__inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* Index heading -------------------------------------------------------- */
.blog__kicker {
    margin: 0;
    color: var(--brand-600);
    font-size: var(--text-caption);
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.blog__title {
    margin: var(--space-2) 0 0;
    font-family: var(--font-display);
    font-size: var(--text-h2);
    font-weight: 800;
    line-height: 1.2;
    color: var(--ink-950);
}

.blog__lead {
    max-width: 40rem;
    margin: var(--space-3) 0 0;
    font-size: var(--text-lead);
    line-height: 1.65;
    color: var(--ink-500);
}

/* Cards ---------------------------------------------------------------- */
.blog__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    margin-top: var(--space-7);
}

@media (min-width: 640px) {
    .blog__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .blog__grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.blog-card {
    display: flex;
    border-radius: var(--radius-lg);
    background: var(--cloud);
    box-shadow: var(--shadow-xs), inset 0 0 0 1px var(--border);
    overflow: hidden;
    transition: transform .15s ease, box-shadow .15s ease;
}

.blog-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--border);
}

.blog-card__link {
    display: flex;
    flex: 1;
    flex-direction: column;
    text-decoration: none;
}

.blog-card__media {
    display: block;
    aspect-ratio: 16 / 9;
    background: var(--brand-100);
    overflow: hidden;
}

.blog-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.blog-card:hover .blog-card__media img {
    transform: scale(1.05);
}

.blog-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: var(--space-5);
}

.blog-card__kicker {
    display: block;
    color: var(--brand-600);
    font-size: var(--text-caption);
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.blog-card__title {
    display: block;
    margin-top: var(--space-1);
    font-family: var(--font-display);
    font-size: var(--text-h5);
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink-900);
    transition: color .15s ease;
}

.blog-card:hover .blog-card__title {
    color: var(--brand-600);
}

.blog-card__excerpt {
    display: block;
    margin-top: var(--space-2);
    color: var(--ink-500);
    font-size: var(--text-small);
    line-height: 1.6;
}

.blog-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    /* Pinned to the bottom so cards in a row line up. */
    margin-top: auto;
    padding-top: var(--space-4);
    color: var(--ink-400);
    font-size: var(--text-caption);
}

.blog__empty {
    margin-top: var(--space-7);
    color: var(--ink-500);
}

/* Pagination ----------------------------------------------------------- */

/*
 * WordPress gives the pagination a nav.navigation, and the original theme
 * styles .navigation as its old fixed site header - so without this the
 * pagination pins itself to the top left corner of the window.
 */
.blog .navigation {
    position: static !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
}

.blog .nav-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-8);
}

.blog .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--cloud);
    box-shadow: inset 0 0 0 1px var(--border);
    color: var(--ink-700);
    font-size: var(--text-small);
    font-weight: 700;
    text-decoration: none;
}

.blog .page-numbers:hover {
    box-shadow: inset 0 0 0 1px var(--brand-300);
}

.blog .page-numbers.current {
    background: var(--brand-600);
    box-shadow: inset 0 0 0 1px var(--brand-600);
    color: #fff;
}

.blog .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Single post ---------------------------------------------------------- */
.post {
    padding: var(--space-8) 0 var(--space-9);
    background: var(--mist);
}

/*
 * The article sits in a card, the way every other section of the site is
 * built, rather than as bare text on the page background.
 */
.post__card {
    display: block;
    margin-top: var(--space-5);
    padding: var(--space-7) var(--gutter) var(--space-8);
    border-radius: var(--radius-xl);
    background: var(--cloud);
    box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border);
}

@media (min-width: 640px) {
    .post__card {
        padding: var(--space-8);
    }
}

.post__inner {
    /*
     * Narrower than the site container: long prose reads better in a column.
     * Sized so the text inside the card lands near 65 characters a line once
     * the gutter and the card's own padding are taken off.
     */
    max-width: 56rem;
}

.post__crumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--ink-400);
}

.post__crumb {
    color: inherit;
    text-decoration: none;
    transition: color .15s ease;
}

.post__crumb:hover {
    color: var(--brand-600);
}

.post__head {
    margin-top: 0;
}

.post__kicker {
    margin: 0;
    color: var(--brand-600);
    font-size: var(--text-caption);
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.post__title {
    margin: var(--space-2) 0 0;
    font-family: var(--font-display);
    font-size: var(--text-h2);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -.01em;
    color: var(--ink-950);
}

.post__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin: var(--space-3) 0 0;
    color: var(--ink-400);
    font-size: var(--text-small);
}

.post__media {
    margin: var(--space-6) 0 0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--brand-100);
}

.post__media img {
    display: block;
    width: 100%;
    height: auto;
}

/* Prose ---------------------------------------------------------------- */
.post__body {
    margin-top: var(--space-6);
    color: var(--ink-700);
    font-size: var(--text-base);
    line-height: 1.75;
}

.post__body > * + * {
    margin-top: var(--space-4);
}

.post__body h2,
.post__body h3,
.post__body h4 {
    margin-top: var(--space-7);
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1.3;
    color: var(--ink-900);
}

.post__body h2 { font-size: var(--text-h3); }
.post__body h3 { font-size: var(--text-h4); }
.post__body h4 { font-size: var(--text-h5); }

.post__body a {
    color: var(--brand-600);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post__body a:hover {
    color: var(--brand-700);
}

.post__body ul,
.post__body ol {
    padding-left: var(--space-5);
}

.post__body li + li {
    margin-top: var(--space-2);
}

.post__body ul { list-style: disc; }
.post__body ol { list-style: decimal; }

.post__body blockquote {
    padding: var(--space-4) var(--space-5);
    border-left: 3px solid var(--brand-600);
    border-radius: var(--radius-md);
    background: var(--mist);
    color: var(--ink-900);
    font-size: var(--text-lead);
    font-style: italic;
}

.post__body img,
.post__body iframe,
.post__body video {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

.post__body figure {
    margin-left: 0;
    margin-right: 0;
}

.post__body figcaption {
    margin-top: var(--space-2);
    color: var(--ink-400);
    font-size: var(--text-caption);
}

.post__body code {
    padding: .15em .4em;
    border-radius: var(--radius-sm);
    background: var(--mist);
    font-family: var(--font-mono);
    font-size: .9em;
}

.post__body pre {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--ink-950);
    color: #e2e8f0;
    overflow-x: auto;
}

.post__body pre code {
    padding: 0;
    background: none;
    color: inherit;
}

.post__body table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
}

.post__body th,
.post__body td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    text-align: left;
}

/* Tags and footer ------------------------------------------------------ */
.post__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-7) 0 0;
    padding: 0;
    list-style: none;
}

.post__tags a {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--mist);
    box-shadow: inset 0 0 0 1px var(--border);
    color: var(--ink-700);
    font-size: var(--text-small);
    font-weight: 600;
    text-decoration: none;
}

.post__tags a:hover {
    box-shadow: inset 0 0 0 1px var(--brand-300);
}

.post__foot {
    margin-top: var(--space-7);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.post__back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--brand-600);
    font-weight: 700;
    text-decoration: none;
}

.post__back svg {
    width: 1rem;
    height: 1rem;
}

.post__back:hover {
    color: var(--brand-700);
}

/* Related -------------------------------------------------------------- */
.post-related {
    padding: var(--space-9) 0;
    background: var(--mist);
}

.post-related__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-h3);
    font-weight: 800;
    color: var(--ink-900);
}

/* Focus ---------------------------------------------------------------- */
.blog-card__link:focus-visible,
.post__crumb:focus-visible,
.post__back:focus-visible,
.post__tags a:focus-visible,
.blog .page-numbers:focus-visible {
    outline: 2px solid var(--brand-600);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .blog-card,
    .blog-card__media img,
    .blog-card__title,
    .post__crumb {
        transition: none;
    }

    .blog-card:hover {
        transform: none;
    }

    .blog-card:hover .blog-card__media img {
        transform: none;
    }
}
