@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;700&display=swap");

:root {
    --legal-paper: #f6ecdc;
    --legal-paper-strong: #fde2c3;
    --legal-panel: rgba(255, 248, 236, 0.9);
    --legal-panel-strong: rgba(255, 242, 223, 0.96);
    --legal-ink: #1d160f;
    --legal-muted: #67584a;
    --legal-accent: #ff7a45;
    --legal-accent-soft: #ffd7b7;
    --legal-signal: #1f7aef;
    --legal-signal-soft: #dceaff;
    --legal-line: #1d160f;
    --legal-shadow: 8px 8px 0 var(--legal-line);
    --legal-shadow-soft: 5px 5px 0 var(--legal-line);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

.legal-page {
    min-height: 100vh;
    margin: 0;
    padding: 24px 18px 48px;
    color: var(--legal-ink);
    background:
        radial-gradient(circle at 14% 16%, rgba(255, 122, 69, 0.18), transparent 34%),
        radial-gradient(circle at 86% 18%, rgba(31, 122, 239, 0.14), transparent 32%),
        linear-gradient(180deg, #f8efe2 0%, #f5ead8 55%, #f2e3cd 100%);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    position: relative;
}

.legal-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(29, 22, 15, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 22, 15, 0.06) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent 88%);
}

.legal-shell {
    max-width: 1180px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.glass {
    border: 3px solid var(--legal-line);
    border-radius: 28px;
    background: var(--legal-panel);
    box-shadow: var(--legal-shadow);
}

.legal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.legal-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--legal-ink);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.legal-brand::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: var(--legal-accent);
    border: 2px solid var(--legal-line);
    box-shadow: 2px 2px 0 var(--legal-line);
}

.legal-page-switch {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    border: 3px solid var(--legal-line);
    background: rgba(255, 255, 255, 0.62);
    box-shadow: var(--legal-shadow-soft);
}

.legal-switch-link {
    text-decoration: none;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--legal-muted);
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.legal-switch-link:hover {
    transform: translateY(-1px);
    color: var(--legal-ink);
}

.legal-switch-link.active {
    color: #fff8ef;
    background: var(--legal-ink);
}

.legal-hero {
    padding: 28px;
    margin-bottom: 18px;
    background:
        radial-gradient(circle at top right, rgba(31, 122, 239, 0.15), transparent 30%),
        linear-gradient(160deg, rgba(255, 255, 255, 0.84), rgba(255, 243, 223, 0.92));
    overflow: hidden;
    position: relative;
}

.legal-hero::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -36px;
    top: -46px;
    border-radius: 40px;
    background: rgba(255, 122, 69, 0.12);
    border: 3px solid var(--legal-line);
    transform: rotate(18deg);
}

.legal-kicker,
.legal-badge,
.legal-toc-title {
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.legal-kicker {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 16px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 2px solid var(--legal-line);
    background: var(--legal-paper-strong);
    box-shadow: 3px 3px 0 var(--legal-line);
    font-size: 12px;
    font-weight: 700;
}

.legal-kicker::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--legal-accent);
    border: 2px solid var(--legal-line);
}

.legal-title {
    position: relative;
    z-index: 1;
    margin: 0;
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-size: clamp(42px, 6vw, 72px);
    line-height: 0.94;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.legal-subtitle {
    position: relative;
    z-index: 1;
    margin: 16px 0 0;
    max-width: 72ch;
    font-size: 16px;
    line-height: 1.8;
    color: var(--legal-muted);
}

.legal-meta {
    position: relative;
    z-index: 1;
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.legal-badge {
    display: inline-flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 999px;
    border: 2px solid var(--legal-line);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 3px 3px 0 var(--legal-line);
    font-size: 11px;
    font-weight: 700;
}

.legal-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
}

.legal-toc {
    align-self: start;
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 38px);
    overflow: auto;
    padding: 18px;
    background: var(--legal-panel-strong);
}

.legal-toc-title {
    margin: 0 0 12px;
    font-size: 11px;
    color: var(--legal-muted);
}

.legal-toc-list {
    display: grid;
    gap: 4px;
}

