/*
 * Sales Assistant AI — Legal Workspace
 *
 * Responsibility:
 * - shared legal-document viewport
 * - centred framed legal-document workspace
 * - fixed legal-document heading
 * - internally scrollable legal content
 * - shared legal-document print action
 * - print-friendly legal documents
 * - fixed site footer
 * - responsive legal-document layout
 */

body[data-legal-page="true"] {
    display: flex;
    flex-direction: column;

    height: 100vh;
    min-height: 100vh;

    overflow: hidden;

    background:
        radial-gradient(
            circle at 50% 0%,
            rgba(79, 140, 255, 0.07),
            transparent 34rem
        ),
        var(--color-background);
}

body[data-legal-page="true"]
.site-header {
    flex: 0 0 auto;
}

body[data-legal-page="true"]
main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;

    min-height: 0;

    overflow: hidden;
}

body[data-legal-page="true"]
.legal-page {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    justify-content: center;

    min-height: 0;

    padding:
        1rem
        1rem;

    overflow: hidden;
}

body[data-legal-page="true"]
.legal-page > .container {
    display: flex;
    flex-direction: column;

    box-sizing: border-box;

    width: min(
        calc(100vw - 2rem),
        52rem
    );

    height: min(
        100%,
        42rem
    );

    min-height: 0;

    margin-inline: auto;

    padding:
        2rem
        2.4rem
        1.6rem;

    overflow: hidden;

    border: 1px solid rgba(212, 175, 55, 0.38);
    border-radius: 1.4rem;

    background:
        radial-gradient(
            circle at 15% 0%,
            rgba(79, 140, 255, 0.11),
            transparent 26rem
        ),
        linear-gradient(
            145deg,
            rgba(18, 31, 51, 0.97),
            rgba(10, 21, 37, 0.99)
        );

    box-shadow:
        0 1.6rem 4.5rem rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

/*
 * Fixed legal heading
 */

body[data-legal-page="true"]
.legal-page__heading {
    position: relative;

    display: block;
    flex: 0 0 auto;

    width: 100%;
    margin: 0 0 1rem;
}

body[data-legal-page="true"]
.legal-page__heading
.section-heading__eyebrow {
    display: block;

    margin:
        0
        0
        0.9rem;

    padding-right: 7rem;
}

body[data-legal-page="true"]
.legal-page__heading h1 {
    display: block;

    width: 100%;
    margin:
        0
        0
        0.8rem;

    font-size: clamp(2.8rem, 4vw, 3.6rem);
    line-height: 1.05;
}

body[data-legal-page="true"]
.legal-page__heading > p:last-child {
    display: block;

    max-width: 44rem;
    margin: 0;

    line-height: 1.65;
}

/*
 * Shared print action
 */

body[data-legal-page="true"]
.legal-page__print {
    position: absolute;
    top: 0;
    right: 0;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;

    min-height: 2.35rem;

    padding:
        0.48rem
        0.8rem;

    border: 1px solid rgba(212, 175, 55, 0.42);
    border-radius: 0.7rem;

    color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.035);

    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;

    cursor: pointer;

    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

body[data-legal-page="true"]
.legal-page__print:hover {
    border-color: rgba(212, 175, 55, 0.72);

    color: #ffffff;
    background: rgba(212, 175, 55, 0.09);

    transform: translateY(-1px);
}

body[data-legal-page="true"]
.legal-page__print:focus-visible {
    outline: 2px solid rgba(212, 175, 55, 0.75);
    outline-offset: 3px;
}

body[data-legal-page="true"]
.legal-page__print__icon {
    display: inline-flex;

    align-items: center;
    justify-content: center;

    font-size: 1rem;
    line-height: 1;
}

/*
 * Scrollable legal document content
 */

body[data-legal-page="true"]
.legal-page__content {
    flex: 1 1 auto;

    box-sizing: border-box;

    width: 100%;
    min-height: 0;

    padding:
        1.1rem
        0.8rem
        0.5rem
        0;

    overflow-x: hidden;
    overflow-y: auto;

    overscroll-behavior: contain;
    scrollbar-gutter: stable;

    border-top: 1px solid rgba(255, 255, 255, 0.08);

    outline: none;
}

body[data-legal-page="true"]
.legal-page__content:focus-visible {
    box-shadow:
        inset 0 0 0 2px rgba(212, 175, 55, 0.18);
}

body[data-legal-page="true"]
.legal-page__content::-webkit-scrollbar {
    width: 0.65rem;
}

body[data-legal-page="true"]
.legal-page__content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.025);
}

