.terms-page {
    padding-top: 44px;
    padding-bottom: 88px;
}

.terms-document {
    width: min(1240px, 100%);
    margin: 0 auto;
}

.terms-hero,
.terms-content,
.terms-footer {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.terms-hero {
    border-radius: 28px;
    padding: clamp(32px, 6vw, 72px);
}

.terms-hero h1 {
    max-width: 920px;
    margin: 18px 0 16px;
    font-size: clamp(40px, 7vw, 76px);
    line-height: 0.99;
    letter-spacing: -0.06em;
    text-wrap: balance;
}

.terms-version {
    width: fit-content;
    margin: 0 0 26px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--canvas);
    padding: 8px 12px;
    color: #4f555e;
    font-size: 13px;
    font-weight: 700;
}

.terms-hero__lead {
    max-width: 760px;
    margin: 0;
    color: var(--muted);
    font-size: clamp(18px, 2.2vw, 22px);
    line-height: 1.55;
}

.terms-highlights {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-top: 44px;
}

.terms-highlight {
    min-width: 0;
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    background: var(--canvas);
    padding: 22px;
}

.terms-highlight h2 {
    margin: 0 0 8px;
    font-size: 16px;
    letter-spacing: -0.02em;
}

.terms-highlight p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.6;
}

.terms-layout {
    display: grid;
    grid-template-columns: minmax(220px, 270px) minmax(0, 1fr);
    align-items: start;
    gap: 24px;
    margin-top: 24px;
}

.terms-sidebar {
    position: sticky;
    top: 100px;
}

.terms-toc {
    max-height: calc(100vh - 124px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--surface);
    padding: 24px;
    box-shadow: var(--shadow);
    scrollbar-width: thin;
}

.terms-toc h2 {
    margin: 0 0 16px;
    font-size: 14px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.terms-toc ol {
    margin: 0;
    padding-left: 21px;
    color: var(--quiet);
}

.terms-toc li + li {
    margin-top: 8px;
}

.terms-toc a {
    color: #4f555e;
    font-size: 13px;
    line-height: 1.4;
    text-decoration-color: transparent;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.terms-toc a:hover {
    color: var(--ink);
    text-decoration-color: currentColor;
}

.terms-content {
    min-width: 0;
    border-radius: 24px;
    padding: clamp(28px, 5vw, 64px);
}

.terms-content > section {
    max-width: 76ch;
    padding: 40px 0;
    scroll-margin-top: 104px;
}

.terms-content > section:first-child {
    padding-top: 0;
}

.terms-content > section:last-child {
    padding-bottom: 0;
}

.terms-content > section + section {
    border-top: 1px solid var(--border-soft);
}

.terms-content h2 {
    margin: 0 0 18px;
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.2;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.terms-content h3 {
    margin: 0 0 8px;
    font-size: 17px;
    letter-spacing: -0.02em;
}

.terms-content p,
.terms-content li,
.terms-definitions dd,
.operator-details dd {
    color: #555b64;
    font-size: 16px;
    line-height: 1.75;
}

.terms-content p {
    margin: 0;
}

.terms-content p + p,
.terms-content ul + p,
.terms-content p + ul,
.terms-content .terms-callout + p {
    margin-top: 16px;
}

.terms-content ul {
    margin: 16px 0 0;
    padding-left: 24px;
}

.terms-content li + li {
    margin-top: 8px;
}

.terms-content li::marker {
    color: var(--ink);
}

.terms-content code {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--canvas);
    padding: 2px 6px;
    color: var(--ink);
    font-size: 0.92em;
}

.terms-definitions,
.operator-details {
    display: grid;
    gap: 0;
    margin: 0;
}

.terms-definitions > div,
.operator-details > div {
    display: grid;
    grid-template-columns: minmax(130px, 0.32fr) minmax(0, 1fr);
    gap: 22px;
    border-top: 1px solid var(--border-soft);
    padding: 16px 0;
}

.terms-definitions > div:first-child,
.operator-details > div:first-child {
    border-top: 0;
    padding-top: 0;
}

.terms-definitions > div:last-child,
.operator-details > div:last-child {
    padding-bottom: 0;
}

.terms-definitions dt,
.operator-details dt {
    color: var(--ink);
    font-size: 14px;
    font-weight: 750;
    line-height: 1.5;
}

.terms-definitions dd,
.operator-details dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}

.terms-callout {
    margin: 22px 0 0;
    border: 1px solid #cfd4dc;
    border-left: 4px solid var(--ink);
    border-radius: 16px;
    background: var(--canvas);
    padding: 22px;
}

.terms-callout p {
    color: #4f555e;
}

.terms-source-list a,
.terms-footer a {
    color: var(--ink);
    font-weight: 700;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.terms-source-list a:hover,
.terms-footer a:hover {
    text-decoration-thickness: 2px;
}

.terms-contact-note {
    margin-top: 24px !important;
    border-radius: 14px;
    background: var(--canvas);
    padding: 16px 18px;
    font-size: 14px !important;
}

.terms-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 24px;
    border-radius: 20px;
    padding: 22px 28px;
}

.terms-footer p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.terms-footer a {
    flex: 0 0 auto;
    font-size: 13px;
}

.terms-page :focus-visible {
    outline: 3px solid #15171a;
    outline-offset: 4px;
}

@media (max-width: 900px) {
    .terms-highlights {
        grid-template-columns: 1fr;
    }

    .terms-layout {
        grid-template-columns: 1fr;
    }

    .terms-sidebar {
        position: static;
    }

    .terms-toc {
        max-height: none;
    }

    .terms-toc ol {
        columns: 2;
        column-gap: 34px;
    }

    .terms-toc li {
        break-inside: avoid;
    }
}

@media (max-width: 640px) {
    .terms-page {
        padding-top: 14px;
        padding-bottom: 48px;
    }

    .terms-hero,
    .terms-content {
        border-radius: 20px;
    }

    .terms-hero {
        padding: 28px 22px;
    }

    .terms-hero h1 {
        font-size: clamp(36px, 12vw, 52px);
    }

    .terms-highlights {
        margin-top: 32px;
    }

    .terms-highlight {
        padding: 18px;
    }

    .terms-toc {
        padding: 20px;
    }

    .terms-toc ol {
        columns: 1;
    }

    .terms-content {
        padding: 28px 22px;
    }

    .terms-content > section {
        padding: 32px 0;
    }

    .terms-content p,
    .terms-content li,
    .terms-definitions dd,
    .operator-details dd {
        font-size: 15px;
    }

    .terms-definitions > div,
    .operator-details > div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .terms-footer {
        align-items: flex-start;
        flex-direction: column;
        border-radius: 18px;
        padding: 20px 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

@media print {
    .site-header,
    .skip-link,
    .terms-sidebar,
    .terms-footer a {
        display: none;
    }

    body {
        background: #fff;
    }

    .terms-page {
        padding: 0;
    }

    .terms-hero,
    .terms-content,
    .terms-footer {
        border: 0;
        box-shadow: none;
    }

    .terms-hero,
    .terms-content {
        padding: 24px 0;
    }

    .terms-layout {
        display: block;
        margin-top: 0;
    }

    .terms-content > section {
        max-width: none;
        break-inside: avoid;
    }

    .terms-highlights {
        grid-template-columns: 1fr;
    }

    .terms-footer {
        margin-top: 0;
        padding: 24px 0 0;
    }

    a {
        text-decoration: none;
    }
}
