/* 본문 속 성경 약어 링크와 본문 팝오버 스타일.
 * 색상은 theme-tokens.css 의 토큰을 사용해 4개 테마를 모두 따라간다.
 */

.bible-ref {
    /* 목록 카드의 stretched-link 위에서도 눌리도록 위로 올린다 */
    position: relative;
    z-index: 2;
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    cursor: pointer;
    padding: 0 0.05em;
}

.bible-ref:hover,
.bible-ref:focus {
    color: var(--accent);
    background-color: var(--accent-soft-bg);
    border-radius: 0.2rem;
    outline: none;
}

.bible-ref:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* 팝오버 */
.bible-popover {
    position: absolute;
    z-index: 1080;
    max-height: min(60vh, 460px);
    overflow-y: auto;
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.6rem;
    box-shadow: var(--shadow-strong);
}

.bible-popover-head {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border-color);
    border-radius: 0.6rem 0.6rem 0 0;
}

.bible-popover-title {
    font-size: 0.95rem;
}

.bible-popover-close {
    background: none;
    border: 0;
    font-size: 1.35rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 0.15rem;
}

.bible-popover-close:hover {
    color: var(--text-primary);
}

.bible-popover-body {
    padding: 0.75rem 0.85rem;
    font-size: 0.95rem;
    line-height: 1.65;
}

.bible-popover-body.is-error {
    color: var(--state-danger-text);
}

.bible-popover-loading {
    color: var(--text-muted);
}

/* 절 번호는 내어쓰기 대신 flex 로 배치한다.
 * (음수 text-indent 를 쓰면 좁은 화면에서 번호가 팝오버 밖으로 밀려 잘린다)
 */
.bible-verse {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin: 0 0 0.6rem 0;
}

.bible-verse:last-child {
    margin-bottom: 0;
}

.bible-verse-no {
    flex: 0 0 auto;
    min-width: 1.4rem;
    text-align: right;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.82em;
}

.bible-verse-text {
    flex: 1 1 auto;
    min-width: 0;
}

/* 좁은 화면: 하단 시트
 * 아이폰은 화면 모서리가 둥글고 하단에 홈 인디케이터가 있으므로
 * 화면 끝에 딱 붙이지 않고 안전 영역만큼 띄운다.
 */
@media (max-width: 576px) {
    .bible-popover.is-sheet {
        position: fixed;
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0;
        top: auto;
        width: auto;
        max-height: 62vh;
        border-radius: 0.9rem;
        margin-bottom: 0.75rem;
        /* 홈 인디케이터가 있는 기기에서는 그만큼 더 띄운다 */
        margin-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
    }

    .bible-popover.is-sheet .bible-popover-head {
        border-radius: 0.9rem 0.9rem 0 0;
    }

    .bible-popover.is-sheet .bible-popover-body {
        padding-bottom: 1rem;
    }

    /* 화면이 낮은 가로 모드에서는 더 낮게 */
    @media (max-height: 460px) {
        .bible-popover.is-sheet {
            max-height: 78vh;
        }
    }
}
