/**
 * Blog surfaces: single posts, articles variant, and blog archive (.wrusa-blog-archive).
 * Templates: partials/blog/single-post.php, partials/blog/archive.php.
 */

.blog-single {
    --primary-color: #1b335f;
    --tertiary-color: #1A8943;
    --color-surface: #fff;
    --color-surface-subtle: #f8f9fa;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-border: #e9ecef;
    --font-heading: "General Sans", sans-serif;
    --font-body: "Montserrat", sans-serif;
    --blog-post-link: #0b57d0;
    --blog-post-link-hover: #084298;
    --blog-post-link-visited: #6b4ea2;
    --blog-gutter: 12px;
    --blog-band-max: none;
    --blog-measure: min(42rem, 100%);
    --blog-related-max: min(68rem, 100%);
    --blog-anchor-offset: clamp(5.25rem, 14vh, 9rem);
    --blog-ease-out: cubic-bezier(0.25, 1, 0.5, 1);
    --blog-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --blog-dur-fast: 0.2s;
    --blog-dur-med: 0.35s;
    --blog-touch-min: 44px;

    box-sizing: border-box;
    position: relative;
    width: 100%;
    max-width: var(--blog-band-max);
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--blog-gutter);
    padding-right: var(--blog-gutter);
    color: var(--color-text);
    font-family: var(--font-body);
    background: var(--color-surface);
}

@media (min-width: 768px) {
    .blog-single {
        --blog-measure: min(50rem, 100%);
        --blog-related-max: min(72rem, 100%);
    }
}

@media (min-width: 992px) {
    .blog-single {
        --blog-gutter: 16px;
    }
}

@media (min-width: 1024px) {
    .blog-single {
        --blog-measure: min(64rem, 100%);
        --blog-related-max: min(78rem, 100%);
    }
}

@media (min-width: 1200px) {
    .blog-single {
        --blog-gutter: 16px;
    }
}

@media (min-width: 1280px) {
    .blog-single {
        --blog-measure: min(72rem, 100%);
        --blog-related-max: min(84rem, 100%);
    }
}

@media (min-width: 1400px) {
    .blog-single {
        --blog-gutter: 16px;
        --blog-measure: min(78rem, 100%);
        --blog-related-max: min(90rem, 100%);
    }
}

@media (min-width: 1680px) {
    .blog-single {
        --blog-band-max: 90rem;
        --blog-gutter: 14px;
        --blog-measure: min(84rem, 100%);
        --blog-related-max: min(92rem, 100%);
    }
}

@media (min-width: 2000px) {
    .blog-single {
        --blog-band-max: 96rem;
        --blog-gutter: 12px;
        --blog-measure: min(88rem, 100%);
        --blog-related-max: min(96rem, 100%);
    }
}

#navigation + .blog-single {
    margin-top: -0.5rem;
}

@media (min-width: 992px) {
    #navigation + .blog-single {
        margin-top: -0.35rem;
    }
}

.blog-single__progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 4px;
    width: 0;
    max-width: 100%;
    background: var(--primary-color);
    /* Above sticky nav; sit above WP admin bar (99999) when aligned to viewport top */
    z-index: 100100;
    transition: width 0.15s linear;
    pointer-events: none;
}

/* Logged-in: bar sits just under the admin bar so it is not painted underneath it */
body.admin-bar .blog-single__progress {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .blog-single__progress {
        top: 46px;
    }
}

.blog-single__hero {
    position: relative;
    left: 50%;
    right: 50%;
    width: 100vw;
    max-width: 100vw;
    margin-left: -50vw;
    margin-right: -50vw;
    min-height: clamp(14rem, 32vh, 22rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    background-size: cover;
    background-position: center;
    background-color: var(--primary-color);
    overflow: hidden;
}

@media (min-width: 768px) {
    .blog-single__hero {
        min-height: clamp(16rem, 42vh, 32rem);
    }
}

/* Inline: --wrusa-blog-hero-image: url(...) when a hero image exists (archive + single). */
.blog-single__hero--has-bg {
    background-image: var(--wrusa-blog-hero-image);
}

.blog-single__hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.5) 0%,
        rgba(0, 0, 0, 0.62) 50%,
        rgba(0, 0, 0, 0.55) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.blog-single__hero-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 56rem;
    margin-left: auto;
    margin-right: auto;
    padding: clamp(1.25rem, 3vh, 2rem) var(--blog-gutter);
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .blog-single__hero-content {
        padding: clamp(1.5rem, 4vh, 2.5rem) var(--blog-gutter);
    }
}

