html {
    scroll-padding-top: 76px;
}

/* Container for sidebar + main */
.legal-content-wrapper {
    display: flex;
    flex-direction: row;
    max-width: var(--width-996);
    gap: var(--space-24);
    box-sizing: border-box;
    /* position: relative; */
}

/* Sidebar styles */
.legal-sidebar {
    background: var(--color-light-grey);
    border-radius: var(--radius-sm);
    padding: 24px 24px;
    box-sizing: border-box;
    box-shadow: 4px 0px 0px rgba(0, 0, 0, 0.25);
    box-shadow: var(--shadow-bottom-left);
    position: sticky;
    top: 72px; /* Adjust depending on your header height */
    align-self: flex-start;
}

.legal-sidebar ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.legal-sidebar li {
    margin-bottom: 16px;
}

/* Section titles in sidebar */
.legal-sidebar li.section-title a,
.legal-sidebar li.section-title-later a{
    font-family: Arial, sans-serif;
    font-weight: 700;
    font-size: 24px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: rgba(0, 0, 0, 0.8);
    margin-bottom: 12px;
}

.legal-sidebar li.section-title-later {
    margin-top: 24px;
    margin-bottom: 12px;
}

/* Links in sidebar */
.legal-sidebar a {
    display: block;
    font-family: Arial, sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: rgba(0, 0, 0, 0.8);
    text-decoration: none;
    width: 255px;
}

.legal-sidebar a:hover {
    text-decoration: underline;

}

aside ul > li:not(.section-title):not(.section-title-later):not(:first-child) > a {
    padding-left: 16px;

}

/* Main content area */
.legal-main {
    display: flex;
    flex-direction: column;
    gap: 48px;
    width: 100%;
    /* max-width: 700px; */
    box-sizing: border-box;
}

.legal-main h2 {
    font-family: Arial, sans-serif;
    line-height: 1.2;
    margin-bottom: 12px;
    text-align: left;
    width: 100%;
    max-width: none;
}

.legal-main p {
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    text-align: left;
    width: 100%;
}

.legal-main > div > p:not(:last-of-type) {
    margin-bottom: var(--space-12);
}

.subtitle {
    font-size: var(--font-24);
    font-family: Arial, sans-serif;
    font-weight: bold;
    margin-bottom: 12px;
}

.subtitle span {
    font-weight: initial;
}

p strong {
    font-weight: bold;
}

div > ul {
    padding-left: var(--space-24);
}

div > ul li {
    font-family: Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.sidebar-toggle-btn {
    display: none;
}

/* Close button inside sidebar */
.sidebar-close-btn {
    position: absolute;
    top: 8px;
    right: 16px;
    background: transparent;
    border: none;
    font-size: 48px;
    font-weight: 200;
    cursor: pointer;
    color: var(--color-black-text);
    z-index: 1101;
    transition: var(--transition-fast);
    display: none; /* hidden by default, shown on mobile when sidebar visible */
}

.sidebar-close-btn:hover {
    color: var(--color-orange);
}

@media (max-width: 768px) {
    .legal-content-wrapper {
        flex-direction: column;
    }

    .legal-sidebar {
        position: fixed; /* overlay */
        top: 0;
        left: 0;
        height: 100vh;
        /* width: 80vw; */
        max-width: 300px;
        background: var(--color-light-grey);
        padding: 24px;
        box-shadow: 4px 0px 0px rgba(0, 0, 0, 0.25);
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1000;
        overflow-y: auto;
        pointer-events: auto; /* ensure it doesn't block pointer events */
        transition: border-radius 150ms ease;
    }

    .legal-sidebar.open {
        transform: translateX(0);
    }

    .legal-main {
        width: 100%;
        padding: 16px;
    }

    /* Hide sidebar toggle button by default on desktop */
    .sidebar-toggle-btn {
        display: block;
        position: sticky;
        top: 76px;
        /* left: 16px; */
        z-index: 999; /* higher than sidebar's 1000 */
        background: var(--color-light-grey);
        border: none;
        padding: 8px 12px;
        font-size: 16px;
        font-weight: bold;
        cursor: pointer;
        border-radius: var(--radius-sm);
        box-shadow: var(--shadow-bottom);
        transition: var(--transition-fast);
        width: 100%;
        /* margin-left: auto; */
        right: 0;
    }

    .sidebar-toggle-btn.scrolled-right {
        width: auto;
        margin-left: auto;
    }

    .sidebar-toggle-btn:hover {
        box-shadow: var(--shadow-bottom-yellow);
    }

    .sidebar-close-btn {
        display: block;
    }
}

@media (max-width: 500px) {
    .legal-sidebar {
        /* max-width: 100vw; */
        /* width: 100vw; */
        border-radius: 0;
    }

    .legal-main {
        padding: 16px;
    }
}

