/* QRelia legal pages
   Kept separate from the marketing layout so long-form documents remain stable,
   readable and responsive without inheriting feature-page compositions. */

body.legal-page {
    --legal-bg: #07080d;
    --legal-panel: rgba(13, 15, 23, .94);
    --legal-panel-soft: rgba(255, 255, 255, .035);
    --legal-panel-hover: rgba(255, 255, 255, .055);
    --legal-line: rgba(255, 255, 255, .105);
    --legal-line-strong: rgba(255, 255, 255, .17);
    --legal-text: #f7f3f1;
    --legal-muted: #aaa7b2;
    --legal-soft: #d7d2d5;
    --legal-coral: #ff8a6c;
    --legal-coral-soft: #ffc1b0;
    --legal-cyan: #56e3e8;
    --legal-violet: #9b84ff;
    min-width: 320px;
    margin: 0;
    overflow-x: clip;
    color: var(--legal-text);
    background: var(--legal-bg);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body.legal-page main[role="main"] {
    position: relative;
    z-index: 1;
}

body.legal-page .qrelia-ambient {
    opacity: .45;
}

.legal-shell,
.legal-shell * {
    box-sizing: border-box;
}

.legal-shell {
    width: min(1240px, calc(100% - 40px));
    min-height: 100vh;
    margin: 0 auto;
    padding: 18px 0 48px;
}

.legal-shell a {
    color: inherit;
}

.legal-nav {
    position: sticky;
    top: 12px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 24px;
    min-height: 70px;
    padding: 9px 10px 9px 17px;
    border: 1px solid var(--legal-line);
    border-radius: 18px;
    background: rgba(8, 10, 16, .88);
    box-shadow: 0 18px 46px rgba(0, 0, 0, .26);
    backdrop-filter: blur(18px) saturate(125%);
    -webkit-backdrop-filter: blur(18px) saturate(125%);
}

.legal-brand {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    width: 124px;
    min-width: 124px;
    height: 46px;
    overflow: hidden;
    text-decoration: none;
}

.legal-brand img {
    display: block;
    width: auto;
    height: 42px;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
}

.legal-nav-links {
    display: flex;
    min-width: 0;
    margin-left: auto;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.legal-nav-links a {
    flex: 0 0 auto;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--legal-muted);
    font-size: .79rem;
    font-weight: 680;
    line-height: 1;
    text-decoration: none;
    transition: color .18s ease, background-color .18s ease;
}

.legal-nav-links a:hover,
.legal-nav-links a:focus-visible,
.legal-nav-links a[aria-current="page"] {
    color: #fff;
    background: var(--legal-panel-hover);
}

.legal-nav-links .legal-nav-trial {
    margin-left: 5px;
    color: #100d10;
    background: var(--legal-coral);
}

.legal-nav-links .legal-nav-trial:hover,
.legal-nav-links .legal-nav-trial:focus-visible {
    color: #100d10;
    background: #ff9b80;
}

.legal-hero {
    position: relative;
    overflow: hidden;
    margin-top: 18px;
    padding: clamp(42px, 6vw, 78px);
    border: 1px solid var(--legal-line);
    border-radius: 26px;
    background:
        radial-gradient(circle at 86% 20%, rgba(155, 132, 255, .15), transparent 34%),
        radial-gradient(circle at 15% 100%, rgba(255, 138, 108, .15), transparent 38%),
        linear-gradient(135deg, rgba(18, 20, 30, .98), rgba(9, 11, 18, .98));
    box-shadow: 0 34px 90px rgba(0, 0, 0, .30);
}

.legal-hero::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 138, 108, .72), rgba(86, 227, 232, .42), transparent);
}

.legal-hero-inner {
    position: relative;
    width: 100%;
    margin: 0;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
    align-items: end;
    gap: clamp(32px, 6vw, 84px);
}

.legal-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 17px;
    color: var(--legal-coral-soft);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .145em;
    text-transform: uppercase;
}

.legal-eyebrow::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--legal-coral);
    box-shadow: 24px 0 0 rgba(86, 227, 232, .6);
}

.legal-hero h1 {
    max-width: 790px;
    margin: 0;
    color: #fff;
    font-size: clamp(2.75rem, 6vw, 5.35rem);
    font-weight: 760;
    line-height: .98;
    letter-spacing: -.06em;
    text-wrap: balance;
}

.legal-hero-lead {
    max-width: 700px;
    margin: 22px 0 0;
    color: var(--legal-muted);
    font-size: clamp(1rem, 1.45vw, 1.14rem);
    line-height: 1.75;
}

.legal-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.legal-meta-card,
.legal-hero-note {
    min-width: 0;
    padding: 16px 17px;
    border: 1px solid var(--legal-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .035);
}

