/* =====================================================
   blog.css — RapiX Solutions Blog Bundle
   var() colours only (RULE 1). Loaded on the Blog page
   template, topic (category) pages and single posts.

   Blocks:
     .blog-topics   topic chip links
     .blog-list     lead story + post rows + pagination
     .blog-lead     newest post as an asymmetric two-up
     (.post-list / .post-row and the shared meta line live in global.css:
      Home's "From the blog" section uses them too)
     .post-hero     single post header + cover
     .post-body     sticky contents + article + author box
     .post-toc      "On this page" contents list
     .post-prose    long-form article typography
     .post-author   author box
     .post-related  related posts section
   ===================================================== */

/* =====================================================
   Topic chips
   ===================================================== */

.blog-topics {
    padding-top: var(--space-16);
    padding-bottom: 0;
}

.blog-topics__list {
    list-style: none;
    margin: var(--space-4) 0 0;
    padding: 0 0 var(--space-6);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    border-bottom: 1px solid var(--color-border);
}

.blog-topics__chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--space-4);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    color: var(--color-text);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    transition:
        background-color var(--ease-base),
        border-color     var(--ease-base),
        color            var(--ease-base),
        transform        var(--ease-base);
}

.blog-topics__chip:hover {
    border-color: var(--color-text);
    transform: translateY( -1px );
}

.blog-topics__chip.is-active {
    background-color: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-white);
}

.blog-topics__chip.is-active:hover { transform: none; }

/* =====================================================
   List section
   ===================================================== */

.blog-list {
    padding-top: var(--space-12);
}

/* The topic row is hidden when there's only one topic; the list then
   sits right under the hero and needs the full section padding. */
.page-hero + .blog-list {
    padding-top: var(--section-py);
}

/* ---- Lead story ---- */

.blog-lead {
    margin-bottom: var(--space-16);
}

.blog-lead__link {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: var(--space-12);
    align-items: center;
    color: inherit;
    text-decoration: none;
}

.blog-lead__media {
    display: block;
    aspect-ratio: 1200 / 630;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background-color: var(--color-text);
}

.blog-lead__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--ease-slow);
}

.blog-lead__link:hover .blog-lead__img {
    transform: scale( 1.02 );
}

.blog-lead__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
}

.blog-lead__title {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: var(--fw-extrabold);
    font-size: var(--text-prose-h2);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-snug);
    color: var(--color-text);
    transition: color var(--ease-base);
}

.blog-lead__link:hover .blog-lead__title {
    color: var(--color-primary);
}

.blog-lead__excerpt {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-body-lg);
    line-height: var(--leading-body);
    color: var(--color-muted);
    max-width: var(--measure-text);
}

.blog-lead__more {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding-bottom: var(--space-1);
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    font-size: var(--text-body-lg);
    color: var(--color-text);
    border-bottom: 2px solid var(--color-text);
    transition: color var(--ease-base), border-color var(--ease-base);
}

.blog-lead__more svg { transition: transform var(--ease-base); }

.blog-lead__link:hover .blog-lead__more {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.blog-lead__link:hover .blog-lead__more svg {
    transform: rotate( -45deg );
}

.blog-lead__link:focus-visible {
    outline-offset: 6px;
}

/* ---- Pagination ---- */

.blog-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-12);
}

.blog-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0 var(--space-3);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    color: var(--color-text);
    text-decoration: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    transition: background-color var(--ease-base), border-color var(--ease-base), color var(--ease-base);
}

.blog-pagination a.page-numbers:hover {
    border-color: var(--color-text);
}

.blog-pagination .page-numbers.current {
    background-color: var(--color-text);
    border-color: var(--color-text);
    color: var(--color-white);
}

.blog-pagination .page-numbers.dots {
    border-color: transparent;
}

/* ---- Empty state ---- */

.blog-list__empty {
    max-width: var(--measure-text);
}

.blog-list__empty-heading {
    margin: 0 0 var(--space-4);
    font-family: var(--font-heading);
    font-weight: var(--fw-extrabold);
    font-size: var(--text-prose-h2);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-snug);
    color: var(--color-text);
}

.blog-list__empty-sub {
    font-family: var(--font-body);
    font-size: var(--text-body-lg);
    line-height: var(--leading-body);
    color: var(--color-muted);
}

.blog-list__empty-sub p { margin: 0 0 var(--space-3); }
.blog-list__empty-sub p:last-child { margin-bottom: 0; }

