/* ─── Slurpy legal pages (Privacy Policy, Terms of Service) ─────────────────
   Loaded after /css/home.css, which provides tokens, nav, buttons and footer. */

/* Nav: home.js toggles .scrolled; legal pages have no JS, so the nav is
   always in its frosted "scrolled" state (class set in the markup). */

/* ─── Header band ──────────────────────────────────────────────────────── */

.legal-hero {
    position: relative;
    margin-top: calc(-1 * var(--nav-h));
    padding: calc(var(--nav-h) + clamp(40px, 5vw, 72px)) 0 clamp(36px, 4vw, 56px);
    background:
        radial-gradient(60% 120% at 0% 0%, rgba(18, 194, 255, .16), transparent 60%),
        radial-gradient(50% 120% at 100% 0%, rgba(166, 61, 255, .12), transparent 60%),
        linear-gradient(180deg, #eaf5fe 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--line);
}
.legal-hero .wrap { max-width: 1180px; }
.legal-hero .eyebrow { margin-bottom: 18px; }
.legal-hero h1 { font-size: clamp(40px, 5.2vw, 72px); }
.legal-hero h1 > span { display: inline; }
.legal-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px;
    margin-top: 22px;
    font-size: 14.5px; color: var(--muted);
}
.legal-meta .date {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 7px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, .8); border: 1px solid var(--line);
    font-weight: 600; color: var(--ink-2);
}
.legal-meta .date svg { width: 16px; height: 16px; fill: none; stroke: url(#g); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.legal-meta a { font-weight: 600; color: var(--blue); }
.legal-meta a:hover { text-decoration: underline; text-underline-offset: 3px; }
.legal-intro { max-width: 62ch; margin-top: 18px; font-size: 18px; line-height: 1.6; color: var(--ink-2); }

/* ─── Layout ───────────────────────────────────────────────────────────── */

.legal-layout {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: clamp(40px, 5vw, 72px);
    align-items: start;
    max-width: 1180px;
    padding-top: clamp(36px, 4vw, 56px);
    padding-bottom: clamp(64px, 7vw, 104px);
}

/* ─── Table of contents ────────────────────────────────────────────────── */

.toc {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
    max-height: calc(100vh - var(--nav-h) - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}
.toc summary {
    list-style: none;
    font-size: 11.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
    color: var(--muted);
    padding: 0 0 12px 14px;
    pointer-events: none;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary .chev { display: none; }
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; border-left: 2px solid var(--line); }
.toc li { counter-increment: toc; }
.toc a {
    display: flex; gap: 10px;
    margin-left: -2px;
    padding: 6px 10px 6px 14px;
    border-left: 2px solid transparent;
    font-size: 14px; line-height: 1.4; font-weight: 500;
    color: var(--muted);
    transition: color .15s, border-color .15s;
}
.toc a::before { content: counter(toc, decimal-leading-zero); font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: #9aa2b6; padding-top: 1px; flex: none; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--ink); font-weight: 700; border-left-color: var(--violet); border-image: var(--grad-d) 1; }
.toc a.active::before { color: var(--violet); }

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

.doc {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: clamp(28px, 4.5vw, 64px);
    min-width: 0;
}
.doc > * { max-width: 70ch; }
.doc section + section { margin-top: 52px; padding-top: 44px; border-top: 1px solid var(--line); }

.doc h2 {
    position: relative;
    display: flex; align-items: baseline; gap: 12px;
    font-family: var(--body);
    font-size: clamp(22px, 2.1vw, 27px);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -.01em;
    color: var(--ink);
    margin-bottom: 18px;
}
.doc h2 .n {
    flex: none;
    font-size: .62em; font-weight: 800; letter-spacing: .04em;
    font-variant-numeric: tabular-nums;
    background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
    transform: translateY(-.15em);
}
.doc h3 { font-size: 18px; font-weight: 700; line-height: 1.35; margin: 30px 0 10px; color: var(--ink); }
.doc h2 + h3 { margin-top: 8px; }

.anchor {
    margin-left: 2px;
    font-weight: 600; font-size: .8em;
    color: #b6bdcc;
    opacity: 0;
    transition: opacity .15s, color .15s;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--blue); }
@media (hover: none) { .anchor { opacity: .7; } }

.doc p, .doc li { font-size: 17px; line-height: 1.72; color: var(--ink-2); }
.doc p + p, .doc p + ul, .doc p + ol, .doc ul + p, .doc ol + p { margin-top: 14px; }
.doc ul, .doc ol { margin: 12px 0 0; padding-left: 1.3em; }
.doc li + li { margin-top: 8px; }
.doc li::marker { color: var(--violet); }
.doc strong { color: var(--ink); font-weight: 700; }
.doc a:not(.anchor) {
    color: var(--blue);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(91, 107, 255, .35);
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}
.doc a:not(.anchor):hover { text-decoration-color: currentColor; }
.doc code { font-size: .88em; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; overflow-wrap: anywhere; }

/* "In short" summary box */
.tldr {
    position: relative;
    padding: 22px 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, #eef8ff, #f5f0ff);
    border: 1px solid #dfe3f7;
    margin-bottom: 8px;
}
.tldr h2 { font-size: 13px !important; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2) !important; margin-bottom: 10px !important; }
.tldr ul { margin-top: 0; }
.tldr li { font-size: 16px; }
.tldr + section { margin-top: 44px; }

/* Key/value list (service providers, plan prices) */
.kv { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; }
.kv > div { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 4px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfcfe; }
.kv dt { font-weight: 700; color: var(--ink); font-size: 15.5px; }
.kv dd { margin: 0; font-size: 15.5px; line-height: 1.6; color: var(--ink-2); }

.note {
    margin-top: 16px;
    padding: 14px 18px;
    border-left: 3px solid var(--violet);
    border-image: var(--grad-d) 1;
    background: #fafbff;
    font-size: 16px !important;
}
.caps { text-transform: uppercase; font-size: 15px !important; letter-spacing: .01em; }

/* Owner-must-fill placeholders: deliberately loud so none ship unnoticed. */
.todo {
    background: #fff1a8;
    color: #6a4a00;
    border: 1px dashed #d9a400;
    border-radius: 6px;
    padding: 0 5px;
    font-weight: 700;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.doc-end { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 14.5px !important; color: var(--muted) !important; }

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

@media (max-width: 1080px) {
    .legal-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 860px; }
    .toc {
        position: static; max-height: none; overflow: visible;
        background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm);
    }
    .toc summary {
        pointer-events: auto; cursor: pointer;
        display: flex; align-items: center; justify-content: space-between;
        padding: 16px 18px; min-height: 52px;
        font-size: 12px; color: var(--ink-2);
    }
    .toc summary .chev { display: block; width: 18px; height: 18px; fill: none; stroke: var(--ink-2); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
    .toc details[open] summary .chev { transform: rotate(180deg); }
    .toc details[open] summary { border-bottom: 1px solid var(--line); }
    .toc ol { border-left: 0; padding: 8px 8px 12px; columns: 2; column-gap: 8px; }
    .toc li { break-inside: avoid; }
    .toc a { margin: 0; border-left: 0; padding: 8px 10px; border-radius: 8px; }
    .toc a.active { border-image: none; background: #f2f0ff; }
}

@media (max-width: 640px) {
    .legal-hero { padding-bottom: 30px; }
    .legal-hero h1 { font-size: clamp(36px, 11vw, 46px); }
    .legal-intro { font-size: 16.5px; }
    .legal-meta { font-size: 13.5px; }
    .legal-layout { padding-top: 20px; padding-bottom: 56px; }
    .toc ol { columns: 1; }
    .doc { border-radius: 18px; padding: 24px 18px 28px; }
    .doc section + section { margin-top: 36px; padding-top: 32px; }
    .doc h2 { font-size: 21px; gap: 10px; }
    .doc h3 { font-size: 17px; margin-top: 24px; }
    .doc p, .doc li { font-size: 16.5px; line-height: 1.68; }
    .tldr { padding: 18px 16px; }
    .kv > div { grid-template-columns: minmax(0, 1fr); padding: 12px 14px; }
}

@media print {
    .nav, .toc, .footer, .anchor { display: none !important; }
    .legal-layout { display: block; }
    .doc { border: 0; box-shadow: none; padding: 0; }
    .legal-hero { margin-top: 0; padding: 0 0 20px; background: none; }
}