.blog-single__category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    margin-bottom: 0.75rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    background: var(--primary-color);
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    /* Match archive / card category pills (.blog-single__related-cat) */
    border-radius: 999px;
    transition:
        opacity var(--blog-dur-fast) var(--blog-ease-out),
        filter var(--blog-dur-fast) var(--blog-ease-out);
}

.blog-single__category-badge:hover {
    color: #fff;
    opacity: 0.92;
    filter: brightness(1.08);
}

.blog-single__category-badge:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    opacity: 1;
    filter: brightness(1.08);
}

.blog-single__hero-title {
    margin: 0 0 0.75rem;
    color: #fff;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
}

/* Optional deck (e.g. ACF intro_headline on articles variant). */
.blog-single__hero-dek {
    margin: 0 0 1rem;
    max-width: 52ch;
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-body);
    font-size: clamp(1rem, 2.2vw, 1.2rem);
    font-weight: 400;
    line-height: 1.45;
}

.blog-single__hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: var(--font-body);
    font-size: 0.875rem;
}

.blog-single__hero-meta a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
}

.blog-single__hero-meta a:hover {
    text-decoration: underline;
}

.blog-single__hero-meta-sep {
    opacity: 0.5;
}

.blog-single__hero-author {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    position: relative;
}

.blog-single__hero-author img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.4);
}

.blog-single__hero-author-name {
    color: rgba(255, 255, 255, 0.9);
    cursor: default;
    border-bottom: 1px dotted rgba(255, 255, 255, 0.4);
}

.blog-single__hero-author:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.95);
    outline-offset: 4px;
    border-radius: 6px;
}

.blog-single__author-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translate3d(-50%, 6px, 0);
    width: max(220px, min(320px, 80vw));
    padding: 1rem 1.15rem;
    background: var(--color-surface);
    color: var(--color-text);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    font-size: 0.8125rem;
    line-height: 1.55;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.22s var(--blog-ease-out),
        visibility 0.22s,
        transform 0.22s var(--blog-ease-out);
    z-index: 10;
}

.blog-single__author-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--color-surface);
}

.blog-single__hero-author:hover .blog-single__author-tooltip,
.blog-single__hero-author:focus-within .blog-single__author-tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate3d(-50%, 0, 0);
}

.blog-single__author-tooltip-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.blog-single__author-tooltip-header img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(27, 51, 95, 0.1);
    flex-shrink: 0;
}

.blog-single__author-tooltip-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color);
    margin: 0;
}

.blog-single__author-tooltip-bio {
    margin: 0;
    color: var(--color-text-muted);
    font-family: var(--font-body);
}

@media (max-width: 480px) {
    .blog-single__author-tooltip {
        left: 0;
        transform: translate3d(-20%, 6px, 0);
    }
    .blog-single__hero-author:hover .blog-single__author-tooltip,
    .blog-single__hero-author:focus-within .blog-single__author-tooltip {
        transform: translate3d(-20%, 0, 0);
    }
    .blog-single__author-tooltip::after {
        left: 30%;
    }
}

.blog-single__hero-social {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.blog-single__social-link {
    position: relative;
    z-index: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--blog-touch-min);
    height: var(--blog-touch-min);
    border-radius: 8px;
    text-decoration: none;
    transition:
        transform var(--blog-dur-fast) var(--blog-ease-out),
        opacity var(--blog-dur-fast) var(--blog-ease-out);
}

.blog-single__social-link::before {
    content: '';
    position: absolute;
    z-index: 0;
    inset: 4px;
    border-radius: 8px;
    background: var(--blog-social-bg);
    transition:
        box-shadow var(--blog-dur-fast) var(--blog-ease-out),
        opacity var(--blog-dur-fast) var(--blog-ease-out);
}

.blog-single__social-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.blog-single__social-link:hover {
    transform: translate3d(0, -2px, 0);
    opacity: 0.92;
}

