/*
 * TradeStop's public pages outside the app: the legal pages (/terms,
 * /privacy, /refunds, /complaints) and the error page. Plain CSS served as
 * it is, with the app's colours (frontend/src/index.css) and font. The page
 * policy allows no inline style, so everything lives here. No text is
 * smaller than 12px.
 */

@font-face {
    font-family: Manrope;
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("/build/fonts/manrope-latin.woff2") format("woff2-variations"), url("/build/fonts/manrope-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    color-scheme: dark;
    --bg: #050b0a;
    --bg-light: #08110f;
    --surface: #0b1614;
    --surface-light: #10201c;
    --border: #1b2f2a;
    --border-light: #294a41;
    --text: #f1f8f5;
    --text-secondary: #a4bab3;
    --text-muted: #7f9c94;
    --primary: #3ce5a3;
    --primary-hover: #6ef0bf;
    --danger: #ff6b78;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: var(--bg);
    background-image: radial-gradient(1100px 520px at 50% -260px, rgba(60, 229, 163, 0.11), transparent 70%);
    background-repeat: no-repeat;
    color: var(--text-secondary);
    font-family: Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    overflow-wrap: break-word;
}

a {
    color: var(--primary);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--primary-hover);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 20;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--primary);
    color: var(--bg);
    font-weight: 800;
    text-decoration: none;
}

.skip-link:focus {
    top: 12px;
}

/* Header */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid rgba(27, 47, 42, 0.75);
    background: rgba(5, 11, 10, 0.86);
    backdrop-filter: blur(12px);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-width: 1120px;
    margin: 0 auto;
    padding: 10px 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--text);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.045em;
    text-decoration: none;
}

.brand:hover {
    color: var(--text);
}

.brand-mark {
    width: 34px;
    height: 34px;
}

