/*
 * THITO legal pages: Privacy Policy, Terms and Conditions, User Data Deletion
 * Loaded after css/homepage.css and css/pages.css (design tokens, nav, page hero,
 * buttons, support panel). Everything here is scoped to .th-page--legal / th-legal.
 */

/* Hero: switch between the three documents */
.th-legal__switch {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
}

.th-page--legal .th-legal__switch a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 18px;
    border: 1px solid rgba(239, 118, 18, .25);
    border-radius: 999px;
    background: rgba(255, 255, 255, .85);
    font-size: 14px;
    font-weight: 600;
    color: var(--th-ink-2);
    transition: border-color .2s, color .2s, background-color .2s;
}

.th-page--legal .th-legal__switch a:hover { border-color: var(--th-brand); color: var(--th-ink); }

.th-page--legal .th-legal__switch a[aria-current="page"] {
    border-color: transparent;
    background: var(--th-grad);
    color: var(--th-ink);
    box-shadow: 0 10px 22px -12px rgba(227, 95, 0, .7);
}

/* Layout */
.th-page--legal .th-legal { padding-top: 56px; padding-bottom: 72px; }

.th-legal__grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 40px;
    align-items: start;
}

/* On-this-page navigation */
.th-legal__aside {
    position: sticky;
    top: calc(var(--th-nav-h) + 20px);
}

.th-legal__toc--mobile { display: none; }

.th-page--legal .th-legal__toc--desktop {
    display: block;
    max-height: calc(100vh - var(--th-nav-h) - 48px);
    margin: 0;
    padding: 18px 12px;
    overflow-y: auto;
    border: 1px solid rgba(239, 118, 18, .15);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 16px 36px -26px rgba(120, 60, 10, .35);
    scrollbar-width: thin;
}

.th-page--legal .th-legal__toctitle {
    margin: 0 0 10px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--th-brand-ink);
}

.th-page--legal .th-legal__toc a {
    display: block;
    min-height: 0;
    margin: 0;
    padding: 7px 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--th-muted);
    transition: background-color .2s, color .2s;
}

.th-page--legal .th-legal__toc a.is-sub { padding-left: 26px; font-size: 13.5px; }

.th-page--legal .th-legal__toc a:hover {
    border: 0;
    background: var(--th-brand-tint);
    color: var(--th-ink);
}

.th-page--legal .th-legal__toc a.is-active {
    border: 0;
    background: var(--th-brand-tint);
    box-shadow: inset 3px 0 0 var(--th-brand);
    color: var(--th-ink);
    font-weight: 600;
}

/* Legal text */
.th-legal__body {
    padding: 48px 56px;
    border: 1px solid rgba(239, 118, 18, .12);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 20px 44px -30px rgba(120, 60, 10, .35);
    font-size: 16px;
    line-height: 1.75;
    color: var(--th-ink-2);
    overflow-wrap: anywhere;
}

.th-page--legal .th-legal__body h2,
.th-page--legal .th-legal__body h3 {
    position: relative;
    margin: 44px 0 14px;
    padding-top: 4px;
    font-family: var(--th-font-display);
    line-height: 1.25;
    letter-spacing: -.01em;
    color: var(--th-ink);
    text-align: left;
    scroll-margin-top: calc(var(--th-nav-h) + 24px);
}

.th-page--legal .th-legal__body h2 { font-size: 26px; font-weight: 800; }
.th-page--legal .th-legal__body h3 { font-size: 20px; font-weight: 700; }

.th-page--legal .th-legal__body > :first-child { margin-top: 0; }

/* Brief highlight when a section is opened from the list */
.th-page--legal .th-legal__body h2:target,
.th-page--legal .th-legal__body h3:target { color: var(--th-brand-ink); }

.th-page--legal .th-legal__body p {
    margin: 0 0 14px;
    text-align: left;
}

.th-page--legal .th-legal__body b { color: var(--th-ink); font-weight: 700; }

.th-page--legal .th-legal__body ul {
    margin: 0 0 18px;
    padding-left: 22px;
    list-style: disc;
}

.th-page--legal .th-legal__body ul ul { margin: 8px 0 4px; list-style: circle; }

/* The original markup indents list items inline; normalise it */
.th-page--legal .th-legal__body li {
    margin: 0 0 8px !important;
    padding-left: 4px;
}

.th-page--legal .th-legal__body li::marker { color: var(--th-brand); }

.th-page--legal .th-legal__body a {
    color: var(--th-brand-ink);
    font-weight: 600;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

.th-page--legal .th-legal__body a:hover { color: var(--th-ink); }

/* Spacer <br> tags between blocks are replaced by consistent margins */
.th-page--legal .th-legal__body > br { display: none; }

/* Help panel */
.th-page--legal .th-legal-help { padding-top: 0; }

/* Responsive */
@media (max-width: 1023px) {
    .th-legal__grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }

    .th-legal__aside { position: static; }

    .th-page--legal .th-legal__toc--desktop { display: none; }

    .th-legal__toc--mobile {
        display: block;
        border: 1px solid rgba(239, 118, 18, .18);
        border-radius: 18px;
        background: #fff;
        box-shadow: 0 12px 28px -22px rgba(120, 60, 10, .35);
    }

    .th-legal__toc--mobile summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 54px;
        padding: 0 20px;
        cursor: pointer;
        list-style: none;
        font-family: var(--th-font-display);
        font-size: 17px;
        font-weight: 700;
        color: var(--th-ink);
    }

    .th-legal__toc--mobile summary::-webkit-details-marker { display: none; }

    .th-legal__toc--mobile summary::after {
        content: "";
        width: 9px;
        height: 9px;
        border-right: 2px solid var(--th-brand);
        border-bottom: 2px solid var(--th-brand);
        transform: translateY(-3px) rotate(45deg);
        transition: transform .2s var(--th-ease);
    }

    .th-legal__toc--mobile[open] summary::after { transform: translateY(2px) rotate(-135deg); }

    .th-legal__toclist {
        padding: 0 8px 12px;
        border-top: 1px solid var(--th-line);
        padding-top: 8px;
    }

    .th-legal__body { padding: 36px 32px; }
}

@media (max-width: 767px) {
    .th-page--legal .th-legal { padding-top: 32px; padding-bottom: 56px; }

    .th-legal__body {
        padding: 28px 20px;
        border-radius: 20px;
        font-size: 15.5px;
    }

    .th-page--legal .th-legal__body h2 { font-size: 22px; margin-top: 36px; }
    .th-page--legal .th-legal__body h3 { font-size: 18px; margin-top: 32px; }

    .th-page--legal .th-legal__body ul { padding-left: 18px; }
}