.blog-single__social-link:hover::before {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.blog-single__social-link:active {
    transform: translate3d(0, 0, 0) scale(0.96);
}

.blog-single__social-link svg {
    position: relative;
    z-index: 1;
    width: 18px;
    height: 18px;
    fill: #fff;
    flex-shrink: 0;
}

@media (prefers-reduced-motion: no-preference) {
    @keyframes blog-single-hero-rise {
        from {
            opacity: 0;
            transform: translate3d(0, 14px, 0);
        }
        to {
            opacity: 1;
            transform: translate3d(0, 0, 0);
        }
    }

    .blog-single__hero-content > .blog-single__category-badge {
        animation: blog-single-hero-rise 0.58s var(--blog-ease-out-expo) both;
        animation-delay: 0.06s;
    }

    .blog-single__hero-content > .blog-single__hero-title {
        animation: blog-single-hero-rise 0.58s var(--blog-ease-out-expo) both;
        animation-delay: 0.12s;
    }

    .blog-single__hero-content > .blog-single__hero-meta {
        animation: blog-single-hero-rise 0.58s var(--blog-ease-out-expo) both;
        animation-delay: 0.2s;
    }

    .blog-single__hero-content > .blog-single__hero-social {
        animation: blog-single-hero-rise 0.58s var(--blog-ease-out-expo) both;
        animation-delay: 0.28s;
    }
}

.blog-single__toc {
    max-width: var(--blog-measure);
    margin: 1.5rem auto 0;
    padding: 0;
}

.blog-single__toc-box {
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    overflow: hidden;
}

.blog-single__toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    background: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
    text-align: left;
    transition:
        background-color var(--blog-dur-fast) var(--blog-ease-out),
        transform 0.12s var(--blog-ease-out);
}

.blog-single__toc-toggle:hover {
    background: rgba(27, 51, 95, 0.05);
}

.blog-single__toc-toggle:active {
    transform: scale(0.992);
}

.blog-single__toc-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.blog-single__toc-toggle-icon {
    width: 20px;
    height: 20px;
    transition: transform var(--blog-dur-med) var(--blog-ease-out);
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.blog-single__toc-toggle[aria-expanded="true"] .blog-single__toc-toggle-icon {
    transform: rotate(180deg);
}

.blog-single__toc-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.42s var(--blog-ease-out);
}

/* Open state: .blog-single__toc-box--open set by JS (more reliable than button + sibling). */
.blog-single__toc-box--open .blog-single__toc-body {
    max-height: 2400px;
}

.blog-single__toc-list {
    list-style: none;
    margin: 0;
    padding: 0 1.25rem 1rem;
}

.blog-single__toc-item {
    border-left: 2px solid var(--color-border);
    transition: border-color var(--blog-dur-fast) var(--blog-ease-out);
}

.blog-single__toc-item--active {
    border-left-color: var(--primary-color);
}

.blog-single__toc-item--active .blog-single__toc-link {
    font-weight: 600;
    color: var(--primary-color);
}

.blog-single__toc-link {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition:
        color var(--blog-dur-fast) var(--blog-ease-out),
        transform var(--blog-dur-fast) var(--blog-ease-out);
    line-height: 1.4;
}

.blog-single__toc-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}

.blog-single__toc-link:hover {
    color: var(--primary-color);
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__toc-link:hover {
        transform: translate3d(2px, 0, 0);
    }
}

.blog-single__content {
    max-width: var(--blog-measure);
    margin: 2.25rem auto;
    padding: 0;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1.0625rem, 1.45vw, 1.125rem);
    line-height: 1.8;
    color: var(--color-text);
}

.blog-single__content h2 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 1.75rem);
    line-height: 1.25;
    margin: 2.5rem 0 1rem;
    color: var(--primary-color);
    position: relative;
    padding-bottom: 0.75rem;
    scroll-margin-top: var(--blog-anchor-offset);
}

/* Brand red accent (theme --secondary-color); keep link hovers navy elsewhere */
.blog-single__content h2::after {
    content: "";
    display: block;
    width: 40px;
    height: 2px;
    background: var(--secondary-color, #a81d3e);
    margin-top: 0.5rem;
    border-radius: 1px;
}

.blog-single__content h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: clamp(1.15rem, 2.5vw, 1.35rem);
    line-height: 1.3;
    margin: 2rem 0 0.75rem;
    color: var(--color-text);
    scroll-margin-top: var(--blog-anchor-offset);
}

.blog-single__content h4,
.blog-single__content h5,
.blog-single__content h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    margin: 2em 0 0.75em;
    color: var(--color-text);
}

.blog-single__content h4 { font-size: clamp(1.05rem, 2vw, 1.2rem); }

body.admin-bar .blog-single__content :is(h2, h3)[id] {
    scroll-margin-top: calc(var(--blog-anchor-offset) + var(--wp-admin--admin-bar--height, 32px));
}

@media screen and (max-width: 782px) {
    body.admin-bar .blog-single__content :is(h2, h3)[id] {
        scroll-margin-top: calc(var(--blog-anchor-offset) + var(--wp-admin--admin-bar--height, 46px));
    }
}

