/* Custom CSS to match glog.glennf.com Squarespace design */

/* Body text: Museo Sans, 17px, 1.8em line-height */
body, .gh-content, .is-body {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 17px !important;
    line-height: 1.8em !important;
    font-weight: 400;
    color: #222;
}

/* Headings: all Museo Sans */
h1, .gh-article-title, .is-title {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 400 !important;
    text-transform: uppercase;
    letter-spacing: 5px;
    font-size: 28px !important;
    line-height: 1.3em !important;
    color: #222;
}

h2, .gh-card-title {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 700 !important;
    letter-spacing: 1px;
    font-size: 22px !important;
    line-height: 1.2em !important;
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    color: #222;
}

h3 {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 1px;
    font-size: 19px !important;
    line-height: 1.2em !important;
    color: #222;
}

h4 {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 400;
    color: #222;
}

/* Links in body: Museo Sans bold */
.gh-content a, .gh-content p a, body p a {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 700 !important;
    font-style: normal !important;
    color: #0085bd;
    text-decoration: none;
}

.gh-content p strong a, .gh-content p a, .gh-content li a, body li a {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-style: normal !important;
    font-weight: 700 !important;
}

.gh-content a:hover {
    color: #006a96;
    text-decoration: underline;
}

.gh-content p em a {
    font-style: italic !important;
}

/* body p a weight */
body p a {
    font-weight: 600;
}

/* Blockquote links */
.gh-content blockquote a, blockquote a {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-style: normal !important;
}

/* Metadata: dark red, uppercase, letterspaced */
.gh-article-tag, .gh-article-meta-date, .gh-article-meta-length,
time.published, .categories, .meta-row {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 5px;
    word-spacing: -5px;
    color: #b41714;
}

.gh-article-tag {
    color: #b41714 !important;
    background: transparent !important;
}

time.published, .gh-article-meta-date {
    font-weight: 700;
    font-size: 70% !important;
}

.meta, .categories, .meta-row {
    line-height: 15px;
}

/* Navigation: overlay on header image, white knocked-out bold text */
#gh-navigation {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: transparent !important;
}

