.legal-document-modal {
    position: fixed;
    inset: 0;
    margin: auto;
    width: min(960px, calc(100vw - 32px));
    height: min(90vh, 960px);
    height: min(90dvh, 960px);
    max-width: none;
    max-height: none;
    padding: 0;
    border: 1px solid #d8c7b4;
    background: #fffaf2;
    color: #29221d;
    box-shadow: 0 24px 80px rgb(41 34 29 / 24%);
}

.legal-document-modal::backdrop {
    background: rgb(29 23 19 / 68%);
}

.legal-document-modal__panel {
    display: flex;
    height: 100%;
    min-height: 0;
    flex-direction: column;
}

.legal-document-modal__header,
.legal-document-modal__footer {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 22px;
    background: #fffaf2;
}

.legal-document-modal__header { border-bottom: 1px solid #d8c7b4; }
.legal-document-modal__footer { border-top: 1px solid #d8c7b4; }

.legal-document-modal__header h2 {
    margin: 0;
    font-family: var(--font-heading, Georgia, serif);
    font-size: clamp(22px, 3vw, 30px);
    font-weight: 600;
    line-height: 1.15;
}

.legal-document-modal__close {
    display: grid;
    width: 44px;
    height: 44px;
    flex: none;
    place-items: center;
    border: 1px solid #d8c7b4;
    background: #fffaf2;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.legal-document-modal__frame {
    display: block;
    width: 100%;
    min-height: 0;
    flex: 1;
    border: 0;
    background: #fffaf2;
}

.legal-document-modal__loading {
    margin: 0;
    padding: 10px 22px;
    color: #6b594c;
    font-size: 14px;
}

.legal-document-modal__loading[hidden] { display: none; }

.legal-document-modal__print,
.legal-document-modal__done {
    min-height: 44px;
    padding: 9px 16px;
    border: 1px solid #8c4f32;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.legal-document-modal__print { background: #8c4f32; color: white; }
.legal-document-modal__done { background: #fffaf2; color: #8c4f32; }
.legal-document-modal__print:disabled { cursor: wait; opacity: 0.55; }

.legal-document-modal button:focus-visible { outline: 2px solid #8c4f32; outline-offset: 3px; }

@media (max-width: 640px) {
    .legal-document-modal { width: calc(100vw - 16px); height: calc(100vh - 16px); height: calc(100dvh - 16px); }
    .legal-document-modal__header, .legal-document-modal__footer { padding: 10px 14px; }
    .legal-document-modal__footer { gap: 8px; }
    .legal-document-modal__print, .legal-document-modal__done { padding-inline: 9px; font-size: 12px; }
}
