﻿/* Stoling — Legal centre (footer-linked legal documents)
 *
 * Premium editorial reading experience. The page sits on a soft animated
 * mesh of violet · fuchsia · cyan blobs; the document itself is a
 * glass-effect card with a gradient outline, numbered chapter chips and a
 * gradient drop-cap. Inspired by modern docs surfaces (Stripe, Linear,
 * Vercel) — calm, confident, brand-aligned, never cute.
 */

/* ── Page shell + ambient background ───────────────────── */
.page-legal .as-main {
    background: #0b0a14;
    color: #e2e8f0;
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.page-legal .as-main::before,
.page-legal .as-main::after {
    content: "";
    position: absolute;
    inset: -10%;
    z-index: -1;
    pointer-events: none;
}

/* Soft violet → fuchsia → cyan mesh; keeps motion subtle so the document
 * remains the focus. */
.page-legal .as-main::before {
    background:
        radial-gradient(620px 480px at 12% 8%, rgba(124, 58, 237, 0.42), transparent 60%),
        radial-gradient(560px 460px at 92% 22%, rgba(217, 70, 239, 0.32), transparent 62%),
        radial-gradient(700px 520px at 78% 92%, rgba(34, 211, 238, 0.20), transparent 65%),
        radial-gradient(420px 360px at 22% 84%, rgba(99, 102, 241, 0.28), transparent 60%),
        linear-gradient(180deg, #0b0a14 0%, #0d0c1a 100%);
    filter: saturate(1.05);
    animation: legal-aurora 22s ease-in-out infinite alternate;
}

/* Faint dotted grid for depth. */
.page-legal .as-main::after {
    background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 50%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, #000 50%, transparent 100%);
    opacity: 0.7;
}

@keyframes legal-aurora {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
    }

    50% {
        transform: translate3d(-1.5%, 1.5%, 0) scale(1.04);
    }

    100% {
        transform: translate3d(1.5%, -1%, 0) scale(1.02);
    }
}

.legal-page {
    padding: clamp(2.5rem, 6vw, 5rem) 1rem 6rem;
    position: relative;
}

/* ── Glass card ────────────────────────────────────────── */
.legal-page-inner {
    max-width: 980px;
    margin: 0 auto;
    position: relative;
    border-radius: 24px;
    padding: clamp(1.75rem, 4vw, 3.25rem) clamp(1.25rem, 4vw, 3rem);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.015) 100%),
        rgba(15, 14, 28, 0.55);
    backdrop-filter: blur(18px) saturate(1.1);
    -webkit-backdrop-filter: blur(18px) saturate(1.1);
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        0 0 0 1px rgba(255, 255, 255, 0.06),
        0 30px 60px -20px rgba(0, 0, 0, 0.6),
        0 12px 30px -10px rgba(124, 58, 237, 0.25);
}

/* Gradient outline that wraps the card — pseudo border so we can use
 * a multi-stop gradient instead of a flat border colour. */
.legal-page-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(167, 139, 250, 0.55) 0%,
            rgba(217, 70, 239, 0.35) 35%,
            rgba(34, 211, 238, 0.30) 70%,
            rgba(167, 139, 250, 0.55) 100%);
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

/* ── Close button (top-right corner) ───────────────────── */
.legal-page-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: #cbd5e1;
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease, border-color 180ms ease;
    z-index: 2;
}

.legal-page-close:hover {
    background: rgba(248, 113, 113, 0.14);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
    transform: rotate(90deg);
}

.legal-page-close svg {
    width: 18px;
    height: 18px;
}

/* ── Header ────────────────────────────────────────────── */
.legal-page-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.legal-page-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #c4b5fd;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(217, 70, 239, 0.18));
    border: 1px solid rgba(167, 139, 250, 0.35);
    padding: 0.4rem 0.95rem;
    border-radius: 999px;
    margin-bottom: 1rem;
    box-shadow: 0 0 24px -6px rgba(167, 139, 250, 0.45);
}

.legal-page-eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a78bfa;
    box-shadow: 0 0 10px #a78bfa;
}

