/**
 * BeMatrx Legal Pages — Stylesheet
 * 
 * Uses design tokens from style.css (--bm-* variables)
 * Matches existing BeMatrx theme aesthetic
 * 
 * Applied via functions.php or inlined in page-legal.php
 * 
 * @package BeMatrx
 * @version 1.0.0
 * @since 2026-04-22
 */

/* ==========================================================================
   Legal Page Container
   ========================================================================== */

.bm-legal {
    background: var(--bm-bg);
    min-height: 60vh;
    padding: var(--bm-doc-padding-y) 0;
}

.bm-legal .bm-container {
    max-width: 1200px;
}

@media (max-width: 767px) {
    .bm-legal .bm-container {
        padding-inline: var(--bm-space-3);
    }
}

/* ==========================================================================
   Content Card
   ========================================================================== */

.bm-legal__content {
    background: var(--bm-white);
    padding: var(--bm-space-4) var(--bm-space-4);
    border-radius: var(--bm-radius-lg);
    box-shadow: var(--bm-shadow-md);
    border: 1px solid var(--bm-border);
}

@media (min-width: 768px) {
    .bm-legal__content {
        padding: var(--bm-space-5) var(--bm-space-5);
        border-radius: var(--bm-radius-xl);
    }
}

@media (min-width: 1024px) {
    .bm-legal__content {
        padding: var(--bm-space-5) var(--bm-space-6);
    }
}

/* ==========================================================================
   Typography (leveraging theme tokens)
   ========================================================================== */

