
/* AnnexusX site – legal pages
   Palette: exact login-screen background #481B86, single-theme.
   No prefers-color-scheme override — the site commits to the brand purple
   regardless of OS dark/light preference, matching the app login screen. */
:root {
  --bg: #481B86;
  --surface: rgba(255,255,255,0.08);
  --surface-border: rgba(255,255,255,0.15);
  --border: rgba(255,255,255,0.14);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.58);
  --soft: rgba(255,255,255,0.38);
  --accent: #d8c7fb;
  --accent-soft: rgba(255,255,255,0.12);
  --nav-hover: rgba(255,255,255,0.10);
  --link: #d8c7fb;
  --code-bg: rgba(255,255,255,0.10);
  --header-bg: rgba(0,0,0,0.18);
  --header-text: #ffffff;
  --badge-bg: rgba(255,255,255,0.15);
  --badge-text: #d8c7fb;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  background: #481B86;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body {
  background: #481B86;
  /* Login-screen radial glows — reproduced from apps/web/src/pages/login.tsx */
  background-image:
    radial-gradient(circle at 40% 35%, rgba(255,255,255,0.07), transparent 55%),
    radial-gradient(circle at 70% 70%, rgba(120,60,200,0.18), transparent 50%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 12px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ── Header ── */
.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding: 0 24px;
}
.header-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}
.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.header-logo svg {
  height: 28px;
  width: auto;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.header-nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-size: 13.5px;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.header-nav a:hover, .header-nav a:focus-visible {
  background: rgba(255,255,255,0.1);
  color: #fff;
  outline: none;
}
.header-signin {
  color: #fff !important;
  background: rgba(255,255,255,0.12) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  font-weight: 500 !important;
  margin-left: 8px;
}
.header-signin:hover, .header-signin:focus-visible {
  background: rgba(255,255,255,0.2) !important;
}

/* ── Layout ── */
.page-layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
  flex: 1;
}
.legal-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 80px;
  align-items: start;
}
@media (max-width: 900px) {
  .legal-layout { grid-template-columns: 1fr; gap: 0; padding-top: 0; }
}

/* ── Document ── */
article.legal-doc {
  min-width: 0;
  padding-bottom: 64px;
}
.doc-meta {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  margin-top: 32px;
}
@media (max-width: 900px) { .doc-meta { margin-top: 24px; } }

article.legal-doc h1 {
  font-size: clamp(22px, 3.5vw, 30px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  text-wrap: balance;
  margin-bottom: 32px;
  scroll-margin-top: 80px;
}
article.legal-doc h2 {
  font-size: 18px;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 12px;
  color: var(--text);
  scroll-margin-top: 80px;
  text-wrap: balance;
}
article.legal-doc h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 8px;
  color: var(--text);
  scroll-margin-top: 80px;
  text-wrap: balance;
}
article.legal-doc h2 + h3 {
  margin-top: 10px;
}
article.legal-doc h4 {
  font-size: 14px;
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: 6px;
  scroll-margin-top: 80px;
}
article.legal-doc p { margin-bottom: 14px; }
article.legal-doc ul, article.legal-doc ol {
  padding-left: 24px;
  margin-bottom: 14px;
}
article.legal-doc li { margin-bottom: 6px; }
article.legal-doc a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 2px;
}
article.legal-doc a:hover { opacity: 0.8; }
article.legal-doc strong { font-weight: 600; }
article.legal-doc hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
article.legal-doc blockquote {
  border-left: 3px solid var(--accent-soft);
  padding-left: 16px;
  color: var(--muted);
  margin: 16px 0;
}
article.legal-doc code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.9em;
}
article.legal-doc pre {
  background: var(--code-bg);
  padding: 16px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.6;
}

/* ── Tables ── */
.table-scroll {
  overflow-x: auto;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
article.legal-doc table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 480px;
}
article.legal-doc th {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
article.legal-doc td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}
article.legal-doc tr:nth-child(even) td {
  background: var(--surface);
}

