/* The policy and trust pages' one stylesheet: Privacy, Terms, Security,
   Subprocessors, the Data Processing Addendum and Data retention, plus Status,
   which shares the prose rules and adds its own status cards inline.

   It holds the theme tokens, the base rules and the prose those pages are set
   in, then the wide policy layout, scoped to `main.legal-doc`: at desktop
   width an "On this page" list of the sections on the left and the text on
   the right, kept to a readable line length; on a phone one column, the
   title, the list, then the text. The list and the section ids are written by
   marketing/build-chrome.mjs from each page's h2s.

   No page carries its own copy of these rules (build-chrome.test.mjs).
   Bump the ?v= on every page that links this file when it changes. */

/* ==========================================================================
   Ravensight theme tokens
   --------------------------------------------------------------------------
   One source of truth for color, type, space, and radius. Every rule below
   reads from these tokens, so the same block can be lifted into the dashboard
   without renaming anything. Names describe role, not product.

   Palette: raven ink. A near black with a cold blue cast (bg, surface),
   a warm bone for headings, a cool gray for body copy, and exactly one
   saturated accent: sodium amber. Amber marks signal only, meaning flags,
   primary actions, tool calls, and the raven eye. Nothing else is colored.

   Contrast on --rs-bg (#0B0B0F): bone 16.4:1, text 10.3:1, muted 8.7:1,
   accent 11.1:1. All clear WCAG AAA for body copy (7:1).
   ========================================================================== */
:root {
  /* surfaces */
  --rs-bg:              #0B0B0F;
  --rs-bg-alt:          #0F1015;
  --rs-surface:         #14161C;
  --rs-surface-2:       #1A1D25;
  --rs-border:          #22252E;
  --rs-border-strong:   #5B6070; /* 3.1:1 on --rs-bg, clears WCAG 1.4.11 for control edges */

  /* text */
  --rs-text-strong:     #EDEAE3;
  --rs-text:            #C6C9D1;
  --rs-text-muted:      #B2B6C2;

  /* accent */
  --rs-accent:          #FFB454;
  --rs-accent-strong:   #FFC77E;
  --rs-accent-contrast: #0B0B0F;
  --rs-accent-tint:     rgba(255, 180, 84, 0.10);
  --rs-accent-line:     rgba(255, 180, 84, 0.34);
  --rs-accent-glow:     rgba(255, 180, 84, 0.07);
  --rs-focus:           #FFB454;

  /* utility */
  --rs-mask-opaque:     rgba(0, 0, 0, 1);
  --rs-mask-clear:      rgba(0, 0, 0, 0);
  --rs-shadow-card:     0 1px 0 rgba(255, 255, 255, 0.03) inset,
                        0 24px 60px rgba(0, 0, 0, 0.45);

  /* type families */
  --rs-font-sans: ui-sans-serif, system-ui, -apple-system, "SF Pro Text",
                  "Segoe UI Variable Text", "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
  --rs-font-mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono",
                  "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* type scale */
  --rs-text-2xs:  0.8125rem;
  --rs-text-xs:   0.75rem;
  --rs-text-sm:   0.8125rem;
  --rs-text-base: 0.9375rem;
  --rs-text-md:   1.0625rem;
  --rs-text-lg:   1.1875rem;
  --rs-text-xl:   1.375rem;
  --rs-text-2xl:  clamp(1.75rem, 1.15rem + 2.4vw, 2.5rem);
  --rs-text-3xl:  clamp(2.1rem, 1.25rem + 3.7vw, 3.85rem);

  /* type rhythm */
  --rs-leading-tight:  1.02;
  --rs-leading-snug:   1.2;
  --rs-leading-normal: 1.62;
  --rs-tracking-tight: -0.028em;
  --rs-tracking-wide:  0.16em;

  /* space scale, 4px base */
  --rs-space-1:  0.25rem;
  --rs-space-2:  0.5rem;
  --rs-space-3:  0.75rem;
  --rs-space-4:  1rem;
  --rs-space-5:  1.5rem;
  --rs-space-6:  2rem;
  --rs-space-7:  2.5rem;
  --rs-space-8:  3rem;
  --rs-space-9:  4rem;
  --rs-space-10: 5rem;
  --rs-space-11: 6rem;
  --rs-space-section: clamp(4.5rem, 8vw, 7.5rem);

  /* radius */
  --rs-radius-sm:   0.375rem;
  --rs-radius-md:   0.625rem;
  --rs-radius-lg:   1rem;
  --rs-radius-pill: 999px;

  /* layout */
  --rs-container: 86rem;
  --rs-rule: 1px;
  --rs-tap: 2.75rem; /* 44px minimum tap target */
}

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

