/*
 * docs.css — shared design system for the doc-style pages
 * (methodology, privacy, terms, dpa, memo).
 *
 * Goal: feel modern + technical without breaking the audit-grade trust
 * that compliance buyers need. Borrowed patterns from Linear (subtle
 * gradients, refined typography), Stripe (callouts, restrained accent),
 * Vercel (animated gradient borders, fade-in-on-scroll).
 *
 * No JS — every effect is pure CSS, scroll-linked or hover-driven.
 * Pages can still ship page-specific overrides via inline <style>.
 */

/* ── Page chrome ─────────────────────────────────────────────────────────── */

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    overflow-x: hidden;
}

/* Ambient mesh-gradient background pinned behind content. Three radial
   blobs in our palette — animated very slowly so the page feels alive
   without distracting from prose. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(60vw 60vh at 15% 10%, rgba(99,102,241,0.18) 0%, transparent 50%),
        radial-gradient(50vw 50vh at 85% 30%, rgba(34,211,238,0.10) 0%, transparent 55%),
        radial-gradient(70vw 70vh at 50% 90%, rgba(139,92,246,0.12) 0%, transparent 60%);
    animation: doc-bg-drift 24s ease-in-out infinite alternate;
    pointer-events: none;
}
@keyframes doc-bg-drift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-2%, 2%) scale(1.05); }
}

/* Faint dot grid pattern overlaid on the gradient — gives the page a
   technical / blueprint feel without competing with the type. */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.04) 1px, transparent 0);
    background-size: 32px 32px;
    pointer-events: none;
    mask-image: linear-gradient(180deg, transparent 0%, black 20%, black 80%, transparent 100%);
}

/* Scroll-progress bar pinned at the very top — pure CSS via animation-timeline. */
@supports (animation-timeline: scroll()) {
    body { position: relative; }
    body > #scroll-progress {
        position: fixed; top: 0; left: 0; right: 0; height: 2px;
        background: linear-gradient(90deg, var(--accent) 0%, var(--accent-cyan) 100%);
        transform-origin: left center; transform: scaleX(0);
        z-index: 1000;
        animation: doc-scroll-progress linear;
        animation-timeline: scroll(root);
    }
    @keyframes doc-scroll-progress {
        to { transform: scaleX(1); }
    }
}

/* ── Top navigation ─────────────────────────────────────────────────────── */

.topnav {
    padding: 14px 32px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    backdrop-filter: blur(12px);
    background: rgba(5,5,8,0.55);
    position: sticky; top: 0; z-index: 100;
}
.topnav-left, .topnav-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topnav a {
    color: var(--text-secondary); text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px;
    transition: color .15s;
}
.topnav a:hover { color: var(--accent-light); }
.topnav .logo-icon {
    color: var(--accent); font-weight: 600;
    filter: drop-shadow(0 0 8px var(--accent-glow));
}
.topnav-sep { color: var(--text-muted); }
.topnav-current { color: var(--text-primary); font-weight: 500; }
.topnav-cta {
    background: var(--accent); color: #fff !important;
    padding: 7px 14px; border-radius: 6px; font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(99,102,241,0.25);
}
.topnav-cta:hover {
    background: var(--accent-light); color: #fff !important;
    box-shadow: 0 6px 24px rgba(99,102,241,0.45);
    transform: translateY(-1px);
}

/* ── Document container ─────────────────────────────────────────────────── */

.doc {
    max-width: 820px;
    margin: 0 auto;
    padding: 80px 32px 120px;
    font-size: 16px;
    line-height: 1.72;
    position: relative;
    z-index: 1;
}

/* Hero header: oversized eyebrow, gradient h1, soft underline. */
.doc-header {
    padding-bottom: 36px;
    margin-bottom: 48px;
    position: relative;
}
.doc-header::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0; height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(99,102,241,0.4) 30%,
        rgba(34,211,238,0.4) 70%,
        transparent 100%);
}
.doc-header .eyebrow {
    font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
    color: var(--accent-light); font-weight: 700;
    margin-bottom: 18px;
    display: inline-flex; align-items: center; gap: 8px;
}
.doc-header .eyebrow::before {
    content: ''; width: 24px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-light));
}
.doc-header h1 {
    font-size: clamp(36px, 5vw, 52px);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.05;
    margin-bottom: 18px;
    background: linear-gradient(180deg, var(--text-primary) 0%, #b6b8d3 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.doc-header .subtitle {
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.6;
    max-width: 640px;
}
.doc-header .meta {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 24px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
    display: flex; gap: 20px; flex-wrap: wrap;
}
.doc-header .meta span {
    display: inline-flex; align-items: center; gap: 6px;
}
.doc-header .meta span::before {
    content: ''; width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Optional stat row under the hero — cards with glow on the number. */
.doc-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin: 32px 0 8px;
}
.doc-stat {
    background: rgba(15,15,24,0.6);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 12px;
    padding: 18px 20px;
    backdrop-filter: blur(12px);
    transition: var(--transition);
}
.doc-stat:hover {
    border-color: rgba(99,102,241,0.4);
    transform: translateY(-2px);
}
.doc-stat .num {
    font-size: 26px; font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
}
.doc-stat .lbl {
    font-size: 12px; color: var(--text-secondary);
    margin-top: 6px; letter-spacing: 0.3px;
}

/* ── Section typography ─────────────────────────────────────────────────── */

.doc h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.015em;
    margin: 56px 0 16px;
    color: var(--text-primary);
    position: relative;
    padding-left: 18px;
}
/* Gradient bar to the left of every h2 — visual anchor for sections. */
.doc h2::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-cyan) 100%);
    border-radius: 2px;
    box-shadow: 0 0 12px var(--accent-glow);
}

