/* =========================================
   Legal Pages Specific Styles
   ========================================= */

/* Hero Section */
.legal-hero {
    padding-top: 140px;
    padding-bottom: 80px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.legal-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.legal-hero .subtitle {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-family: 'JetBrains Mono', monospace;
    opacity: 0.8;
}

/* Legal Content Container */
.legal-container {
    max-width: 1200px; /* Increased from 900px */
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 2;
    padding-bottom: 120px;
}

.legal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 60px 60px; /* Reduced side padding from 80px */
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
}

/* Glassmorphism Effect */
.legal-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-highlight), transparent);
    opacity: 0.3;
}

/* Typography & Layout */
.legal-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.legal-content h1, 
.legal-content h2, 
.legal-content h3 {
    color: var(--text-primary);
    font-weight: 700;
    margin-top: 48px;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
    scroll-margin-top: 100px; /* Fix for sticky navbar overlap */
}

.legal-content h1 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 16px;
    margin-top: 0;
}

.legal-content h2 {
    font-size: 1.5rem;
    position: relative;
    padding-left: 16px;
}

.legal-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 4px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.legal-content h3 {
    font-size: 1.25rem;
    margin-top: 32px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.legal-content p {
    margin-bottom: 24px;
}

.legal-content ul, 
.legal-content ol {
    margin-bottom: 24px;
    padding-left: 24px;
}

.legal-content li {
    margin-bottom: 8px;
    padding-left: 8px;
}

.legal-content a {
    color: var(--accent-primary);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition-smooth);
}

.legal-content a:hover {
    border-bottom-color: var(--accent-primary);
}

/* Highlight Box for Important Notices */
.highlight-box {
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 24px;
    margin: 32px 0;
}

.highlight-box p:last-child {
    margin-bottom: 0;
}

.highlight-title {
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 8px;
    display: block;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sticky TOC (Table of Contents) */
.legal-layout {
    display: block; /* Default to single column */
}

.toc-sidebar {
    position: sticky;
    top: 120px;
    padding-right: 24px;
    border-right: 1px solid var(--border-subtle);
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    display: none; /* Hidden on mobile/tablet by default */
}

/* Desktop Layout (Wide Screens Only) */
@media (min-width: 1100px) { /* Increased breakpoint to support half-screen mode */
    .legal-layout {
        display: grid;
        grid-template-columns: 260px 1fr;
        gap: 60px;
        align-items: start;
    }
    
    .toc-sidebar {
        display: block;
    }
}

.toc-link {
    display: block;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 8px 0;
    text-decoration: none;
    transition: var(--transition-smooth);
    border-left: 2px solid transparent;
    padding-left: 16px;
    margin-left: -2px;
}

.toc-link:hover,
.toc-link.active {
    color: var(--accent-primary);
    border-left-color: var(--accent-primary);
}

.toc-link.active {
    font-weight: 600;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 40px;
    right: 40px;
    width: 48px;
    height: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-smooth);
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.back-to-top:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
}

/* Mobile Responsiveness */
@media (max-width: 1099px) {
    .legal-card {
        padding: 40px 32px; /* Optimize padding for tablet/half-screen */
    }
}

@media (max-width: 768px) {
    .legal-card {
        padding: 32px 24px; /* Optimize padding for mobile */
    }
    
    .legal-hero h1 {
        font-size: 2.5rem;
    }
}
