/* ==================================================================
   BLOG INDEX  (blog/index.php only — loaded via $page['css'], 2026-11-12)
   ------------------------------------------------------------------
   Listing redesign: dark hero like the articles (blog-post.css), the
   newest guide as a wide featured card, a uniform 3-column grid, topic
   filters and "Load more" (blog-index.js). Site tokens only (site.css).
   Contrast: --brand-700 on --brand-tint 6.6:1 · --ink-70 on white 9.3:1 ·
   --ink-50 on white 4.8:1 · #fff / rgba(255,255,255,.72) on ink > 9:1.
   ================================================================== */

/* Hero ------------------------------------------------------------- */
.bi-crumbs { padding-bottom: 18px; }
.bi-hero { padding: clamp(40px, 5.5vw, 80px) 0 clamp(40px, 5.5vw, 76px); overflow: hidden; }
.bi-hero .eyebrow { margin-bottom: 16px; }
.bi-title {
    font-size: clamp(2.2rem, 1.4rem + 3vw, 3.8rem);
    line-height: 1.08; letter-spacing: -.01em;
    margin: 0 0 18px; text-wrap: balance;
}
.bi-lede {
    max-width: 38rem; margin: 0;
    font-size: clamp(1.02rem, .97rem + .3vw, 1.16rem); line-height: 1.7;
    text-wrap: pretty;
}
.bi-stats {
    display: grid; grid-template-columns: repeat(3, 1fr);
    margin: 0; border-top: 1px solid rgba(255,255,255,.14);
}
.bi-stats > div { margin-top: 18px; }
.bi-stats > div + div { padding-left: 18px; border-left: 1px solid rgba(255,255,255,.14); }
.bi-stats dt {
    font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
    color: rgba(255,255,255,.72);
}
.bi-stats dd {
    margin: 4px 0 0; color: #fff;
    font-family: var(--font-display); font-size: clamp(1.6rem, 1.2rem + 1.2vw, 2.2rem); line-height: 1.1;
}