.bm-legal__content h1 {
    font-size: var(--bm-doc-fs-title);
    font-weight: 700;
    color: var(--bm-dark);
    margin: 0 0 var(--bm-space-3);
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.bm-legal__content h2 {
    font-size: var(--bm-doc-fs-h2);
    font-weight: 700;
    color: var(--bm-dark);
    margin: var(--bm-space-5) 0 var(--bm-space-3);
    letter-spacing: -0.015em;
    padding-bottom: var(--bm-space-2);
    border-bottom: 2px solid var(--bm-border);
}

.bm-legal__content h3 {
    font-size: var(--bm-doc-fs-h3);
    font-weight: 600;
    color: var(--bm-dark);
    margin: var(--bm-space-4) 0 var(--bm-space-2);
}

.bm-legal__content p {
    font-size: var(--bm-fs-body);
    line-height: 1.7;
    color: var(--bm-text);
    margin: 0 0 var(--bm-space-3);
}

.bm-legal__content em {
    font-style: normal;
    display: inline-block;
    padding: var(--bm-space-2) var(--bm-space-3);
    background: var(--bm-bg-alt);
    border-radius: var(--bm-radius-sm);
    font-size: var(--bm-fs-small);
    color: var(--bm-text-muted);
    border-left: 3px solid var(--bm-primary);
    margin: var(--bm-space-2) 0;
    line-height: 1.6;
}

.bm-legal__content strong {
    color: var(--bm-dark);
    font-weight: 600;
}

/* ==========================================================================
   Lists
   ========================================================================== */

.bm-legal__content ul,
.bm-legal__content ol {
    margin: 0 0 var(--bm-space-3);
    padding-left: var(--bm-space-4);
    color: var(--bm-text);
}

.bm-legal__content li {
    margin-bottom: var(--bm-space-1);
    line-height: 1.7;
}

.bm-legal__content li strong {
    color: var(--bm-dark);
}

.bm-legal__content ul ul,
.bm-legal__content ol ol {
    margin-top: var(--bm-space-1);
    margin-bottom: var(--bm-space-1);
}

/* ==========================================================================
   Links
   ========================================================================== */

.bm-legal__content a {
    color: var(--bm-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: color var(--bm-dur-fast) var(--bm-ease-out), 
                border-color var(--bm-dur-fast) var(--bm-ease-out);
}

.bm-legal__content a:hover {
    color: var(--bm-primary-hover);
    border-bottom-color: var(--bm-primary-hover);
}

.bm-legal__content a[href^="mailto:"] {
    font-family: "SF Mono", Monaco, "Cascadia Code", Consolas, monospace;
    background: var(--bm-primary-soft);
    padding: 2px 8px;
    border-radius: var(--bm-radius-sm);
    font-size: 0.95em;
}

/* ==========================================================================
   Horizontal Rule
   ========================================================================== */

.bm-legal__content hr {
    border: none;
    border-top: 1px solid var(--bm-border);
    margin: var(--bm-space-6) 0 var(--bm-space-4);
}

/* ==========================================================================
   RTL Support (Arabic)
   ========================================================================== */

html[lang="ar"] .bm-legal__content ul,
html[lang="ar"] .bm-legal__content ol {
    padding-right: var(--bm-space-4);
    padding-left: 0;
}

html[lang="ar"] .bm-legal__content em {
    border-left: none;
    border-right: 3px solid var(--bm-primary);
}

/* ==========================================================================
   Error State
   ========================================================================== */

.bm-legal__error {
    text-align: center;
    padding: var(--bm-space-7) var(--bm-space-3);
    background: var(--bm-white);
    border-radius: var(--bm-radius-lg);
    box-shadow: var(--bm-shadow-sm);
}

.bm-legal__error h1 {
    color: var(--bm-dark);
    font-size: var(--bm-doc-fs-title);
    margin-bottom: var(--bm-space-3);
}

.bm-legal__error p {
    color: var(--bm-text-muted);
    margin-bottom: var(--bm-space-2);
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 767px) {
    .bm-legal {
        padding: var(--bm-space-4) 0 var(--bm-space-6);
    }

    .bm-legal__content {
        padding: var(--bm-space-4) var(--bm-space-3);
    }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .bm-legal {
        background: var(--bm-white);
        padding: 0;
    }
    
    .bm-legal__content {
        max-width: 100%;
        padding: 0;
        box-shadow: none;
        border: none;
        border-radius: 0;
    }
    
    .bm-legal__content a {
        color: var(--bm-dark);
        border-bottom: none;
    }
    
    .bm-legal__content a[href^="mailto:"]::after,
    .bm-legal__content a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: var(--bm-text-muted);
    }
    
    .bm-header,
    .bm-footer,
    #wpadminbar {
        display: none !important;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.bm-legal__content :focus-visible {
    outline: 3px solid var(--bm-primary);
    outline-offset: 2px;
    border-radius: var(--bm-radius-sm);
}

/* ==========================================================================
   Extended Typography (account-deletion, future pages)
   Uses --bm-doc-fs-* scale for document-style typography.
   ========================================================================== */

.bm-legal__header {
    margin-bottom: var(--bm-space-5);
    padding-bottom: var(--bm-space-4);
    border-bottom: 1px solid var(--bm-border);
}

.bm-legal__title {
    font-size: var(--bm-doc-fs-title);
    font-weight: 700;
    color: var(--bm-text);
    margin: 0 0 var(--bm-space-3) 0;
    line-height: 1.2;
}

.bm-legal__meta {
    display: inline-block;
    padding: var(--bm-space-3) var(--bm-space-4);
    background: rgba(232, 65, 90, 0.08);
    border-left: 3px solid var(--bm-primary);
    border-radius: var(--bm-radius-sm);
    font-size: var(--bm-doc-fs-small);
    color: var(--bm-text-muted);
}

.bm-legal__meta p {
    margin: 0;
    line-height: 1.6;
}

.bm-legal__meta p + p {
    margin-top: var(--bm-space-1);
}

.bm-legal__intro {
    font-size: var(--bm-doc-fs-lead);
    color: var(--bm-text);
    margin-bottom: var(--bm-space-5);
    line-height: 1.6;
}

.bm-legal__intro p {
    margin: 0;
}

.notice-box {
    margin-top: var(--bm-space-5);
    padding: var(--bm-space-4);
    background: rgba(232, 65, 90, 0.05);
    border: 1px solid rgba(232, 65, 90, 0.2);
    border-radius: var(--bm-radius-md);
    font-size: var(--bm-doc-fs-small);
}

.notice-box p {
    margin: 0;
}

.email-highlight {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(232, 65, 90, 0.1);
    color: var(--bm-primary);
    border-radius: var(--bm-radius-sm);
    font-family: var(--bm-font-mono, "SF Mono", Monaco, "Cascadia Code", Consolas, monospace);
    font-size: 0.95em;
    font-weight: 500;
}