html {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

/* keep anchored sections clear of the sticky header */
[id] { scroll-margin-top: 5.5rem; }

body {
  margin: 0;
  background: var(--rs-bg);
  color: var(--rs-text);
  font-family: var(--rs-font-sans);
  font-size: var(--rs-text-md);
  line-height: var(--rs-leading-normal);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  color: var(--rs-text-strong);
  font-weight: 700;
  letter-spacing: var(--rs-tracking-tight);
  line-height: var(--rs-leading-snug);
  text-wrap: pretty;
  margin: 0;
}

p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a {
  color: var(--rs-text-strong);
  text-decoration-color: var(--rs-border-strong);
  text-underline-offset: 0.22em;
}
a:hover { text-decoration-color: var(--rs-accent); }

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

code, kbd, pre { font-family: var(--rs-font-mono); }

/* ===================== motion ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ===================== legal prose ===================== */
main {
  max-width: 46rem;
  margin-inline: auto;
  padding: var(--rs-space-8) var(--rs-space-6) var(--rs-space-section);
}
main h1 {
  color: var(--rs-text-strong);
  font-size: var(--rs-text-2xl);
  line-height: var(--rs-leading-snug);
  letter-spacing: -0.02em;
  margin: 0 0 var(--rs-space-2);
}
.updated {
  color: var(--rs-text-muted);
  font-size: var(--rs-text-sm);
  margin: 0 0 var(--rs-space-7);
}
main h2 {
  color: var(--rs-text-strong);
  font-size: var(--rs-text-lg);
  line-height: var(--rs-leading-snug);
  margin: var(--rs-space-7) 0 var(--rs-space-2);
}
main p, main li { color: var(--rs-text); }
main ul { padding-left: var(--rs-space-5); }
main li { margin-bottom: var(--rs-space-2); }

/* ===================== trust pages ===================== */
main p { margin: 0 0 var(--rs-space-4); }
main ul, main ol { margin: 0 0 var(--rs-space-4); padding-left: var(--rs-space-5); }
main ul { list-style: disc; }
main ol { list-style: decimal; }
main h3 {
  color: var(--rs-text-strong);
  font-size: var(--rs-text-md);
  line-height: var(--rs-leading-snug);
  margin: var(--rs-space-6) 0 var(--rs-space-2);
}
main strong { color: var(--rs-text-strong); }
main code { font-size: 0.9em; overflow-wrap: anywhere; }
.lead { color: var(--rs-text); font-size: var(--rs-text-md); }
.facts { margin: 0 0 var(--rs-space-5); }
.facts dt {
  color: var(--rs-text-strong);
  font-weight: 600;
  margin-top: var(--rs-space-3);
}
.facts dd { margin: var(--rs-space-1) 0 0; color: var(--rs-text); }
.vendor {
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-md);
  background: var(--rs-surface);
  padding: var(--rs-space-4) var(--rs-space-5);
  margin: 0 0 var(--rs-space-4);
}
.vendor h3 { margin-top: 0; }
.vendor .facts { margin-bottom: 0; }
.table-wrap {
  overflow-x: auto;
  margin: 0 0 var(--rs-space-5);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-md);
}
.table-wrap:focus-visible { outline: 2px solid var(--rs-focus); outline-offset: 2px; }
.table-wrap table { border-collapse: collapse; width: 100%; font-size: var(--rs-text-sm); }
.table-wrap th, .table-wrap td {
  text-align: left;
  vertical-align: top;
  padding: var(--rs-space-3);
  border-bottom: 1px solid var(--rs-border);
  min-width: 9rem;
  color: var(--rs-text);
}
.table-wrap th { color: var(--rs-text-strong); background: var(--rs-surface); }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td:first-child { width: 28%; max-width: 24rem; color: var(--rs-text-strong); }
.table-wrap td code, .table-wrap th code { white-space: nowrap; overflow-wrap: normal; }
@media (max-width: 40rem) {
  .table-wrap thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td, .table-wrap td:first-child { display: block; width: auto; min-width: 0; max-width: none; }
  .table-wrap tr { border-bottom: 1px solid var(--rs-border); padding: var(--rs-space-2) 0; }
  .table-wrap tr:last-child { border-bottom: 0; }
  .table-wrap td { border-bottom: 0; padding: var(--rs-space-1) var(--rs-space-3); }
  .table-wrap td::before { content: attr(data-label); display: block; color: var(--rs-text-muted); font-size: var(--rs-text-xs); text-transform: uppercase; letter-spacing: 0.04em; }
  .table-wrap td:first-child::before { content: none; }
  .table-wrap td:first-child { font-weight: 600; }
}

