/* ==========================================================================
   SIPL blog — layout and typography.

   Per-client, like layout.php: each client's blog matches that client's site,
   so this is not shared back to the toolkit. It sits alongside
   blog-content.css, which styles the WordPress block markup INSIDE an article
   (.wp-block-*) and nothing else.

   blog-content.css reads --sipl-font-body and --sipl-font-heading. Nothing
   defined them, so every article was falling back to system-ui while the rest
   of the site ran Montserrat and Open Sans. They are defined here.

   Designed text-first on purpose: no post in this blog has a featured image,
   so an image-led card grid would render 130 empty boxes. An editorial list —
   eyebrow, title, excerpt, hairline — reads better and degrades gracefully if
   images appear later (the template already supports them).
   ========================================================================== */

:root {
    /* consumed by blog-content.css as well as this file */
    --sipl-font-heading: "Montserrat", system-ui, sans-serif;
    --sipl-font-body: "Open Sans", system-ui, sans-serif;

    --sipl-ink: #1d2126;
    --sipl-body: #3f4753;
    --sipl-muted: #6b7480;
    --sipl-accent: #f5502b;
    --sipl-link: #1f7cb4;
    --sipl-rule: #e3e7ec;
    --sipl-rule-soft: #eef1f4;
    --sipl-surface: #f8f9fa;

    --sipl-measure: 68ch;
    --sipl-radius: 6px;
}

/* --------------------------------------------------------------------------
   Shell: content plus a sidebar that stays put while you scroll.
   One column until there is genuinely room for two.
   -------------------------------------------------------------------------- */

.sipl-blog-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
}

@media (min-width: 992px) {
    .sipl-blog-shell {
        grid-template-columns: minmax(0, 1fr) 300px;
        gap: 64px;
        align-items: start;
    }

    .sipl-blog-sidebar {
        position: sticky;
        top: 24px;
    }
}

.sipl-blog-main {
    min-width: 0;
}

/* --------------------------------------------------------------------------
   Archive header
   -------------------------------------------------------------------------- */

.sipl-archive__header {
    padding-bottom: 28px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--sipl-ink);
}

.sipl-archive__kicker {
    font-family: var(--sipl-font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sipl-accent);
    margin: 0 0 8px;
}

.sipl-archive__title {
    font-family: var(--sipl-font-heading);
    font-weight: 700;
    font-size: clamp(32px, 5vw, 44px);
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--sipl-ink);
    margin: 0;
}

.sipl-archive__lede {
    font-family: var(--sipl-font-body);
    font-size: 16px;
    line-height: 1.6;
    color: var(--sipl-muted);
    margin: 10px 0 0;
    max-width: 58ch;
}

.sipl-archive__empty {
    font-family: var(--sipl-font-body);
    color: var(--sipl-muted);
    padding: 48px 0;
}

/* --------------------------------------------------------------------------
   The list of posts.

   Separation is a hairline plus real space rather than a card: with no
   thumbnails, boxes would be a border round a paragraph and read as clutter.
   -------------------------------------------------------------------------- */

.sipl-archive__posts {
    display: flex;
    flex-direction: column;
}

.sipl-post-card {
    display: grid;
    gap: 20px;
    padding: 36px 0;
    border-bottom: 1px solid var(--sipl-rule);
}

.sipl-post-card:last-child {
    border-bottom: 0;
}

@media (min-width: 640px) {
    .sipl-post-card:has(.sipl-post-card__image) {
        /* Widened with the ratio change: a 16:9 image at 240px is only 135px
           tall, which reads as a thumbnail rather than a card image. */
        grid-template-columns: 280px minmax(0, 1fr);
        /* Horizontal gap between image and text. The base rule's 20px gap is
           right when the card stacks on a phone, but too tight beside a
           280px image. */
        column-gap: 36px;
        align-items: start;
    }
}

/* 992-1199px: the sidebar is showing but the screen is still narrow, which
   leaves the card text only ~250px wide beside a 280px image — titles wrapped
   to five or six lines at 1024px. A narrower image and gap hand that width
   back to the text. Outside this band the 280px / 36px values above apply. */
@media (min-width: 992px) and (max-width: 1199px) {
    .sipl-post-card:has(.sipl-post-card__image) {
        grid-template-columns: 210px minmax(0, 1fr);
        column-gap: 28px;
    }
}