.legal-toc-link {
    display: block;
    border-radius: 16px;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--legal-muted);
    font-size: 13px;
    line-height: 1.45;
    transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.legal-toc-link.level-1 {
    font-weight: 700;
    color: var(--legal-ink);
}

.legal-toc-link.level-2 {
    padding-left: 18px;
}

.legal-toc-link.level-3 {
    padding-left: 26px;
    font-size: 12px;
}

.legal-toc-link:hover {
    transform: translateX(2px);
    color: var(--legal-ink);
    background: rgba(255, 122, 69, 0.12);
}

.legal-toc-link.active {
    color: var(--legal-ink);
    background: rgba(31, 122, 239, 0.12);
    box-shadow: inset 0 0 0 2px var(--legal-line);
}

.legal-article {
    padding: 28px;
    background: rgba(255, 252, 246, 0.94);
}

.legal-content {
    color: var(--legal-ink);
    font-size: 16px;
    line-height: 1.84;
}

.legal-content h1,
.legal-content h2,
.legal-content h3,
.legal-content h4 {
    margin-top: 34px;
    margin-bottom: 12px;
    color: var(--legal-ink);
    font-family: "Space Grotesk", "Segoe UI", sans-serif;
    font-weight: 700;
    letter-spacing: -0.04em;
    line-height: 1.02;
    scroll-margin-top: 26px;
}

.legal-content h1:first-child,
.legal-content h2:first-child,
.legal-content h3:first-child {
    margin-top: 0;
}

.legal-content h1 { font-size: 36px; }
.legal-content h2 { font-size: 28px; }
.legal-content h3 { font-size: 22px; }
.legal-content h4 { font-size: 18px; }

.legal-heading-anchor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin-right: 8px;
    border-radius: 8px;
    opacity: 0;
    transform: translateY(-1px);
    color: var(--legal-signal);
    text-decoration: none;
    transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.legal-content h1:hover .legal-heading-anchor,
.legal-content h2:hover .legal-heading-anchor,
.legal-content h3:hover .legal-heading-anchor,
.legal-content h4:hover .legal-heading-anchor {
    opacity: 1;
    transform: translateY(0);
    background: rgba(31, 122, 239, 0.1);
}

.legal-content p,
.legal-content ul,
.legal-content ol,
.legal-content blockquote,
.legal-content pre {
    margin: 0 0 16px;
}

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

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

.legal-content strong {
    font-weight: 700;
}

.legal-content a {
    color: var(--legal-signal);
    text-decoration-thickness: 2px;
    text-underline-offset: 2px;
}

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

.legal-content code {
    padding: 2px 6px;
    border-radius: 8px;
    border: 2px solid var(--legal-line);
    background: var(--legal-signal-soft);
    font-size: 0.9em;
}

.legal-content pre {
    overflow: auto;
    padding: 16px;
    border: 3px solid var(--legal-line);
    border-radius: 20px;
    background: #fff8ed;
    box-shadow: var(--legal-shadow-soft);
}

.legal-content pre code {
    padding: 0;
    border: 0;
    background: transparent;
}

.legal-content blockquote {
    padding: 14px 16px;
    border-left: 6px solid var(--legal-accent);
    border-radius: 0 18px 18px 0;
    background: rgba(255, 122, 69, 0.1);
    color: var(--legal-ink);
}

.legal-content hr {
    border: 0;
    border-top: 3px solid rgba(29, 22, 15, 0.2);
    margin: 24px 0;
}

.legal-empty {
    color: var(--legal-muted);
}

.legal-footer {
    margin-top: 18px;
    padding: 12px 4px 0;
    color: var(--legal-muted);
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.04em;
}

@media (max-width: 980px) {
    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-toc {
        position: static;
        max-height: none;
    }
}

@media (max-width: 720px) {
    .legal-page {
        padding-inline: 14px;
    }

    .legal-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .legal-page-switch {
        width: 100%;
        justify-content: space-between;
    }

    .legal-switch-link {
        flex: 1;
        text-align: center;
    }

    .glass {
        border-radius: 24px;
        box-shadow: 6px 6px 0 var(--legal-line);
    }

    .legal-hero,
    .legal-article,
    .legal-toc {
        padding: 20px;
    }
}
