/*
 * Shared styles for the static legal pages in public/legal/ (privacy policy, terms and
 * conditions). They are plain HTML served by Amplify rewrites, not React routes, so the full
 * text reaches anything that fetches them without JavaScript.
 *
 * Brand tokens mirror src/app/pages/landingPage/constants/colors.js, and the header and footer
 * mirror the /diagnostico shell (diagnosticPage/constants/styles.js). Keep them in step.
 */

:root {
    --purple: #540AF0;
    --deep-purple: #331796;
    --blue: #2C57EE;
    --green: #24CF64;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --text: #0F172A;
    --muted: #64748B;
    --border: #E2E8F0;
    --purple-soft: rgba(84, 10, 240, 0.05);
    --header-h: 60px;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--deep-purple); }
a:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 4px; }

/* Header: the slim bar from /diagnostico, with the language switch on the right */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(248, 250, 252, 0.92);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}
.site-header__bar {
    max-width: 880px; margin: 0 auto;
    padding: 0 20px; height: var(--header-h);
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-header__logo { display: block; flex-shrink: 0; }
.site-header__logo img { display: block; height: 26px; width: auto; }

.lang-nav { display: flex; gap: 8px; }
.lang-nav a {
    display: inline-block;
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--purple);
    font-size: 13px; font-weight: 600; line-height: 1.4;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.lang-nav a:hover { background: var(--purple); border-color: var(--purple); color: #FFFFFF; }

/* Document */
.wrap { max-width: 880px; margin: 0 auto; padding: 32px 20px 56px; }
.doc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 56px 40px;
}
@media (max-width: 640px) {
    .wrap { padding: 16px 12px 40px; }
    .doc { padding: 28px 20px 24px; border-radius: 16px; }
}

/* Anchor targets land below the sticky header, not under it */
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

h1, h2, h3 { color: var(--text); font-weight: 800; letter-spacing: -0.03em; }
h1 { font-size: 36px; line-height: 1.15; margin: 0 0 12px; }
h2 { font-size: 22px; line-height: 1.3; margin: 44px 0 10px; }
h3 { font-size: 17px; line-height: 1.4; font-weight: 700; letter-spacing: -0.01em; margin: 26px 0 6px; }
@media (max-width: 640px) {
    h1 { font-size: 28px; }
    h2 { font-size: 20px; }
}

p, li { color: var(--text); }
p { margin: 0 0 14px; }
ul { padding-left: 22px; margin: 0 0 14px; }
li { margin: 5px 0; }
strong { font-weight: 700; }

.updated { color: var(--muted); font-size: 14px; margin: 0 0 2px; }
.updated + p:not(.updated) { margin-top: 24px; }

.callout {
    background: var(--purple-soft);
    border: 1px solid rgba(84, 10, 240, 0.12);
    border-left: 4px solid var(--purple);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 24px 0;
    font-size: 15px;
}

.toc {
    list-style: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px 22px;
    columns: 2; column-gap: 32px;
    font-size: 15px;
}
.toc li { margin: 4px 0; break-inside: avoid; }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--purple); text-decoration: underline; }
@media (max-width: 640px) { .toc { columns: 1; } }

.divider { border: none; border-top: 1px solid var(--border); margin: 56px 0; }

.back-top { margin-top: 32px; font-size: 13px; }
.back-top a { color: var(--muted); text-decoration: none; }
.back-top a:hover { color: var(--purple); }

/* Footer: the legal-links footer from /diagnostico */
.site-footer { border-top: 1px solid var(--border); padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); }
.site-footer__inner {
    max-width: 880px; margin: 0 auto;
    display: flex; flex-wrap: wrap; gap: 8px 20px;
    align-items: center; justify-content: space-between;
    font-size: 12px; color: var(--muted);
}
.site-footer__links { display: flex; gap: 18px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

@media print {
    body { background: #FFFFFF; font-size: 11pt; }
    .site-header { position: static; background: none; border: none; }
    .lang-nav, .back-top, .site-footer__links { display: none; }
    .wrap { padding: 0; max-width: none; }
    .doc { border: none; padding: 0; }
    .callout, .toc { break-inside: avoid; }
    a { color: inherit; }
}
