/* =========================================================
   Browse By Letter – Final Stable & Dynamic Layout
   ========================================================= */

[data-bbl],
[data-bbl] * {
    box-sizing: border-box;
}

/* ---------------- Headings ---------------- */

[data-bbl] h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 18px;
}

[data-bbl] h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 28px 0 18px;
}

[data-bbl] h5 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    line-height: 1.4;
}

/* ---------------- Letters Grid ---------------- */

[data-bbl] .bbl-letters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 32px;
}

[data-bbl] .bbl-letter {
    width: 62px;
    height: 62px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    border-radius: 8px;
    border: 1.5px solid #055499;
    background: #ffffff;
    color: #055499;

    text-decoration: none;
    font-weight: 600;
    font-size: 14px;

    box-shadow: 0 4px 6px -1px rgba(5, 84, 153, 0.25);
    transition: all 0.2s ease;
}

[data-bbl] .bbl-letter:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(5, 84, 153, 0.35);
}

[data-bbl] .bbl-letter.active {
    background: #055499;
    color: #ffffff;
}

[data-bbl] .bbl-letter-char {
    font-size: 15px;
    line-height: 1;
    margin-bottom: 2px;
}

[data-bbl] .bbl-letter-count {
    font-size: 11px;
    line-height: 1;
    margin-top: 0;
    opacity: 0.85;
}

/* ---------------- Cards Grid ---------------- */

[data-bbl] .bbl-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
}

/* Tablet */
@media (max-width: 1024px) {
    [data-bbl] .bbl-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile */
@media (max-width: 600px) {
    [data-bbl] .bbl-cards {
        grid-template-columns: 1fr;
    }
}

/* ---------------- Card ---------------- */

[data-bbl] .bbl-card-link {
    text-decoration: none;
    color: inherit;
}

[data-bbl] .bbl-card {
    position: relative;

    min-height: 160px;
    padding: 20px;
    padding-right: 56px; /* reserve space for badge */

    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #eef2f7;

    transition: box-shadow 0.2s ease;
}

[data-bbl] .bbl-card:hover {
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

/* ---------------- Badge ---------------- */

[data-bbl] .bbl-badge {
    position: absolute;
    top: 14px;
    right: 14px;

    width: 28px;
    height: 28px;
    border-radius: 50%;

    background: #e9f1ff;
    color: #055499;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 13px;
    font-weight: 600;
}

/* ---------------- Title Clamp ---------------- */

[data-bbl] .bbl-card h5 {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-right: 44px; /* extra safety from badge */
}

/* ---------------- Dynamic Excerpt ---------------- */

[data-bbl] .bbl-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;

    overflow: hidden;
    line-height: 1.5;
    color: #6b7280;
    font-size: 14px;

    max-height: calc(1.5em * 3);
}

/* Tablet excerpt */
@media (max-width: 1024px) {
    [data-bbl] .bbl-excerpt {
        -webkit-line-clamp: 4;
        max-height: calc(1.5em * 4);
    }
}

/* Mobile excerpt */
@media (max-width: 600px) {
    [data-bbl] .bbl-excerpt {
        -webkit-line-clamp: 5;
        max-height: calc(1.5em * 5);
    }
}

/* ---------------- Placeholder Cards ---------------- */

[data-bbl] .bbl-card--placeholder {
    visibility: hidden;
}

/* ---------------- Elementor Safety ---------------- */

.elementor-widget-shortcode,
.elementor-widget-shortcode .elementor-shortcode {
    width: 100%;
    display: block;
}

[data-bbl] .bbl-excerpt {
    min-height: calc(1.5em * 3); /* same as line-clamp */
}

.dictionary-content-wrapper {
    max-width: 900px;
    margin: 0 auto;
}

.dictionary-term-title {
    font-size: 28px;
    margin-bottom: 20px;
}

.dictionary-content-box {
    background: #f7f9fc;
    padding: 30px;
    border-radius: 12px;
    line-height: 1.7;
}

.dictionary-content-box h3 {
    margin-top: 0;
    color: #055499;
}

.dictionary-placeholder {
    font-style: italic;
    color: #6b7280;
    background: #eef2f7;
    padding: 16px;
    border-radius: 8px;
}
