/* Blog index */
.blog-meta span {
    display: inline-block;
    margin-right: 14px;
}

.blog-meta span:last-child {
    margin-right: 0;
}

/* Index cards: square featured image on the left, text on the right */
.blog-card {
    display: flex;
    align-items: flex-start;
    gap: 28px;
    padding: 28px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.blog-card:last-of-type {
    border-bottom: 0;
}

/* The theme still carries ".blog-list .blog-card" rules from an older blog design (a boxed card with its own
   background, shadow and vertically centred, padded text). Reset them so each post is a flat row on the
   section's single background, with the title level with the top of the image, in day and night mode alike. */
.blog-list .blog-card,
.bg-dark .blog-list .blog-card {
    align-items: flex-start;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
}

.bg-dark .blog-list .blog-card {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.blog-list .blog-card:last-of-type {
    border-bottom: 0;
}

.blog-list .blog-card-body {
    display: block;
    padding: 0;
}

/* Featured images are 1200x630 (the social share size), so the thumbnail uses the same 1.91:1 shape */
.blog-card-image {
    flex: 0 0 280px;
    width: 280px;
    aspect-ratio: 1200 / 630;
    overflow: hidden;
    border-radius: 8px;
}

/* The theme's global "img { max-width: 99% }" left a strip of the box showing, so the image is pinned to fill it */
.blog-list .blog-card-image img {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.blog-card-body {
    flex: 1 1 auto;
    min-width: 0;
}

/* Post titles: the same element and size as the site's section titles, in the theme's blue */
.blog-card-title {
    margin-bottom: 0.5rem;
    line-height: 1.25;
    text-align: left;
}

/* The theme sizes every link at 0.9rem, which shrank the title text; take the heading's size instead */
.blog-card-title a {
    font-size: inherit;
}

.blog-card-excerpt {
    margin-bottom: 0.75rem;
    color: #555;
}

.bg-dark .blog-card-excerpt {
    color: #ececec;
}

.blog-card-title a,
.blog-card-title a:hover,
.blog-card-title a:focus,
.bg-dark .blog-card-title a,
.bg-dark .blog-card-title a:hover,
.bg-dark .blog-card-title a:focus {
    color: var(--blue, #5D8FCB);
}

/* No hover effects on the index cards or on post images */
.blog-card,
.blog-card:hover,
.blog-card a,
.blog-card a:hover,
.blog-card-image,
.blog-card-image:hover,
.blog-card-image img,
.blog-card-image:hover img,
.blog-post-hero-image img,
.blog-post-hero-image img:hover,
.blog-content img,
.blog-content img:hover {
    transform: none !important;
    box-shadow: none !important;
    filter: none !important;
    opacity: 1 !important;
    transition: none !important;
}

.blog-card a:hover,
.blog-card a:focus {
    text-decoration: none;
}

/* Phones: the square image sits above the text */
@media (max-width: 575.98px) {
    .blog-card {
        flex-direction: column;
        gap: 16px;
    }

    .blog-card-image {
        flex-basis: auto;
        width: 100%;
        max-width: 100%;
        height: auto;
        aspect-ratio: 1200 / 630;
    }
}

/* Post title (the theme's .mrheading h1 is larger and is used site-wide, so only the blog is changed) */
.blog-post .mrheading h1 {
    font-size: 40px;
}

@media (max-width: 767.98px) {
    .blog-post .mrheading h1 {
        font-size: 30px;
    }
}

/* Post header: the featured image is shown whole, capped in size and centred beside the title */
.blog-post-hero-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.blog-post-hero-image {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 20px;
    padding-bottom: 20px;
}

.blog-post-hero-image img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 360px;
    object-fit: contain;
    border-radius: 8px;
}

@media (max-width: 767.98px) {
    .blog-post-hero-image img {
        max-height: 260px;
    }
}

/* Post content */
.blog-content {
    font-size: 1.05rem;
    line-height: 1.75;
    overflow-wrap: break-word;
}

.blog-content h2,
.blog-content h3,
.blog-content h4 {
    margin-top: 1.8rem;
    margin-bottom: 0.8rem;
}

.blog-content img {
    max-width: 100%;
    height: auto;
}

.blog-content .blog-image {
    margin: 1.5rem 0;
    text-align: center;
}

.blog-content .blog-image-bordered img {
    border: 1px solid #e3e3e3;
}

.blog-content .blog-image-background {
    background: #f5f7fa;
    padding: 16px;
    border-radius: 6px;
}

.blog-content .blog-image-background img {
    max-width: 60%;
}

.blog-content .blog-image-stretched img {
    width: 100%;
}

.blog-content figcaption {
    color: #777;
    font-size: 0.9rem;
    margin-top: 6px;
}

.blog-content .blog-quote {
    border-left: 4px solid #0d6efd;
    background: #f7faff;
    padding: 14px 18px;
    margin: 1.5rem 0;
}

.blog-content .blog-quote p {
    margin-bottom: 0;
    font-style: italic;
}

.blog-content .blog-quote footer {
    color: #666;
    font-size: 0.9rem;
    margin-top: 6px;
}

.blog-content .blog-code {
    background: #1f2430;
    color: #e6e6e6;
    border-radius: 6px;
    padding: 14px 16px;
    overflow-x: auto;
    font-size: 0.9rem;
}

.blog-content .blog-delimiter {
    border: 0;
    text-align: center;
    margin: 2rem 0;
}

.blog-content .blog-delimiter::before {
    content: "* * *";
    color: #999;
    letter-spacing: 0.6em;
}

.blog-content .blog-checklist {
    list-style: none;
    padding-left: 0.5rem;
}

.blog-content .blog-embed {
    margin: 1.5rem 0;
}

.blog-content .blog-embed-frame {
    position: relative;
    padding-top: 56.25%;
}

.blog-content .blog-embed-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Comments */
.blog-comments {
    margin: 30px 0;
    padding-top: 30px;
    border-top: 1px solid #e5e5e5;
}

.blog-comments-count {
    color: #888;
    font-size: 0.8em;
}

.blog-comment {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 14px;
}

.blog-comment-reply {
    margin-left: 40px;
}

.blog-comment-staff {
    border-left: 3px solid #0d6efd;
    background: #f7faff;
}

.blog-comment-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.blog-comment-author {
    font-weight: 600;
}

.blog-comment-badge {
    background: #0d6efd;
    color: #fff;
    border-radius: 3px;
    font-size: 11px;
    padding: 1px 6px;
    text-transform: uppercase;
}

.blog-comment-date {
    color: #888;
    font-size: 0.85em;
}

.blog-comment-text {
    overflow-wrap: anywhere;
}

.blog-comment-form {
    margin-top: 30px;
}

.blog-hp {
    position: absolute !important;
    left: -10000px !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 576px) {
    .blog-comment-reply {
        margin-left: 16px;
    }
}

/* Dark mode (the theme adds .bg-dark to <html>); text matches the theme's #ececec paragraphs */
.bg-dark .blog-content,
.bg-dark .blog-content li,
.bg-dark .blog-content li::marker,
.bg-dark .blog-content td,
.bg-dark .blog-content th,
.bg-dark .blog-content dt,
.bg-dark .blog-content dd,
.bg-dark .blog-content strong,
.bg-dark .blog-content b,
.bg-dark .blog-comment,
.bg-dark .blog-comment-text,
.bg-dark .blog-comment-author {
    color: #ececec;
}

.bg-dark .blog-content figcaption,
.bg-dark .blog-content .blog-quote footer,
.bg-dark .blog-comments-count,
.bg-dark .blog-comment-date {
    color: #b8bec8;
}

.bg-dark .blog-content .blog-quote {
    background: rgba(13, 110, 253, 0.12);
}

.bg-dark .blog-content .blog-image-background {
    background: rgba(255, 255, 255, 0.06);
}

.bg-dark .blog-content .blog-image-bordered img {
    border-color: rgba(255, 255, 255, 0.15);
}

.bg-dark .blog-content table,
.bg-dark .blog-content .table {
    --bs-table-bg: transparent;
    --bs-table-color: #ececec;
    border-color: rgba(255, 255, 255, 0.15);
}

.bg-dark .blog-content .table > :not(caption) > * > * {
    border-color: rgba(255, 255, 255, 0.15);
}

.bg-dark .blog-content :not(pre) > code {
    background: rgba(255, 255, 255, 0.08);
    color: #ffb4c8;
}

.bg-dark .blog-comments {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.bg-dark .blog-comment {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.bg-dark .blog-comment-staff {
    background: rgba(13, 110, 253, 0.1);
    border-left-color: #0d6efd;
}

/* Image lightbox */
/* Clickable images show only a zoom cursor (no hover effect) */
.blog-zoomable {
    cursor: zoom-in;
}

.blog-zoomable:focus-visible {
    outline: 3px solid #0d6efd;
    outline-offset: 3px;
}

.blog-lightbox-open,
.blog-lightbox-open body {
    overflow: hidden;
}

.blog-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 20px 20px;
    background: rgba(8, 12, 24, 0.92);
    cursor: zoom-out;
    animation: blog-lightbox-in 0.15s ease;
}

.blog-lightbox[hidden] {
    display: none;
}

.blog-lightbox-figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 100%;
    max-height: 100%;
    margin: 0;
}

.blog-lightbox-figure img {
    display: block;
    width: auto;
    max-width: 95vw;
    height: auto;
    max-height: calc(100vh - 150px);
    object-fit: contain;
    border-radius: 6px;
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    cursor: default;
}

.blog-lightbox-figure figcaption {
    max-width: 800px;
    margin-top: 12px;
    color: #e6e6e6;
    font-size: 0.95rem;
    text-align: center;
}

/* Wraps the image so the close button sits on its top-right corner */
.blog-lightbox-frame {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.blog-lightbox .blog-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #dc3545;
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.blog-lightbox .blog-lightbox-close:hover,
.blog-lightbox .blog-lightbox-close:focus-visible {
    background: #dc3545;
    color: #fff;
    transform: scale(1.1);
    outline: none;
}

.blog-lightbox .blog-lightbox-close svg {
    display: block;
    pointer-events: none;
}

@media (max-width: 576px) {
    .blog-lightbox .blog-lightbox-close {
        top: -38px;
        right: 0;
    }
}

@keyframes blog-lightbox-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.blog-lightbox-figure img.blog-lightbox-svg {
    width: min(95vw, 900px);
}

/* Comment form: "Register now" sits after "Log in to comment", on its own line on narrow screens */
.blog-comment-register {
    display: inline-block;
    margin-left: 14px;
}
