/* ==========================================================================
   Hide dropinblog's own "Blog" homepage heading block — we render our own
   <h1>Blog</h1> at the top of .nl-blog above #dib-posts.
   ========================================================================== */

#dib-posts .dib-heading {
    display: none !important;
}

/* Hide dropinblog's horizontal category scroll arrows — we present the
   category nav in the top-right toolbar instead of a scrollable strip. */
#dib-posts .dib-scroll-arrow {
    display: none !important;
}

/* ==========================================================================
   Top-right blog toolbar — holds the relocated dropinblog category menu
   (moved in by the script in index.ejs). Aligned horizontally with the
   masthead: same 60px left margin, right edge flush with the compass cell.
   ========================================================================== */

.nl-blog-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px 24px;
    margin-left: 60px;       /* match .nl-masthead's 60px left offset */
    padding: 14px 24px;      /* 24px right matches .nl-mh-compass right padding */
    min-height: 32px;
}

/* Treat immediate children as inline items regardless of what dropinblog
   wraps them in. */
.nl-blog-toolbar > * {
    margin: 0 !important;
}

/* Category menu — dropinblog renders this as a <ul class="dib-cat-menu">
   with <li> children. Flatten it into a horizontal row of nav links. */
.nl-blog-toolbar .dib-cat-menu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 24px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nl-blog-toolbar .dib-cat-menu li {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nl-blog-toolbar .dib-cat-menu li::marker {
    content: '';
}

.nl-blog-toolbar .dib-cat-menu a {
    font-family: 'Roobert Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #222049;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    transition: opacity 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nl-blog-toolbar .dib-cat-menu a:hover {
    opacity: 0.7;
    color: #222049;
    text-decoration: underline;
}

/* Magnifying-glass search toggle — strip its underline, keep the icon in ink */
.nl-blog-toolbar .dib-cat-menu li.dib-search-toggle a {
    text-decoration: none !important;
}

.nl-blog-toolbar .dib-cat-menu li.dib-search-toggle label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.nl-blog-toolbar .dib-cat-menu li.dib-search-toggle svg {
    width: 16px;
    height: 16px;
    fill: #222049;
    display: block;
}

/* On narrow viewports collapse the toolbar to a single left-aligned row
   and drop the masthead-matching 60px offset. */
@media (max-width: 600px) {
    .nl-blog-toolbar {
        justify-content: flex-start;
        margin-left: 0;
        padding: 12px clamp(20px, 4vw, 24px);
    }
}

/* ==========================================================================
   Blog list — post cards styled to match the cream-theme pages.

   Dropinblog DOM:
     .dib-post-wrap
       a.dib-post
         img.dib-post-featured-image
         div.dib-post-text
           h2.dib-post-title.dib-highlight
           p.dib-meta-text (spans: .dib-meta-author .dib-meta-date .dib-meta-readtime)
           p.dib-category-text

   IMPORTANT: dropinblog injects its own CSS (via an inline <style> tag in
   #dib-template-2) that differentiates the first post (treated as a "hero"
   card at 100% width / 50-50 split) from the rest (treated as 32%-width
   thumbnails in a 3-up grid). We force every card into the same horizontal
   layout by overriding those rules explicitly — scoped by #dib-template-2
   to match their specificity.
   ========================================================================== */

/* Force the post wrap into a vertical stack regardless of dropinblog's
   defaults (flex-wrap with .dib-col-3 etc). */
#dib-posts #dib-template-2 .dib-post-wrap {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    gap: 20px !important;
    margin-top: 24px !important;
}

/* Every card — override both the first-child "hero" rule and the non-first
   3-up column rules so they render identically. */
#dib-posts #dib-template-2 a.dib-post,
#dib-posts #dib-template-2.dib-col-3 a.dib-post,
#dib-posts #dib-template-2.dib-col-3.dib-hero a.dib-post:not(:first-child),
#dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child {
    display: grid !important;
    grid-template-columns: minmax(220px, 38%) 1fr !important;
    align-items: stretch !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 240px;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.35) !important;
    border: 1px solid rgba(34, 32, 73, 0.25) !important;
    border-radius: 4px !important;
    text-decoration: none !important;
    color: #222049 !important;
    box-shadow: none !important;
    transition: background 0.2s ease, border-color 0.2s ease;
}

