/* =========================================================
   MAGICMOON · LEGAL PAGE
   Tokens / nav / footer / buttons inherit from homepage-squatch.css.
   This file adds: legal hero, tab switcher, TOC sidebar, prose.
========================================================= */

/* ---------- LEGAL HERO ---------- */
.legal-hero {
    position: relative;
    overflow: hidden;
    background: var(--ink-up);
    padding: 88px 32px 64px;
    border-bottom: 1px solid var(--line);
}
.legal-hero .legal-hero-bg {
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.legal-hero .legal-hero-bg::before {
    content: "";
    position: absolute; inset: -60px;
    background:
        radial-gradient(ellipse 46% 42% at 15% 30%, rgba(124, 95, 235, 0.38), transparent 65%),
        radial-gradient(ellipse 38% 32% at 85% 80%, rgba(233, 196, 106, 0.22), transparent 65%);
    filter: blur(24px);
}
.legal-hero-inner {
    position: relative; z-index: 2;
    max-width: 1080px; margin: 0 auto;
    text-align: left;
}
.legal-hero .eyebrow { display: inline-block; margin-bottom: 18px; }
.legal-hero h1 {
    font-family: "DM Sans", sans-serif;
    font-weight: 900;
    font-size: clamp(3.2rem, 7vw, 5.8rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
    color: var(--cream);
    margin-bottom: 16px;
}
.legal-hero .legal-subtitle {
    font-family: "Fraunces", serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.6vw, 1.35rem);
    color: var(--text-dim);
    max-width: 560px;
    line-height: 1.5;
}

/* ---------- TAB SWITCHER ---------- */
.legal-tabs-bar {
    position: sticky;
    top: 64px;
    z-index: 20;
    background: rgba(5, 1, 15, 0.9);
    backdrop-filter: blur(16px) saturate(1.3);
    -webkit-backdrop-filter: blur(16px) saturate(1.3);
    border-bottom: 1px solid var(--line);
}
.legal-tabs {
    max-width: 1240px; margin: 0 auto;
    padding: 12px 32px;
    display: inline-flex;
    gap: 8px;
    width: 100%;
}
.legal-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "DM Sans", sans-serif;
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-dim);
    background: transparent;
    border: 1.5px solid var(--line-strong);
    padding: 12px 22px;
    border-radius: 10px;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.legal-tab:hover {
    color: var(--cream);
    border-color: rgba(233, 196, 106, 0.35);
}
.legal-tab.is-active {
    color: var(--ink);
    background: var(--gold);
    border-color: var(--gold);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

/* ---------- MAIN LAYOUT: TOC + CONTENT ---------- */
.legal-wrap {
    max-width: 1240px;
    margin: 0 auto;
    padding: 56px 32px 96px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 64px;
    align-items: start;
}

/* ---------- TOC SIDEBAR ---------- */
.legal-toc {
    position: sticky;
    top: 140px;
    align-self: start;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    padding-right: 8px;
}
.legal-toc-label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-strong);
}
.legal-toc-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.legal-toc-list a {
    font-family: "Inter Tight", sans-serif;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-dim);
    padding: 8px 10px;
    border-radius: 6px;
    border-left: 2px solid transparent;
    transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
    line-height: 1.35;
}
.legal-toc-list a:hover {
    color: var(--cream);
    background: rgba(244, 238, 220, 0.04);
}
.legal-toc-list a.is-active {
    color: var(--gold);
    border-left-color: var(--gold);
    background: rgba(233, 196, 106, 0.06);
}

/* Scrollbar polish */
.legal-toc::-webkit-scrollbar { width: 6px; }
.legal-toc::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
.legal-toc::-webkit-scrollbar-thumb:hover { background: rgba(233, 196, 106, 0.35); }

