@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap");

:root {
    --header-height: 70.4px;
    --legal-blue: #005eb8;
    --legal-border: #e2e2e3;
    --legal-ink: #272d3a;
    /* Align with redesign tokens (v/css/reset.css) when those sheets aren't loaded. */
    --blue-500: #005eb8;
    --fw-bold: 700;
}

body header.head + main.legal-page {
    padding-top: var(--header-height);
}

.legal-page,
.legal-page * {
    /* Global pages.css/header.css load after this file and set Roboto on base
       elements; scope DM Sans to the page subtree so specificity wins. */
    font-family: "DM Sans", Arial, sans-serif;
}

.legal-page {
    color: #2a2829;
    min-height: 460px;
}

.legal-content {
    width: min(1190px, calc(100% - 24px));
    margin: 0 auto;
}

.legal-content #title {
    margin: 0 0 20px;
    font-size: 30px;
    line-height: 38px;
    font-weight: 700;
    text-align: left;
}

/* ---------- Country select ---------- */
.legal-country-select {
    padding: 48px 0 110px;
}

.legal-country-select p {
    margin: 24px 0;
    font-size: 18px;
    line-height: 28px;
    font-weight: 700;
}

.legal-country-select p u {
    text-underline-offset: 2px;
}

.country-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.country-list a {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--legal-blue);
    text-decoration: none;
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
}

.country-list a:visited {
    color: var(--legal-blue);
}

.country-list a:hover .title,
.country-list a:hover span {
    text-decoration: underline;
}

.country-list .flag {
    flex: 0 0 auto;
    width: 21px;
    height: auto;
    display: block;
}

/* ---------- Resources ---------- */
.legal-resources {
    padding: 12px 0 58px;
}

.legal-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 24px;
}

.legal-breadcrumb a {
    color: var(--legal-blue);
    text-decoration: none;
    font-weight: 700;
}

.legal-breadcrumb a:visited {
    color: var(--legal-blue);
}

.legal-breadcrumb span {
    color: #969ca8;
    font-weight: 500;
}

.legal-breadcrumb span:last-child {
    color: var(--legal-ink);
    font-weight: 400;
}

/* (0,2,1) specificity needed to beat "body .layout main h1" (0,1,3) in style2.css, which center-aligns. */
.legal-page .legal-resources h1 {
    margin: 0 0 64px;
    font-size: 30px;
    line-height: 38px;
    font-weight: 700;
    text-align: left;

    @media (max-width: 1100px) {
        margin: 0 0 24px;
    }
}

/* ---------- Legal document body (API / fixture HTML) ----------
   Matches Brand Guidelines typography & spacing for long-form
   legal pages (privacy, export). Content column ~745px per Figma.
*/
.legal-page .legal-document-shell {
    width: min(745px, 100%);
    margin: 0 auto;
}

/*
 * Spacing model (Figma): flex column + gap for the 16px body rhythm.
 * Headings add margin so (gap + margin) lands on 48px before h2 and
 * 32px after h2/h3 — avoids fighting a blanket margin:0 with sibling selectors.
 *
 *   between paragraphs / lists: 16px (gap only)
 *   before section h2:          48px (16 gap + 32 margin-top)
 *   after h2 / h3 into body:    32px (16 gap + 16 margin-bottom)
 *   before h3:                  32px (16 gap + 16 margin-top)
 */
.legal-document-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: #272d3a;
    font-size: 16px;
    line-height: 24px;
    font-weight: 400;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.legal-document-body > * {
    margin: 0;
    min-width: 0;
}

/* Beats `.legal-page .legal-resources h1` (hub title) so document titles use Display XL. */
.legal-page .legal-document-body h1 {
    margin: 0;
    font-size: 36px;
    line-height: 44px;
    font-weight: 700;
    color: #272d3a;
    text-align: left;
}

.legal-page .legal-document-body h2 {
    margin: 32px 0 16px;
    font-size: 30px;
    line-height: 38px;
    font-weight: 700;
    color: #272d3a;
    text-align: left;
    text-decoration: none;
}

.legal-page .legal-document-body h3 {
    margin: 16px 0 16px;
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    color: #272d3a;
    text-align: left;
    text-decoration: none;
}

.legal-page .legal-document-body > h2:first-child,
.legal-page .legal-document-body > h3:first-child {
    margin-top: 0;
}

.legal-document-body address {
    font-style: normal;
}

.legal-document-body .legal-doc-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.legal-document-body .legal-doc-meta p {
    margin: 0;
    font-size: 16px;
    line-height: 24px;
    font-weight: 500;
}

.legal-document-body .legal-doc-meta .legal-doc-updated,
.legal-document-body .legal-doc-meta .legal-doc-updated strong {
    font-weight: 700;
}

.legal-document-body p {
    margin: 0;
}

/* Match redesign .inline-link treatment without requiring that class on API HTML. */
.legal-document-body a {
    --inline-link-color: var(--blue-500);
    color: var(--inline-link-color);
    text-decoration: none;
    font: inherit;
    font-weight: var(--fw-bold);
    word-break: break-word;
}

.legal-document-body a:hover,
.legal-document-body a:focus {
    color: var(--inline-link-color);
    text-decoration: underline;
    text-underline-offset: 5px;
}

.legal-document-body a:visited {
    color: var(--inline-link-color);
}

