/* ==========================================================================
   Privacy & Terms — premium legal-page enhancements
   Additive only. All classes prefixed .pv- / .privacy-layout so nothing
   collides with the page's existing inline styles. No legal text touched.
   ========================================================================== */

/* ---- Reading progress bar ---------------------------------------------- */
.pv-progress {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: transparent;
    z-index: 1200;
    pointer-events: none;
}

.pv-progress__bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #0d9488, #2dd4bf);
    transition: width 0.1s linear;
}

/* ---- Trust chips (hero) ------------------------------------------------- */
.pv-trust {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 1.75rem;
    position: relative;
    z-index: 2;
}

.pv-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #e0f2fe;
    padding: 0.5rem 1.05rem;
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.pv-chip i {
    width: 16px;
    height: 16px;
    color: #2dd4bf;
    flex-shrink: 0;
}

/* ---- Layout: content + sticky TOC -------------------------------------- */
/* Compound selector (.privacy-container.privacy-layout) is required to beat the
   page's inline `.privacy-container { max-width: 850px }`, which would otherwise
   squeeze the TOC + card into 850px and shrink the legal card. */
.privacy-container.privacy-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
    max-width: 1280px;
}

.privacy-layout .privacy-card {
    flex: 1;
    min-width: 0;
}

/* ---- Table of contents -------------------------------------------------- */
.pv-toc {
    position: sticky;
    top: 100px;
    width: 290px;
    flex-shrink: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1.25rem;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.pv-toc__title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
    padding: 0.35rem 0.4rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    cursor: default;
    list-style: none;
}

.pv-toc__title::-webkit-details-marker {
    display: none;
}

.pv-toc__title-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.pv-toc__title i {
    width: 18px;
    height: 18px;
    color: #0d9488;
}

.pv-toc__caret {
    transition: transform 0.25s ease;
    display: none;
}

.pv-toc__list {
    list-style: none;
    margin: 0.85rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.12rem;
}

.pv-toc__link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.65rem;
    border-radius: 10px;
    color: #475569;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.4;
    border-right: 3px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.pv-toc__num {
    flex-shrink: 0;
    width: 23px;
    height: 23px;
    border-radius: 7px;
    background: #f0fdfa;
    color: #0d9488;
    font-weight: 800;
    font-size: 0.78rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pv-toc__link:hover {
    background: #f8fafc;
    color: #0f172a;
}

.pv-toc__link.is-active {
    background: #f0fdfa;
    color: #0f766e;
    border-right-color: #0d9488;
}

.pv-toc__link.is-active .pv-toc__num {
    background: #0d9488;
    color: #ffffff;
}

.pv-toc__link:focus-visible {
    outline: 3px solid #0d9488;
    outline-offset: 2px;
}

/* Section anchor offset so jumps clear the fixed header */
.policy-section {
    scroll-margin-top: 100px;
}

/* ---- Back to top -------------------------------------------------------- */
.pv-top {
    position: fixed;
    bottom: 28px;
    left: 28px;
    z-index: 1100;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0d9488;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(13, 148, 136, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s, background 0.2s;
}

.pv-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pv-top:hover {
    background: #0f766e;
}

.pv-top:focus-visible {
    outline: 3px solid #2dd4bf;
    outline-offset: 3px;
}

.pv-top i {
    width: 22px;
    height: 22px;
}

/* Fade while actively scrolling on mobile (body.is-scrolling set by accessibility.js) */
@media (max-width: 768px) {
    body.is-scrolling .pv-top.is-visible {
        opacity: 0.3;
    }
}

/* ---- Tablet / mobile ---------------------------------------------------- */
@media (max-width: 1023px) {
    .privacy-container.privacy-layout {
        flex-direction: column;
        max-width: 850px;
    }

    .pv-toc {
        position: static;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .pv-toc__title {
        cursor: pointer;
        padding-bottom: 0.85rem;
    }

    .pv-toc__caret {
        display: inline-block;
    }

    .pv-toc[open] .pv-toc__caret {
        transform: rotate(180deg);
    }

    /* collapsed by default on mobile; the list only shows when open */
    .pv-toc:not([open]) .pv-toc__title {
        border-bottom: none;
        padding-bottom: 0.35rem;
    }
}

/* ---- Reduced motion ----------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {

    .pv-progress__bar,
    .pv-top,
    .pv-toc__caret {
        transition: none;
    }
}