.blog-single__content p {
    margin: 0 0 1.5em;
}

.blog-single__content a {
    color: var(--blog-post-link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.blog-single__content a:visited {
    color: var(--blog-post-link-visited);
}

.blog-single__content a:hover {
    color: var(--blog-post-link-hover);
    text-decoration-thickness: 1px;
}

.blog-single__content a:focus-visible {
    outline: 2px solid var(--blog-post-link);
    outline-offset: 3px;
    border-radius: 2px;
}

.blog-single__content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5em auto;
    display: block;
}

.blog-single__content figure:not(.wp-block-gallery) {
    margin: 1.5em auto;
    max-width: 100%;
}

.blog-single__content .wp-block-image:not(.alignleft):not(.alignright) {
    text-align: center;
}

.blog-single__content .wp-block-image {
    margin-left: auto;
    margin-right: auto;
}

.blog-single__content figure.aligncenter,
.blog-single__content .wp-block-image.aligncenter,
.blog-single__content .aligncenter {
    display: table;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.blog-single__content .aligncenter img,
.blog-single__content img.aligncenter {
    margin-left: auto;
    margin-right: auto;
}

.blog-single__content figcaption {
    margin-top: 0.5rem;
    font-size: 0.9em;
    color: var(--color-text-muted);
    text-align: center;
}

.blog-single__content .wp-caption {
    margin: 1.5em auto;
    max-width: 100%;
}

.blog-single__content .wp-caption.aligncenter {
    display: table;
    margin-left: auto;
    margin-right: auto;
}

.blog-single__content .wp-caption-text {
    margin-top: 0.5rem;
    font-size: 0.9em;
    color: var(--color-text-muted);
    text-align: center;
}

.blog-single__content .alignleft {
    float: left;
    margin: 0.35em 1.25em 1em 0;
}

.blog-single__content .alignright {
    float: right;
    margin: 0.35em 0 1em 1.25em;
}

.blog-single__content blockquote {
    border-left: 3px solid var(--primary-color);
    padding: 1.25rem 1.25rem 1.25rem 1.5rem;
    margin: 2em 0;
    background: var(--color-surface-subtle);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    font-size: 1.08em;
    color: var(--color-text-muted);
}

.blog-single__content blockquote p:last-child {
    margin-bottom: 0;
}

.blog-single__content ul,
.blog-single__content ol {
    padding-left: 1.75em;
    margin: 0 0 1.5em;
}

.blog-single__content li {
    margin-bottom: 0.5em;
}

.blog-single__content li::marker {
    color: var(--secondary-color, #a81d3e);
}

.blog-single__content pre {
    background: var(--color-surface-subtle);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    font-size: 0.9em;
    margin: 1.5em 0;
}

.blog-single__content code {
    font-size: 0.9em;
    background: var(--color-surface-subtle);
    padding: 0.15em 0.4em;
    border-radius: 4px;
}

.blog-single__content pre code {
    background: none;
    padding: 0;
}

.blog-single__content hr {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 2.5em 0;
}

.blog-single__btt {
    --blog-btt-size: 48px;
    --blog-btt-icon: 22px;
    --blog-btt-fade: 0.38s;
    position: fixed;
    bottom: 24px;
    right: 24px;
    box-sizing: border-box;
    width: var(--blog-btt-size);
    height: var(--blog-btt-size);
    min-width: var(--blog-btt-size);
    min-height: var(--blog-btt-size);
    padding: 0;
    margin: 0;
    border-radius: 9999px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
    aspect-ratio: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--blog-btt-fade) var(--blog-ease-out),
        visibility 0s linear var(--blog-btt-fade),
        background var(--blog-dur-med) var(--blog-ease-out),
        transform var(--blog-dur-med) var(--blog-ease-out),
        box-shadow var(--blog-dur-med) var(--blog-ease-out);
    z-index: 9999;
}

.blog-single__btt--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        opacity var(--blog-btt-fade) var(--blog-ease-out),
        visibility 0s,
        background var(--blog-dur-med) var(--blog-ease-out),
        transform var(--blog-dur-med) var(--blog-ease-out),
        box-shadow var(--blog-dur-med) var(--blog-ease-out);
}

.blog-single__btt:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
    box-shadow:
        0 0 0 2px var(--primary-color),
        0 6px 20px rgba(27, 51, 95, 0.35);
}

.blog-single__btt:hover {
    background: #142848;
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__btt:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 18px rgba(27, 51, 95, 0.32);
    }

    .blog-single__btt:active {
        transform: scale(0.96);
    }
}

