/* ============================================
   TERMS OF SERVICE — layout additions
   (loads after privacy.css, which provides the
   base legal typography: h2, p, ul, .container)
   ============================================ */

/* --- Intro subtext (matches the Privacy Policy treatment) --- */
#terms-subtext {
    color: #ff4d4d;
    margin-bottom: 40px;
}

body.dark-mode #terms-subtext {
    color: #ecf010;
}

/* --- Document meta (effective / last updated) --- */
.legal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    padding: 16px 20px;
    margin: 0 0 34px;
    border-left: 4px solid #2563eb;
    background: rgba(37, 99, 235, 0.06);
    border-radius: 6px;
    font-size: 0.92rem;
}

.legal-meta span {
    display: block;
}

.legal-meta strong {
    color: #2563eb;
}

body.dark-mode .legal-meta {
    background: rgba(140, 171, 255, 0.1);
    border-left-color: #8cabff;
}

body.dark-mode .legal-meta strong {
    color: #8cabff;
}

/* --- Callout box for important / plain-language notes --- */
.legal-note {
    padding: 18px 22px;
    margin: 0 0 30px;
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.04);
}

.legal-note p:last-child {
    margin-bottom: 0;
}

body.dark-mode .legal-note {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(140, 171, 255, 0.3);
}

/* --- Table of contents --- */
.legal-toc {
    margin: 0 0 48px;
    padding: 24px 26px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.03);
}

.legal-toc h2 {
    margin-top: 0;
    font-size: 1.15rem;
}

.legal-toc ol {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 6px 32px;
    margin: 0;
    padding-left: 20px;
    list-style-type: decimal;
}

.legal-toc li {
    margin: 0;
    padding: 2px 0;
}

.legal-toc a {
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid transparent;
}

.legal-toc a:hover {
    color: #2563eb;
    border-bottom-color: currentColor;
}

body.dark-mode .legal-toc {
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .legal-toc a:hover {
    color: #8cabff;
}

/* --- Section anchors clear the fixed header --- */
.legal-section {
    scroll-margin-top: 140px;
}

/* --- Definition list --- */
.legal-defs {
    list-style-type: none;
    margin-left: 0;
}

.legal-defs li {
    margin-bottom: 12px;
}

.legal-defs strong {
    color: #2563eb;
}

body.dark-mode .legal-defs strong {
    color: #8cabff;
}

/* Sub-heading inside a numbered clause (h2/h3 are already taken by the
   section and sub-section numbering). */
.legal-section h4 {
    margin: 22px 0 8px;
    font-size: 1rem;
    font-weight: 700;
}

/* --- Rate / threshold tables --- */
.legal-table {
    width: 100%;
    max-width: 560px;
    border-collapse: collapse;
    margin: 0 0 28px;
    font-size: 0.95rem;
}

.legal-table caption {
    caption-side: top;
    text-align: left;
    padding: 0 0 10px;
    font-weight: 600;
    color: #2563eb;
}

.legal-table th,
.legal-table td {
    padding: 10px 14px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    text-align: left;
    vertical-align: top;
}

.legal-table thead th {
    background: rgba(37, 99, 235, 0.07);
    font-weight: 600;
}

.legal-table tbody th {
    font-weight: 400;
}

.legal-table tbody td {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

body.dark-mode .legal-table caption {
    color: #8cabff;
}

body.dark-mode .legal-table th,
body.dark-mode .legal-table td {
    border-color: rgba(255, 255, 255, 0.18);
}

body.dark-mode .legal-table thead th {
    background: rgba(255, 255, 255, 0.06);
}

/* Wide content must scroll inside its own box, never the page */
.legal-table-scroll {
    overflow-x: auto;
}

/* --- Emphasised legal blocks (disclaimers, liability caps) --- */
.legal-emphasis {
    text-transform: none;
    font-weight: 600;
}

/* --- Back-to-top link between sections --- */
.legal-top {
    display: inline-block;
    margin-bottom: 30px;
    font-size: 0.85rem;
    text-decoration: none;
    color: #2563eb;
}

body.dark-mode .legal-top {
    color: #8cabff;
}

@media (max-width: 768px) {
    .legal-toc ol {
        grid-template-columns: 1fr;
    }

    .legal-meta {
        flex-direction: column;
        gap: 6px;
    }

    /* Long unbroken strings (emails, statute names) shouldn't push the
       narrow text column sideways. */
    .legal-body {
        overflow-wrap: break-word;
    }
}
