﻿/* ==========================================================================
   AXIOM LEGAL / COMPLIANCE PAGES
   Shared by Terms, Conditions for Use, Privacy, etc.

   Usage: wrap the document in <div class="legal-page" v-pre> and follow the
   markup contract at the bottom of this file. Depends on axiom-tokens.css.
   ========================================================================== */

.legal-page {
    /* Local knobs - override per page if needed */
    --legal-measure: 70ch; /* reading column width */
    --legal-offset: 6.5rem; /* sticky/scroll offset to clear the topbar */
    --legal-panel: rgba(13, 27, 48, 0.78); /* --axiom-bg-alt, translucent so the grid shows through */
    --legal-rule: rgba(255, 255, 255, 0.09);
    --legal-accent: var(--axiom-primary, #14b8a6);
    --legal-warn: var(--orange, #E8722A);
    max-width: 78rem;
    margin: 0 auto;
    padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 2.5rem) clamp(2.5rem, 6vw, 5rem);
    color: var(--axiom-text-main);
    font-family: var(--axiom-font);
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
    line-height: 1.7;
    /* The site sets .1em tracking on body, which is too loose for long-form reading */
    letter-spacing: 0.005em;
    overflow-wrap: break-word;
}

/* ---------- Header ---------- */

.legal-hero {
    max-width: var(--legal-measure);
    margin-bottom: clamp(1.5rem, 4vw, 2.75rem);
}

.legal-hero__org {
    margin: 0 0 0.75rem;
    color: var(--axiom-text-muted);
    font-size: 0.95rem;
}

.legal-page .legal-hero h1 {
    margin: 0;
    color: var(--axiom-text-bright, #CAC9C1);
    font-family: var(--axiom-font-disp, Georgia, serif);
    font-weight: 400;
    font-size: clamp(2.1rem, 1.2rem + 4vw, 3.4rem);
    line-height: 1.1;
    letter-spacing: -0.005em;
}

.legal-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin: 1.1rem 0 0;
    padding: 0;
    list-style: none;
    color: var(--axiom-text-muted);
    font-size: 0.95rem;
}

    .legal-hero__meta strong {
        color: var(--axiom-text-main);
        font-weight: 500;
    }

.legal-hero__lead {
    margin: 1.5rem 0 0;
    padding-left: 1rem;
    border-left: 3px solid var(--legal-accent);
    color: var(--axiom-text-main);
}

/* ---------- Two-column layout: TOC rail + document ---------- */

.legal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 901px) {
    .legal-layout {
        grid-template-columns: 16.5rem minmax(0, 1fr);
        gap: clamp(2rem, 4vw, 3.5rem);
    }
}

/* ---------- Table of contents (built by legal-toc.js) ---------- */

.legal-toc {
    border: 1px solid var(--legal-rule);
    border-radius: 0.75rem;
    background: var(--legal-panel);
}

    .legal-toc > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.85rem 1.1rem;
        color: var(--axiom-text-bright, #CAC9C1);
        font-weight: 600;
        cursor: pointer;
        list-style: none;
    }

        .legal-toc > summary::-webkit-details-marker {
            display: none;
        }

        /* Chevron that rotates: shows that the list opens and closes */
        .legal-toc > summary::after {
            content: "";
            width: 0.55rem;
            height: 0.55rem;
            border-right: 2px solid var(--legal-accent);
            border-bottom: 2px solid var(--legal-accent);
            transform: rotate(45deg) translateY(-2px);
            transition: transform 0.2s ease;
        }

    .legal-toc[open] > summary::after {
        transform: rotate(-135deg) translateY(-2px);
    }

    .legal-toc ol {
        margin: 0;
        padding: 0 0.6rem 0.75rem;
        list-style: none;
        font-size: 0.93rem;
        line-height: 1.4;
    }

    .legal-toc li {
        margin: 0;
        padding: 0;
    }

/* Matches the section number shown on the heading itself */
.legal-toc__num {
    display: inline-block;
    min-width: 1.5em;
    color: var(--axiom-text-dim);
}