.gh-navigation-menu a, .gh-navigation-menu .nav a {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 16px;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-decoration: none;
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

/* Narrow the search field */
.gh-navigation .gh-form-input,
.gh-navigation [data-ghost-search],
button.gh-form-input,
.sodo-search-modal {
    max-width: 200px;
}

.gh-navigation-menu a:hover, .gh-navigation-menu .nav a:hover {
    opacity: 0.8;
}

/* Hide the GLOG logo text in nav */
.gh-navigation-logo {
    display: none !important;
}

/* ALL icons in nav knocked out white — search, burger, everything */
#gh-navigation svg,
#gh-navigation .gh-search-icon,
#gh-navigation button svg,
.gh-navigation svg,
.gh-navigation .gh-search-icon,
.gh-navigation button svg,
.gh-icon-button svg,
[data-ghost-search] svg {
    color: #fff !important;
    fill: #fff !important;
    stroke: #fff !important;
}

/* Navigation bar itself */
.gh-navigation-inner {
    background: transparent !important;
}

/* Content area - wider and responsive, consistent padding */
.gh-canvas {
    max-width: min(1200px, 90vw);
    margin-left: auto;
    margin-right: auto;
    padding-left: max(4vmin, 20px);
    padding-right: max(4vmin, 20px);
}

.gh-inner {
    max-width: min(1400px, 95vw);
    margin-left: auto;
    margin-right: auto;
    padding-left: max(4vmin, 20px);
    padding-right: max(4vmin, 20px);
}

/* Consistent outer padding on all pages - override nested .gh-outer .gh-outer reset */
.gh-outer,
.gh-outer .gh-outer,
.gh-viewport .gh-outer {
    padding-left: max(4vmin, 20px) !important;
    padding-right: max(4vmin, 20px) !important;
}

/* Post content column shouldn't be too wide for readability */
.gh-content {
    max-width: 800px;
}

/* Card/feed styling */
.gh-card-link {
    color: #222;
}

.gh-card-link:hover .gh-card-title {
    color: #0085bd;
}

/* Blockquote */
.gh-content blockquote {
    border-left: 3px solid #b41714;
    padding-left: 1.2em;
    font-style: italic;
    color: #444;
}

/* Drop-in for images whose source files are gone (broken external links,
   long-dead Flickr photo subdomains, etc.). Replaces the original
   <img>/<figure> with a small italic note. */
.gh-content .glog-missing-image {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-style: italic;
    color: #888;
    font-size: 0.9em;
    padding: 0.4em 0.8em;
    border-left: 2px solid #ddd;
    margin: 1em 0;
}

/* Image captions — flush-left, tighter leading than body copy */
.gh-content figcaption {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-size: 13px;
    line-height: 1.3;
    color: #666;
    text-align: left;
    margin-top: 8px;
}

/* Card meta */
.gh-card-meta {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-size: 13px;
    color: #878787;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Read more link */
.read-more {
    font-size: 20px;
    text-transform: uppercase;
    float: right;
    font-weight: 700;
    letter-spacing: 4px;
    border-top: 1px solid #878787;
    border-bottom: 1px solid #878787;
    margin-bottom: -6px;
    line-height: 32px;
    padding-top: 1px;
    padding-right: 12px;
    color: #878787;
    border-right: 15px solid #878787;
}

/* Canvas padding */
#canvas, .gh-main {
    padding-top: 23px;
}

/* White background */
:root {
    --background-color: #ffffff;
}

/* Mobile adjustments */
@media only screen and (max-width: 639px) {
    body p, body li, .gh-content p, .gh-content li {
        font-size: 15px !important;
        line-height: 23px !important;
    }
    .gh-content li, body li {
        padding-bottom: 11px;
    }
    body ul, .gh-content ul {
        padding-bottom: 0px;
        margin-bottom: 0px;
    }
}

/* Print styles */
@media print {
    body {
        margin: 0;
        padding: 0;
        line-height: 1.4;
        font-size: 12pt !important;
        color: #000;
        background: #fff;
        font-family: "Georgia", serif;
        width: 100%;
    }
    p {
        font-size: 10pt !important;
        line-height: 1.1;
    }
}

/* ===== SIDEBAR STYLES ===== */

.gh-sidebar-section {
    margin-bottom: 2em;
    padding-bottom: 1.5em;
    border-bottom: 1px solid #e8e8e8;
}

.gh-sidebar-section:last-child {
    border-bottom: none;
}

.gh-sidebar-title {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 14px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #b41714;
    margin-bottom: 0.8em;
}

.gh-sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gh-sidebar-links li {
    padding: 4px 0;
    font-size: 14px;
    line-height: 1.4;
}

.gh-sidebar-links li a {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 500;
    color: #222;
    text-decoration: none;
}

.gh-sidebar-links li a:hover {
    color: #0085bd;
}

/* Archive year links - horizontal flow */
.gh-sidebar-archives {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.gh-sidebar-archives li {
    float: left;
    padding-right: 19px;
    font-size: 12px;
    line-height: 15px;
    font-weight: bold;
}

/* ===== FOOTER STYLES ===== */

.gh-footer {
    background: #f9f9f9;
    border-top: 1px solid #e8e8e8;
    padding: 2em 0;
    margin-top: 0;   /* base theme adds margin-top:12vw — kill the dead space */
}

.gh-footer-bottom-nav {
    text-align: center;
    margin-bottom: 1em;
}

.gh-footer-bottom-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5em 2em;
}

.gh-footer-bottom-nav li a {
    font-family: "museo-sans-1", "museo-sans-2", Helvetica, Arial, sans-serif !important;
    font-size: 14px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    color: #222;
}

.gh-footer-bottom-nav li a:hover {
    color: #0085bd;
}

.gh-footer-bar {
    display: block;        /* base theme uses a 3-col grid that pins copyright left */
    text-align: center;
    border: 0;             /* base theme draws border-block (top+bottom rules) */
    margin-bottom: 0;      /* base theme adds margin-bottom:100px */
    padding-block: 0;      /* base theme adds 28px padding */
}

.gh-footer-copyright {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-size: 13px;
    color: #878787;
    text-align: center;    /* base theme right-aligns it */
    white-space: normal;
}

/* Show sidebar at narrower widths (default hides below 1200px) */
@media (max-width: 1199px) and (min-width: 900px) {
    .gh-container.has-sidebar .gh-sidebar {
        display: block !important;
    }
    .gh-container.has-sidebar .gh-container-inner {
        display: grid !important;
        grid-template-columns: repeat(16, 1fr);
        overflow: visible !important;
    }
    .gh-container.has-sidebar .gh-main {
        grid-column: 1 / 12;
    }
    .gh-container.has-sidebar .gh-sidebar {
        grid-column: 13 / -1;
    }
}

/* Fix sidebar scrolling - remove sticky, allow natural scroll */
.gh-sidebar-inner {
    position: static !important;
}

/* ===== HEADER BANNER FIXES ===== */

/* Crop header image shorter, overlay title, flush with top */
.gh-header {
    margin-top: -80px !important;
    padding-top: 80px;
    margin-bottom: 0 !important;
    position: relative;
    overflow: hidden;
    max-height: 180px;
}

.gh-header-image {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center 40%;
    position: absolute;
    inset: 0;
    z-index: 0;
}

.gh-header-inner {
    position: relative;
    z-index: 1;
    padding: 20px 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
}

/* Blog title knocked out in white on the banner */
.gh-header-title {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-weight: 900 !important;
    color: #fff !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.5);
    font-size: clamp(1.6rem, 3vw + 0.8rem, 3.2rem) !important;
    letter-spacing: 3px !important;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.2 !important;
}

/* Responsive header */
@media (max-width: 768px) {
    .gh-header {
        max-height: 110px;
    }
    .gh-header-inner {
        padding: 15px 15px 10px;
        min-height: 70px;
    }
}

@media (max-width: 480px) {
    .gh-header {
        max-height: 90px;
    }
    .gh-header-inner {
        padding: 10px;
        min-height: 50px;
    }
}

/* ===== DATE FORMATTING FIX ===== */

/* Tighten the date letter-spacing - was way too spread out */
.gh-article-meta-date, time.published {
    letter-spacing: 1px !important;
    word-spacing: normal !important;
    font-size: 13px !important;
    font-weight: 600;
}

/* Also fix tag link spacing */
.gh-article-tag {
    letter-spacing: 2px !important;
}

/* ===== TAG LINKS IN SIDEBAR ===== */
.gh-sidebar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.gh-sidebar-tags li a {
    display: inline-block;
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 12px;
    font-weight: 600;
    color: #222;
    background: #f0f0f0;
    padding: 3px 10px;
    border-radius: 3px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gh-sidebar-tags li a:hover {
    background: #b41714;
    color: #fff;
}

/* ===== SIDEBAR LAYOUT: force grid on desktop, stack on mobile ===== */

/* Override the built-in rule that kills grid below 1200px */
.gh-container.has-sidebar .gh-container-inner {
    display: grid !important;
    grid-template-columns: repeat(16, 1fr);
    overflow: visible !important;
}

.gh-container.has-sidebar .gh-main {
    grid-column: 1 / 12;
}

.gh-container.has-sidebar .gh-sidebar {
    display: block !important;
    grid-column: 13 / -1;
}

.gh-container.has-sidebar .gh-container-title {
    grid-column: 1 / -1;
}

/* Stack sidebar below content on narrow screens */
@media (max-width: 899px) {
    .gh-container.has-sidebar .gh-container-inner {
        display: flex !important;
        flex-direction: column;
    }
    .gh-container.has-sidebar .gh-sidebar {
        margin-top: 3em;
        padding-top: 2em;
        border-top: 1px solid #e8e8e8;
    }
    .gh-container.has-sidebar .gh-main {
        grid-column: auto;
    }
}

/* ===== REDUCE SPACE BELOW HEADER ===== */

/* Remove gap between header and content */
.gh-header + main,
.gh-header + .gh-main,
.gh-header + section,
.gh-header + .gh-container {
    margin-top: 0 !important;
    padding-top: 0.5em !important;
}

/* Hide CTA/featured section gaps */
.gh-cta, .gh-featured {
    display: none;
}

/* Hide "Latest" label and its border line on blog listing */
.gh-container-title {
    display: none !important;
}

/* ===== READING TIME: lighter weight, normal spacing ===== */
.gh-article-meta-length {
    font-size: 13px !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    font-weight: 400;
    color: #878787 !important;
    text-transform: none;
}

/* Separator between date and reading time */
.gh-article-meta-length .bull {
    color: #878787;
}

/* ===== FIT ALL NAV ITEMS ON DESKTOP ===== */

/* Prevent JS from hiding nav items into ... dropdown */
@media (min-width: 900px) {
    .gh-navigation-menu .nav > li {
        opacity: 1 !important;
        visibility: visible !important;
        display: list-item !important;
    }
    .gh-more-toggle {
        display: none !important;
    }
    /* Tighten nav item spacing to fit */
    .gh-navigation-menu .nav {
        gap: 20px;
    }
}

/* ===== FIX SEARCH OVERLAY PUSHING NAV ===== */
/* Ensure Sodo search modal is a fixed overlay, not inline */
.sodo-search,
.sodo-search-container,
[data-sodo-search] {
    position: fixed !important;
    z-index: 9999;
}

/* Prevent search from expanding inside the nav bar */
.gh-navigation-actions {
    flex-shrink: 0;
    min-width: auto !important;
    width: auto !important;
}

/* Keep nav items visible when search is active */
.gh-navigation-menu {
    flex-shrink: 0 !important;
    overflow: visible !important;
}

/* ===== HIDE SODO SEARCH INLINE INPUT ===== */
/* Sodo search injects an input bar - hide it, keep only the modal on icon click */
.gh-navigation [data-ghost-search] > :not(button):not(svg) {
    display: none !important;
}

/* Hide any injected search input/form in the nav */
.gh-navigation input[type="search"],
.gh-navigation input[type="text"],
.gh-navigation .sodo-search-input,
.gh-navigation form {
    display: none !important;
}

/* The Sodo search root element - ensure it's only a modal, not inline */
#sodo-search-root {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    pointer-events: none;
}

#sodo-search-root > div {
    pointer-events: auto;
}