.legal-page-title {
    font-size: clamp(2rem, 4vw, 2.85rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin: 0 0 0.85rem 0;
    background: linear-gradient(135deg, #ffffff 0%, #e9d5ff 50%, #f0abfc 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.legal-page-subtitle {
    max-width: 640px;
    margin: 0 auto;
    color: #94a3b8;
    font-size: 1rem;
    line-height: 1.65;
}

/* ── Tabs ──────────────────────────────────────────────── */
.legal-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 0.4rem;
    margin: 0 auto 1.5rem;
}

.legal-tab {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    padding: 0.75rem 0.85rem;
    background: transparent;
    border: 0;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 200ms ease, background 200ms ease, transform 200ms ease;
    white-space: nowrap;
    min-width: 0;
}

.legal-tab:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.04);
}

.legal-tab.is-active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.35), rgba(217, 70, 239, 0.25));
    box-shadow:
        inset 0 0 0 1px rgba(167, 139, 250, 0.45),
        0 8px 22px -8px rgba(124, 58, 237, 0.55);
}

.legal-tab.is-active .legal-tab-ico {
    color: #f0abfc;
}

.legal-tab-ico {
    width: 1.05rem;
    height: 1.05rem;
    color: #64748b;
    flex: 0 0 auto;
    display: inline-flex;
}

.legal-tab-ico svg {
    width: 100%;
    height: 100%;
}

.legal-tab-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Signed check chip on tabs the user has already accepted. */
.legal-tab-check {
    display: none;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: linear-gradient(135deg, #34d399, #10b981);
    color: #04140e;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.45);
}

.legal-tab-check svg {
    width: 11px;
    height: 11px;
}

.legal-tab.is-signed .legal-tab-check {
    display: inline-flex;
}

/* ── Meta + status ─────────────────────────────────────── */
.legal-page-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin: 0 0 1.25rem;
}

.legal-page-meta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.4rem 0.95rem;
    margin: 0;
}

.legal-page-meta strong {
    font-weight: 600;
    color: #c4b5fd;
}

.legal-page-meta-sep {
    color: #475569;
}

/* Consent badges shown next to the meta pill. */
.legal-page-consent {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    border: 1px solid;
    margin-left: auto;
}

.legal-page-consent svg {
    width: 14px;
    height: 14px;
}

.legal-page-consent-sep {
    color: rgba(255, 255, 255, 0.25);
    font-weight: 400;
}

/* Hide the "Signed on …" suffix until we know the date — the /me/status
 * endpoint only carries dates for pending docs, so for the common
 * already-signed case we keep just the clean "Signed" pill. */
.legal-page-consent--signed>[data-i18n="Legal_SignedOn"],
.legal-page-consent--signed .legal-page-consent-sep,
.legal-page-consent--signed #legal-page-signed-at {
    display: none;
}

.legal-page-consent--signed.has-date>[data-i18n="Legal_SignedOn"],
.legal-page-consent--signed.has-date .legal-page-consent-sep,
.legal-page-consent--signed.has-date #legal-page-signed-at {
    display: inline;
}

.legal-page-consent--signed {
    color: #6ee7b7;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(34, 197, 94, 0.10));
    border-color: rgba(110, 231, 183, 0.4);
    box-shadow: 0 0 18px -6px rgba(110, 231, 183, 0.45);
}

.legal-page-consent--pending {
    color: #fcd34d;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(217, 119, 6, 0.08));
    border-color: rgba(252, 211, 77, 0.4);
    box-shadow: 0 0 18px -6px rgba(252, 211, 77, 0.4);
}

.legal-page-status {
    color: #94a3b8;
    font-size: 0.95rem;
    padding: 1.25rem 0;
    text-align: center;
}

.legal-page-status.is-error {
    color: #fca5a5;
}