.blog-single__btt svg {
    display: block;
    width: var(--blog-btt-icon);
    height: var(--blog-btt-icon);
    flex-shrink: 0;
}

.blog-single__related {
    max-width: var(--blog-related-max);
    margin: 0 auto 3rem;
    padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__related {
        opacity: 0;
        transform: translate3d(0, 20px, 0);
        transition:
            opacity 0.52s var(--blog-ease-out-expo),
            transform 0.52s var(--blog-ease-out-expo);
    }

    .blog-single__related.blog-single__related--inview {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.blog-single__related-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.blog-single__related-heading {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    color: var(--color-text);
    margin: 0;
}

.blog-single__carousel-nav {
    display: flex;
    gap: 0.5rem;
}

.blog-single__carousel-btn {
    width: var(--blog-touch-min);
    height: var(--blog-touch-min);
    border-radius: 50%;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        border-color var(--blog-dur-fast) var(--blog-ease-out),
        color var(--blog-dur-fast) var(--blog-ease-out),
        background var(--blog-dur-fast) var(--blog-ease-out),
        transform 0.14s var(--blog-ease-out),
        box-shadow var(--blog-dur-fast) var(--blog-ease-out);
}

.blog-single__carousel-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.blog-single__carousel-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--color-surface-subtle);
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__carousel-btn:hover:not(:disabled) {
        transform: scale(1.06);
        box-shadow: 0 2px 8px rgba(27, 51, 95, 0.12);
    }

    .blog-single__carousel-btn:active:not(:disabled) {
        transform: scale(0.96);
    }
}

.blog-single__carousel-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.blog-single__carousel-btn svg {
    width: 18px;
    height: 18px;
}

/* Embla loop: margin between slides, not flex gap (gap skips before loop clones). */
.blog-single__carousel-viewport {
    --blog-carousel-gap: 20px;
    --blog-slide-basis: 280px;
    width: 100%;
    overflow: hidden;
    touch-action: pan-x pinch-zoom;
}

.blog-single__carousel-container {
    display: flex;
    touch-action: pan-x pinch-zoom;
}

.blog-single__carousel-slide {
    flex: 0 0 var(--blog-slide-basis);
    min-width: 0;
    margin-right: var(--blog-carousel-gap);
}

.blog-single__related-card {
    background: var(--color-surface);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    transition:
        box-shadow var(--blog-dur-med) var(--blog-ease-out),
        transform var(--blog-dur-med) var(--blog-ease-out),
        border-color var(--blog-dur-fast) var(--blog-ease-out);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-single__related-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__related-card:hover {
        transform: translate3d(0, -3px, 0);
    }
}

.blog-single__related-thumb {
    display: block;
    overflow: hidden;
    text-decoration: none;
}

.blog-single__related-thumb img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    transition: transform var(--blog-dur-med) var(--blog-ease-out);
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__related-card:hover .blog-single__related-thumb img {
        transform: scale(1.03);
    }
}

.blog-single__related-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* One or more category pills above the card title (e.g. archive grid, related posts). */
.blog-single__related-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-self: flex-start;
    list-style: none;
    margin: 0 0 0.6rem;
    padding: 0;
}

.blog-single__related-cats > li {
    margin: 0;
    padding: 0;
}

.blog-single__related-cats .blog-single__related-cat {
    margin-bottom: 0;
}

/* Pills: same hover language as .blog-single__category-badge (brightness + opacity). */
.blog-single__related-cat {
    display: inline-block;
    background: var(--primary-color);
    color: #fff;
    padding: 0.2em 0.6em;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    margin-bottom: 0.6rem;
    align-self: flex-start;
    transition:
        opacity var(--blog-dur-fast) var(--blog-ease-out),
        filter var(--blog-dur-fast) var(--blog-ease-out),
        transform var(--blog-dur-fast) var(--blog-ease-out);
}

.blog-single__related-cat:hover {
    color: #fff;
    opacity: 0.92;
    filter: brightness(1.08);
}

.blog-single__related-cat:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px var(--primary-color);
    opacity: 1;
    filter: brightness(1.08);
}

@media (prefers-reduced-motion: no-preference) {
    .blog-single__related-cat:active {
        transform: scale(0.98);
    }
}

.blog-single__related-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.35;
    margin: 0 0 0.5rem;
    color: var(--color-text);
}

.blog-single__related-title a {
    color: inherit;
    text-decoration: none;
}

.blog-single__related-title a:hover {
    color: var(--primary-color);
}