/* When Sodo isn't active, fully hide it */
#sodo-search-root:empty,
#sodo-search-root[style*="display: none"] {
    display: none !important;
}

/* ===== SIDEBAR SEARCH FIELD STYLE ===== */
.gh-sidebar-search-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    padding: 8px 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    color: #999;
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-size: 14px;
    cursor: pointer;
    text-align: left;
}

.gh-sidebar-search-field span {
    flex: 1;
    text-align: left;
}

.gh-sidebar-search-field:hover {
    border-color: #b41714;
    background: #fff;
}

.gh-sidebar-search-field svg {
    flex-shrink: 0;
    color: #999;
}

/* ===== HEADER DESCRIPTION ALIGN LEFT ===== */
/* Use same max-width/margin as gh-inner but keep banner full-width */
.gh-header-inner.gh-inner {
    justify-content: flex-start !important;
    padding-left: max(4vmin, 20px) !important;
    padding-right: max(4vmin, 20px) !important;
}

.gh-header-title {
    text-align: left !important;
}

/* Header title link - white, no underline */
.gh-header-title a {
    color: #fff !important;
    text-decoration: none !important;
}

.gh-header-title a:hover {
    opacity: 0.9;
}

/* ===== LONGER EXCERPTS ON BLOG LISTING ===== */
.gh-card-excerpt {
    -webkit-line-clamp: unset !important;
    display: block !important;
    overflow-y: visible !important;
    max-width: 100% !important;
}

