/* ============================================================
   Smart Homepage — Trending / Main Feed / Sidebar
   Loaded only on the front page, on top of site-mode.css.
   ============================================================ */

.hbp-home-layout {
    display: block;
}

.hbp-home-col-main { min-width: 0; }
.hbp-home-col-sidebar { margin-top: 32px; }

@media (min-width: 1024px) {
    .hbp-home-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 320px;
        gap: 28px;
        align-items: start;
    }
    .hbp-home-col-sidebar { position: sticky; top: calc(var(--hbp-topbar-h, 64px) + 16px); margin-top: 0; }
}

/* ───────────────────── Trending Right Now ───────────────────── */

.hbp-trending-box {
    background: var(--hbp-gray-50, #F8FAFC);
    border-radius: var(--hbp-radius, 12px);
    padding: 16px 18px 8px;
    margin-bottom: 22px;
}

.hbp-trending-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.hbp-live-dot {
    position: relative;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--hbp-danger, #DC2626);
    flex-shrink: 0;
}
.hbp-live-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--hbp-danger, #DC2626);
    opacity: .35;
    animation: hbp-live-pulse 1.6s ease-out infinite;
}
@keyframes hbp-live-pulse {
    0%   { transform: scale(.6); opacity: .5; }
    100% { transform: scale(1.9); opacity: 0; }
}

.hbp-trending-title {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-color, #1E293B);
    text-transform: uppercase;
    letter-spacing: .03em;
}

.hbp-trend-list { list-style: none; margin: 0; padding: 0; }