/* Shared bits ------------------------------------------------------ */
.bi-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.bi-tag, .bi-badge {
    display: inline-flex; align-items: center;
    padding: 4px 10px; border-radius: 999px;
    font-size: .74rem; font-weight: 600; letter-spacing: .04em; line-height: 1.3;
}
.bi-tag { background: var(--brand-tint); color: var(--brand-700); }
.bi-badge--new { background: var(--ink); color: #fff; }
.bi-foot {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    margin: auto 0 0; padding-top: 16px; border-top: 1px solid var(--line);
    font-size: .84rem; color: var(--ink-50);
}
.bi-go { font-weight: 600; color: var(--brand-700); white-space: nowrap; }
.bi-go::after { content: " →"; display: inline-block; transition: transform .2s ease; }

/* Typographic cover for guides without a photograph ---------------- */
.bi-cover {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: clamp(18px, 2.2vw, 26px);
    color: #fff;
    background:
        radial-gradient(120% 90% at 100% 0%, var(--bi-glow, rgba(79,140,255,.35)) 0%, transparent 60%),
        linear-gradient(160deg, var(--ink-800) 0%, var(--ink-900) 60%, #101826 100%);
}
.bi-cover::after {                       /* fine engineering grid */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(200deg, #000 10%, transparent 75%);
    -webkit-mask-image: linear-gradient(200deg, #000 10%, transparent 75%);
}
.bi-cover > * { position: relative; z-index: 1; }
.bi-cover-kicker { font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.72); }
.bi-cover-topic { font-family: var(--font-display); font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.1rem); line-height: 1.1; }
.bi-cover-read { font-size: .8rem; color: rgba(255,255,255,.72); }
.bi-cover--buying-guide   { --bi-glow: rgba(226,32,140,.42); }
.bi-cover--technical      { --bi-glow: rgba(79,140,255,.42); }
.bi-cover--compliance     { --bi-glow: rgba(216,163,58,.38); }
.bi-cover--automation     { --bi-glow: rgba(45,212,191,.32); }
.bi-cover--cash-handling  { --bi-glow: rgba(34,197,94,.30); }

/* Featured (newest) guide ------------------------------------------ */
.bi-featured-wrap { padding: clamp(32px, 4vw, 56px) 0 0; }
.bi-featured {
    position: relative;
    display: grid; grid-template-columns: 1fr;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-xl);
    overflow: hidden;
    box-shadow: var(--sh-sm);
    transition: box-shadow .25s ease, border-color .25s ease;
}
@media (min-width: 992px) { .bi-featured { grid-template-columns: 1.15fr 1fr; } }
.bi-featured-media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
@media (min-width: 992px) { .bi-featured-media { aspect-ratio: auto; min-height: 360px; } }
.bi-featured-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.bi-featured-body { display: flex; flex-direction: column; padding: clamp(24px, 3.2vw, 44px); }
.bi-featured-title {
    font-family: var(--font-display); font-weight: 400;
    font-size: clamp(1.5rem, 1.15rem + 1.2vw, 2.1rem); line-height: 1.2;
    margin: 0 0 14px; text-wrap: balance;
}
.bi-featured-title a { color: var(--ink); text-decoration: none; }
.bi-featured-excerpt { color: var(--ink-70); line-height: 1.7; margin: 0 0 20px; }
.bi-featured:hover { border-color: var(--line-strong); box-shadow: var(--sh-lg); }
.bi-featured:hover .bi-featured-media img { transform: scale(1.03); }

/* Section head + topic filters ------------------------------------- */
.bi-list { padding-top: clamp(40px, 5vw, 72px); }
.bi-list-head { margin-bottom: clamp(22px, 3vw, 32px); }
.bi-list-title { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0 0 16px; }
.bi-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.bi-chip {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 44px; padding: 8px 16px;
    border: 1px solid var(--line-strong); border-radius: 999px;
    background: var(--surface); color: var(--ink-70);
    font-size: .9rem; font-weight: 600; line-height: 1.2;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.bi-chip-n {
    min-width: 24px; padding: 2px 7px; border-radius: 999px;
    background: var(--surface-3); color: var(--ink-70);
    font-size: .76rem; text-align: center;
}
.bi-chip:hover { border-color: var(--ink-40); color: var(--ink); }
.bi-chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.bi-chip[aria-pressed="true"] .bi-chip-n { background: rgba(255,255,255,.18); color: #fff; }
.bi-chip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Grid cards ------------------------------------------------------- */
.bi-card {
    position: relative; height: 100%;
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r-lg);
    overflow: hidden;
    transition: border-color .25s ease, box-shadow .25s ease, transform .25s ease;
}
.bi-card-media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.bi-card-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.bi-card-body { display: flex; flex-direction: column; flex: 1; padding: 20px 22px 18px; }
.bi-card-title { font-size: 1.12rem; font-weight: 700; line-height: 1.35; margin: 0 0 10px; text-wrap: pretty; }
.bi-card-title a { color: var(--ink); text-decoration: none; }
.bi-card-excerpt {
    margin: 0 0 4px; font-size: .93rem; line-height: 1.6; color: var(--ink-70);
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.bi-card:hover { border-color: var(--line-strong); box-shadow: var(--sh-md); transform: translateY(-3px); }
.bi-card:hover .bi-card-media img { transform: scale(1.04); }
.bi-card:hover .bi-go::after, .bi-featured:hover .bi-go::after { transform: translateX(3px); }
.bi-card-title a:hover, .bi-featured-title a:hover { color: var(--brand-700); }

/* Whole card is the link (stretched-link): show focus on the card. */
.bi-card:focus-within, .bi-featured:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.bi-card .stretched-link:focus-visible, .bi-featured .stretched-link:focus-visible { outline: none; }

/* The newest guide is already the featured card: in the "All" view its grid
   copy stays hidden (also without JS). A topic filter shows it again. */
[data-bi-grid] > [data-featured]:not(.bi-in-filter) { display: none; }

/* Load more -------------------------------------------------------- */
.bi-more { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: clamp(32px, 4vw, 48px); text-align: center; }
.bi-more[hidden] { display: none; }
.bi-more-status { margin: 0; font-size: .9rem; color: var(--ink-50); }
.bi-progress { width: min(240px, 70%); height: 3px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bi-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .3s ease; }
.bi-more-btn {
    min-height: 48px; padding: 12px 28px; margin-top: 6px;
    border: 1px solid var(--ink); border-radius: 999px;
    background: var(--surface); color: var(--ink);
    font-weight: 600; font-size: .95rem; cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
.bi-more-btn:hover { background: var(--ink); color: #fff; }
.bi-more-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.bi-more-btn[hidden] { display: none; }

.bi-topic-select { max-width: 360px; }
.bi-topic-select .form-label { font-size: .84rem; font-weight: 600; color: var(--ink-70); margin-bottom: 6px; }
.bi-topic-select .form-select { min-height: 48px; border: 1px solid var(--ink-40); border-radius: var(--r-sm); font-weight: 600; color: var(--ink); }
.bi-topic-select .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29,78,216,.25); }
@media (max-width: 767.98px) { .bi-filters { display: none; } }
@media (min-width: 768px)    { .bi-topic-select { display: none; } }

@media (max-width: 575.98px) {
    .bi-stats dd { font-size: 1.5rem; }
    .bi-featured-excerpt {
        display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
    }
    .bi-card-body { padding: 18px 18px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .bi-card, .bi-card-media img, .bi-featured, .bi-featured-media img, .bi-go::after,
    .bi-chip, .bi-more-btn, .bi-progress span { transition: none; }
    .bi-card:hover { transform: none; }
    .bi-card:hover .bi-card-media img, .bi-featured:hover .bi-featured-media img { transform: none; }
}