/* ===== FORMATTED POST CARDS ===== */
.gh-card-content {
    margin-top: 12px;
    font-size: 16px;
    line-height: 1.7;
    color: #333;
}

.gh-card-content p {
    margin-bottom: 0.8em;
}

/* Hide images/embeds in card content preview.
   div[style*="padding-bottom"] catches the responsive-embed wrapper
   (e.g. YouTube), which otherwise leaves an empty aspect-ratio box. */
.gh-card-content img,
.gh-card-content figure,
.gh-card-content iframe,
.gh-card-content .kg-card,
.gh-card-content div[style*="padding-bottom"] {
    display: none;
}

.gh-card-title a {
    color: #222;
    text-decoration: none;
}

.gh-card-title a:hover {
    color: #0085bd;
}

.gh-card-readmore {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #0085bd;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: auto;
}

.gh-card-readmore:hover {
    text-decoration: underline;
}

.gh-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== FIX HOME PAGE COLUMN OFFSET ===== */
/* Match the post page's left inset on the home listing */
.gh-container .gh-feed,
.gh-container .gh-main {
    padding-left: max(4vmin, 20px) !important;
}

/* Space between banner and first post */
.gh-container.has-sidebar {
    margin-top: 1.5em !important;
}

/* ===== COMPACT RELATED POSTS AT BOTTOM OF ARTICLES ===== */
.gh-related {
    border-top: 1px solid #e8e8e8;
    margin-top: 3em;
    padding-top: 2em;
    padding-bottom: 2em;
}

.gh-related-title {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 16px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: #b41714;
    margin-bottom: 1.5em;
}