.blog-single__related-title a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 2px;
    color: var(--primary-color);
}

.blog-single__related-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin: auto 0 0;
}

@media (min-width: 768px) {
    .blog-single__content {
        margin-top: 3rem;
        margin-bottom: 3.5rem;
    }
    .blog-single__toc {
        margin-top: 1.75rem;
    }
}

@media (min-width: 1024px) {
    .blog-single__content {
        margin-top: 3.5rem;
        margin-bottom: 4rem;
    }
}


/* -------------------------------------------------------------------------- */
/* Blog archive — partials/blog/archive.php (.wrusa-blog-archive)              */
/* -------------------------------------------------------------------------- */

/* Legacy blog splash used `right center` (95% on small screens); full-bleed hero above. */
.wrusa-blog-archive .blog-single__hero {
    background-position: right center;
}

@media only screen and (max-width: 767px) {
    .wrusa-blog-archive .blog-single__hero {
        background-position: 95% center;
    }
}

/*
 * Archive hero: title and dek sit close below.
 * Mobile-first: center hero text; from tablet up match default blog hero (left-aligned).
 */
.wrusa-blog-archive .blog-single__hero-content {
    text-align: center;
}

.wrusa-blog-archive .blog-single__hero-content > .blog-single__hero-title {
    margin-bottom: clamp(0.35rem, 1vw, 0.625rem);
}

.wrusa-blog-archive .blog-single__hero-meta--archive {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.375rem;
    max-width: min(40rem, 100%);
    margin-left: auto;
    margin-right: auto;
    font-size: inherit;
    line-height: normal;
}

@media (min-width: 768px) {
    .wrusa-blog-archive .blog-single__hero-content {
        text-align: left;
    }

    .wrusa-blog-archive .blog-single__hero-meta--archive {
        align-items: flex-start;
        margin-left: 0;
        margin-right: 0;
    }
}

.wrusa-blog-archive .wrusa-blog-archive__hero-dek {
    margin: 0;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(1.125rem, 2.35vw, 1.375rem);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
}

.wrusa-blog-archive .wrusa-blog-archive__main {
    width: 100%;
    max-width: var(--blog-related-max);
    margin-left: auto;
    margin-right: auto;
    padding-top: clamp(1.25rem, 3vw, 2rem);
    padding-bottom: clamp(2rem, 5vw, 3rem);
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
}

.wrusa-blog-archive__filters {
    position: relative;
    margin: 0 0 clamp(1.25rem, 3vw, 1.75rem);
    padding: 0;
}

.wrusa-blog-archive__filter-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

/*
 * Mobile: single-row horizontal rail.
 * Wrapping 6+ pills eats 3 rows of vertical space on a 360px viewport and pushes
 * the grid below the fold. A scrolling rail keeps the filter to one row and
 * matches the familiar Medium/Google News pattern (Jakob's Law).
 *
 * Negative margins break out of .blog-single's --blog-gutter side padding so the
 * rail scrolls edge-to-edge; padding-inline inside the list keeps the first chip
 * visually aligned with surrounding content.
 */
