/* News Harvester — enhanced News single (minimalist, theme-agnostic) */
/* All selectors are namespaced .nhx-* so they won't collide with the theme. */

.nhx-container{
    --nhx-aside-w: 280px;
    --nhx-gap: 40px;
    --nhx-sticky-top: 90px;
    --nhx-ink: #1a1a1a;
    --nhx-muted: #6b7280;
    --nhx-line: #e5e7eb;
    --nhx-accent: #2563eb;
    --nhx-radius: 8px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 20px 60px;
    box-sizing: border-box;
}
.nhx-container *{ box-sizing: border-box; }

/* Breadcrumb */
.nhx-breadcrumb{
    font-size: 13px;
    color: var(--nhx-muted);
    margin: 0 0 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.nhx-breadcrumb a{ color: var(--nhx-muted); text-decoration: none; }
.nhx-breadcrumb a:hover{ color: var(--nhx-accent); text-decoration: underline; }
.nhx-breadcrumb .nhx-sep{ color: #c4c8d0; }
.nhx-breadcrumb .nhx-current{ color: var(--nhx-ink); }

/* ── Grid layout: sidebar (TOC + related) / article ─────────────────────── */
.nhx-layout{
    display: grid;
    gap: var(--nhx-gap);
    align-items: start;
}
/* sidebar on the LEFT (default) */
.nhx-pos-left .nhx-layout{
    grid-template-columns: var(--nhx-aside-w) minmax(0, 1fr);
    grid-template-areas: "aside article";
}
/* sidebar on the RIGHT */
.nhx-pos-right .nhx-layout{
    grid-template-columns: minmax(0, 1fr) var(--nhx-aside-w);
    grid-template-areas: "article aside";
}
.nhx-layout.nhx-no-aside{ grid-template-columns: minmax(0,1fr); grid-template-areas: "article"; }

/* The whole sidebar is sticky, so Contents AND More News follow together,
   with More News sitting directly beneath Contents. */
.nhx-aside{
    grid-area: aside;
    position: sticky;
    top: var(--nhx-sticky-top);
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-height: calc(100vh - var(--nhx-sticky-top) - 20px);
}
.nhx-article{ grid-area: article; min-width: 0; }

/* ── Article ─────────────────────────────────────────────────────────────── */
.nhx-title{
    font-size: clamp(1.6rem, 2.6vw, 2.3rem);
    line-height: 1.25;
    margin: 0 0 14px;
    color: var(--nhx-ink);
}
.nhx-meta{
    font-size: 14px;
    color: var(--nhx-muted);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.nhx-meta .nhx-dot{ color: #c4c8d0; }

/* Share row — sits directly under the date/author line */
.nhx-share{
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 4px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--nhx-line);
    position: relative;
}
.nhx-share-btn{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--nhx-line);
    color: var(--nhx-muted);
    background: #fff;
    cursor: pointer;
    transition: color .15s, border-color .15s, transform .15s;
    text-decoration: none;
    padding: 0;
}
.nhx-share-btn:hover{ transform: translateY(-1px); }
.nhx-fb:hover{ color: #1877f2; border-color: #1877f2; }
.nhx-x:hover{ color: #000; border-color: #000; }
.nhx-ig:hover{ color: #c13584; border-color: #c13584; }
.nhx-email:hover{ color: var(--nhx-accent); border-color: var(--nhx-accent); }
.nhx-copied{
    font-size: 12px;
    color: #16a34a;
    margin-left: 4px;
}

.nhx-feat{ margin: 22px 0; }
.nhx-feat img{ width: 100%; height: auto; border-radius: var(--nhx-radius); display: block; }

/* Content typography is intentionally light — it inherits most from the theme */
.nhx-content{ font-size: 1.05rem; line-height: 1.75; color: #222; }
.nhx-content > *{ margin: 0 0 1.1em; }
.nhx-content h2,.nhx-content h3,.nhx-content h4,.nhx-content h5{
    line-height: 1.3;
    margin: 1.6em 0 .5em;
    scroll-margin-top: var(--nhx-sticky-top); /* so anchored headings clear sticky headers */
}
.nhx-content blockquote{
    border-left: 3px solid var(--nhx-line);
    margin: 1.3em 0;
    padding: .3em 1.1em;
    color: #555;
}
.nhx-content img{ max-width: 100%; height: auto; }

/* In-content images placed by the Image Library */
.nhx-content .nh-inline-image{ margin: 1.4em 0; }
.nh-inline-image img{ width: 100%; height: auto; border-radius: 8px; display: block; }
.nh-inline-image figcaption{
    font-size: 13px;
    color: #6b7280;
    text-align: center;
    margin-top: 6px;
}

/* ── Article tags (bottom of body, link to /news/?nh_tag=slug) ─────────── */
.nhx-article-tags{
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding-top: 18px;
    border-top: 1px solid var(--nhx-line);
}
.nhx-article-tags-label{
    font-size: 12px;
    color: var(--nhx-muted);
    letter-spacing: .12em;
    text-transform: uppercase;
    margin-right: 4px;
}
.nhx-article-tag{
    display: inline-block;
    font-size: 13px;
    line-height: 1.2;
    padding: 6px 12px;
    border: 1px solid var(--nhx-line);
    border-radius: 999px;
    color: var(--nhx-ink);
    background: #fff;
    text-decoration: none;
    transition: border-color .15s, color .15s, background .15s;
}
.nhx-article-tag:hover{
    border-color: var(--nhx-ink);
    color: var(--nhx-ink);
}

/* ── TOC (Contents) ──────────────────────────────────────────────────────── */
.nhx-toc{
    grid-area: toc; /* used only on mobile, when .nhx-aside becomes display:contents */
    border: 1px solid var(--nhx-line);
    border-radius: var(--nhx-radius);
    padding: 6px 4px;
    background: #fff;
    font-size: 14px;
    flex: 0 0 auto;
}
.nhx-toc-head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 8px 12px;
    font: inherit;
    color: var(--nhx-ink);
}
.nhx-toc-title{ font-weight: 600; letter-spacing: .02em; }
.nhx-toc-caret{
    width: 8px; height: 8px;
    border-right: 2px solid var(--nhx-muted);
    border-bottom: 2px solid var(--nhx-muted);
    transform: rotate(45deg);
    transition: transform .2s;
    margin-right: 4px;
}
.nhx-toc.is-collapsed .nhx-toc-caret{ transform: rotate(-45deg); }
.nhx-toc-list{ display: block; max-height: none; overflow: visible; }
.nhx-toc.is-collapsed .nhx-toc-list{ display: none; }
.nhx-toc-list a{
    display: block;
    padding: 5px 12px;
    color: var(--nhx-muted);
    text-decoration: none;
    border-left: 2px solid transparent;
    line-height: 1.4;
    transition: color .12s, border-color .12s;
}
.nhx-toc-list a:hover{ color: var(--nhx-ink); }
.nhx-toc-list a.is-active{ color: var(--nhx-accent); border-left-color: var(--nhx-accent); font-weight: 600; }
.nhx-toc-list a.lvl-3{ padding-left: 26px; font-size: 13px; }
.nhx-toc-list a.lvl-4{ padding-left: 38px; font-size: 13px; }
.nhx-toc-list a.lvl-5{ padding-left: 50px; font-size: 12px; }

/* ── More News (sits directly under Contents, follows it as you scroll) ───── */
.nhx-related{
    grid-area: related; /* used only on mobile */
    border: 1px solid var(--nhx-line);
    border-radius: var(--nhx-radius);
    padding: 14px;
    background: #fff;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.nhx-related-title{
    font-weight: 600;
    font-size: 14px;
    color: var(--nhx-ink);
    margin-bottom: 10px;
    letter-spacing: .02em;
    flex: 0 0 auto;
}
.nhx-related-list{
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;   /* scrolls within the sticky sidebar if long */
    min-height: 0;
}
.nhx-related-item{ margin: 0; }
.nhx-related-item + .nhx-related-item{ border-top: 1px solid var(--nhx-line); }
.nhx-related-item a{
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 2px;
    text-decoration: none;
    color: var(--nhx-ink);
}
.nhx-related-thumb{ flex: 0 0 52px; }
.nhx-related-thumb img{ width: 52px; height: 52px; object-fit: cover; border-radius: 6px; display: block; }
.nhx-related-text{ display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.nhx-related-headline{
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--nhx-ink);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.nhx-related-item a:hover .nhx-related-headline{ color: var(--nhx-accent); }
.nhx-related-date{ font-size: 12px; color: var(--nhx-muted); }

/* custom slim scrollbar for the panels */
.nhx-toc-list::-webkit-scrollbar,
.nhx-related-list::-webkit-scrollbar{ width: 6px; }
.nhx-toc-list::-webkit-scrollbar-thumb,
.nhx-related-list::-webkit-scrollbar-thumb{ background: #d6dae1; border-radius: 3px; }

/* ── Mobile (≤ 980px): single column, TOC on top as a dropdown, related at bottom ── */
@media (max-width: 980px){
    .nhx-pos-left .nhx-layout,
    .nhx-pos-right .nhx-layout{
        grid-template-columns: 1fr;
        grid-template-areas:
            "toc"
            "article"
            "related";
        gap: 24px;
    }
    /* Dissolve the sticky sidebar box so TOC + related become grid items again */
    .nhx-aside{
        display: contents;
        position: static;
        max-height: none;
        overflow: visible;
    }
    .nhx-toc{
        position: sticky;
        top: 0;
        z-index: 20;
        margin: 0;
    }
    .nhx-toc-list{ max-height: 45vh; overflow-y: auto; }
    /* On mobile the TOC starts collapsed (acts as a dropdown) */
    .nhx-toc.is-collapsed .nhx-toc-list{ display: none; }
    .nhx-related{ display: block; }
    .nhx-related-list{ max-height: none; overflow: visible; } /* full height at the bottom */
}

@media (max-width: 600px){
    .nhx-container{ padding: 18px 14px 44px; }
    .nhx-share-btn{ width: 38px; height: 38px; } /* comfortable tap targets */
}
