/* Legal document modals — hub */

.doc-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(16px, 4vw, 40px) clamp(12px, 3vw, 20px);
    overflow: hidden;
    overscroll-behavior: none;
    opacity: 0;
    transition: opacity 0.28s ease;
}

.doc-modal.active {
    display: flex;
    opacity: 1;
}

.doc-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 10, 22, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: -1;
}

html[data-theme="light"] .doc-modal-backdrop {
    background: rgba(18, 19, 24, 0.45);
}

.doc-modal-panel {
    position: relative;
    width: 100%;
    max-width: 720px;
    max-height: min(88dvh, 900px);
    margin: auto 0;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, rgba(22, 26, 50, 0.98) 0%, rgba(14, 13, 28, 0.98) 100%);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    overflow: hidden;
    animation: docModalIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] .doc-modal-panel {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 246, 252, 0.98) 100%);
    border-color: rgba(139, 92, 246, 0.22);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.12);
}

@keyframes docModalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.doc-modal-head {
    position: relative;
    flex-shrink: 0;
    padding: clamp(20px, 4vw, 24px) clamp(52px, 8vw, 56px) clamp(16px, 3vw, 18px) clamp(20px, 4vw, 28px);
    border-bottom: 1px solid rgba(139, 92, 246, 0.12);
    background: rgba(18, 21, 40, 0.6);
}

html[data-theme="light"] .doc-modal-head {
    background: rgba(255, 255, 255, 0.85);
    border-bottom-color: rgba(139, 92, 246, 0.15);
}

.doc-modal-head h2 {
    font-family: var(--font-display, 'Cinzel', Georgia, serif);
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 600;
    line-height: 1.25;
    color: var(--text, #e8eef3);
    margin: 0 0 6px;
}

.doc-modal-date {
    font-size: 0.78rem;
    color: var(--text-muted, rgba(232, 238, 243, 0.48));
    margin: 0;
}

.doc-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.08);
    color: var(--text-soft, rgba(232, 238, 243, 0.72));
    cursor: pointer;
    padding: 0;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.doc-modal-close:hover {
    color: var(--gold, #fbbf24);
    border-color: rgba(251, 191, 36, 0.35);
    background: rgba(251, 191, 36, 0.08);
}

.doc-modal-close svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.doc-modal-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: clamp(18px, 3vw, 24px) clamp(20px, 4vw, 28px) clamp(24px, 4vw, 32px);
    font-size: clamp(0.86rem, 1.7vw, 0.92rem);
    line-height: 1.65;
    color: var(--text-soft, rgba(232, 238, 243, 0.72));
}

.doc-modal-body h3 {
    font-family: var(--font-display, 'Cinzel', Georgia, serif);
    font-size: clamp(0.88rem, 1.8vw, 0.95rem);
    font-weight: 600;
    color: var(--text, #e8eef3);
    margin: 1.25rem 0 0.5rem;
}

.doc-modal-body h3:first-child { margin-top: 0; }

.doc-modal-body p { margin: 0 0 0.65rem; }

.doc-modal-body ul {
    margin: 0 0 0.65rem;
    padding-left: 1.2rem;
}

.doc-modal-body li { margin-bottom: 0.35rem; }

.doc-modal-body a {
    color: #a78bfa;
    text-decoration: none;
}

.doc-modal-body a:hover { color: #c4b5fd; text-decoration: underline; }

.doc-modal-body code {
    font-size: 0.85em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(139, 92, 246, 0.12);
}

.doc-modal-note {
    margin-top: 1.25rem;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
}

@media (prefers-reduced-motion: reduce) {
    .doc-modal, .doc-modal-panel { animation: none; transition: none; }
}