@media (max-width: 767px) {
    .wrusa-blog-archive__filters {
        margin-left: calc(-1 * var(--blog-gutter, 12px));
        margin-right: calc(-1 * var(--blog-gutter, 12px));
    }

    .wrusa-blog-archive__filter-list {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.25rem var(--blog-gutter, 12px);
        scroll-snap-type: x proximity;
        scroll-padding-inline: var(--blog-gutter, 12px);
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-inline: contain;
    }

    .wrusa-blog-archive__filter-list::-webkit-scrollbar {
        display: none;
    }

    .wrusa-blog-archive__filter-list > li {
        flex: 0 0 auto;
        scroll-snap-align: start;
    }

    /*
     * Edge-fade affordance — signals more content off-screen.
     * Pseudo-elements (not mask-image on the scroller) so focus-visible outlines
     * on edge chips aren't clipped. Visibility is gated on data-scroll-state set
     * by the inline script in archive.php, so the fade only appears on the side that
     * actually has hidden content (prevents the first/last chip from looking
     * washed out when you're pinned to that edge).
     */
    .wrusa-blog-archive__filters::before,
    .wrusa-blog-archive__filters::after {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        width: 1.25rem;
        pointer-events: none;
        z-index: 1;
        opacity: 0;
        transition: opacity 160ms var(--blog-ease-out);
    }

    .wrusa-blog-archive__filters::before {
        left: 0;
        background: linear-gradient(to right, var(--color-surface, #fff), rgba(255, 255, 255, 0));
    }

    .wrusa-blog-archive__filters::after {
        right: 0;
        background: linear-gradient(to left, var(--color-surface, #fff), rgba(255, 255, 255, 0));
    }

    .wrusa-blog-archive__filters[data-scroll-state="middle"]::before,
    .wrusa-blog-archive__filters[data-scroll-state="end"]::before {
        opacity: 1;
    }

    .wrusa-blog-archive__filters[data-scroll-state="middle"]::after,
    .wrusa-blog-archive__filters[data-scroll-state="start"]::after {
        opacity: 1;
    }

    @media (prefers-reduced-motion: reduce) {
        .wrusa-blog-archive__filters::before,
        .wrusa-blog-archive__filters::after {
            transition: none;
        }
    }
}

@media (min-width: 768px) {
    .wrusa-blog-archive__filter-list {
        justify-content: flex-start;
    }
}

.wrusa-blog-archive__filter-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: var(--blog-touch-min, 44px);
    padding: 0.35rem 1rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-decoration: none;
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    white-space: nowrap;
    transition:
        background var(--blog-dur-fast) var(--blog-ease-out),
        color var(--blog-dur-fast) var(--blog-ease-out),
        border-color var(--blog-dur-fast) var(--blog-ease-out),
        box-shadow var(--blog-dur-fast) var(--blog-ease-out),
        transform 80ms var(--blog-ease-out);
}

@media (min-width: 768px) {
    .wrusa-blog-archive__filter-link {
        font-size: 0.8125rem;
    }
}

.wrusa-blog-archive__filter-link:hover {
    color: var(--primary-color);
    border-color: rgba(27, 51, 95, 0.35);
    background: var(--color-surface-subtle);
}

.wrusa-blog-archive__filter-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

/* Tap feedback: full page reload leaves a 200-800ms dead zone; 0.97 scale gives an instant ack. */
.wrusa-blog-archive__filter-link:active {
    transform: scale(0.97);
}

@media (prefers-reduced-motion: reduce) {
    .wrusa-blog-archive__filter-link {
        transition: none;
    }
    .wrusa-blog-archive__filter-link:active {
        transform: none;
    }
}

.wrusa-blog-archive__filter-link.is-active {
    color: #fff;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.wrusa-blog-archive__filter-link.is-active:hover {
    color: #fff;
    filter: brightness(1.06);
}

/* High-contrast focus on filled chips (primary background). */
.wrusa-blog-archive__filter-link.is-active:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.wrusa-blog-archive__filter-count {
    font-size: 0.75rem;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    color: var(--color-text-muted, rgba(33, 37, 41, 0.58));
    padding: 0.05em 0.4em;
    border-radius: 999px;
    background: rgba(27, 51, 95, 0.06);
}

.wrusa-blog-archive__filter-link.is-active .wrusa-blog-archive__filter-count {
    color: rgba(255, 255, 255, 0.88);
    background: rgba(255, 255, 255, 0.18);
}

.wrusa-blog-archive .wrusa-blog-archive__grid {
    --blog-carousel-gap: 20px;
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--blog-carousel-gap);
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
}

@media (min-width: 768px) {
    .wrusa-blog-archive .wrusa-blog-archive__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .wrusa-blog-archive .wrusa-blog-archive__grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Match Recent Blogs row height: cards use .blog-single__related-* below. */
.wrusa-blog-archive .wrusa-blog-archive__grid > li {
    display: flex;
    min-width: 0;
}

.wrusa-blog-archive .wrusa-blog-archive__grid .blog-single__related-card {
    width: 100%;
}

/*
 * Archive grid: one full-card hit target (overlay link). Category pills sit above
 * the overlay (z-index). Larger, easier targets (Fitts's Law).
 */
.wrusa-blog-archive .blog-single__related-card--clickable {
    position: relative;
    cursor: pointer;
}

.wrusa-blog-archive .blog-single__related-card--clickable .blog-single__related-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    text-decoration: none;
}

.wrusa-blog-archive .blog-single__related-card--clickable .blog-single__related-overlay:focus {
    outline: none;
}

.wrusa-blog-archive .blog-single__related-card--clickable .blog-single__related-thumb {
    position: relative;
    z-index: 0;
}

.wrusa-blog-archive .blog-single__related-card--clickable .blog-single__related-cat {
    position: relative;
    z-index: 2;
}

@media (prefers-reduced-motion: no-preference) {
    /* Keep hover lift from .blog-single__related-card:hover; add slight press-in. */
    .wrusa-blog-archive .blog-single__related-card--clickable:hover:active {
        transform: translate3d(0, -3px, 0) scale(0.985);
    }
}

/*
 * Archive cards: normalize vertical rhythm so equal-height rows don't create
 * floating gaps above the CTA.
 *
 * Titles and excerpts get both a line-clamp AND a matching min-height so
 * every card reserves the same space for those blocks regardless of the post.
 * With that in place, the CTA sits at a consistent position across the row
 * and the date (margin-top: auto from .blog-single__related-date) absorbs any remaining
 * stretch at the very bottom — one gap per card, at the bottom only.
 *
 * No `flex: 1` on the excerpt: `-webkit-line-clamp` clamps by implicit
 * max-height, and a flexing parent overrides that — extra lines bleed
 * through and `overflow: hidden` crops them mid-line.
 */
.wrusa-blog-archive .blog-single__related-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* 2 lines × line-height 1.35 from .blog-single__related-title */
    min-height: calc(2 * 1.35em);
    overflow-wrap: anywhere;
    transition: color var(--blog-dur-fast) var(--blog-ease-out);
}

.wrusa-blog-archive .blog-single__related-excerpt {
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
    margin: 0 0 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    /* Reserve 3 lines so short excerpts don't collapse and push the CTA up. */
    min-height: calc(3 * 1.5em);
    overflow-wrap: anywhere;
}

.wrusa-blog-archive .blog-single__related-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0 0 0.5rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
    text-decoration: none;
    transition:
        color var(--blog-dur-fast) var(--blog-ease-out),
        transform var(--blog-dur-fast) var(--blog-ease-out);
}

