/* ==========================================================================
   Legal pages (terms.php)
   Layout, sidebar and callouts come from api-doc.css; this file only adds
   reading typography and the few blocks specific to legal text.
   ========================================================================== */

.legal-main {
    max-width: 780px;
}

.legal-summary {
    margin: 0 0 48px;
}

/* ===== Sections ===== */
.legal-section {
    padding-bottom: 40px;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border-light);
    scroll-margin-top: calc(var(--header-h) + 24px);
}

.legal-section:last-child {
    border-bottom: 0;
    margin-bottom: 0;
}

.legal-section h2 {
    display: flex;
    align-items: baseline;
    gap: 14px;
    margin-bottom: 16px;
    font-size: clamp(1.35rem, 2.2vw, 1.6rem);
    letter-spacing: -0.025em;
}

.legal-num {
    flex-shrink: 0;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    font-variant-numeric: tabular-nums;
    color: var(--primary);
}

.legal-section p,
.legal-section li,
.legal-section dd {
    font-size: 15.5px;
    line-height: 1.75;
    color: var(--text-secondary);
}

.legal-section > p + p,
.legal-section > p + ul,
.legal-section > ul + p,
.legal-section > div + p {
    margin-top: 14px;
}

.legal-section a:not(.btn) {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Bulleted list, same dot as the callouts */
.legal-list {
    margin-top: 10px;
}

.legal-list li {
    position: relative;
    padding: 4px 0 4px 20px;
}

.legal-list li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 15px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.7;
}

/* ===== Definitions ===== */
.legal-defs {
    display: grid;
    grid-template-columns: minmax(140px, 200px) 1fr;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--card);
}

.legal-defs dt,
.legal-defs dd {
    padding: 14px 18px;
    border-top: 1px solid var(--border-light);
}

.legal-defs dt:first-of-type,
.legal-defs dt:first-of-type + dd {
    border-top: 0;
}

.legal-defs dt {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: var(--bg-softer);
}

.legal-defs dd {
    font-size: 14.5px;
    line-height: 1.6;
}

/* ===== Fee recap ===== */
.legal-rates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.legal-rate {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--card);
}

.legal-rate strong {
    display: block;
    font-size: 22px;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text);
}

.legal-rate span:not(.icon-circle) {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ===== Contact card ===== */
.legal-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    background: var(--bg-soft);
}

.legal-contact p {
    font-size: 15px;
    line-height: 1.6;
}

.legal-contact .legal-contact-name {
    font-weight: 700;
    color: var(--text);
}

/* ===== Company details not filled in yet (see top of terms.php) ===== */
.legal-placeholder {
    display: inline-block;
    padding: 0 6px;
    border: 1px dashed var(--warning-border);
    border-radius: 6px;
    background: var(--warning-soft);
    color: var(--warning-text);
    font-size: 0.92em;
    font-weight: 600;
    line-height: 1.5;
}

.legal-print {
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition);
}

.legal-print:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

/* ===== Tablet & mobile ===== */
@media (max-width: 1024px) {
    .legal-section {
        scroll-margin-top: calc(var(--header-h) + 72px);
    }
}

@media (max-width: 640px) {
    .legal-defs {
        grid-template-columns: 1fr;
    }

    .legal-defs dd {
        padding-top: 0;
        border-top: 0;
    }

    .legal-defs dt {
        background: none;
        padding-bottom: 4px;
    }

    .legal-rates {
        grid-template-columns: 1fr;
    }

    .legal-contact .btn {
        width: 100%;
    }
}

/* ===== Print: just the text ===== */
@media print {
    .legal-layout {
        display: block;
        padding: 0;
    }

    .legal-layout .api-sidebar,
    .legal-print,
    .legal-contact .btn,
    .site-footer {
        display: none !important;
    }

    .legal-section {
        break-inside: avoid-page;
    }
}