#dib-posts #dib-template-2 a.dib-post:hover {
    background: rgba(184, 217, 213, 0.25) !important;
    border-color: #222049 !important;
    box-shadow: none !important;
}

/* Image — fills left grid cell. Override dropinblog's aspect-ratio:16/9,
   border-radius, and the hero card's 50% max-width. */
#dib-posts #dib-template-2 a.dib-post img.dib-post-featured-image,
#dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child img.dib-post-featured-image {
    grid-column: 1;
    grid-row: 1;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    min-height: 240px !important;
    aspect-ratio: auto !important;
    object-fit: cover !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    vertical-align: top !important;
}

/* Text column — second grid cell. Override dropinblog's center-align and
   50% max-width on the hero card. */
#dib-posts #dib-template-2 a.dib-post .dib-post-text,
#dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child .dib-post-text {
    grid-column: 2;
    grid-row: 1;
    width: auto !important;
    max-width: 100% !important;
    padding: clamp(20px, 2.4vw, 32px) !important;
    text-align: left !important;
    position: static !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    min-width: 0; /* allow text to shrink inside grid cell */
    box-sizing: border-box;
}

/* Title — override dropinblog's -webkit-line-clamp:2 + size */
#dib-posts #dib-template-2 .dib-post-text h2,
#dib-posts #dib-template-2 .dib-post-text h2.dib-post-title,
#dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child .dib-post-text h2 {
    font-family: 'Manier', 'Fraunces', Georgia, serif !important;
    font-size: clamp(22px, 2.4vw, 32px) !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    letter-spacing: -0.4px !important;
    color: #222049 !important;
    margin: 0 0 12px !important;
    padding: 0 !important;
    text-align: left !important;
    text-transform: none !important;
    display: block !important;
    overflow: visible !important;
    -webkit-line-clamp: unset !important;
    -webkit-box-orient: unset !important;
    text-wrap: balance;
}

/* Meta — override dropinblog's position:absolute */
#dib-posts #dib-template-2 .dib-post-text p.dib-meta-text,
#dib-posts #dib-template-2 .dib-post-text p.dib-meta-text.dib-no-author,
#dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child .dib-post-text .dib-meta-text,
#dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child .dib-post-text .dib-meta-text.dib-no-author {
    position: static !important;
    left: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 12px 0 0 !important;
    font-family: 'Roobert Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace !important;
    font-size: 12px !important;
    letter-spacing: 1.6px !important;
    text-transform: uppercase !important;
    color: rgba(34, 32, 73, 0.7) !important;
    line-height: 1.6 !important;
    text-align: left !important;
}

#dib-posts #dib-template-2 .dib-post-text .dib-meta-text .dib-meta-item {
    color: rgba(34, 32, 73, 0.7);
}

#dib-posts #dib-template-2 .dib-post-text .dib-meta-text .dib-meta-author {
    color: #222049;
    font-weight: 500;
}

#dib-posts #dib-template-2 .dib-post-text .dib-meta-text .dib-meta-item + .dib-meta-item::before {
    content: '·';
    margin: 0 10px;
    color: rgba(34, 32, 73, 0.5);
}

/* Category badge — override dropinblog's opacity:0.7 and align left */
#dib-posts #dib-template-2 .dib-post-text p.dib-category-text {
    font-family: 'Roobert Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace !important;
    font-size: 12px !important;
    letter-spacing: 1.6px !important;
    text-transform: uppercase !important;
    color: rgba(34, 32, 73, 0.7) !important;
    opacity: 1 !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    text-align: left !important;
    font-weight: 400 !important;
}

