/* Legal documents (terms, refund, privacy, operator notice). Long-form reading
   pages: one narrow column, generous line height, no cards or decoration. */

/* The panel spans the site content width like every other page, but the prose
   column stays at a readable measure — a 1340px line of legal text is unreadable.
   The width that frees up carries the table of contents. */
.legal-doc {
    width: 100%;
    padding: 32px;
    border: 1px solid var(--theme-card-border);
    border-radius: 18px;
    background: var(--theme-panel-bg);
    box-shadow: var(--theme-card-shadow);
    color: var(--theme-copy);
}

/* Centred as a pair: the reading column is capped, so left-aligning the grid
   would leave all the slack on one side and look off-balance in a wide panel. */
.legal-doc-body {
    display: grid;
    grid-template-columns: minmax(0, 250px) minmax(0, 76ch);
    gap: 44px;
    align-items: start;
    justify-content: center;
}

.legal-toc {
    position: sticky;
    top: 18px;
}

.legal-toc ol {
    margin: 0;
    padding: 0 0 0 20px;
    color: var(--theme-copy-muted);
    font-size: 0.86rem;
}

.legal-toc li {
    margin-bottom: 9px;
    line-height: 1.4;
}

.legal-toc a {
    color: var(--theme-copy-muted);
    text-decoration: none;
}

.legal-toc a:hover,
.legal-toc a:focus-visible {
    color: var(--theme-copy-accent);
    text-decoration: underline;
}

/* Anchored sections must not hide under the sticky top bar. */
.legal-section {
    scroll-margin-top: 90px;
}

.legal-doc-head {
    padding-bottom: 20px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--theme-card-border);
}

.legal-doc-head h1 {
    margin: 10px 0 8px;
    color: var(--theme-copy-strong);
    font-size: clamp(1.6rem, 3.4vw, 2.2rem);
    line-height: 1.15;
}

.legal-doc-updated {
    margin: 0;
    color: var(--theme-copy-muted);
    font-size: 0.86rem;
}

.legal-lead {
    margin: 0 0 16px;
    color: var(--theme-copy-muted-strong);
    font-size: 1.02rem;
    line-height: 1.65;
}

.legal-section {
    margin-top: 30px;
}

.legal-section h2 {
    margin: 0 0 12px;
    color: var(--theme-copy-accent);
    font-size: 1.16rem;
    line-height: 1.3;
}

.legal-section p {
    margin: 0 0 12px;
    line-height: 1.7;
}

.legal-list {
    margin: 4px 0 12px;
    padding-left: 20px;
}

.legal-list li {
    margin-bottom: 8px;
    line-height: 1.65;
}

.legal-contact {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    margin-top: 34px;
    padding: 18px;
    border: 1px solid var(--theme-card-border);
    border-radius: 14px;
    background: var(--theme-panel-fill);
}

.legal-contact p {
    margin: 0;
    color: var(--theme-copy-muted-strong);
}

.legal-doc-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--theme-card-border);
}

.legal-doc-nav a {
    color: var(--theme-copy-accent);
    font-size: 0.9rem;
    text-decoration: none;
}

.legal-doc-nav a:hover,
.legal-doc-nav a:focus-visible {
    color: var(--theme-copy-accent-soft);
    text-decoration: underline;
}

/* Legal links shown inside the shop, where the purchase terms actually apply. */
.titan-shop-legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    justify-content: center;
    margin: 4px 0 0;
    padding: 14px;
    border-top: 1px solid var(--theme-card-border);
}

.titan-shop-legal-links a {
    color: var(--theme-copy-muted);
    font-size: 0.84rem;
    text-decoration: none;
}

.titan-shop-legal-links a:hover,
.titan-shop-legal-links a:focus-visible {
    color: var(--theme-copy-accent);
    text-decoration: underline;
}

/* Below the two-column threshold the contents list becomes a plain block at the
   top of the document instead of a sticky rail. */
@media (max-width: 900px) {
    .legal-doc-body {
        grid-template-columns: minmax(0, 1fr);
        gap: 28px;
    }

    .legal-toc {
        position: static;
        padding-bottom: 20px;
        border-bottom: 1px solid var(--theme-card-border);
    }
}

@media (max-width: 640px) {
    .legal-doc {
        padding: 20px 16px;
    }

    .legal-contact {
        justify-content: flex-start;
    }
}