.legal-meta-card span {
    display: block;
    color: #8f8c98;
    font-size: .65rem;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.legal-meta-card strong {
    display: block;
    margin-top: 6px;
    overflow-wrap: anywhere;
    color: #fff;
    font-size: .86rem;
    font-weight: 680;
    line-height: 1.4;
}

.legal-hero-note {
    grid-column: 1 / -1;
    color: #c2bec6;
    font-size: .86rem;
    line-height: 1.65;
}

.legal-layout {
    display: grid;
    width: 100%;
    margin-inline: 0;
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
    gap: clamp(30px, 5vw, 64px);
    padding: 54px 0 70px;
}

.legal-toc {
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 118px);
    overflow: auto;
    padding: 16px;
    border: 1px solid var(--legal-line);
    border-radius: 18px;
    background: rgba(12, 14, 21, .82);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 138, 108, .45) transparent;
}

.legal-toc summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 36px;
    color: #fff;
    font-size: .82rem;
    font-weight: 740;
    cursor: pointer;
    list-style: none;
}

.legal-toc summary::-webkit-details-marker {
    display: none;
}

.legal-toc summary::after {
    content: "−";
    display: grid;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    place-items: center;
    border: 1px solid var(--legal-line);
    border-radius: 8px;
    color: var(--legal-coral-soft);
    background: rgba(255, 255, 255, .025);
    font-size: 1rem;
    line-height: 1;
}

.legal-toc:not([open]) summary::after {
    content: "+";
}

.legal-toc-summary-copy {
    display: grid;
    gap: 2px;
}

.legal-toc-summary-copy small {
    color: #85828e;
    font-size: .66rem;
    font-weight: 600;
}

.legal-toc-links {
    display: grid;
    gap: 2px;
    margin-top: 13px;
    padding-top: 13px;
    border-top: 1px solid var(--legal-line);
}

.legal-toc-title {
    display: none;
}

.legal-toc-links a {
    display: block;
    padding: 7px 9px;
    border-radius: 8px;
    color: #96939e;
    font-size: .72rem;
    font-weight: 610;
    line-height: 1.35;
    text-decoration: none;
    transition: color .16s ease, background-color .16s ease;
}

.legal-toc-links a:hover,
.legal-toc-links a:focus-visible {
    color: #fff;
    background: rgba(255, 255, 255, .05);
}

.legal-content {
    min-width: 0;
    overflow: hidden;
    padding: clamp(25px, 4.6vw, 58px);
    border: 1px solid var(--legal-line);
    border-radius: 24px;
    background: var(--legal-panel);
    box-shadow: 0 32px 88px rgba(0, 0, 0, .25);
}

.legal-section {
    scroll-margin-top: 105px;
    padding: 0 0 clamp(34px, 4.5vw, 52px);
    margin: 0 0 clamp(34px, 4.5vw, 52px);
    border-bottom: 1px solid var(--legal-line);
}

.legal-section:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.legal-section h2 {
    margin: 0 0 20px;
    color: #fff;
    font-size: clamp(1.55rem, 2.8vw, 2.25rem);
    font-weight: 735;
    line-height: 1.12;
    letter-spacing: -.035em;
    text-wrap: balance;
}

.legal-section h3 {
    margin: 28px 0 11px;
    color: var(--legal-soft);
    font-size: 1.08rem;
    font-weight: 720;
    line-height: 1.35;
}

.legal-section p,
.legal-section li {
    color: var(--legal-muted);
    font-size: .96rem;
    line-height: 1.78;
}

.legal-section p {
    margin: 0 0 15px;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-section ul,
.legal-section ol {
    margin: 15px 0 18px;
    padding-left: 1.35rem;
}

.legal-section li {
    margin: 8px 0;
    padding-left: .25rem;
}

.legal-section li::marker {
    color: var(--legal-coral);
}

.legal-section strong {
    color: var(--legal-soft);
    font-weight: 720;
}

.legal-section a {
    color: var(--legal-coral-soft);
    text-decoration-color: rgba(255, 193, 176, .35);
    text-underline-offset: 3px;
}

.legal-section a:hover,
.legal-section a:focus-visible {
    color: #fff;
    text-decoration-color: var(--legal-coral);
}

.legal-callout {
    margin: 22px 0;
    padding: 18px 20px;
    border: 1px solid rgba(255, 138, 108, .24);
    border-left: 3px solid var(--legal-coral);
    border-radius: 0 13px 13px 0;
    color: #bbb7c0;
    background: rgba(255, 138, 108, .055);
    font-size: .93rem;
    line-height: 1.68;
}

.legal-callout.sage {
    border-color: rgba(86, 227, 232, .20);
    border-left-color: var(--legal-cyan);
    background: rgba(86, 227, 232, .045);
}

.legal-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    margin: 22px 0;
    border: 1px solid var(--legal-line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .018);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 138, 108, .45) transparent;
}

.legal-table {
    width: 100%;
    min-width: 680px;
    margin: 0;
    border-collapse: collapse;
    color: var(--legal-muted);
    font-size: .86rem;
}

.legal-table th,
.legal-table td {
    padding: 14px 16px;
    border-right: 1px solid var(--legal-line);
    border-bottom: 1px solid var(--legal-line);
    text-align: left;
    vertical-align: top;
    line-height: 1.58;
}

.legal-table th:last-child,
.legal-table td:last-child {
    border-right: 0;
}

.legal-table tr:last-child td {
    border-bottom: 0;
}