.sipl-post-card__image {
    margin: 0;
    overflow: hidden;
    border-radius: var(--sipl-radius);
    background: var(--sipl-surface);
}

.sipl-post-card__image img {
    display: block;
    width: 100%;
    height: auto;
    /* 16:9, because that is what the artwork actually is. Of the 100 posts
       carrying a featured image, 80 are 16:9, 9 are wider still and 8 are
       squarish. The 4/3 frame this replaced scaled a 16:9 image to cover the
       taller box, which pushed it to 320px inside a 240px column and cut 25%
       off — 12.5% from each side. These are title cards with centred text and
       a logo, so it was the artwork edges that disappeared. */
    aspect-ratio: 16 / 9;
    object-fit: cover;
    transition: transform .4s ease;
}

.sipl-post-card__image a:hover img {
    transform: scale(1.04);
}

.sipl-post-card__content {
    min-width: 0;
}

.sipl-post-card__eyebrow {
    display: inline-block;
    font-family: var(--sipl-font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sipl-accent);
    text-decoration: none;
    margin-bottom: 10px;
}

.sipl-post-card__eyebrow:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.sipl-post-card__title {
    font-family: var(--sipl-font-heading);
    font-size: clamp(21px, 2.4vw, 26px);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin: 0 0 10px;
    text-wrap: balance;
}

.sipl-post-card__title a {
    color: var(--sipl-ink);
    text-decoration: none;
    background-image: linear-gradient(var(--sipl-accent), var(--sipl-accent));
    background-size: 0 2px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size .3s ease, color .2s ease;
}

.sipl-post-card__title a:hover {
    color: var(--sipl-accent);
    background-size: 100% 2px;
}

.sipl-post-card__meta {
    font-family: var(--sipl-font-body);
    font-size: 13px;
    color: var(--sipl-muted);
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: center;
}

.sipl-post-card__meta > * + *::before {
    content: "·";
    margin-right: 14px;
    color: var(--sipl-rule);
}

.sipl-post-card__excerpt {
    font-family: var(--sipl-font-body);
    font-size: 15.5px;
    line-height: 1.7;
    color: var(--sipl-body);
    margin: 0 0 16px;
    max-width: 62ch;
}

.sipl-post-card__link {
    font-family: var(--sipl-font-heading);
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--sipl-accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.sipl-post-card__link::after {
    content: "→";
    transition: transform .2s ease;
}

.sipl-post-card__link:hover {
    color: var(--sipl-ink);
}

.sipl-post-card__link:hover::after {
    transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Sidebar widgets
   -------------------------------------------------------------------------- */

.sipl-widget {
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--sipl-rule);
}

.sipl-widget:last-child {
    border-bottom: 0;
    margin-bottom: 0;
}

.sipl-widget__title {
    font-family: var(--sipl-font-heading);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sipl-ink);
    margin: 0 0 16px;
}

.sipl-widget__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sipl-widget__list a {
    font-family: var(--sipl-font-body);
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--sipl-body);
    text-decoration: none;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--sipl-rule-soft);
}

.sipl-widget__list li:last-child a {
    border-bottom: 0;
}

.sipl-widget__list a:hover {
    color: var(--sipl-accent);
}

.sipl-widget__count {
    font-family: var(--sipl-font-heading);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--sipl-muted);
    background: var(--sipl-surface);
    border-radius: 999px;
    padding: 2px 9px;
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}

/* Recent posts read as titles, not as a menu, so they wrap and have no count */
.sipl-widget__recent a {
    display: block;
    border-bottom: 0;
    padding: 0;
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--sipl-ink);
}

.sipl-widget__recent li {
    padding: 11px 0;
    border-bottom: 1px solid var(--sipl-rule-soft);
}

.sipl-widget__recent li:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.sipl-widget__recent .sipl-widget__date {
    display: block;
    font-family: var(--sipl-font-body);
    font-size: 12px;
    color: var(--sipl-muted);
    margin-top: 4px;
}

.sipl-widget__cta {
    background: var(--sipl-surface);
    border-radius: var(--sipl-radius);
    padding: 20px;
    border-bottom: 0;
}

.sipl-widget__cta p {
    font-family: var(--sipl-font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--sipl-body);
    margin: 0 0 14px;
}

.sipl-widget__cta .sipl-btn {
    display: inline-block;
    font-family: var(--sipl-font-heading);
    font-size: 13.5px;
    font-weight: 600;
    background: var(--sipl-accent);
    color: #fff;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 4px;
}