.brand-accent {
    color: var(--primary);
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.link-quiet {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
}

.link-quiet:hover {
    background: var(--surface-light);
    color: var(--text);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: var(--primary);
    box-shadow: 0 8px 24px rgba(69, 227, 164, 0.18);
    color: var(--bg);
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
}

.button:hover {
    background: var(--primary-hover);
    color: var(--bg);
}

.button-secondary {
    border-color: var(--border-light);
    background: transparent;
    box-shadow: none;
    color: var(--text);
}

.button-secondary:hover {
    background: var(--surface-light);
    color: var(--text);
}

/* Page */

.site-main {
    flex: 1;
    width: 100%;
    max-width: 820px;
    margin: 0 auto;
    padding: 40px 16px 72px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border: 1px solid rgba(60, 229, 163, 0.22);
    border-radius: 999px;
    background: rgba(60, 229, 163, 0.06);
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

h1 {
    margin: 16px 0 0;
    color: var(--text);
    font-size: clamp(2rem, 6vw, 2.75rem);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.08;
}

.updated {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 14px;
}

.lede {
    margin: 18px 0 0;
    color: var(--text-secondary);
    font-size: 18px;
    line-height: 1.65;
}

/* The boxes below sit inside .legal, so their rules name it to outrank .legal h2, ul and li. */

.summary {
    margin: 28px 0 0;
    padding: 18px 22px;
    border: 1px solid rgba(60, 229, 163, 0.24);
    border-radius: 18px;
    background: rgba(60, 229, 163, 0.05);
}

.legal .summary h2 {
    margin: 0;
    color: var(--text);
    font-size: 16px;
    letter-spacing: 0;
}

.legal .summary ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.legal .summary li + li {
    margin-top: 6px;
}

.toc {
    margin: 20px 0 0;
    padding: 16px 22px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(11, 22, 20, 0.7);
}

.legal .toc h2 {
    margin: 0 0 6px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.legal .toc ol {
    margin: 0;
    padding-left: 22px;
}

.legal .toc li {
    font-size: 15px;
    line-height: 1.5;
    break-inside: avoid;
}

.legal .toc li + li {
    margin-top: 4px;
}

.toc a {
    display: inline-block;
    padding: 3px 0;
    color: var(--text-secondary);
    text-decoration: none;
}

.toc a:hover {
    color: var(--primary);
    text-decoration: underline;
}

@media (min-width: 720px) {
    .legal .toc ol {
        columns: 2;
        column-gap: 36px;
    }
}

/* The legal text */

.legal h2 {
    margin: 48px 0 10px;
    color: var(--text);
    font-size: 23px;
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1.3;
    scroll-margin-top: 84px;
}

.legal h3 {
    margin: 26px 0 6px;
    color: var(--text);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.4;
    scroll-margin-top: 84px;
}

.legal p {
    margin: 12px 0 0;
}

.legal ul,
.legal ol {
    margin: 12px 0 0;
    padding-left: 22px;
}

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

.legal strong {
    color: var(--text);
}

/* Guides from HQ's Agent Factory (/guides and /guides/{slug}) */

.eyebrow a {
    color: inherit;
    text-decoration: none;
}

.legal .guide-list {
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.legal .guide-list li + li {
    margin-top: 0;
    border-top: 1px solid rgba(60, 229, 163, 0.12);
}

.legal .guide-list h2 {
    margin: 22px 0 6px;
    font-size: 20px;
}

.legal .guide-list h2 a {
    color: var(--text);
    text-decoration: none;
}

.legal .guide-list h2 a:hover {
    text-decoration: underline;
}

.legal .guide-list p {
    margin: 0 0 22px;
}

.legal code {
    padding: 1px 6px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-light);
    color: var(--text);
    font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 14px;
    overflow-wrap: anywhere;
}

/* Cookie names stay whole; on a narrow screen the table scrolls instead. */
.legal td code {
    overflow-wrap: normal;
    white-space: nowrap;
}

.table-scroll {
    margin: 14px 0 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
}

.legal table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.55;
}

.legal th,
.legal td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.legal tr:last-child td {
    border-bottom: 0;
}

.legal th {
    background: var(--surface);
    color: var(--text);
    font-weight: 800;
}

.callout {
    margin: 18px 0 0;
    padding: 14px 18px;
    border-left: 3px solid var(--primary);
    border-radius: 0 14px 14px 0;
    background: var(--surface);
}

.callout-risk {
    border-left-color: var(--danger);
}

.callout p:first-child {
    margin-top: 0;
}

.legal details {
    margin: 16px 0 0;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
}

.legal summary {
    min-height: 28px;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.form-text {
    white-space: pre-line;
}

.back-to-top {
    margin: 48px 0 0;
    font-size: 14px;
}

/* Error page */

.error-page {
    padding-top: 40px;
    text-align: center;
}

.error-code {
    margin: 0;
    color: var(--primary);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.24em;
}

.error-page p {
    margin: 14px auto 0;
    max-width: 520px;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 28px;
}

/* Footer */

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--bg-light);
}

.site-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 26px 16px 34px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.65;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 20px;
    margin: 0 0 10px;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    color: var(--text-secondary);
    font-weight: 700;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.footer-links a:hover,
.footer-links a[aria-current="page"] {
    color: var(--primary);
}

.footer-links a[aria-current="page"] {
    text-decoration: underline;
}

.site-footer p {
    max-width: 880px;
    margin: 8px 0 0;
}

@media (max-width: 420px) {
    .brand {
        font-size: 18px;
    }

    .brand-mark {
        width: 30px;
        height: 30px;
    }

    .link-quiet {
        padding: 8px;
    }

    .button {
        padding: 8px 12px;
    }

    .lede {
        font-size: 17px;
    }
}

@media print {
    body {
        background: #fff;
        color: #000;
    }

    .site-header,
    .skip-link,
    .toc,
    .back-to-top {
        display: none;
    }

    h1,
    .legal h2,
    .legal h3,
    .legal strong,
    .legal p,
    .legal li,
    .legal th,
    .legal td,
    .legal .summary h2,
    .site-footer-inner,
    .footer-links a {
        color: #000;
    }

    a {
        color: #000;
    }

    .summary,
    .callout,
    .legal details,
    .legal th,
    .site-footer {
        background: #fff;
    }
}