/* ── Body — modern editorial reading surface ───────────── */
.legal-page-body {
    counter-reset: legal-h2;
    color: #d8def0;
    font-size: 1.05rem;
    line-height: 1.85;
    letter-spacing: 0.005em;
    padding: clamp(1.25rem, 3vw, 2.25rem) clamp(0.5rem, 2vw, 1.5rem) 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 0.5rem;
    /* Cap the reading surface so the page itself doesn't stretch — long
     * documents scroll inside the card while the tabs/header stay in view. */
    max-height: min(70vh, 720px);
    overflow-y: auto;
    overscroll-behavior: contain;
    /* Soft fade at top + bottom so the cut-off feels intentional. */
    -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
    mask-image: linear-gradient(180deg, transparent 0, #000 24px, #000 calc(100% - 24px), transparent 100%);
    /* Smooth tab swap: opacity is animated; the fade-in keyframe is gated
     * behind a class so it only fires on freshly loaded content, not on
     * every layout reflow. */
    transition: opacity 220ms ease;
}

.legal-page-body.is-loading {
    opacity: 0.35;
    pointer-events: none;
}

.legal-page-body.is-fade-in {
    animation: legal-fade-in 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Slim, brand-tinted scrollbar — Webkit. */
.legal-page-body::-webkit-scrollbar {
    width: 8px;
}

.legal-page-body::-webkit-scrollbar-track {
    background: transparent;
}

.legal-page-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.45), rgba(217, 70, 239, 0.45));
    border-radius: 999px;
}

.legal-page-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(167, 139, 250, 0.7), rgba(217, 70, 239, 0.7));
}

/* Firefox */
.legal-page-body {
    scrollbar-width: thin;
    scrollbar-color: rgba(167, 139, 250, 0.5) transparent;
}

@keyframes legal-fade-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* H1 inside the document — kept restrained because the page already has a
 * big hero title above. */
.legal-page-body h1 {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 1.75rem 0 0.85rem;
    color: #ffffff;
    letter-spacing: -0.01em;
}

/* H2 = numbered chapter. The number is auto-incremented and rendered as a
 * gradient pill before the heading text. */
.legal-page-body h2 {
    counter-increment: legal-h2;
    position: relative;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 2.5rem 0 1rem;
    color: #ffffff;
    letter-spacing: -0.01em;
    padding-left: 3.4rem;
    min-height: 2.4rem;
    display: flex;
    align-items: center;
}

.legal-page-body h2::before {
    content: counter(legal-h2, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2.7rem;
    height: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #f0abfc;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22), rgba(217, 70, 239, 0.18));
    border: 1px solid rgba(167, 139, 250, 0.35);
    border-radius: 8px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.06),
        0 6px 18px -8px rgba(124, 58, 237, 0.55);
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* H3 = sub-section, with a thin gradient rail on the left. */
.legal-page-body h3 {
    position: relative;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
    margin: 1.75rem 0 0.6rem;
    padding-left: 0.85rem;
    color: #f1f5f9;
}

.legal-page-body h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.35rem;
    bottom: 0.35rem;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #a78bfa, #f0abfc);
    box-shadow: 0 0 12px rgba(167, 139, 250, 0.5);
}

/* Paragraph + drop-cap on the very first paragraph for editorial flair. */
.legal-page-body p {
    margin: 0 0 1.05rem;
    color: #cbd5e1;
}

/* Lists — gradient custom marker. */
.legal-page-body ul,
.legal-page-body ol {
    margin: 0 0 1.1rem 0;
    padding: 0;
    list-style: none;
}

.legal-page-body li {
    position: relative;
    padding-left: 1.6rem;
    margin: 0.45rem 0;
    color: #cbd5e1;
}