.sipl-widget__cta .sipl-btn:hover {
    filter: brightness(1.08);
}

/* --------------------------------------------------------------------------
   Pagination
   -------------------------------------------------------------------------- */

.sipl-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 40px;
    padding-top: 28px;
    border-top: 2px solid var(--sipl-ink);
}

.sipl-pagination a {
    font-family: var(--sipl-font-heading);
    font-size: 14px;
    font-weight: 600;
    color: var(--sipl-ink);
    text-decoration: none;
    padding: 9px 18px;
    border: 1px solid var(--sipl-rule);
    border-radius: 4px;
    transition: border-color .2s ease, color .2s ease;
}

.sipl-pagination a:hover {
    border-color: var(--sipl-accent);
    color: var(--sipl-accent);
}

.sipl-pagination__info {
    font-family: var(--sipl-font-body);
    font-size: 13.5px;
    color: var(--sipl-muted);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Single post — a centred reading column, no sidebar.

   Article left, sticky rail right. The earlier centred column was chosen so
   the measure stayed comfortable; left-aligning does not give that up, because
   the article keeps --sipl-measure and the rail is what holds the column to it
   rather than letting the text run the full width of a desktop screen.

   Below 992px the shell collapses to one column and the rail stacks underneath,
   which is why the jump list is repeated as a <details> inside the article —
   see partials/post-rail.php.
   -------------------------------------------------------------------------- */

.sipl-post {
    max-width: var(--sipl-measure);
    margin: 0;
}

/* The post shell's rail is narrower than the archive's, leaving more room for
   the article itself. */
@media (min-width: 992px) {
    .sipl-blog-shell--post {
        grid-template-columns: minmax(0, 1fr) 280px;
    }

    /* The longest post here has 16 H2s. A sticky rail taller than the viewport
       would put the call to action permanently off-screen with no way to reach
       it, so the rail scrolls within itself instead. */
    .sipl-post-rail {
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
}

/* --------------------------------------------------------------------------
   On this page
   -------------------------------------------------------------------------- */

.sipl-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sipl-toc__list li + li {
    margin-top: 2px;
}

.sipl-toc__list a {
    display: block;
    padding: 6px 0 6px 12px;
    border-left: 2px solid var(--sipl-rule);
    font-size: 14px;
    line-height: 1.45;
    color: var(--sipl-body);
    text-decoration: none;
    transition: border-color .2s ease, color .2s ease;
}

.sipl-toc__list a:hover,
.sipl-toc__list a:focus-visible {
    border-left-color: var(--sipl-accent);
    color: var(--sipl-accent);
}

/* Rail copy on desktop, collapsible copy on narrow screens. Exactly one is in
   the document at any width, so neither is announced twice. */
.sipl-toc--inline { display: block; }
.sipl-toc--rail   { display: none; }

@media (min-width: 992px) {
    .sipl-toc--inline { display: none; }
    .sipl-toc--rail   { display: block; }
}

.sipl-toc--inline {
    margin: 0 0 32px;
    padding: 16px 20px;
    border: 1px solid var(--sipl-rule);
    border-radius: var(--sipl-radius);
    background: var(--sipl-surface);
}

.sipl-toc--inline > summary {
    font-family: var(--sipl-font-heading);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sipl-ink);
    cursor: pointer;
}

.sipl-toc--inline[open] > summary {
    margin-bottom: 10px;
}

/* An anchor jump must not land the heading under a sticky site header. */
.sipl-post__content h2 {
    scroll-margin-top: 90px;
}

/* --------------------------------------------------------------------------
   Rail call to action
   -------------------------------------------------------------------------- */

.sipl-widget--cta {
    padding: 20px;
    border: 1px solid var(--sipl-rule);
    border-radius: var(--sipl-radius);
    background: var(--sipl-surface);
}

.sipl-cta__text {
    margin: 0 0 16px;
    font-size: 14px;
    line-height: 1.55;
    color: var(--sipl-body);
}

.sipl-cta__button {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--sipl-radius);
    background: var(--sipl-accent);
    color: #fff;
    font-family: var(--sipl-font-heading);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .2s ease;
}

.sipl-cta__button:hover,
.sipl-cta__button:focus-visible {
    opacity: .88;
    color: #fff;
}

.sipl-post__header {
    padding-bottom: 28px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--sipl-rule);
}