/* ---------- CONTENT PANEL ---------- */
.legal-content {
    max-width: 780px;
}
.legal-panel {
    display: none;
}
.legal-panel.is-active {
    display: block;
    animation: legalFade 0.3s ease;
}
@keyframes legalFade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.legal-panel-head {
    margin-bottom: 40px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--line);
}
.legal-panel-head .eyebrow { margin-bottom: 12px; display: inline-block; }
.legal-panel-head h2 {
    font-family: "DM Sans", sans-serif;
    font-weight: 900;
    font-size: clamp(1.8rem, 3.2vw, 2.6rem);
    line-height: 1.05;
    letter-spacing: -0.03em;
    color: var(--cream);
    margin-bottom: 12px;
}
.legal-panel-head p {
    font-family: "Inter Tight", sans-serif;
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.55;
    max-width: 620px;
}

/* ---------- PROSE (SECTION BLOCKS) ---------- */
.legal-section {
    padding: 32px 0;
    border-bottom: 1px solid var(--line);
    scroll-margin-top: 160px;
}
.legal-section:last-child { border-bottom: 0; }
.legal-section h3 {
    font-family: "DM Sans", sans-serif;
    font-weight: 800;
    font-size: 1.35rem;
    letter-spacing: -0.015em;
    color: var(--cream);
    margin-bottom: 16px;
    line-height: 1.2;
}
.legal-section h3 .italic-gold {
    font-size: 1em;
    font-weight: 500;
}
.legal-section p {
    font-family: "Inter Tight", sans-serif;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 14px;
}
.legal-section p:last-child { margin-bottom: 0; }
.legal-section ul,
.legal-section ol {
    margin: 10px 0 16px 0;
    padding-left: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.legal-section li {
    font-family: "Inter Tight", sans-serif;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text);
    padding-left: 22px;
    position: relative;
}
.legal-section ul li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 11px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px rgba(233, 196, 106, 0.5);
}
.legal-section ol {
    counter-reset: legal-count;
}
.legal-section ol li {
    counter-increment: legal-count;
}
.legal-section ol li::before {
    content: counter(legal-count) ".";
    position: absolute;
    left: 0;
    top: 0;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.82rem;
    color: var(--gold);
    font-weight: 600;
}
.legal-section a.legal-link {
    color: var(--gold);
    border-bottom: 1px solid rgba(233, 196, 106, 0.4);
    transition: color 0.18s ease, border-color 0.18s ease;
}
.legal-section a.legal-link:hover {
    color: var(--cream-warm);
    border-bottom-color: var(--cream-warm);
}
.legal-section strong {
    color: var(--cream);
    font-weight: 700;
}

.legal-updated {
    display: inline-block;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--gold);
    padding: 6px 12px;
    border: 1px solid rgba(233, 196, 106, 0.3);
    border-radius: 6px;
    margin-bottom: 22px;
}

.legal-contact-card {
    margin-top: 28px;
    padding: 22px 24px;
    background: rgba(14, 8, 37, 0.5);
    border: 1px solid var(--line-strong);
    border-radius: 12px;
}
.legal-contact-card p {
    margin-bottom: 0;
    font-size: 0.95rem;
}
.legal-contact-card strong {
    display: block;
    font-family: "DM Sans", sans-serif;
    font-weight: 800;
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 6px;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1080px) {
    .legal-wrap {
        grid-template-columns: 1fr;
        gap: 40px;
        padding: 40px 32px 72px;
    }
    .legal-toc {
        position: static;
        max-height: none;
        overflow: visible;
    }
    .legal-toc-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }
    .legal-toc-list a {
        border-left: 0;
        border: 1px solid var(--line-strong);
        font-size: 0.78rem;
        padding: 6px 12px;
    }
    .legal-toc-list a.is-active {
        border-left: 1px solid var(--gold);
        border-color: var(--gold);
    }
}
@media (max-width: 760px) {
    .legal-hero { padding: 56px 20px 44px; }
    .legal-tabs { padding: 10px 20px; gap: 6px; flex-wrap: wrap; }
    .legal-tab { font-size: 0.72rem; padding: 10px 16px; letter-spacing: 0.1em; }
    .legal-wrap { padding: 32px 20px 64px; gap: 32px; }
    .legal-tabs-bar { top: 56px; }
    .legal-section h3 { font-size: 1.18rem; }
}