.doc h3 {
    font-size: 17px;
    font-weight: 600;
    margin: 28px 0 12px;
    color: var(--accent-light);
    letter-spacing: -0.005em;
}

.doc p {
    color: #c4c8db;
    margin-bottom: 14px;
}

.doc strong {
    color: var(--text-primary);
    font-weight: 600;
}

.doc a:not(.topnav a):not(.topnav-cta) {
    color: var(--accent-light);
    text-decoration: none;
    border-bottom: 1px solid rgba(129,140,248,0.3);
    transition: var(--transition);
}
.doc a:not(.topnav a):not(.topnav-cta):hover {
    color: var(--accent-cyan);
    border-bottom-color: var(--accent-cyan);
}

.doc code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: rgba(99,102,241,0.1);
    color: var(--accent-light);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(99,102,241,0.15);
}

.doc pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: rgba(8,8,14,0.8);
    color: var(--text-primary);
    padding: 18px 20px;
    border-radius: 10px;
    overflow-x: auto;
    border: 1px solid var(--border);
    margin: 14px 0 20px;
    backdrop-filter: blur(8px);
    line-height: 1.6;
}
.doc pre code {
    background: transparent;
    border: none;
    color: inherit;
    padding: 0;
}

.doc ul, .doc ol {
    margin: 10px 0 18px 0;
    padding-left: 24px;
    color: #c4c8db;
}
.doc li {
    margin-bottom: 8px;
    padding-left: 4px;
}
.doc ul li::marker {
    color: var(--accent);
}

/* ── Tables ─────────────────────────────────────────────────────────────── */

.doc table {
    width: 100%;
    border-collapse: collapse;
    margin: 18px 0 24px;
    font-size: 14px;
    background: rgba(15,15,24,0.4);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.doc th {
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    padding: 12px 14px;
    background: rgba(99,102,241,0.05);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.doc td {
    color: #c4c8db;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(99,102,241,0.06);
}
.doc tbody tr:last-child td { border-bottom: none; }
.doc tbody tr:hover { background: rgba(99,102,241,0.04); }

/* Risk-band pills (used on methodology page bands table). */
.doc .band {
    display: inline-block; min-width: 78px; text-align: center;
    padding: 3px 12px; border-radius: 999px; font-size: 11px; font-weight: 700;
    letter-spacing: 0.5px; text-transform: uppercase;
    border: 1px solid;
}
.band-low    { background: rgba(76,200,120,0.15);  color: #7fe0a0; border-color: rgba(127,224,160,0.3); }
.band-mod    { background: rgba(255,200,60,0.15);  color: #f0c050; border-color: rgba(240,192,80,0.3); }
.band-elev   { background: rgba(255,140,60,0.18);  color: #ffa066; border-color: rgba(255,160,102,0.3); }
.band-crit   { background: rgba(255,80,80,0.20);   color: #ff7a7a; border-color: rgba(255,122,122,0.35); }

/* ── Callouts ───────────────────────────────────────────────────────────── */

.callout {
    position: relative;
    background: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(34,211,238,0.04) 100%);
    border: 1px solid rgba(99,102,241,0.2);
    border-radius: 12px;
    padding: 18px 22px 18px 50px;
    margin: 22px 0 26px;
    color: #c4c8db;
    backdrop-filter: blur(10px);
}
.callout::before {
    content: '';
    position: absolute;
    left: 18px; top: 22px;
    width: 18px; height: 18px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23818cf8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' y1='16' x2='12' y2='12'/><line x1='12' y1='8' x2='12.01' y2='8'/></svg>");
    background-size: contain; background-repeat: no-repeat;
}
.callout strong { color: var(--accent-light); }

/* ── Section card (optional wrapper for grouped content) ────────────────── */

.doc-card {
    background: rgba(15,15,24,0.55);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 28px 32px;
    margin: 24px 0;
    backdrop-filter: blur(14px);
    position: relative;
    overflow: hidden;
}
/* Gradient border highlight that sweeps on hover — Vercel-ish accent. */
.doc-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, transparent 30%, rgba(99,102,241,0.5) 50%, transparent 70%);
    opacity: 0; transition: opacity 0.5s;
    z-index: -1;
}
.doc-card:hover::before { opacity: 1; }

/* ── Footer note ────────────────────────────────────────────────────────── */

.doc-footer-note {
    margin-top: 80px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    text-align: center;
}
.doc-footer-note a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px dotted var(--text-muted);
    transition: var(--transition);
}
.doc-footer-note a:hover {
    color: var(--accent-light);
    border-bottom-color: var(--accent-light);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .doc { padding: 60px 22px 90px; font-size: 15px; }
    .doc-header { padding-bottom: 28px; margin-bottom: 36px; }
    .doc-header h1 { font-size: 32px; }
    .doc h2 { font-size: 22px; margin: 44px 0 12px; }
    .doc h3 { font-size: 16px; }
    .doc-stats { grid-template-columns: repeat(2, 1fr); }
    .topnav { padding: 12px 18px; font-size: 13px; }
    .doc-card { padding: 22px 20px; }
}

/* Honor reduced-motion users — no background drift, no progress animation. */
@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
    body > #scroll-progress { display: none; }
    .doc-stat:hover { transform: none; }
    .topnav-cta:hover { transform: none; }
}