/* =====================================================
   Post header
   Same surface and rhythm as the universal page-hero: pulls up under
   the fixed header, ink with a lime glow (rs-section--dark in the
   template). The cover sits at the bottom of the ink.
   ===================================================== */

.post-hero {
    position: relative;
    margin-top: -80px;
    background:
        radial-gradient(
            ellipse at 90% -10%,
            rgba( var(--color-primary-rgb), 0.16 ) 0%,
            transparent 50%
        ),
        var(--color-text);
}

.post-hero__inner {
    padding-top: calc( 80px + var(--section-py) );
    padding-bottom: var(--section-py);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.post-hero__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.post-hero__back {
    display: inline-flex;
    align-items: center;
    min-height: 36px; /* the same height as the topic chip beside it */
    gap: var(--space-2);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    color: var(--color-on-dark-muted);
    text-decoration: none;
    transition: color var(--ease-base);
}

.post-hero__back svg { transition: transform var(--ease-base); }

.post-hero__back:hover { color: var(--color-white); }
.post-hero__back:hover svg { transform: translateX( calc( var(--space-1) * -1 ) ); }

.post-hero__topic {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 var(--space-4);
    font-family: var(--font-body);
    font-weight: var(--fw-semibold);
    font-size: var(--text-sm);
    color: var(--color-on-dark);
    text-decoration: none;
    border: 1px solid var(--color-on-dark-line);
    border-radius: var(--radius-full);
    transition: border-color var(--ease-base);
}

.post-hero__topic:hover { border-color: var(--color-primary); }

.post-hero__rule {
    border: 0;
    border-top: 1px solid var(--color-on-dark-line);
    margin: 0;
    width: 100%;
}

.post-hero__title {
    margin: var(--space-4) 0 0;
    max-width: var(--measure-heading);
    font-family: var(--font-heading);
    font-weight: var(--fw-extrabold);
    font-size: var(--text-display);
    line-height: var(--leading-display);
    letter-spacing: var(--tracking-tight);
    color: var(--color-white);
}

.post-hero__standfirst {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-body-lg);
    line-height: var(--leading-body);
    color: var(--color-on-dark);
    max-width: var(--measure-text);
}

/* Same clipped-separator line as the post lists above. */
.post-hero__byline {
    --meta-sep: calc( var(--space-3) * 2 + 0.35em );
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    row-gap: var(--space-2);
    margin: 0 0 0 calc( -1 * var(--meta-sep) );
    clip-path: inset( -0.5em -0.5em -0.5em var(--meta-sep) );
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--color-on-dark-muted);
}

.post-hero__byline > *::before {
    content: "·";
    display: inline-block;
    width: var(--meta-sep);
    text-align: center;
}

.post-hero__author {
    font-weight: var(--fw-semibold);
    color: var(--color-white);
}

.post-hero__cover {
    margin: var(--space-6) 0 0;
    aspect-ratio: 1200 / 630;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background-color: var(--color-text);
    /* A faint edge, so the ink covers don't melt into the ink hero */
    box-shadow: 0 0 0 1px var(--color-on-dark-line);
}

.post-hero__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================================
   Post body: sticky contents + article + author box
   ===================================================== */

.post-body__inner {
    display: grid;
    grid-template-columns: 260px minmax( 0, 1fr );
    gap: var(--space-16);
    align-items: start;
}

.post-body__inner--solo {
    grid-template-columns: minmax( 0, var(--measure-prose) );
    justify-content: center;
}

.post-body__main {
    min-width: 0;
    max-width: var(--measure-prose);
}

/* ---- Contents ---- */

.post-toc {
    position: sticky;
    top: calc( 80px + var(--space-8) );
}

.post-toc__label {
    display: block;
    /* The padding is its tap area (it toggles the list); the negative top
       margin keeps the text exactly where it sits without it. */
    margin: calc( -1 * var(--space-2) ) 0 var(--space-2);
    padding-block: var(--space-2);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    list-style: none;
    cursor: default;
}

.post-toc__label::-webkit-details-marker { display: none; }

.post-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: post-toc;
    border-top: 1px solid var(--color-border);
}

.post-toc__list li {
    counter-increment: post-toc;
    border-bottom: 1px solid var(--color-border);
}

.post-toc__list a {
    display: grid;
    grid-template-columns: var(--space-8) minmax( 0, 1fr );
    padding: var(--space-3) 0;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    line-height: var(--leading-snug);
    color: var(--color-muted);
    text-decoration: none;
    transition: color var(--ease-base);
}

