/*
   Legal & Policies, mobile. SCD-536.
   Figma Qkw1rAqYvxShVppu34QlEv, page frames under 2156:21307, sheet spec 2177:5493.
   Deliberately not the desktop layout: the page scrolls normally and "On this page" is a
   bottom sheet, not a rail.
   Body copy carries !important because project.css forces every <p> to 16px/400/24px, which
   would override the 14/20 the design asks for here.
*/

/* Same release as legal-policy-desktop.css, for a page carrying only the mobile widget.
   The floor bites at exactly 768, where this twin is the one on screen. */
body:has(.legal-policy-mobile) {
    min-width: 0 !important;
}

.legal-policy-mobile,
.legal-policy-mobile *,
.legal-policy-mobile *::before,
.legal-policy-mobile *::after {
    box-sizing: border-box;
}

.legal-policy-mobile {
    background: #fff;
}

.legal-policy-mobile__title-bar {
    padding: 20px 16px 12px;
}

.legal-policy-mobile__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    color: #262626;
}

/* ---------- tabs ---------- */

/* Four tabs do not fit 390px, so the bar scrolls sideways with the bar itself hidden. */
.legal-policy-mobile__tabs {
    display: flex;
    align-items: stretch;
    gap: 24px;
    padding: 0 16px;
    background: #fff;
    border-bottom: 1px solid #d9d9d9;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.legal-policy-mobile__tabs::-webkit-scrollbar {
    display: none;
}

.legal-policy-mobile__tab {
    position: relative;
    display: flex;
    align-items: center;
    padding: 18px 0;
    border: 0;
    background: transparent;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: #717680;
    white-space: nowrap;
    cursor: pointer;
}

.legal-policy-mobile__tab.is-active {
    font-weight: 600;
    color: #465da6;
}

.legal-policy-mobile__tab.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: #465da6;
}

/* ---------- "On this page" trigger ---------- */

/* Sticky so the current section stays visible and the sheet stays reachable while reading.
   legal-policy-v2.js measures the site header and writes --legal-policy-sticky-top, so the bar
   parks under it instead of behind it. */
.legal-policy-mobile__toc-bar {
    position: sticky;
    top: var(--legal-policy-sticky-top, 0px);
    z-index: 5;
    padding: 12px 16px;
    background: #fff;
}

.legal-policy-mobile__toc-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 16px;
    background: #fff;
    border: 1px solid #d5d7da;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(10, 13, 18, 0.05);
    cursor: pointer;
    text-align: left;
}

.legal-policy-mobile__toc-text {
    display: flex;
    gap: 4px;
    min-width: 0;
    font-size: 14px;
    line-height: 20px;
}

.legal-policy-mobile__toc-label {
    flex: 0 0 auto;
    font-weight: 400;
    color: #717680;
}

.legal-policy-mobile__toc-current {
    min-width: 0;
    font-weight: 600;
    color: #465da6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.legal-policy-mobile__toc-trigger img {
    flex: 0 0 auto;
    display: block;
    width: 16px;
    height: 16px;
}

/* ---------- document copy ---------- */

.legal-policy-mobile__content {
    padding: 8px 16px 32px;
}

.legal-policy-mobile .legal-doc__title {
    display: none;
}

.legal-policy-mobile .legal-doc__heading {
    margin: 16px 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    color: #465da6;
}

.legal-policy-mobile .legal-doc p {
    margin: 0 0 14px;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 20px !important;
    color: #000;
}

.legal-policy-mobile .legal-doc ul,
.legal-policy-mobile .legal-doc ol {
    margin: 0 0 14px;
    padding-left: 20px;
}

.legal-policy-mobile .legal-doc li {
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 400;
    line-height: 20px;
    color: #000;
}

.legal-policy-mobile .legal-doc a {
    color: #465da6;
    text-decoration: underline;
}

/* ---------- bottom sheet ---------- */

.legal-policy-mobile__backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
}

.legal-policy-mobile__sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 80vh;
    padding: 16px 8px;
    background: #fff;
    border-radius: 8px 8px 0 0;
}

.legal-policy-mobile__sheet[hidden],
.legal-policy-mobile__backdrop[hidden] {
    display: none;
}

.legal-policy-mobile__sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.legal-policy-mobile__sheet-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    color: rgba(0, 0, 0, 0.88);
}

.legal-policy-mobile__sheet-close {
    display: flex;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
}

.legal-policy-mobile__sheet-close img {
    display: block;
    width: 20px;
    height: 20px;
}

.legal-policy-mobile__sheet-scroll {
    overflow-y: auto;
    overscroll-behavior: contain;
}

.legal-policy-mobile__sheet-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.legal-policy-mobile__sheet-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 400;
    line-height: 22px;
    color: #262626;
    text-decoration: none;
    /* Backstop only: the break opportunities come from LegalPolicySections.NavLabel. */
    overflow-wrap: anywhere;
}

.legal-policy-mobile__sheet-item.is-active {
    background: #ebf1ff;
    font-weight: 600;
    color: #465da6;
}

.legal-policy-mobile__sheet-check {
    flex: 0 0 auto;
    display: none;
    width: 20px;
    height: 20px;
}

.legal-policy-mobile__sheet-item.is-active .legal-policy-mobile__sheet-check {
    display: block;
}

/* html too: `overflow-x: clip` on html (_DefaultLayout) stops body's overflow propagating to
   the viewport, so locking body alone left the page behind the sheet scrolling. */
html.legal-policy-sheet-open {
    overflow-y: hidden;
}

body.legal-policy-sheet-open {
    overflow: hidden;
}

@media (min-width: 769px) {
    .legal-policy-mobile {
        display: none;
    }
}