body[data-legal-page="true"]
.legal-page__content::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 999px;

    background: rgba(212, 175, 55, 0.44);
    background-clip: padding-box;
}

body[data-legal-page="true"]
.legal-page__content::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.64);
    background-clip: padding-box;
}

/*
 * Fixed site footer
 */

body[data-legal-page="true"]
.site-footer {
    flex: 0 0 auto;
}

/*
 * Responsive
 */

@media (max-width: 768px) {
    body[data-legal-page="true"] {
        height: 100dvh;
        min-height: 100dvh;
    }

    body[data-legal-page="true"]
    .legal-page {
        padding:
            0.7rem
            0.6rem;
    }

    body[data-legal-page="true"]
    .legal-page > .container {
        width: 100%;
        height: min(
            100%,
            42rem
        );

        padding:
            1.4rem
            1.25rem
            1.1rem;

        border-radius: 1.1rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading {
        margin-bottom: 0.8rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading
    .section-heading__eyebrow {
        margin-bottom: 0.7rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading h1 {
        margin-bottom: 0.7rem;

        font-size: 2.7rem;
    }

    body[data-legal-page="true"]
    .legal-page__content {
        padding:
            0.9rem
            0.35rem
            0.4rem
            0;
    }
}

@media (max-width: 520px) {
    body[data-legal-page="true"]
    .legal-page {
        padding:
            0.4rem
            0.35rem;
    }

    body[data-legal-page="true"]
    .legal-page > .container {
        width: 100%;
        height: 100%;

        padding:
            1.1rem
            0.95rem
            0.9rem;

        border-radius: 1rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading {
        margin-bottom: 0.65rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading
    .section-heading__eyebrow {
        margin-bottom: 0.55rem;

        padding-right: 5.5rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading h1 {
        font-size: 2.2rem;
    }

    body[data-legal-page="true"]
    .legal-page__print {
        min-height: 2.1rem;

        padding:
            0.42rem
            0.62rem;

        font-size: 0.75rem;
    }
}

/*
 * Print
 */

@media print {
    @page {
        margin: 16mm;
    }

    html,
    body[data-legal-page="true"] {
        width: auto;
        height: auto;
        min-height: 0;

        overflow: visible;

        background: #ffffff;
    }

    body[data-legal-page="true"] {
        display: block;

        color: #000000;
    }

    body[data-legal-page="true"]
    .site-header,
    body[data-legal-page="true"]
    .site-footer,
    body[data-legal-page="true"]
    .legal-page__print {
        display: none !important;
    }

    body[data-legal-page="true"]
    main,
    body[data-legal-page="true"]
    .legal-page,
    body[data-legal-page="true"]
    .legal-page > .container,
    body[data-legal-page="true"]
    .legal-page__content {
        display: block;

        width: auto;
        height: auto;
        min-height: 0;
        max-height: none;

        margin: 0;
        padding: 0;

        overflow: visible;

        border: 0;
        border-radius: 0;

        background: transparent;
        box-shadow: none;
    }

    body[data-legal-page="true"]
    .legal-page__heading {
        margin:
            0
            0
            1.5rem;
    }

    body[data-legal-page="true"]
    .legal-page__heading
    .section-heading__eyebrow {
        padding-right: 0;

        color: #555555;
    }

    body[data-legal-page="true"]
    .legal-page__heading h1 {
        color: #000000;

        font-size: 24pt;
        line-height: 1.15;
    }

    body[data-legal-page="true"]
    .legal-page__heading > p:last-child {
        max-width: none;

        color: #333333;
    }

    body[data-legal-page="true"]
    .legal-page__content {
        padding-top: 1rem;

        border-top: 1px solid #cccccc;

        color: #000000;
        scrollbar-gutter: auto;
    }

    body[data-legal-page="true"]
    .legal-page__content * {
        color: #000000;
        text-shadow: none;
    }

    body[data-legal-page="true"]
    .legal-page__content a {
        color: #000000;
        text-decoration: underline;
    }

    body[data-legal-page="true"]
    .legal-page__content h2,
    body[data-legal-page="true"]
    .legal-page__content h3 {
        break-after: avoid-page;
        page-break-after: avoid;
    }

    body[data-legal-page="true"]
    .legal-page__content p,
    body[data-legal-page="true"]
    .legal-page__content li {
        orphans: 3;
        widows: 3;
    }
}