.legal-toc a {
    display: block;
    padding: 0.45rem 0.5rem;
    border-radius: 0.4rem;
    color: var(--axiom-text-muted);
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
}

    .legal-toc a:hover {
        color: var(--axiom-text-main);
        background: rgba(255, 255, 255, 0.05);
    }

    .legal-toc a:focus-visible {
        outline: 2px solid var(--legal-accent);
        outline-offset: 1px;
    }

    /* Scroll-spy state: the one "alive" element on the page */
    .legal-toc a[aria-current="true"] {
        color: var(--axiom-primary-soft, #8cf2e7);
        background: var(--teal-dim, rgba(0, 196, 160, 0.12));
        box-shadow: inset 3px 0 0 var(--legal-accent);
    }

@media (min-width: 901px) {
    .legal-toc {
        position: sticky;
        top: var(--legal-offset);
        max-height: calc(100vh - var(--legal-offset) - 1.5rem);
        overflow-y: auto;
    }

        .legal-toc > summary {
            cursor: default;
            pointer-events: none;
        }

            .legal-toc > summary::after {
                display: none;
            }
}

/* ---------- Document body ---------- */

.legal-body {
    min-width: 0;
    padding: clamp(1.25rem, 4vw, 3rem);
    border: 1px solid var(--legal-rule);
    border-radius: 0.9rem;
    background: var(--legal-panel);
}

    .legal-body > :first-child {
        margin-top: 0;
    }

.legal-section {
    max-width: var(--legal-measure);
    scroll-margin-top: var(--legal-offset);
}

    .legal-section + .legal-section {
        margin-top: clamp(2rem, 5vw, 3.25rem);
        padding-top: clamp(2rem, 5vw, 3.25rem);
        border-top: 1px solid var(--legal-rule);
    }

/* Numbering is opt-in: section numbers are cross-referenced in the text ("see Section 4") */
.legal-body--numbered {
    counter-reset: legal-section;
}

    .legal-body--numbered > .legal-section > h2::before {
        counter-increment: legal-section;
        content: counter(legal-section) ".";
        margin-right: 0.6rem;
        color: var(--legal-accent);
    }

    /* Opt a section out of numbering (e.g. definitions that precede "Section 1") */
    .legal-body--numbered > .legal-section--unnumbered > h2::before {
        content: none;
    }

.legal-body h2 {
    margin: 0 0 1rem;
    scroll-margin-top: var(--legal-offset);
    color: var(--axiom-text-bright, #CAC9C1);
    font-family: var(--axiom-font-disp, Georgia, serif);
    font-weight: 400;
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    line-height: 1.2;
}

/* Run-in headings inside a section ("Your legal responsibility.", etc.) */
.legal-body h3 {
    margin: 1.9rem 0 0.5rem;
    color: var(--axiom-primary-soft, #8cf2e7);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
}

.legal-body p {
    margin: 0 0 1rem;
    color: var(--axiom-text-main);
}

.legal-body strong {
    color: #f3f4f6;
    font-weight: 600;
}

.legal-body a:not(.legal-related__link) {
    color: var(--axiom-primary, #14b8a6);
    text-decoration: underline;
    text-decoration-color: rgba(20, 184, 166, 0.4);
    text-underline-offset: 3px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

    .legal-body a:not(.legal-related__link):hover {
        color: #2dd4bf;
        text-decoration-color: currentColor;
    }

    .legal-body a:not(.legal-related__link):focus-visible {
        outline: 2px solid var(--legal-accent);
        outline-offset: 2px;
        border-radius: 2px;
    }

/* ---------- Lists ---------- */

.legal-body ul {
    margin: 0 0 1.25rem;
    padding: 0;
    list-style: none;
}

    .legal-body ul > li {
        position: relative;
        margin: 0 0 0.6rem;
        padding-left: 1.4rem;
    }

        .legal-body ul > li::before {
            content: "";
            position: absolute;
            left: 0.15rem;
            top: 0.72em;
            width: 0.4rem;
            height: 0.4rem;
            border-radius: 50%;
            background: var(--legal-accent);
        }

/* ---------- Callouts (use sparingly: key obligations and warnings) ---------- */

.legal-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--legal-accent);
    border-radius: 0 0.6rem 0.6rem 0;
    background: var(--teal-dim, rgba(0, 196, 160, 0.12));
}

    .legal-callout > :last-child {
        margin-bottom: 0;
    }

/* Conspicuous all-caps clauses (warranty disclaimer, liability cap). Kept in caps because
   many laws expect these to stand out; slightly smaller and looser so they stay readable. */
.legal-callout--caps p {
    font-size: 0.9rem;
    line-height: 1.75;
    letter-spacing: 0.02em;
}

.legal-callout--warn {
    border-left-color: var(--legal-warn);
    background: rgba(232, 114, 42, 0.12);
}

/* ---------- Table (collapses to stacked rows on small screens) ---------- */

.legal-table-wrap {
    margin: 1.5rem 0;
    overflow-x: auto;
    border: 1px solid var(--legal-rule);
    border-radius: 0.6rem;
}

.legal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.97rem;
    line-height: 1.6;
}

    .legal-table th,
    .legal-table td {
        padding: 0.9rem 1.1rem;
        text-align: left;
        vertical-align: top;
    }

    .legal-table thead th {
        background: rgba(255, 255, 255, 0.05);
        color: var(--axiom-text-bright, #CAC9C1);
        font-weight: 600;
        white-space: nowrap;
    }

    .legal-table tbody tr + tr > * {
        border-top: 1px solid var(--legal-rule);
    }

    .legal-table tbody th {
        width: 11rem;
        color: var(--axiom-primary-soft, #8cf2e7);
        font-weight: 600;
    }

/* Modifier: first column is a sentence or phrase, not a short label */
.legal-table--plain tbody th {
    width: 45%;
    color: var(--axiom-text-main);
    font-weight: 400;
}

@media (max-width: 640px) {
    .legal-table-wrap {
        border: 0;
        overflow: visible;
    }

    .legal-table thead {
        /* visually hidden, still available to screen readers */
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
    }

    .legal-table,
    .legal-table tbody,
    .legal-table tr,
    .legal-table th,
    .legal-table td {
        display: block;
        width: 100%;
    }

        .legal-table tbody tr {
            margin-bottom: 0.9rem;
            border: 1px solid var(--legal-rule);
            border-radius: 0.6rem;
            overflow: hidden;
        }

            .legal-table tbody tr + tr > * {
                border-top: 0;
            }

        .legal-table tbody th {
            width: 100%;
            padding: 0.7rem 1rem;
            background: rgba(255, 255, 255, 0.05);
        }

        .legal-table td {
            padding: 0.85rem 1rem;
        }

            /* Stacked cells lose their column header, so each td carries its own label:
               <td data-label="Source"> */
            .legal-table td[data-label]::before {
                content: attr(data-label);
                display: block;
                margin-bottom: 0.15rem;
                color: var(--axiom-text-muted);
                font-size: 0.85rem;
            }

            .legal-table td + td {
                border-top: 1px solid var(--legal-rule);
            }

    .legal-table--plain tbody th {
        font-weight: 600;
    }
}

/* ---------- "Where to send what": label / address pairs ---------- */

.legal-routes {
    margin: 1rem 0 1.5rem;
    border: 1px solid var(--legal-rule);
    border-radius: 0.6rem;
    overflow: hidden;
}

.legal-routes__row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
    margin: 0;
    padding: 0.85rem 1.1rem;
}

    .legal-routes__row + .legal-routes__row {
        border-top: 1px solid var(--legal-rule);
    }

    .legal-routes__row dt {
        color: var(--axiom-text-muted);
        font-size: 0.95rem;
    }

    .legal-routes__row dd {
        margin: 0;
        font-weight: 500;
        overflow-wrap: anywhere;
    }

@media (min-width: 700px) {
    .legal-routes__row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
        gap: 1.5rem;
        align-items: baseline;
    }
}

/* ---------- Address block ---------- */

.legal-address {
    margin: 1rem 0 1.25rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--legal-rule);
    border-radius: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    font-style: normal;
}

/* ---------- Links to sibling legal documents ---------- */

.legal-related {
    margin-top: clamp(2rem, 5vw, 3rem);
    padding-top: 1.5rem;
    border-top: 1px solid var(--legal-rule);
}

.legal-related__title {
    margin: 0 0 0.75rem;
    color: var(--axiom-text-muted);
    font-size: 0.95rem;
}

.legal-related__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

    .legal-related__list li {
        margin: 0;
        padding: 0;
    }

        .legal-related__list li::before {
            display: none;
        }

.legal-related__link {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid var(--axiom-border-accent, rgba(0, 196, 160, 0.3));
    border-radius: 2rem;
    color: var(--axiom-text-main);
    font-size: 0.95rem;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

    .legal-related__link:hover {
        border-color: var(--legal-accent);
        color: var(--axiom-primary-soft, #8cf2e7);
        background: var(--teal-dim, rgba(0, 196, 160, 0.12));
    }

    .legal-related__link:focus-visible {
        outline: 2px solid var(--legal-accent);
        outline-offset: 2px;
    }

    .legal-related__link[aria-current="page"] {
        border-color: var(--legal-accent);
        color: var(--axiom-primary-soft, #8cf2e7);
    }

/* ---------- Motion + print ---------- */

@media (prefers-reduced-motion: reduce) {
    .legal-page * {
        transition: none !important;
    }

    html {
        scroll-behavior: auto;
    }
}

@media print {
    .axiom-grid-bg {
        background: #fff !important;
    }

    .legal-page {
        color: #000;
        max-width: none;
        padding: 0;
    }

    .legal-toc,
    .legal-related {
        display: none;
    }

    .legal-layout {
        display: block;
    }

    .legal-body {
        border: 0;
        background: none;
        padding: 0;
    }

        .legal-body p,
        .legal-body li,
        .legal-body strong,
        .legal-body h2,
        .legal-body h3,
        .legal-hero h1 {
            color: #000 !important;
        }

        .legal-body a {
            color: #000 !important;
            text-decoration: underline;
        }

    .legal-section {
        break-inside: avoid-page;
    }
}

/* ==========================================================================
   MARKUP CONTRACT

   <div class="legal-page" v-pre>
     <header class="legal-hero">
       <p class="legal-hero__org">...</p>
       <h1>Title</h1>
       <ul class="legal-hero__meta"><li>Effective <strong>date</strong></li></ul>
       <p class="legal-hero__lead">Intro paragraph</p>
     </header>
     <div class="legal-layout">
       <details class="legal-toc" data-legal-toc open></details>   <- filled by legal-toc.js
       <article class="legal-body legal-body--numbered">
         <section class="legal-section" id="slug"><h2>Heading</h2> ... </section>
         <nav class="legal-related">...</nav>
       </article>
     </div>
   </div>

   v-pre is required: the layout mounts Vue over the whole page body, and v-pre
   stops Vue from compiling the legal text (so a stray "{{" can never break it).
   ========================================================================== */