/* ── On this page (desktop) ── */
.toc-aside {
  position: sticky;
  top: 24px;
  align-self: start;
  padding: 20px 0;
  max-height: calc(100dvh - 84px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
@media (max-width: 900px) { .toc-aside { display: none; } }

.toc-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
  padding: 0 4px;
}
.toc-nav { display: flex; flex-direction: column; gap: 2px; }
.toc-nav a {
  display: block;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 5px;
  line-height: 1.4;
  transition: background 0.12s, color 0.12s;
}
.toc-nav a:hover, .toc-nav a:focus-visible {
  background: var(--nav-hover);
  color: var(--text);
  outline: none;
}
.toc-nav a.toc-h3 {
  padding-left: 18px;
  font-size: 12px;
  padding-top: 2px;
  padding-bottom: 2px;
  opacity: 0.85;
}
.toc-nav a + a.toc-h3 {
  margin-top: -1px;
}

/* ── Mobile TOC ── */
.toc-mobile {
  display: none;
  margin: 24px 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
@media (max-width: 900px) { .toc-mobile { display: block; } }
.toc-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  user-select: none;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary::after {
  content: '▾';
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.2s;
}
.toc-mobile[open] summary::after { transform: rotate(-180deg); }
.toc-mobile-nav {
  padding: 8px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-top: 1px solid var(--border);
}
.toc-mobile-nav a {
  display: block;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: 5px;
}
.toc-mobile-nav a:hover, .toc-mobile-nav a:focus-visible {
  background: var(--nav-hover);
  color: var(--text);
  outline: none;
}
.toc-mobile-nav a.toc-h3 { padding-left: 20px; font-size: 12.5px; }

/* ── Legal index ── */
.legal-index-page { padding: 48px 0 80px; }
.legal-index-title {
  font-size: clamp(22px, 3.5vw, 30px);
  font-weight: 700;
  margin-bottom: 8px;
}
.legal-index-intro { color: var(--muted); margin-bottom: 36px; font-size: 15px; }
.legal-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.legal-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.legal-card:hover, .legal-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
.legal-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.legal-card-url {
  font-size: 12px;
  color: var(--muted);
  font-family: monospace;
}

/* ── Homepage ── */
.home-page {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.home-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
}
@media (max-width: 640px) {
  .home-hero { padding: 40px 20px; }
}
.home-logo { margin-bottom: 36px; }
.home-logo svg { height: 44px; width: auto; }
.home-tagline {
  font-size: clamp(26px, 4.5vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 16px;
}
.home-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 420px;
  margin: 0 auto 40px;
}
.home-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.30);
  color: #fff;
  text-decoration: none;
  padding: 14px 32px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.home-cta:hover, .home-cta:focus-visible {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.50);
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
  flex-shrink: 0;
}
.footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.footer-copy { font-size: 12px; }

/* ── 404 ── */
.not-found-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  text-align: center;
  padding: 48px 24px;
}
.not-found-code {
  font-size: 80px;
  font-weight: 800;
  color: var(--accent-soft);
  line-height: 1;
  margin-bottom: 16px;
}
.not-found-msg { font-size: 20px; font-weight: 600; margin-bottom: 12px; }
.not-found-sub { color: var(--muted); margin-bottom: 32px; }
.not-found-back {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 10px 22px;
  border-radius: 7px;
  font-weight: 600;
}

/* ── Print ── */
@media print {
  .site-header, .site-footer, .toc-aside, .toc-mobile, .skip-link { display: none !important; }
  body { background: white; color: black; font-size: 12pt; }
  article.legal-doc h1, article.legal-doc h2 { page-break-after: avoid; }
  article.legal-doc a { color: black; text-decoration: underline; }
}

/* ── Table alignment via data attribute (no inline style needed) ── */
[data-align="center"] { text-align: center; }
[data-align="right"]  { text-align: right; }
[data-align="left"]   { text-align: left; }

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ── Focus visible ── */
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
