/*======================================
    Legal pages (Privacy Policy / Terms of Use)
    Same structure as the SelfieDump legal pages, themed with the LoopIn
    palette from main.css (#6d28d9 accent, #081828 ink, #F4F7FA surface).
========================================*/

/* main.css (`html`) and Bootstrap (`:root`) set `scroll-behavior: smooth`
   for the homepage's single-page nav. On these long legal pages that smooth scroll
   fights the browser's native on-load fragment jump (e.g. arriving at
   #cookies): late web-font loading reflows the page mid-animation and the
   jump lands short, or overshoots. This stylesheet is only loaded on the
   legal pages, so the reset is scoped to them; legal.js still requests an
   explicit 'smooth' behavior for in-page navigation after load. */
:root,
html {
    scroll-behavior: auto;
}

.legal-page {
    --legal-ink: #081828;
    --legal-muted: #5f6774;
    --legal-accent: #6d28d9;
    --legal-accent-deep: #5b21b6;
    --legal-line: #e4e8ef;
    --legal-surface: #F4F7FA;
    --legal-radius: 14px;
    background: #fff;
    padding-bottom: 100px;
}

/* "Last Updated · Effective Date" line under the breadcrumb title */
.breadcrumbs .breadcrumbs-content .page-meta {
    color: rgba(255, 255, 255, .8);
    font-size: 14px;
    line-height: 22px;
    margin-top: 10px;
}

/* Quick topics + search */
.legal-quickbar {
    padding: 50px 0 20px;
}

.legal-quickbar .search-field {
    position: relative;
    max-width: 420px;
    margin-bottom: 18px;
}

.legal-quickbar .search-field label {
    display: block;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--legal-muted);
    font-weight: 700;
    margin-bottom: 8px;
}

.legal-search-input {
    width: 100%;
    border: 1px solid var(--legal-line);
    border-radius: 10px;
    padding: 11px 14px;
    font-family: "DM Sans", sans-serif;
    font-size: 15px;
    background: #fff;
    color: var(--legal-ink);
}

.legal-search-input:focus-visible {
    outline: 2px solid var(--legal-accent);
    outline-offset: 1px;
}

.legal-search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--legal-line);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 8px 24px rgba(8, 24, 40, .1);
    z-index: 20;
    max-height: 320px;
    overflow-y: auto;
}

.legal-search-results[hidden] {
    display: none;
}

.legal-search-results button {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-radius: 8px;
    padding: 9px 10px;
    cursor: pointer;
    font-family: "DM Sans", sans-serif;
}

.legal-search-results button:hover,
.legal-search-results button:focus-visible {
    background: var(--legal-surface);
    outline: none;
}

.legal-search-results .result-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--legal-ink);
}

.legal-search-results .result-blurb {
    font-size: 13px;
    color: var(--legal-muted);
    margin-top: 2px;
}

.legal-search-empty {
    font-size: 13px;
    color: var(--legal-muted);
    padding: 10px 8px;
}

.legal-topics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.legal-topics li {
    margin: 0;
}

.legal-topics a {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
    color: var(--legal-ink);
    background: var(--legal-surface);
    border: 1px solid var(--legal-line);
    border-radius: 999px;
    padding: 8px 14px;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.legal-topics a:hover {
    border-color: var(--legal-accent);
    color: var(--legal-accent-deep);
}

.legal-topics a:focus-visible {
    outline: 2px solid var(--legal-accent);
    outline-offset: 2px;
}

.legal-topics a.is-active {
    background: var(--legal-accent);
    border-color: var(--legal-accent);
    color: #fff;
}

@media (max-width: 767px) {
    .legal-topics {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .legal-topics a {
        flex-shrink: 0;
    }
}

/* "At a glance" comparison cards (privacy page only) */
.legal-summary {
    padding: 0 0 40px;
}

.legal-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 10px;
}

.legal-summary-card {
    border: 1px solid var(--legal-line);
    border-radius: var(--legal-radius);
    padding: 20px 22px;
    background: var(--legal-surface);
}

.legal-summary-card h2 {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 10px;
}

.legal-summary-card.collects h2 {
    color: var(--legal-accent-deep);
}

.legal-summary-card.never h2 {
    color: #1F6E5E;
}

.legal-summary-card ul {
    margin: 0;
    padding-left: 18px;
    list-style: disc;
}

.legal-summary-card li {
    font-size: 14px;
    line-height: 22px;
    color: var(--legal-muted);
    margin-bottom: 6px;
}

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

/* Two-column ToC + content layout */
.legal-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 56px;
    align-items: start;
}