.gh-related-feed {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

@media (max-width: 900px) {
    .gh-related-feed {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 500px) {
    .gh-related-feed {
        grid-template-columns: 1fr;
    }
}

.gh-card-compact .gh-card-link {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-decoration: none;
    color: #222;
}

.gh-card-compact .gh-card-image {
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 4px;
    margin: 0;
}

.gh-card-compact .gh-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gh-card-compact .gh-card-title {
    font-family: "museo-sans-1", "museo-sans-2", sans-serif !important;
    font-size: 15px !important;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.gh-card-compact .gh-card-excerpt {
    font-size: 13px !important;
    line-height: 1.4;
    color: #666;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gh-card-compact .gh-card-date {
    font-size: 12px;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.gh-card-compact .gh-card-link:hover .gh-card-title {
    color: #0085bd;
}

/* ===== CODE / QUOTED-TEXT BLOCKS ===== */
/* Quoted email and code is set in <pre>; wrap long lines and ease the
   size down so it doesn't force a horizontally scrolling box. */
.gh-content pre,
.gh-card-content pre {
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.gh-content pre {
    font-size: 1.2rem;
}

/* In post-listing card previews <pre> is otherwise unstyled browser
   default — make it small and tidy, matching the post treatment. */
.gh-card-content pre {
    font-size: 12px;
    line-height: 1.5;
    background: #f4f4f4;
    border-radius: 4px;
    padding: 8px 10px;
    margin: 0.6em 0;
}

.gh-content pre code,
.gh-card-content pre code {
    font-size: inherit;
    white-space: inherit;
    word-break: inherit;
}

/* ===== PAGINATION ===== */
.gh-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5em 1.4em;
    margin: 3em 0 1em;
    font-family: "museo-sans-1", "museo-sans-2", sans-serif;
    font-size: 14px;
}

.gh-pagination-link {
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    color: #0085bd;
    font-weight: 700;
}

.gh-pagination-link:hover {
    text-decoration: underline;
}

.gh-pagination-link.is-disabled {
    color: #c4c4c4;
    font-weight: 400;
    pointer-events: none;
}

.gh-pagination-status {
    color: #878787;
    letter-spacing: 1px;
}

/* ===== INLINE FLOATED IMAGES (Squarespace text-wrap layout) =====
   .gh-canvas is display:grid, so a bare floated <figure> can't make sibling
   grid items wrap. Floated figures are merged with the following paragraph(s)
   into a .glog-float-wrap div that establishes a block-formatting context;
   inside that BFC, float wraps work normally. */
.gh-content .glog-float-wrap {
    display: flow-root;
    margin-top: 0.8em;
}

/* Inside the wrap-div, paragraphs are not direct children of .gh-content,
   so the theme's > * + * margin rule doesn't apply — match our tighter
   inter-paragraph spacing here too so wrapped paragraphs aren't crammed. */
.gh-content .glog-float-wrap > * + * {
    margin-top: 0.8em;
}

/* Tighter inter-paragraph (and inter-block) spacing site-wide: roughly half
   the body line-height, per Glenn's typographic preference. Base theme uses
   28px which feels loose. */
.gh-content > * + * {
    margin-top: 0.8em;
}
.gh-content :not(.kg-card):not(table):not([id]) + :is(.kg-card,table),
.gh-content :is(.kg-card,table) + :not(.kg-card):not(table):not([id]) {
    margin-top: 0.8em;
}

.gh-content figure.glog-inline-left,
.gh-content figure.glog-inline-right {
    max-width: 42%;
    margin-top: 0.4em !important;
    margin-bottom: 1em;
}

.gh-content figure.glog-inline-left {
    float: left;
    margin-right: 2em;
}

.gh-content figure.glog-inline-right {
    float: right;
    margin-left: 2em;
}

/* Defeat the theme's 48px card-spacing rule for floated figures so the next
   paragraph starts at the figure's top edge and text wraps around the float. */
.gh-content .kg-card.glog-inline-left + :not(.kg-card),
.gh-content .kg-card.glog-inline-right + :not(.kg-card),
.gh-content :not(.kg-card) + .kg-card.glog-inline-left,
.gh-content :not(.kg-card) + .kg-card.glog-inline-right {
    margin-top: 0.4em !important;
}

/* Non-floated image cards: matched to the global 0.8em rule above
   (covered by the .gh-content :not(.kg-card) + :is(.kg-card,table) override). */

@media (max-width: 650px) {
    .gh-content figure.glog-inline-left,
    .gh-content figure.glog-inline-right {
        float: none;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

/* ===== IMAGE GALLERIES (Koenig gallery card) ===== */
.gh-content .kg-gallery-card {
    margin: 1.5em 0;
}

.kg-gallery-container {
    display: flex;
    flex-direction: column;
}

.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}

.kg-gallery-row:not(:first-of-type) {
    margin-top: 6px;
}

.kg-gallery-image {
    flex: 1 1 0;
    min-width: 0;
    /* cap so a row left with a single image stays ~half width (centred)
       rather than ballooning to the full gallery width */
    max-width: calc(50% - 3px);
    margin-right: 6px;
}

.kg-gallery-image:last-of-type {
    margin-right: 0;
}

.kg-gallery-image img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
}

@media (max-width: 650px) {
    .kg-gallery-row {
        flex-direction: column;
    }
    .kg-gallery-image {
        margin: 0 0 6px 0;
    }
}