.sipl-post__eyebrow {
    display: inline-block;
    font-family: var(--sipl-font-heading);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--sipl-accent);
    text-decoration: none;
    margin-bottom: 14px;
}

.sipl-post__title {
    font-family: var(--sipl-font-heading);
    font-size: clamp(28px, 4.4vw, 42px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--sipl-ink);
    margin: 0 0 16px;
    text-wrap: balance;
}

.sipl-post__excerpt {
    font-family: var(--sipl-font-body);
    font-size: 18px;
    line-height: 1.65;
    color: var(--sipl-muted);
    margin: 0 0 20px;
}

.sipl-post__meta {
    font-family: var(--sipl-font-body);
    font-size: 13.5px;
    color: var(--sipl-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    align-items: center;
}

.sipl-post__meta > * + *::before {
    content: "·";
    margin-right: 14px;
    color: var(--sipl-rule);
}

.sipl-post__featured-image {
    margin: 0 0 36px;
    border-radius: var(--sipl-radius);
    overflow: hidden;
}

.sipl-post__featured-image img {
    display: block;
    width: 100%;
    height: auto;
}

/* Article body ---------------------------------------------------------- */

.sipl-post__content {
    font-family: var(--sipl-font-body);
    font-size: 17px;
    line-height: 1.8;
    color: var(--sipl-body);
}

.sipl-post__content > * + * {
    margin-top: 1.5em;
}

/*
   The site sets h1 at 48px and h2 at 40px, which is right for a landing page
   and far too loud inside an article. Scoped down here so the heading
   hierarchy within a post is legible rather than shouting.
*/
.sipl-post__content h2 {
    font-family: var(--sipl-font-heading);
    font-size: 27px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--sipl-ink);
    margin-top: 2.2em;
    margin-bottom: 0.6em;
    letter-spacing: -0.01em;
}

.sipl-post__content h3 {
    font-family: var(--sipl-font-heading);
    font-size: 21px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--sipl-ink);
    margin-top: 1.9em;
    margin-bottom: 0.5em;
}

.sipl-post__content h4 {
    font-family: var(--sipl-font-heading);
    font-size: 18px;
    font-weight: 600;
    color: var(--sipl-ink);
    margin-top: 1.7em;
    margin-bottom: 0.4em;
}

.sipl-post__content p {
    margin: 0;
}

.sipl-post__content a {
    color: var(--sipl-link);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
}

.sipl-post__content a:hover {
    color: var(--sipl-accent);
}

.sipl-post__content ul,
.sipl-post__content ol {
    padding-left: 1.4em;
    margin: 0;
}

.sipl-post__content li + li {
    margin-top: 0.5em;
}

.sipl-post__content li::marker {
    color: var(--sipl-accent);
}

.sipl-post__content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--sipl-radius);
}

.sipl-post__content blockquote {
    margin: 2em 0;
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--sipl-accent);
    font-size: 18px;
    line-height: 1.6;
    color: var(--sipl-ink);
}

.sipl-post__content blockquote p:last-child {
    margin-bottom: 0;
}

.sipl-post__content strong {
    color: var(--sipl-ink);
    font-weight: 600;
}

.sipl-post__content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.sipl-post__content th,
.sipl-post__content td {
    border: 1px solid var(--sipl-rule);
    padding: 10px 12px;
    text-align: left;
}

.sipl-post__content th {
    background: var(--sipl-surface);
    font-family: var(--sipl-font-heading);
    font-weight: 600;
    color: var(--sipl-ink);
}

/* Tags ------------------------------------------------------------------- */

.sipl-post__footer {
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--sipl-rule);
}

.sipl-post__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sipl-tag {
    font-family: var(--sipl-font-body);
    font-size: 13px;
    color: var(--sipl-body);
    text-decoration: none;
    background: var(--sipl-surface);
    border: 1px solid var(--sipl-rule);
    border-radius: 999px;
    padding: 5px 14px;
}

.sipl-tag:hover {
    border-color: var(--sipl-accent);
    color: var(--sipl-accent);
}

/* --------------------------------------------------------------------------
   Focus and motion
   -------------------------------------------------------------------------- */

.sipl-blog-shell a:focus-visible,
.sipl-post a:focus-visible {
    outline: 2px solid var(--sipl-accent);
    outline-offset: 3px;
    border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .sipl-post-card__image img,
    .sipl-post-card__title a,
    .sipl-post-card__link::after {
        transition: none;
    }
}
