/* Catalog dialog uses the editorial palette and existing shared focus/scroll session. */
.bh-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgb(40 36 31 / 48%);
    opacity: 0;
    visibility: hidden;
    transition: opacity 180ms ease;
}
.bh-modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.bh-modal-container {
    display: flex;
    flex-direction: column;
    width: min(100%, 720px);
    max-height: min(85dvh, 800px);
    overflow: hidden;
    border: 1px solid var(--df-line-strong);
    border-radius: 12px;
    background: var(--df-paper);
    color: var(--df-body);
    font-family: var(--df-sans);
    box-shadow: 0 24px 80px rgb(40 36 31 / 22%);
}
.bh-modal__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 24px 28px;
    border-bottom: 1px solid var(--df-line);
}
.bh-modal__title {
    margin: 0;
    color: var(--df-ink);
    font-family: var(--df-serif);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.025em;
}
.bh-modal__close {
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--df-line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--df-ink);
    font: inherit;
    font-size: 1.75rem;
    cursor: pointer;
    box-shadow: none;
}
.bh-modal__close:hover {
    background: var(--df-paper-deep);
    color: var(--df-blue);
}
/* Parent-theme buttons transition all properties, including inherited visibility.
   Exclude visibility so the close control can receive focus on the opening click. */
.bh-modal-container .bh-modal__close {
    transition:
        background-color 180ms ease,
        color 180ms ease;
}
.bh-modal__body {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.bh-modal__loading,
.bh-modal__empty {
    padding: 32px 28px;
    margin: 0;
    color: var(--df-muted);
    text-align: center;
}
.bh-modal__list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.bh-modal__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 24px;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid var(--df-line);
}
.bh-modal__item:last-child {
    border-bottom: 0;
}
.bh-modal__item-title {
    color: var(--df-ink);
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.bh-modal__item-desc {
    grid-column: 1;
    color: var(--df-muted);
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.bh-modal__item-form {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 0;
}
.bh-modal__item-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 1px solid var(--df-blue);
    border-radius: 4px;
    background: transparent;
    color: var(--df-blue);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
}
.bh-modal__item-action:hover {
    background: var(--df-blue);
    color: var(--df-paper);
}
.bh-modal__retry {
    display: block;
    margin: 0 auto 28px;
}
.bh-modal-container button:focus-visible {
    outline: 3px solid var(--df-focus);
    outline-offset: 4px;
}
@media (max-width: 599px) {
    .bh-modal-overlay {
        padding: 16px;
    }
    .bh-modal__header,
    .bh-modal__item {
        padding: 20px;
    }
    .bh-modal__item {
        grid-template-columns: minmax(0, 1fr);
        gap: 12px;
    }
    .bh-modal__item-form {
        grid-column: 1;
        grid-row: auto;
    }
}
@media (prefers-reduced-motion: reduce) {
    .bh-modal-overlay {
        transition: none;
    }
}