/* Stack image on top on narrow viewports */
@media (max-width: 640px) {
    #dib-posts #dib-template-2 a.dib-post,
    #dib-posts #dib-template-2.dib-col-3 a.dib-post,
    #dib-posts #dib-template-2.dib-col-3.dib-hero a.dib-post:not(:first-child),
    #dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child {
        grid-template-columns: 1fr !important;
        grid-template-rows: auto auto !important;
        min-height: 0;
    }
    #dib-posts #dib-template-2 a.dib-post img.dib-post-featured-image,
    #dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child img.dib-post-featured-image {
        grid-column: 1;
        grid-row: 1;
        aspect-ratio: 16 / 9 !important;
        min-height: 180px !important;
        max-height: 260px;
    }
    #dib-posts #dib-template-2 a.dib-post .dib-post-text,
    #dib-posts #dib-template-2.dib-hero.dib-list .dib-post-wrap a.dib-post:first-child .dib-post-text {
        grid-column: 1;
        grid-row: 2;
        padding: 20px !important;
    }
}

/* Stack on narrow viewports: image on top, text below */
@media (max-width: 640px) {
    .dib-post-wrap a.dib-post {
        flex-direction: column;
    }
    .dib-post-wrap a.dib-post .dib-post-featured-image,
    .dib-post-wrap a.dib-post > img {
        flex: 0 0 auto;
        max-width: 100%;
    }
    .dib-post-wrap a.dib-post .dib-post-featured-image img,
    .dib-post-wrap a.dib-post > img {
        min-height: 180px;
        max-height: 260px;
    }
    .dib-post-wrap a.dib-post > *:not(.dib-post-featured-image):not(img) {
        padding-left: 20px;
        padding-right: 20px;
    }
    .dib-post-wrap a.dib-post .dib-post-title {
        margin: 20px 0 10px !important;
    }
    .dib-post-wrap a.dib-post .dib-meta-text {
        margin: 8px 0 20px;
    }
}

#dib-posts a {
    color: #222049;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: opacity 0.2s ease;
}

#dib-posts a:hover {
    opacity: 0.7;
    color: #222049;
    text-decoration: underline;
}

#dib-posts h1,
#dib-posts h2,
#dib-posts h3,
#dib-posts h4 {
    font-family: 'Manier', 'Fraunces', Georgia, serif;
    color: #222049;
    font-weight: 500;
    line-height: 1.2;
}

#dib-posts h1 {
    font-size: clamp(32px, 3.6vw, 48px);
    margin: 0 0 1rem;
    letter-spacing: -0.8px;
}

#dib-posts h2 {
    font-size: clamp(22px, 2.4vw, 28px);
    margin: 2.2rem 0 1rem;
}

#dib-posts h3 {
    font-size: clamp(18px, 1.8vw, 21px);
    margin: 1.8rem 0 0.8rem;
}

#dib-posts h4 {
    font-size: 17px;
    margin: 1.4rem 0 0.6rem;
}

#dib-posts p,
#dib-posts li {
    font-family: 'Roobert VF', 'Roobert', 'Inter', sans-serif;
    color: #222049;
    line-height: 1.7;
    font-size: 16px;
}

.dib-meta-text,
.dib-post-date,
.dib-meta-readtime,
.dib-meta-author,
.dib-post-category-text {
    font-family: 'Roobert Mono', ui-monospace, monospace;
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: rgba(34, 32, 73, 0.7);
}

.dib-meta-author a,
.dib-post-category-text a {
    color: #222049;
    text-decoration: none;
}

.dib-meta-author a:hover,
.dib-post-category-text a:hover {
    opacity: 0.7;
    color: #222049;
}

#dib-posts ul,
#dib-posts ol {
    color: #222049;
    margin: 0 0 16px;
    padding-left: 24px;
}

#dib-posts ul li::marker {
    color: #222049;
}

#dib-posts blockquote {
    background: rgba(184, 217, 213, 0.25);
    border-left: 3px solid #222049;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
    color: #222049;
    font-style: italic;
    border-radius: 0;
}

#dib-posts code {
    background: rgba(34, 32, 73, 0.08);
    color: #222049;
    padding: 0.15rem 0.4rem;
    border-radius: 2px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.9em;
}

#dib-posts pre {
    background: rgba(34, 32, 73, 0.06);
    border: 1px solid rgba(34, 32, 73, 0.2);
    padding: 1.25rem;
    border-radius: 4px;
    overflow-x: auto;
}

