/* ============================================================
   Key categories hub — 8 SEO-strong landing cards on homepage
   ============================================================ */

/* Высокая specificity (.entry-content + body) — перебивает любые GP/legacy-правила.
   minmax(0,1fr) — критично: без этого grid-items с длинными словами
   (maksehäirega, pangaväljavõtteta) расширяют ячейку больше 1fr → грид схлопывается в 2 кол. */
body .entry-content .bb26-key-cats,
.bb26-page .entry-content .bb26-key-cats,
.bb26-key-cats {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 14px;
    margin: 28px 0 36px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
.bb26-key-cats > .bb26-kc {
    min-width: 0 !important;
    max-width: 100% !important;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

/* КРИТИЧНО: wpautop в post_content вставляет <br/> между <a> карточками,
   и каждый <br/> становится отдельным grid-item — создавая пустые ячейки.
   Скрываем их display:none — это исключает из grid layout полностью. */
.bb26-key-cats > br,
.bb26-key-cats > p:empty {
    display: none !important;
}
.bb26-kc br {
    display: none !important;
}
.bb26-key-cats * { box-sizing: border-box; }

.bb26-kc {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 18px 16px;
    background: #fff;
    border: 1px solid #edf2f7;
    border-radius: 14px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    text-decoration: none !important;
    color: #1a202c !important;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
    position: relative;
    overflow: hidden;
}

.bb26-kc:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px rgba(240, 165, 0, 0.18);
    border-color: #f0a500;
    color: #1a202c !important;
}

.bb26-kc::after {
    content: '→';
    position: absolute;
    top: 16px;
    right: 18px;
    color: #f0a500;
    font-weight: 800;
    font-size: 18px;
    opacity: 0;
    transform: translateX(-6px);
    transition: opacity .2s, transform .2s;
}

.bb26-kc:hover::after {
    opacity: 1;
    transform: translateX(0);
}

.bb26-kc__icon {
    font-size: 30px;
    line-height: 1;
    margin-bottom: 8px;
    display: block;
}

.bb26-kc__title {
    font-size: 17px;
    font-weight: 800;
    color: #1a202c;
    line-height: 1.25;
    display: block;
    margin-bottom: 4px;
}

.bb26-kc__desc {
    font-size: 13px;
    color: #4a5568;
    line-height: 1.4;
    display: block;
}

/* Accent card — для "Uued laenud" — выделение жёлтым */
.bb26-kc--accent {
    background: linear-gradient(135deg, #fff8e1 0%, #fff 100%);
    border-color: #f0a500;
}

.bb26-kc--accent::before {
    content: 'UUS';
    position: absolute;
    top: 12px;
    right: 14px;
    background: linear-gradient(135deg, #f0a500 0%, #d97706 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 999px;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35);
}

.bb26-kc--accent::after { display: none; }

/* Tablet portrait + mobile landscape — 480-767px: 2 кол (8/2=4 ровные ряда) */
@media (max-width: 767px) and (min-width: 480px) {
    body .entry-content .bb26-key-cats,
    .bb26-page .entry-content .bb26-key-cats,
    .bb26-key-cats {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px;
    }
    .bb26-kc { padding: 14px 12px 12px; border-radius: 12px; }
    .bb26-kc__icon { font-size: 24px; margin-bottom: 6px; }
    .bb26-kc__title { font-size: 14px; line-height: 1.2; }
    .bb26-kc__desc { font-size: 11.5px; line-height: 1.35; }
    .bb26-kc::after { display: none; }
}

/* Mobile portrait — <480px: 1 колонка горизонтально */
@media (max-width: 479px) {
    body .entry-content .bb26-key-cats,
    .bb26-page .entry-content .bb26-key-cats,
    .bb26-key-cats {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .bb26-kc { padding: 14px 16px; border-radius: 12px; flex-direction: row; align-items: center; gap: 12px; }
    .bb26-kc__icon { font-size: 28px; margin-bottom: 0; flex-shrink: 0; }
    .bb26-kc__title { font-size: 15px; margin-bottom: 2px; }
    .bb26-kc__desc { font-size: 12px; }
    .bb26-kc::after { display: none; }
    .bb26-kc--accent::before { top: 8px; right: 10px; font-size: 9px; padding: 2px 6px; }
}