.legal-document-body strong {
    font-weight: 700;
}

.legal-document-body em {
    font-style: italic;
}

/* .legal-document-body .legal-callout,
.legal-document-body .legal-emphasis {
    color: #f60505;
    font-weight: 700;
} */

.legal-document-body ul,
.legal-document-body ol {
    margin: 0;
    padding-left: 1.5em;
}

.legal-document-body li + li {
    margin-top: 8px;
}

.legal-document-body li > ul,
.legal-document-body li > ol {
    margin-top: 8px;
}

.legal-document-body li > p {
    margin-top: 8px;
}

.legal-document-body ol[type="a"],
.legal-document-body ol.legal-list-alpha {
    list-style-type: lower-alpha;
}

.legal-document-body .legal-table,
.legal-document-body table {
    width: 100%;
    margin: 0;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    border: 1px solid #d1d5dc;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.legal-document-body .legal-table th,
.legal-document-body .legal-table td,
.legal-document-body table th,
.legal-document-body table td {
    padding: 12px;
    font-size: 16px;
    line-height: 24px;
    color: #272d3a;
    text-align: left;
    vertical-align: top;
    border-right: 1px solid #d1d5dc;
    border-bottom: 1px solid #d1d5dc;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.legal-document-body .legal-table th:last-child,
.legal-document-body .legal-table td:last-child,
.legal-document-body table th:last-child,
.legal-document-body table td:last-child {
    border-right: none;
}

.legal-document-body .legal-table tr:last-child th,
.legal-document-body .legal-table tr:last-child td,
.legal-document-body table tr:last-child th,
.legal-document-body table tr:last-child td {
    border-bottom: none;
}

.legal-document-body .legal-table thead th,
.legal-document-body table thead th {
    background: #f3f4f6;
    font-weight: 700;
}

.legal-document-body .legal-table tbody td,
.legal-document-body table tbody td {
    font-weight: 500;
    background: #fff;
}

.legal-document-body .legal-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Desktop: keep multi-line cell stacks (Services) with 8px gap like Figma. */
.legal-document-body .legal-table-cell--stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Equal-width columns (Figma flex-[1_0_0] columns). */
.legal-document-body .legal-table--equal th,
.legal-document-body .legal-table--equal td {
    width: 25%;
}

@media (max-width: 700px) {
    .legal-page .legal-document-shell {
        padding-bottom: 48px;
    }

    .legal-page .legal-document-body h1 {
        font-size: 30px;
        line-height: 38px;
    }

    .legal-page .legal-document-body h2 {
        font-size: 24px;
        line-height: 32px;
    }

    .legal-page .legal-document-body h3 {
        font-size: 20px;
        line-height: 28px;
    }

    /*
     * Stack key/value tables (Figma mobile): each field becomes
     * a full-width gray label bar + white value bar.
     * Requires data-label on each <td> and .legal-table-cell around value.
     */
    .legal-document-body .legal-table.legal-table--stack {
        table-layout: auto;
    }

    .legal-document-body .legal-table.legal-table--stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .legal-document-body .legal-table.legal-table--stack,
    .legal-document-body .legal-table.legal-table--stack tbody,
    .legal-document-body .legal-table.legal-table--stack tr,
    .legal-document-body .legal-table.legal-table--stack td {
        display: block;
        width: 100%;
    }

    .legal-document-body .legal-table.legal-table--stack td {
        padding: 0;
        border-right: none;
        border-bottom: none;
        background: transparent;
    }

    .legal-document-body .legal-table.legal-table--stack td::before {
        content: attr(data-label);
        display: block;
        padding: 12px;
        background: #f3f4f6;
        border-bottom: 1px solid #d1d5dc;
        font-weight: 700;
        color: #272d3a;
        line-height: 24px;
    }

    .legal-document-body .legal-table.legal-table--stack td .legal-table-cell {
        display: block;
        padding: 12px;
        background: #fff;
        border-bottom: 1px solid #d1d5dc;
        font-weight: 500;
        line-height: 24px;
    }

    .legal-document-body .legal-table.legal-table--stack tr:last-child td:last-child .legal-table-cell {
        border-bottom: none;
    }

    /* Multi-line cell content spacing (e.g. Services / address) */
    .legal-document-body .legal-table.legal-table--stack .legal-table-cell--stack {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
}

.legal-card-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 24px;
}

.legal-resource-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 112px;
    padding: 24px 12px;
    background: #fbfbfc;
    border: 1px solid var(--legal-border);
    border-radius: 8px;
    text-align: center;
    text-decoration: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.legal-resource-card:hover {
    border-color: var(--legal-blue);
    box-shadow: 0 2px 8px rgba(0, 94, 184, 0.12);
}

.legal-resource-card .icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.legal-resource-card .icon img {
    width: 24px;
    height: 24px;
    display: block;
}

.legal-resource-card .title {
    color: var(--legal-blue);
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .legal-content #title,
    .legal-resources h1 {
        font-size: 30px;
        line-height: 38px;
    }

    .legal-country-select p {
        font-size: 16px;
        line-height: 24px;
    }

    .legal-resources h1 {
        margin-bottom: 24px;
    }

    .legal-card-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .legal-resource-card {
        flex-direction: row;
        justify-content: flex-start;
        gap: 16px;
        min-height: auto;
        padding: 16px;
        text-align: left;
    }
}
