/*
 * Standalone styles for the Terms of Use (terms.html) and Privacy Policy
 * (privacy.html) pages.
 *
 * These two pages must be readable BEFORE sign-in (the landing gate asks
 * visitors to accept them), so they cannot use styles.css, which sits behind
 * the server-side auth gate. This file is on the middleware allowlist instead
 * and mirrors the look of the other info pages (about.html, disclaimer.html).
 */
:root {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --border-primary: #30363d;
    --border-secondary: #21262d;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --accent-blue: #58a6ff;
    --accent-cyan: #39c5cf;
    --accent-orange: #d29922;
    --gradient-primary: linear-gradient(135deg, #1f6feb 0%, #a371f7 100%);
    --radius-md: 10px;
    --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent-blue); }
a:hover { text-decoration: none; }

.legal-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    min-height: 44px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.legal-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.legal-brand img { width: 28px; height: 28px; flex-shrink: 0; }

.legal-brand span {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legal-navlinks {
    display: flex;
    gap: 14px;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.legal-navlinks a { color: var(--text-secondary); text-decoration: none; }
.legal-navlinks a:hover,
.legal-navlinks a[aria-current="page"] { color: var(--text-primary); }

.legal-container {
    max-width: 880px;
    margin: 0 auto;
    padding: 24px 16px 24px;
}

.legal-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 28px;
}

.legal-card h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.legal-card h1::before {
    content: '';
    width: 4px;
    height: 26px;
    background: var(--gradient-primary);
    border-radius: 2px;
    flex-shrink: 0;
}

.legal-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-primary);
}

.legal-summary {
    background: rgba(56, 139, 253, 0.08);
    border: 1px solid rgba(56, 139, 253, 0.25);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    font-size: 0.92rem;
}

.legal-summary.warning {
    background: rgba(210, 153, 34, 0.08);
    border-color: rgba(210, 153, 34, 0.35);
}

.legal-summary p { margin: 0 0 8px; }
.legal-summary p:last-child, .legal-summary ul:last-child { margin-bottom: 0; }
.legal-summary ul { margin: 0 0 8px; padding-left: 20px; }

.legal-toc {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-secondary);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 28px;
    font-size: 0.88rem;
}

.legal-toc ol { margin: 6px 0 0; padding-left: 22px; columns: 2; column-gap: 28px; }
.legal-toc li { margin-bottom: 2px; break-inside: avoid; }
.legal-toc a { text-decoration: none; }

.legal-section { margin-bottom: 26px; scroll-margin-top: 64px; }

.legal-section h2 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent-cyan);
    margin: 0 0 10px;
}

.legal-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 16px 0 6px;
}

.legal-section p,
.legal-section li {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.legal-section p { margin: 0 0 10px; }
.legal-section ul { margin: 0 0 10px; padding-left: 22px; }
.legal-section li { margin-bottom: 4px; }
.legal-section strong { color: var(--text-primary); }

.legal-caps { text-transform: uppercase; font-size: 0.86rem !important; letter-spacing: 0.1px; }

.legal-table-wrap { overflow-x: auto; margin: 0 0 12px; }

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.legal-table th,
.legal-table td {
    text-align: left;
    vertical-align: top;
    padding: 8px 10px;
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
}

.legal-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
}

.legal-table code,
.legal-section code {
    font-size: 0.82rem;
    background: var(--bg-tertiary);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--text-primary);
    word-break: break-word;
}

.legal-footer {
    text-align: center;
    padding: 28px 16px 36px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.legal-footer p { margin: 0 0 6px; }
.legal-footer a { color: var(--text-secondary); }

@media (max-width: 600px) {
    .legal-card { padding: 20px 16px; }
    .legal-toc ol { columns: 1; }
    .legal-navlinks { gap: 10px; }
    .legal-brand span { font-size: 0.95rem; }
}

@media (max-width: 420px) {
    .legal-brand span { display: none; }
}

@media print {
    body { background: #fff; color: #000; }
    .legal-navbar { display: none; }
    .legal-card { border: none; padding: 0; background: #fff; }
    .legal-section p, .legal-section li, .legal-table td { color: #000; }
}