.dib-toc {
    background: rgba(255, 255, 255, 0.35) !important;
    border: 1px solid rgba(34, 32, 73, 0.25);
    border-radius: 4px;
    padding: 1.25rem 1.5rem;
    margin: 1.5rem 0;
}

.dib-toc summary {
    cursor: pointer;
    margin-bottom: 1rem;
    color: #222049;
}

.dib-toc h2 {
    font-family: 'Manier', 'Fraunces', Georgia, serif;
    color: #222049;
    margin: 0;
    font-size: clamp(18px, 1.6vw, 20px);
}

.dib-toc ul {
    margin-top: 0;
}

.dib-toc a {
    color: rgba(34, 32, 73, 0.75);
    text-decoration: none;
}

.dib-toc a:hover {
    color: #222049;
}

.dib-post-back-link {
    color: #222049 !important;
    text-decoration: underline !important;
    text-underline-offset: 4px;
    text-decoration-thickness: 1px;
    font-family: 'Roobert Mono', ui-monospace, monospace;
    font-size: 12px;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    display: inline-block;
    margin: 1.5rem 0;
    background: transparent !important;
}

.dib-post-back-link:hover {
    opacity: 0.7;
    color: #222049 !important;
    background: transparent !important;
}

.dib-related {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(34, 32, 73, 0.2);
}

.dib-related h2 {
    font-family: 'Manier', 'Fraunces', Georgia, serif;
    color: #222049;
    font-size: clamp(22px, 2.4vw, 28px);
    margin-bottom: 1.5rem;
}

.dib-related-post {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(34, 32, 73, 0.25);
    border-radius: 4px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    transition: background 0.2s ease, border-color 0.2s ease;
    cursor: pointer;
}

.dib-related-post:hover {
    background: rgba(184, 217, 213, 0.25);
    border-color: #222049;
    transform: none;
}

.dib-related-post .dib-post-title a {
    color: #222049;
    font-family: 'Manier', 'Fraunces', Georgia, serif;
    font-size: clamp(17px, 1.6vw, 20px);
}

.dib-related-post .dib-post-title a:hover {
    color: #222049;
    opacity: 0.7;
}

#dib-audio {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid rgba(34, 32, 73, 0.25);
    border-radius: 4px;
    padding: 1.25rem;
    margin: 1.5rem 0;
}

#dib-posts .btn,
#dib-posts button[type="submit"] {
    background: #222049;
    color: #E8E4DB;
    border: none;
    border-radius: 2px;
    padding: 0.7rem 1.4rem;
    font-family: 'Roobert VF', 'Roobert', 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

#dib-posts .btn:hover,
#dib-posts button[type="submit"]:hover {
    opacity: 0.85;
    color: #E8E4DB;
    background: #222049;
    transform: none;
}

#dib-posts input[type="text"],
#dib-posts input[type="email"],
#dib-posts textarea {
    background: rgba(255, 255, 255, 0.35);
    border: 1px solid #222049;
    border-radius: 2px;
    color: #222049;
    padding: 0.7rem 1rem;
    font-family: 'Roobert VF', 'Roobert', 'Inter', sans-serif;
    width: 100%;
}

#dib-posts input:focus,
#dib-posts textarea:focus {
    border-color: #222049;
    background: rgba(255, 255, 255, 0.6);
    outline: none;
}

#dib-posts table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    background: transparent;
}

#dib-posts th {
    background: rgba(34, 32, 73, 0.08);
    color: #222049;
    font-family: 'Roobert VF', 'Roobert', 'Inter', sans-serif;
    font-weight: 500;
    padding: 0.75rem 1rem;
    text-align: left;
    border: 1px solid rgba(34, 32, 73, 0.35);
}

#dib-posts td {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(34, 32, 73, 0.2);
    color: #222049;
}

#dib-posts tr:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* monkey patch */
.dib-post-wrap a.dib-post {
    align-items: normal !important;
}

@media (max-width: 600px) {
    #dib-posts h1 { font-size: 2rem; }
    #dib-posts h2 { font-size: 1.5rem; }
    #dib-posts h3 { font-size: 1.2rem; }
}