/* ===================== wide policy layout ===================== */

main.legal-doc {
  max-width: var(--rs-container);
  padding: var(--rs-space-8) var(--rs-space-5) var(--rs-space-section);
}
.legal-doc .legal-head p,
.legal-doc .legal-body p,
.legal-doc .legal-body li,
.legal-doc .legal-body dd { max-width: 75ch; }

/* On this page */
.legal-doc .legal-toc {
  margin: 0 0 var(--rs-space-7);
  padding: var(--rs-space-4) var(--rs-space-5);
  border: 1px solid var(--rs-border);
  border-radius: var(--rs-radius-md);
  background: var(--rs-surface);
}
.legal-doc .legal-toc-title {
  margin: 0 0 var(--rs-space-1);
  font-family: var(--rs-font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--rs-text-strong);
}
.legal-doc .legal-toc ol { list-style: none; margin: 0; padding: 0; }
.legal-doc .legal-toc li { margin: 0; }
.legal-doc .legal-toc a {
  display: flex;
  align-items: center;
  min-height: var(--rs-tap);
  padding-block: var(--rs-space-1);
  color: var(--rs-text-muted);
  font-size: var(--rs-text-base);
  line-height: 1.4;
  text-decoration: none;
}
.legal-doc .legal-toc a:hover { color: var(--rs-accent); }

/* A label and its value side by side, so a vendor card or the DPA scope
   reads as a table rather than a long stack. */
@media (min-width: 40rem) {
  .legal-doc .facts {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    column-gap: var(--rs-space-5);
  }
  .legal-doc .facts dt,
  .legal-doc .facts dd { margin-top: var(--rs-space-3); }
  .legal-doc .facts dt:first-of-type,
  .legal-doc .facts dt:first-of-type + dd { margin-top: 0; }
}

@media (min-width: 64rem) {
  main.legal-doc {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    column-gap: var(--rs-space-9);
    align-items: start;
  }
  .legal-doc .legal-head { grid-column: 2; grid-row: 1; }
  .legal-doc .legal-body { grid-column: 2; grid-row: 2; min-width: 0; }
  .legal-doc .legal-toc {
    grid-column: 1;
    grid-row: 1 / span 2;
    position: sticky;
    top: 5.5rem;
    max-height: calc(100vh - 7rem);
    overflow-y: auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
  }
}
/* The list scrolls on a short window, so the focus ring sits inside it. */
.legal-doc .legal-toc a:focus-visible { outline-offset: -2px; }