.legal-page-body ul li::before {
    content: "";
    position: absolute;
    left: 0.4rem;
    top: 0.7rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 999px;
    background: linear-gradient(135deg, #a78bfa, #f0abfc);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.6);
}

.legal-page-body ol {
    counter-reset: legal-li;
}

.legal-page-body ol li {
    counter-increment: legal-li;
}

.legal-page-body ol li::before {
    content: counter(legal-li);
    position: absolute;
    left: 0;
    top: 0.15rem;
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #f0abfc;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.3);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}

/* Inline elements. */
.legal-page-body a {
    color: #c4b5fd;
    text-decoration: none;
    background-image: linear-gradient(transparent calc(100% - 1px), rgba(196, 181, 253, 0.5) 1px);
    background-size: 0% 100%;
    background-repeat: no-repeat;
    transition: background-size 220ms ease, color 200ms ease;
    padding-bottom: 1px;
}

.legal-page-body a:hover {
    color: #f0abfc;
    background-size: 100% 100%;
}

.legal-page-body code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
    color: #f0abfc;
    background: rgba(167, 139, 250, 0.12);
    border: 1px solid rgba(167, 139, 250, 0.22);
    padding: 0.08rem 0.4rem;
    border-radius: 5px;
}

.legal-page-body strong {
    font-weight: 700;
    color: #ffffff;
}

.legal-page-body em {
    font-style: italic;
    color: #e2e8f0;
}

.legal-page-body blockquote {
    margin: 1.25rem 0;
    padding: 0.85rem 1.15rem;
    border-left: 3px solid;
    border-image: linear-gradient(180deg, #a78bfa, #f0abfc) 1;
    background: rgba(167, 139, 250, 0.07);
    border-radius: 0 8px 8px 0;
    color: #cbd5e1;
    font-style: italic;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 720px) {
    .legal-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .legal-tab {
        font-size: 0.85rem;
        padding: 0.65rem;
    }

    .legal-page-body {
        font-size: 1rem;
        line-height: 1.75;
        max-height: min(65vh, 560px);
    }

    .legal-page-body h2 {
        padding-left: 2.85rem;
        font-size: 1.3rem;
    }

    .legal-page-body h2::before {
        width: 2.3rem;
        height: 2.1rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .legal-page {
        padding: 1.5rem 0.75rem 3rem;
    }

    .legal-page-inner {
        border-radius: 18px;
        padding: 1.5rem 1rem;
    }

    .legal-tab-label {
        font-size: 0.8rem;
    }

    .legal-page-meta {
        font-size: 0.78rem;
    }
}

/* Reduced motion. */
@media (prefers-reduced-motion: reduce) {

    .legal-page-body,
    .legal-page-body.is-fade-in {
        animation: none;
        transition: none;
    }

    .page-legal .as-main::before {
        animation: none;
    }
}


/* ── Footer actions (Back + Accept) ────────────────────── */
.legal-page-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.legal-page-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.7rem 1.15rem;
    border-radius: 11px;
    border: 1px solid transparent;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 200ms ease, border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}

.legal-page-btn svg {
    width: 16px;
    height: 16px;
}

.legal-page-btn--ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.10);
    color: #cbd5e1;
}

.legal-page-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
    color: #ffffff;
}

.legal-page-btn--primary {
    color: #ffffff;
    background: linear-gradient(135deg, #7c3aed 0%, #d946ef 100%);
    box-shadow:
        0 10px 24px -8px rgba(124, 58, 237, 0.6),
        inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.legal-page-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 14px 30px -8px rgba(124, 58, 237, 0.75),
        inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.legal-page-btn--primary:active {
    transform: translateY(0);
}

.legal-page-btn.is-loading {
    pointer-events: none;
    opacity: 0.7;
}

.legal-page-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ── Toast (Accept feedback) ───────────────────────────── */
.legal-toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 12px);
    background: linear-gradient(135deg, rgba(15, 14, 28, 0.96), rgba(31, 23, 64, 0.96));
    border: 1px solid rgba(167, 139, 250, 0.4);
    color: #ffffff;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    box-shadow:
        0 18px 40px -10px rgba(0, 0, 0, 0.55),
        0 0 24px -6px rgba(167, 139, 250, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    opacity: 0;
    transition: opacity 220ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 50;
    max-width: calc(100vw - 32px);
}

.legal-toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

/* Responsive footer + close button. */
@media (max-width: 480px) {
    .legal-page-close {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }

    .legal-page-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .legal-page-footer .legal-page-btn {
        justify-content: center;
        width: 100%;
    }

    .legal-page-consent {
        margin-left: 0;
        font-size: 0.78rem;
    }
}