.hbp-trend-item { border-top: 1px solid var(--hbp-gray-100, #F1F5F9); }
.hbp-trend-item:first-child { border-top: none; }

.hbp-trend-link {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 10px 4px;
    text-decoration: none;
    border-radius: var(--hbp-radius-sm, 8px);
    transition: background .15s ease;
}
.hbp-trend-link:hover { background: var(--hbp-primary-xlight, #EFF6FF); }
.hbp-trend-link:hover .hbp-trend-title { color: var(--hbp-primary); }

.hbp-trend-rank {
    flex-shrink: 0;
    width: 26px;
    font-size: 13px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--hbp-primary);
    opacity: .55;
}

.hbp-trend-title {
    font-size: 14.5px;
    line-height: 1.4;
    color: var(--text-color, #1E293B);
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hbp-trending-empty {
    padding: 14px 4px 18px;
    font-size: 13px;
    color: var(--hbp-gray-500, #64748B);
}

/* ───────────────────── Smart main feed ───────────────────── */

.hbp-smart-feed { display: flex; flex-direction: column; gap: 14px; }

/* Featured (rank #1 of the page) — bigger, image-led */
.hbp-feed-featured {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--hbp-gray-50, #F8FAFC);
    border-radius: var(--hbp-radius-lg, 14px);
    overflow: hidden;
    text-decoration: none;
    transition: background .2s ease;
}
.hbp-feed-featured:hover { background: var(--hbp-gray-100, #F1F5F9); }
.hbp-feed-featured-thumb { aspect-ratio: 16/8; background: linear-gradient(135deg, var(--hbp-primary-xlight, #EFF6FF), var(--hbp-primary-light, #DBEAFE)); }
.hbp-feed-featured-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hbp-feed-featured-body { padding: 16px 18px 18px; }

@media (min-width: 640px) {
    .hbp-feed-featured { grid-template-columns: 46% 1fr; }
    .hbp-feed-featured-thumb { aspect-ratio: auto; height: 100%; }
}

.hbp-feed-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--hbp-primary);
    margin-bottom: 8px;
}
.hbp-feed-kicker .dashicons { font-size: 14px; width: 14px; height: 14px; }

.hbp-feed-featured-title {
    font-size: 21px;
    line-height: 1.3;
    font-weight: 800;
    color: var(--text-color, #1E293B);
    margin: 0 0 8px;
}
.hbp-feed-featured-title a { color: inherit; text-decoration: none; }

.hbp-feed-excerpt {
    font-size: 14px;
    line-height: 1.6;
    color: var(--hbp-gray-600, #475569);
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.hbp-feed-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: var(--hbp-gray-500, #64748B);
}
.hbp-feed-meta img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.hbp-feed-author { display: inline-flex; align-items: center; gap: 4px; }
.hbp-feed-meta-sep { color: var(--hbp-gray-300, #CBD5E1); }
.hbp-feed-stats { margin-left: auto; display: flex; gap: 10px; }
.hbp-feed-stats span { display: inline-flex; align-items: center; gap: 3px; }

/* Compact row items (everything after the featured post) */
.hbp-feed-row {
    display: flex;
    gap: 14px;
    background: var(--hbp-gray-50, #F8FAFC);
    border-radius: var(--hbp-radius, 10px);
    padding: 12px;
    text-decoration: none;
    transition: background .15s ease;
}
.hbp-feed-row:hover { background: var(--hbp-gray-100, #F1F5F9); }

.hbp-feed-row-thumb {
    flex-shrink: 0;
    width: 96px;
    height: 72px;
    border-radius: var(--hbp-radius-sm, 8px);
    overflow: hidden;
    background: linear-gradient(135deg, var(--hbp-primary-xlight, #EFF6FF), var(--hbp-primary-light, #DBEAFE));
}
.hbp-feed-row-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hbp-feed-row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; justify-content: center; }

.hbp-feed-row-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text-color, #1E293B);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hbp-feed-row-title a { color: inherit; text-decoration: none; }
.hbp-feed-row:hover .hbp-feed-row-title { color: var(--hbp-primary); }

@media (min-width: 640px) {
    .hbp-feed-row { padding: 14px 16px; }
    .hbp-feed-row-thumb { width: 120px; height: 84px; }
}

/* Main post list rows (homepage + archive) — hide the date on mobile.
   Only .hbp-feed-row is targeted; .hbp-feed-featured (the big post) keeps
   its date at all widths. */
@media (max-width: 639px) {
    .hbp-feed-row .hbp-feed-meta time { display: none; }
    .hbp-feed-row .hbp-feed-meta-sep { display: none; }
}

/* ───────────────────── Sidebar ───────────────────── */

.hbp-sidebar-card {
    background: var(--hbp-gray-50, #F8FAFC);
    border-radius: var(--hbp-radius, 12px);
    padding: 16px 18px;
    margin-bottom: 18px;
}

.hbp-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.hbp-sidebar-title {
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--hbp-gray-600, #475569);
}
.hbp-sidebar-more { font-size: 12px; font-weight: 700; color: var(--hbp-primary); text-decoration: none; }

.hbp-sidebar-list { list-style: none; margin: 0; padding: 0; }
.hbp-sidebar-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--hbp-gray-100, #F1F5F9); }
.hbp-sidebar-item:first-child { border-top: none; }
.hbp-sidebar-item img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }

.hbp-sidebar-item-body { min-width: 0; flex: 1; }
.hbp-sidebar-item-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-color, #1E293B);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}
.hbp-sidebar-item-title:hover { color: var(--hbp-primary); }
.hbp-sidebar-item-sub { font-size: 12px; color: var(--hbp-gray-500, #64748B); }

.hbp-interest-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hbp-interest-chip {
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--hbp-primary-xlight, #EFF6FF);
    color: var(--hbp-primary);
    text-decoration: none;
    transition: background .15s ease;
}
.hbp-interest-chip:hover { background: var(--hbp-primary-light, #DBEAFE); }
.hbp-interest-chip-count {
    font-weight: 700;
    opacity: .65;
    margin-left: 5px;
}

.hbp-sidebar-empty { font-size: 13px; color: var(--hbp-gray-500, #64748B); padding: 4px 0 8px; }

.hbp-sidebar-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 4px;
    padding: 9px 14px;
    border-radius: var(--hbp-radius, 10px);
    background: var(--button-color, var(--hbp-primary));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
}

.hbp-creator-score {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--hbp-success, #16A34A);
    flex-shrink: 0;
}

/* ───────────────────── Single post — left/right sidebars ─────────────────────
   .hbp-single-wrap (the article column itself) is untouched — it keeps its own
   max-width:720px + centering exactly as before. This grid just gives it two
   optional neighbour columns. ────────────────────────────────────────────── */

.hbp-single-layout {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

.hbp-single-col-main { min-width: 0; }

.hbp-single-col-left,
.hbp-single-col-right { display: none; }

/* .hbp-single-wrap (the article column) already adds its own horizontal
   padding, so on mobile the two stacked side-paddings were leaving too
   little width for the article — squeezing .hbp-engage-bar until its
   buttons (vote pill / share / tip / report) wrapped or overflowed
   awkwardly. Trim the outer layout's side padding on small screens and
   let the article's own padding do the work. */
@media (max-width: 640px) {
    .hbp-single-layout {
        padding: 0 0 40px;
    }
}

@media (min-width: 1280px) {
    .hbp-single-layout {
        display: grid;
        grid-template-columns: 240px minmax(0, 1fr) 300px;
        gap: 10px;
        align-items: start;
    }
    .hbp-single-col-left,
    .hbp-single-col-right { display: block; }
    .hbp-single-col-left { order: 1; }
    .hbp-single-col-main { order: 2; }
    .hbp-single-col-right { order: 3; }
    .hbp-single-sticky { position: sticky; top: calc(var(--hbp-topbar-h, 64px) + 20px); }
}

/* ───────────────────── Archive header (category/tag) ───────────────────── */

.hbp-archive-wrap-v2 { padding-top: 8px; }

.hbp-archive-header-v2 { margin-bottom: 24px; }

.hbp-archive-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.hbp-archive-subcount {
    font-size: 12px;
    font-weight: 700;
    color: var(--hbp-gray-500, #64748B);
}
.hbp-archive-subcount::after { content: " subscribers"; font-weight: 600; }

.hbp-archive-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.hbp-archive-title-v2 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text-color, #1E293B);
    margin: 0;
}

.hbp-archive-desc-v2 {
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--hbp-gray-600, #475569);
    margin: 10px 0 6px;
    max-width: 640px;
}

.hbp-archive-count-v2 {
    display: inline-block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--hbp-gray-500, #64748B);
    margin-top: 4px;
}