.post-toc__list a::before {
    content: counter( post-toc, decimal-leading-zero );
    font-weight: var(--fw-semibold);
    color: var(--color-primary);
}

.post-toc__list a:hover { color: var(--color-text); }

/* ---- Author box ---- */

.post-author {
    display: grid;
    grid-template-columns: 72px minmax( 0, 1fr );
    gap: var(--space-6);
    margin-top: var(--space-16);
    padding: var(--space-8);
    background-color: var(--color-bg);
    border-radius: var(--radius-xl);
}

/* The team avatar is the site icon: the lime X, which has no background of
   its own, so it sits on an ink tile here. */
.post-author__img {
    display: block;
    box-sizing: border-box;
    width: 72px;
    height: 72px;
    padding: var(--space-3);
    background-color: var(--color-text);
    border-radius: var(--radius-lg);
}

.post-author__body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.post-author__label {
    margin: 0;
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

.post-author__name {
    margin: 0;
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    font-size: var(--text-h4);
    color: var(--color-text);
}

.post-author__bio {
    font-family: var(--font-body);
    font-size: var(--text-body);
    line-height: var(--leading-body);
    color: var(--color-muted);
}

.post-author__bio p { margin: 0; }

.post-author__link {
    align-self: flex-start;
    margin-top: var(--space-2);
}

/* =====================================================
   Article prose
   Targets the classic editor's output. Two classes may be used inside
   a post: .answer (the short "quick answer" box under the intro) and
   .note (disclaimers, "last checked" notes). Wide tables go inside a
   .table-wrap div so they scroll sideways on phones.
   ===================================================== */

.post-prose {
    font-family: var(--font-body);
    font-size: var(--text-body-lg);
    line-height: 1.75;
    color: var(--color-text);
}

.post-prose > :first-child { margin-top: 0; }

.post-prose h2,
.post-prose h3,
.post-prose h4 {
    font-family: var(--font-heading);
    font-weight: var(--fw-extrabold);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-snug);
    color: var(--color-text);
    scroll-margin-top: calc( 80px + var(--space-8) );
}

.post-prose h2 {
    font-size: var(--text-prose-h2);
    margin: var(--space-16) 0 var(--space-5);
}

.post-prose h3 {
    font-size: var(--text-h4);
    font-weight: var(--fw-bold);
    margin: var(--space-10) 0 var(--space-3);
}

.post-prose h4 {
    font-size: var(--text-body-lg);
    font-weight: var(--fw-bold);
    margin: var(--space-8) 0 var(--space-2);
}

.post-prose p {
    margin: 0 0 var(--space-6);
}

.post-prose ul,
.post-prose ol {
    list-style: none;
    margin: 0 0 var(--space-6);
    padding: 0;
}

.post-prose li {
    position: relative;
    padding-left: var(--space-7);
    margin-bottom: var(--space-3);
}

.post-prose ul > li::before {
    content: '';
    position: absolute;
    left: var(--space-2);
    top: 0.72em;
    width: 6px;
    height: 6px;
    background-color: var(--color-primary);
    border-radius: var(--radius-full);
}

.post-prose ol {
    counter-reset: post-prose;
}

.post-prose ol > li {
    counter-increment: post-prose;
    padding-left: var(--space-8);
}

.post-prose ol > li::before {
    content: counter( post-prose ) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-weight: var(--fw-semibold);
    color: var(--color-primary);
}

.post-prose li > ul,
.post-prose li > ol {
    margin: var(--space-3) 0 0;
}

/* Links: the shared .rs-prose style (global.css). */

.post-prose strong {
    font-weight: var(--fw-bold);
}

.post-prose em {
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: var(--fw-medium);
    font-size: 1.06em;
}

.post-prose blockquote {
    margin: var(--space-10) 0;
    padding: var(--space-1) 0 var(--space-1) var(--space-6);
    border-left: 3px solid var(--color-lime);
    font-family: var(--font-accent);
    font-style: italic;
    font-weight: var(--fw-medium);
    font-size: var(--text-h4);
    line-height: var(--leading-snug);
}

.post-prose blockquote p { margin: 0 0 var(--space-3); }
.post-prose blockquote p:last-child { margin-bottom: 0; }

.post-prose hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin: var(--space-12) 0;
}

.post-prose img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
}

.post-prose figure {
    margin: var(--space-10) 0;
}

.post-prose figcaption {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-muted);
}

/* ---- Tables ---- */