.legal-table th {
    color: #fff;
    background: rgba(255, 255, 255, .04);
    font-size: .7rem;
    font-weight: 760;
    letter-spacing: .065em;
    text-transform: uppercase;
}

.legal-table td strong {
    color: #e5e0e3;
}

.legal-footer {
    display: flex;
    width: 100%;
    margin-inline: 0;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 25px 4px 8px;
    border-top: 1px solid var(--legal-line);
    color: #76737f;
    font-size: .72rem;
}

.legal-footer nav {
    display: flex;
    align-items: center;
    gap: 17px;
}

.legal-footer a {
    color: #8e8b96;
    text-decoration: none;
}

.legal-footer a:hover,
.legal-footer a:focus-visible {
    color: #fff;
}

.legal-nav a:focus-visible,
.legal-toc a:focus-visible,
.legal-footer a:focus-visible,
.legal-section a:focus-visible,
.legal-toc summary:focus-visible {
    outline: 2px solid var(--legal-cyan);
    outline-offset: 3px;
}

@media (max-width: 980px) {
    .legal-hero-inner {
        grid-template-columns: 1fr;
        align-items: start;
        gap: 36px;
    }

    .legal-meta {
        max-width: 720px;
    }

    .legal-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 22px;
        padding-top: 32px;
    }

    .legal-toc {
        position: static;
        max-height: none;
    }

    .legal-toc-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 12px;
    }
}

@media (max-width: 720px) {
    .legal-shell {
        width: min(100% - 24px, 100%);
        padding-top: 10px;
    }

    .legal-nav {
        top: 8px;
        min-height: 60px;
        gap: 8px;
        padding: 7px 8px 7px 12px;
        border-radius: 15px;
    }

    .legal-brand {
        width: 102px;
        min-width: 102px;
        height: 39px;
    }

    .legal-brand img {
        width: auto;
        height: 35px;
        max-width: 100%;
    }

    .legal-nav-links {
        max-width: calc(100% - 105px);
        gap: 1px;
        overflow-x: auto;
        justify-content: flex-start;
        scrollbar-width: none;
    }

    .legal-nav-links::-webkit-scrollbar {
        display: none;
    }

    body.legal-page .legal-nav-links a:not(.legal-nav-trial) {
        display: block;
    }

    .legal-nav-links a {
        padding: 9px 8px;
        font-size: .71rem;
    }

    .legal-nav-tour,
    .legal-nav-trial {
        display: none;
    }

    .legal-hero {
        margin-top: 12px;
        padding: 34px 22px 28px;
        border-radius: 19px;
    }

    .legal-hero h1 {
        font-size: clamp(2.45rem, 13vw, 3.65rem);
        line-height: .97;
    }

    .legal-hero-lead {
        margin-top: 17px;
        font-size: .95rem;
        line-height: 1.62;
    }

    .legal-meta {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .legal-meta-card,
    .legal-hero-note {
        grid-column: auto;
        padding: 14px;
        border-radius: 12px;
    }

    .legal-layout {
        padding: 22px 0 48px;
    }

    .legal-toc {
        padding: 14px;
        border-radius: 15px;
    }

    .legal-toc-links {
        grid-template-columns: 1fr;
        max-height: 330px;
        overflow-y: auto;
        padding-right: 3px;
    }

    .legal-toc-links a {
        padding: 8px;
        font-size: .75rem;
    }

    .legal-content {
        padding: 26px 20px;
        border-radius: 18px;
    }

    .legal-section {
        scroll-margin-top: 86px;
        padding-bottom: 34px;
        margin-bottom: 34px;
    }

    .legal-section h2 {
        margin-bottom: 15px;
        font-size: clamp(1.45rem, 7.4vw, 1.95rem);
    }

    .legal-section h3 {
        margin-top: 23px;
        font-size: 1.02rem;
    }

    .legal-section p,
    .legal-section li {
        font-size: .92rem;
        line-height: 1.7;
    }

    .legal-section ul,
    .legal-section ol {
        padding-left: 1.18rem;
    }

    .legal-callout {
        margin: 18px 0;
        padding: 15px 15px 15px 17px;
        font-size: .89rem;
    }

    .legal-table-wrap {
        margin-inline: -4px;
        border-radius: 12px;
    }

    .legal-table {
        min-width: 620px;
        font-size: .8rem;
    }

    .legal-table th,
    .legal-table td {
        padding: 12px;
    }

    .legal-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
        padding-inline: 4px;
    }

    .legal-footer nav {
        flex-wrap: wrap;
        gap: 12px 16px;
    }
}

@media (max-width: 390px) {
    .legal-shell {
        width: calc(100% - 16px);
    }

    .legal-brand {
        width: 92px;
        min-width: 92px;
    }

    .legal-brand img {
        width: auto;
        height: 32px;
    }

    .legal-nav-links {
        max-width: calc(100% - 95px);
    }

    .legal-nav-home {
        display: none;
    }

    .legal-hero {
        padding-inline: 18px;
    }

    .legal-content {
        padding-inline: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .legal-nav-links a,
    .legal-toc-links a {
        transition: none;
    }
}
