/* MB Sefaria — clickable citations and the Hebrew popup */

.mbs-group { white-space: nowrap; }

/* The theme styles bare <button> elements (padding 8px 16px), which made a
   single-digit citation 40px wide and blew gaps through the sentence.
   Every property has to be forced back to plain inline text. */
.mbs-cite {
    display: inline !important;
    background: none !important;
    border: 0 !important;
    border-bottom: 1px dotted #b8860b !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    font: inherit !important;
    line-height: inherit !important;
    letter-spacing: inherit !important;
    text-transform: none !important;
    vertical-align: baseline !important;
    box-shadow: none !important;
    color: #1a365d !important;
    cursor: pointer;
}

.mbs-cite:hover,
.mbs-cite:focus-visible {
    color: #b8860b !important;
    border-bottom-style: solid !important;
    outline: none;
}

.mbs-cite.is-open {
    color: #b8860b !important;
    border-bottom: 2px solid #b8860b !important;
    font-weight: 600 !important;
}

.mbs-panel {
    position: absolute;
    z-index: 9999;
    width: min(460px, calc(100vw - 24px));
    max-height: 60vh;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: 3px solid #b8860b;
    border-radius: 10px;
    box-shadow: 0 10px 34px rgba(26, 54, 93, 0.22);
    font-family: 'Source Sans 3', -apple-system, sans-serif;
}

.mbs-panel[hidden] { display: none; }

.mbs-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.7rem 0.9rem 0.5rem;
    border-bottom: 1px solid #edf1f5;
}

.mbs-panel-ref {
    font-size: 0.86rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #1a365d;
}

.mbs-panel-close {
    background: none; border: none; cursor: pointer;
    font-size: 1.5rem; line-height: 1; color: #a0aec0; padding: 0 0.2rem;
}
.mbs-panel-close:hover { color: #2d3748; }

.mbs-panel-body {
    padding: 0.85rem 0.95rem 1rem;
    border-radius: 0 0 10px 10px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.mbs-panel-body.is-loading,
.mbs-panel-body.is-error { color: #718096; font-size: 0.92rem; font-style: italic; }
.mbs-panel-body.is-error { color: #9b2c2c; font-style: normal; }

.mbs-heref {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #718096;
    direction: rtl;
    text-align: right;
}

.mbs-hebrew {
    font-size: 1.18rem;
    line-height: 1.85;
    color: #2d3748;
    text-align: right;
    font-family: 'Frank Ruhl Libre', 'Times New Roman', serif;
}

.mbs-hebrew b, .mbs-hebrew strong { color: #1a365d; }



/* In print the citations are just text again */
@media print {
    .mbs-panel { display: none !important; }
    .mbs-cite {
        border: none !important;
        background: none !important;
        color: inherit !important;
        padding: 0;
    }
}