.post-prose .table-wrap {
    margin: var(--space-8) 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.post-prose table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-body);
    line-height: var(--leading-snug);
}

.post-prose th,
.post-prose td {
    text-align: left;
    vertical-align: top;
    padding: var(--space-3) var(--space-4) var(--space-3) 0;
    border-bottom: 1px solid var(--color-border);
}

.post-prose th {
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    border-bottom: 2px solid var(--color-text);
}

.post-prose td:first-child {
    font-weight: var(--fw-semibold);
}

/* ---- Quick answer box ---- */

.post-prose .answer {
    margin: 0 0 var(--space-10);
    padding: var(--space-8);
    background-color: var(--color-bg);
    border-left: 4px solid var(--color-lime);
    border-radius: var(--radius-lg);
}

.post-prose .answer > :last-child { margin-bottom: 0; }

.post-prose .answer__label {
    margin: 0 0 var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
}

/* ---- Notes and disclaimers ---- */

.post-prose .note {
    margin: var(--space-10) 0;
    padding: var(--space-5) var(--space-6);
    font-size: var(--text-sm);
    line-height: var(--leading-body);
    color: var(--color-muted);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}

.post-prose .note > :last-child { margin-bottom: 0; }

/* =====================================================
   Related posts
   ===================================================== */

.post-related__heading {
    margin: 0 0 var(--space-10);
    font-family: var(--font-heading);
    font-weight: var(--fw-extrabold);
    font-size: var(--text-h2);
    line-height: var(--leading-heading);
    letter-spacing: var(--tracking-snug);
    color: var(--color-text);
}

/* =====================================================
   Responsive
   ===================================================== */

@media ( max-width: 1024px ) {
    .blog-lead__link {
        grid-template-columns: 1fr;
        gap: var(--space-8);
    }

    .post-body__inner {
        grid-template-columns: minmax( 0, 1fr );
        gap: var(--space-10);
    }

    .post-body__main { max-width: none; }

    /* The box's vertical padding sits on the label instead, so the whole
       "On this page" row is the tap target. Same size, open or closed. */
    .post-toc {
        position: static;
        padding: var(--space-1) var(--space-6);
        background-color: var(--color-bg);
        border-radius: var(--radius-lg);
    }

    .post-toc__label {
        margin: 0;
        padding-block: var(--space-4);
        cursor: pointer;
    }

    .post-toc__box[open] { padding-bottom: var(--space-4); }
}

@media ( max-width: 768px ) {
    .blog-topics { padding-top: var(--space-12); }

    .post-prose { font-size: var(--text-body); }
    .post-prose h2 { margin-top: var(--space-12); }
    .post-prose .answer { padding: var(--space-6); }
}

@media ( max-width: 640px ) {
    .post-hero { margin-top: -64px; }

    /* "Last reviewed" gets its own line (its dot is clipped like any other). */
    .post-hero__reviewed { flex-basis: 100%; }

    /* Tables stack on phones: each row becomes a small card, the first
       cell its title, and the other cells show their column heading
       (data-label, added by rs_post_table_labels()). */
    .post-prose table,
    .post-prose tbody,
    .post-prose tr,
    .post-prose td {
        display: block;
        width: 100%;
    }

    .post-prose thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect( 0, 0, 0, 0 );
    }

    .post-prose tbody { border-top: 2px solid var(--color-text); }

    .post-prose tr {
        padding: var(--space-4) 0;
        border-bottom: 1px solid var(--color-border);
    }

    .post-prose td {
        padding: 0 0 var(--space-2);
        border: 0;
    }

    .post-prose td:last-child { padding-bottom: 0; }

    .post-prose td:first-child {
        font-family: var(--font-heading);
        font-weight: var(--fw-bold);
        font-size: var(--text-body);
    }

    .post-prose td[data-label]:not( :first-child )::before {
        content: attr( data-label );
        display: block;
        font-size: var(--text-xs);
        font-weight: var(--fw-semibold);
        color: var(--color-muted);
        text-transform: uppercase;
        letter-spacing: var(--tracking-wide);
    }

    .post-hero__inner {
        padding-top: calc( 64px + var(--section-py) );
        gap: var(--space-5);
    }

    .post-hero__cover { border-radius: var(--radius-xl); margin-top: var(--space-4); }

    .post-author {
        grid-template-columns: 1fr;
        padding: var(--space-6);
        gap: var(--space-4);
    }

    .post-author__img { width: 56px; height: 56px; }

    .blog-pagination { margin-top: var(--space-8); }
}