/* CTA is a visual cue only; the card overlay handles navigation. */
.wrusa-blog-archive .blog-single__related-card--clickable:hover .blog-single__related-cta {
    color: var(--primary-color);
    text-decoration: none;
}

.wrusa-blog-archive .blog-single__related-cta svg {
    transition: transform var(--blog-dur-fast) var(--blog-ease-out);
}

.wrusa-blog-archive .blog-single__related-card--clickable:hover .blog-single__related-cta svg {
    transform: translateX(2px);
}

.wrusa-blog-archive .blog-single__related-card--clickable:hover .blog-single__related-title {
    color: var(--primary-color);
}

/*
 * Inset ring: card uses overflow:hidden — outer outline would clip.
 * Subtle lift feedback on press (Doherty-style immediate ack).
 */
.wrusa-blog-archive .blog-single__related-card--clickable:has(.blog-single__related-overlay:focus-visible) {
    box-shadow: inset 0 0 0 2px var(--primary-color);
}

@media (prefers-reduced-motion: reduce) {
    .wrusa-blog-archive .blog-single__related-card--clickable:hover .blog-single__related-cta svg {
        transform: none;
    }
}

.wrusa-blog-archive .wrusa-blog-archive__pagination {
    display: flex;
    justify-content: center;
    margin-top: 2.5rem;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a,
.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--blog-touch-min, 44px);
    min-height: var(--blog-touch-min, 44px);
    padding: 0 0.75rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
    box-sizing: border-box;
    transition:
        background var(--blog-dur-fast) var(--blog-ease-out),
        color var(--blog-dur-fast) var(--blog-ease-out),
        border-color var(--blog-dur-fast) var(--blog-ease-out),
        transform 80ms var(--blog-ease-out);
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a:focus {
    outline: none;
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a:focus-visible {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
    .wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a:active {
        transform: scale(0.96);
    }
}

@media (prefers-reduced-motion: reduce) {
    .wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a {
        transition: none;
    }

    .wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers a:active {
        transform: none;
    }
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers .current {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.wrusa-blog-archive .wrusa-blog-archive__pagination .page-numbers .dots {
    border: none;
    background: transparent;
    min-width: auto;
    padding: 0 0.25rem;
}

.wrusa-blog-archive .wrusa-blog-archive__empty {
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
    color: var(--color-text-muted);
    width: 100%;
    max-width: 36rem;
    margin: clamp(2rem, 5vw, 3rem) auto 0;
    padding: 0 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
    .blog-single__progress {
        transition: none !important;
    }

    .blog-single__hero-content > * {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .blog-single__related {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .blog-single__related-card:hover,
    .blog-single__related-card:hover .blog-single__related-thumb img {
        transform: none !important;
    }

    .blog-single__author-tooltip {
        transition: opacity 0.15s ease, visibility 0.15s !important;
    }

    .blog-single__btt {
        --blog-btt-fade: 0.08s;
    }
}
