/* Cyberdes SafeAI — public legal & support pages.
   Same tokens and self-hosted fonts as the app (mobile/lib/theme.dart) and the
   portal. No external resources, no cookies, no analytics. */
@font-face { font-family: 'Archivo'; src: url('fonts/Archivo-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('fonts/Archivo-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('fonts/Archivo-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Archivo SemiExpanded'; src: url('fonts/ArchivoSemiExpanded-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Archivo SemiExpanded'; src: url('fonts/ArchivoSemiExpanded-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Martian Mono'; src: url('fonts/MartianMono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }

:root {
  --bg: #f2f4f3; --surface: #ffffff; --raised: #e8edec; --line: #dce3e2;
  --ink: #0a2233; --muted: #56707c; --faint: #7d9098;
  --link: #007e9e; --signal: #00c0d8; --warn: #b26b00;
  --deep: #062a3a; --deep2: #0b3d52; --on-deep: #e9f6f8; --on-deep-muted: #9fc3cc;
  --radius: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #051219; --surface: #0a1c26; --raised: #0f2531; --line: #183442;
    --ink: #e3eef0; --muted: #83a0ab; --faint: #5e7a86; --link: #3cd3e8; --warn: #f1b23e;
    --deep: #031b26; --deep2: #07303f;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--link); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 6px; }

/* ── header ─────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .bar { max-width: 1080px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 28px; height: 33px; }
.brand b { font-family: 'Archivo SemiExpanded', 'Archivo', sans-serif; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
.brand small { display: block; font-family: 'Martian Mono', ui-monospace, monospace; font-size: 10px; color: var(--muted); margin-top: -2px; }
.top nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.top nav a {
  text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14.5px;
  padding: 7px 11px; border-radius: 10px;
}
.top nav a:hover { color: var(--ink); background: var(--raised); }
.top nav a[aria-current='page'] { color: var(--ink); background: var(--raised); }
.lang {
  display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface);
}
.lang button {
  appearance: none; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 600 13px/1 'Archivo', sans-serif; padding: 7px 12px; border-radius: 999px;
}
.lang button[aria-pressed='true'] { background: var(--deep); color: var(--on-deep); }

@media (max-width: 640px) {
  .top .bar { flex-wrap: wrap; row-gap: 8px; padding: 10px 16px; }
  .lang { margin-left: auto; }
  .top nav { order: 3; width: 100%; margin: 0 -6px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
  .brand small { display: none; }
  html { scroll-padding-top: 118px; }
}

/* ── layout ─────────────────────────────────────────────────────────────── */
.page { max-width: 1080px; margin: 0 auto; padding: 32px 20px 80px; display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .page.with-toc { grid-template-columns: 220px minmax(0, 760px); justify-content: center; }
}
.toc { display: none; }
@media (min-width: 960px) {
  .toc { display: block; position: sticky; top: 92px; align-self: start; font-size: 14px; }
  .toc p { font-family: 'Martian Mono', ui-monospace, monospace; font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; margin: 0 0 10px; }
  .toc a { display: block; color: var(--muted); text-decoration: none; padding: 5px 0 5px 12px; border-left: 2px solid var(--line); }
  .toc a:hover { color: var(--ink); }
  .toc a.on { color: var(--ink); border-left-color: var(--signal); font-weight: 600; }
}
article { min-width: 0; }

/* ── content ────────────────────────────────────────────────────────────── */
h1 {
  font-family: 'Archivo SemiExpanded', 'Archivo', sans-serif; font-weight: 800;
  font-size: clamp(30px, 22px + 2.4vw, 44px); line-height: 1.06; letter-spacing: -0.02em; margin: 6px 0 10px;
}
h2 {
  display: flex; align-items: center; gap: 10px; position: relative;
  font-family: 'Archivo SemiExpanded', 'Archivo', sans-serif; font-weight: 700; font-size: 20px; line-height: 1.25;
  margin: 40px 0 10px;
}
h2::before { content: ''; width: 9px; height: 9px; flex: none; transform: rotate(45deg); border-radius: 2px; background: var(--signal); }
h2 .anchor { opacity: 0; margin-left: 4px; color: var(--faint); text-decoration: none; font-weight: 400; transition: opacity .15s; }
h2:hover .anchor, h2 .anchor:focus { opacity: 1; }
p, li { color: var(--ink); }
ul { padding-left: 1.2em; }
li { margin: 6px 0; }
li::marker { color: var(--signal); }
strong { font-weight: 700; }
section[hidden] { display: none; }
.meta { font-family: 'Martian Mono', ui-monospace, monospace; font-size: 11.5px; color: var(--muted); }
.draft {
  border-left: 3px solid var(--warn); border-radius: 12px; padding: 12px 16px; margin: 0 0 24px;
  background: color-mix(in srgb, var(--warn) 10%, transparent); font-size: 14.5px;
}

/* ── footer ─────────────────────────────────────────────────────────────── */
footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
footer .bar { max-width: 1080px; margin: 0 auto; padding: 22px 20px 40px; display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer a { color: var(--muted); }
.totop {
  position: fixed; right: 18px; bottom: 18px; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer;
  font-size: 18px; line-height: 1; padding: 0; display: grid; place-items: center; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.totop.show { opacity: 1; pointer-events: auto; }

@media print {
  .top, .toc, footer, .totop, .lang { display: none !important; }
  section[hidden] { display: block !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