.toc {
    position: sticky;
    top: 120px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.toc summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--legal-muted);
    font-weight: 700;
    margin-bottom: 14px;
    padding: 2px 0;
}

.toc summary::-webkit-details-marker {
    display: none;
}

.toc summary .chev {
    transition: transform .2s ease;
    color: var(--legal-accent);
    font-size: 14px;
}

.toc[open] summary .chev {
    transform: rotate(90deg);
}

.toc a {
    display: block;
    font-size: 14px;
    line-height: 20px;
    color: var(--legal-muted);
    padding: 6px 0 6px 12px;
    border-left: 2px solid transparent;
    transition: color .15s ease, border-color .15s ease;
}

.toc a:hover {
    color: var(--legal-ink);
    border-left-color: var(--legal-accent);
}

/* Active state for the on-page ToC, driven by IntersectionObserver */
.toc a.is-active {
    color: var(--legal-accent-deep);
    border-left-color: var(--legal-accent);
    font-weight: 700;
}

.toc a:focus-visible {
    outline: 2px solid var(--legal-accent);
    outline-offset: 2px;
    border-radius: 3px;
}

.legal-body {
    max-width: 720px;
    min-width: 0;
}

.legal-body .lede {
    font-size: 17px;
    line-height: 30px;
    color: var(--legal-muted);
    margin-bottom: 44px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--legal-line);
}

.legal-body section {
    margin-bottom: 44px;
    scroll-margin-top: 120px;
}

.legal-body h2 {
    font-size: 20px;
    line-height: 28px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    gap: 10px;
    align-items: baseline;
}

.legal-body h2 .num {
    color: var(--legal-accent);
    font-weight: 700;
    font-size: 17px;
}

.legal-body h3 {
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    margin: 20px 0 8px;
}

.legal-body p {
    font-size: 15px;
    line-height: 26px;
    color: var(--legal-muted);
    margin-bottom: 12px;
}

.legal-body ul {
    margin: 8px 0 12px 20px;
    list-style: disc;
}

.legal-body li {
    font-size: 15px;
    line-height: 26px;
    color: var(--legal-muted);
    margin-bottom: 6px;
}

.legal-body b {
    color: var(--legal-ink);
}

.legal-body a.inline {
    display: inline;
    color: var(--legal-accent);
    text-decoration: underline;
}

.legal-body a.inline:hover {
    color: var(--legal-accent-deep);
}

/* Plain-language "In simple terms" callouts inside legal sections */
.legal-tldr {
    background: var(--legal-surface);
    border: 1px solid var(--legal-line);
    border-left: 3px solid var(--legal-accent);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.legal-tldr .tldr-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--legal-accent-deep);
    margin-bottom: 4px;
}

.legal-body .legal-tldr p {
    font-size: 14px;
    line-height: 23px;
    color: var(--legal-ink);
    margin: 0;
}

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

    .toc {
        position: static;
        max-height: none;
        margin-bottom: 28px;
        border: 1px solid var(--legal-line);
        border-radius: 12px;
        padding: 14px 16px;
    }

    .toc summary {
        margin-bottom: 0;
    }

    .toc[open] summary {
        margin-bottom: 10px;
    }

    .toc a {
        padding: 12px 8px;
    }

    .legal-body {
        max-width: none;
    }
}

@media (max-width: 767px) {
    .toc summary {
        min-height: 44px;
    }

    .legal-topics a {
        min-height: 44px;
    }
}

@media (max-width: 767px) {
    .legal-quickbar {
        padding-top: 36px;
    }

    .legal-page {
        padding-bottom: 70px;
    }
}
