/* ============================================================
   WASP · legal + trust documents
   Privacy & Security, Terms, Refunds.
   Inherits the Obsidian Chrome token system from main.css.
   Long-form reading surface: no pinning, no scrub, no GSAP.
   Color stays disciplined - Slate is the only accent.
   ============================================================ */

:root {
  --doc-measure: 68ch;
  --doc-rail: 15.5rem;
}

/* ---------- page scaffold ---------- */
.doc {
  padding: calc(var(--nav-h) + clamp(3.5rem, 9vh, 7rem)) var(--gutter) 0;
}

.doc__inner {
  max-width: 78rem;
  margin: 0 auto;
}

/* ---------- masthead ---------- */
.doc__head {
  border-bottom: 1px solid var(--outline-variant);
  padding-bottom: clamp(2.25rem, 5vh, 3.5rem);
}

.doc__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
  padding: .35rem .7rem;
  border: 1px solid var(--outline-variant);
  border-radius: 999px;
}

.doc__title {
  font-size: clamp(2.4rem, 6.6vw, 5.25rem);
  line-height: .98;
  letter-spacing: -.025em;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--white);
  max-width: 18ch;
}

.doc__title em {
  font-weight: 350;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.doc__standfirst {
  margin-top: 1.75rem;
  max-width: 54ch;
  font-size: clamp(1.05rem, 1rem + .4vw, 1.35rem);
  line-height: 1.5;
  color: var(--alabaster);
}

.doc__dates {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem 2rem;
  margin-top: 2.25rem;
}

/* ---------- the short version ---------- */
.doc__summary {
  margin: clamp(2.5rem, 6vh, 4rem) 0 0;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  background: var(--surface-low);
  border: 1px solid var(--outline-variant);
  border-radius: 6px;
}

.doc__summary h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--white);
  margin-bottom: .5rem;
}

.doc__summary > p {
  color: var(--muted);
  font-size: .95rem;
  max-width: 60ch;
}

.doc__summary-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15.5rem, 1fr));
  gap: 1.5rem 2.25rem;
  margin-top: 2rem;
}

.doc__summary-grid li {
  padding-top: 1.1rem;
  border-top: 1px solid var(--outline);
}

.doc__summary-grid strong {
  display: block;
  color: var(--white);
  font-weight: 600;
  font-size: .98rem;
  margin-bottom: .3rem;
}

.doc__summary-grid span {
  display: block;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.55;
}

/* ---------- body layout: sticky rail + prose ---------- */
.doc__body {
  display: grid;
  grid-template-columns: var(--doc-rail) minmax(0, 1fr);
  gap: clamp(2.5rem, 6vw, 5.5rem);
  align-items: start;
  padding: clamp(3rem, 8vh, 5.5rem) 0 clamp(4rem, 10vh, 7rem);
}

/* min-width:0 on both columns is load-bearing, not defensive. A grid item defaults to
   min-width:auto, so the sub-processor table's own min-width would otherwise propagate up
   and stop the column shrinking, overflowing the page on narrow screens. */
.doc__toc {
  min-width: 0;
  position: sticky;
  top: calc(var(--nav-h) + 1.75rem);
  max-height: calc(100vh - var(--nav-h) - 3.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.doc__toc-title {
  display: block;
  padding-bottom: .85rem;
  margin-bottom: .85rem;
  border-bottom: 1px solid var(--outline-variant);
}

.doc__toc ol {
  list-style: none;
  counter-reset: toc;
}

.doc__toc li { counter-increment: toc; }

.doc__toc a {
  display: flex;
  gap: .6rem;
  padding: .4rem 0;
  font-size: .845rem;
  line-height: 1.35;
  color: var(--muted);
  transition: color var(--dur-fast) var(--ease);
}

.doc__toc a::before {
  content: counter(toc, decimal-leading-zero);
  flex: none;
  opacity: .5;
  font-variant-numeric: tabular-nums;
}

.doc__toc a:hover { color: var(--alabaster); }
.doc__toc a[aria-current="true"] { color: var(--white); }
.doc__toc a[aria-current="true"]::before { opacity: 1; color: var(--slate-2); }

/* ---------- prose ---------- */
.prose { max-width: var(--doc-measure); min-width: 0; }

.prose > section + section { margin-top: clamp(2.75rem, 6vh, 4.25rem); }

.prose h2 {
  font-size: clamp(1.4rem, 1.2rem + .8vw, 1.95rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 1.1rem;
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}

.prose h2 .prose__num {
  display: block;
  font-size: .68rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--slate-2);
  margin-bottom: .55rem;
}

.prose h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--white);
  margin: 2rem 0 .6rem;
  scroll-margin-top: calc(var(--nav-h) + 1.5rem);
}

.prose p,
.prose li {
  font-size: 1.005rem;
  line-height: 1.68;
  color: var(--alabaster);
}

.prose p + p { margin-top: 1rem; }

.prose ul,
.prose ol {
  margin: 1rem 0 0 0;
  padding-left: 1.15rem;
  display: grid;
  gap: .6rem;
}

.prose li { padding-left: .25rem; }
.prose li::marker { color: var(--slate-2); }

.prose strong { color: var(--white); font-weight: 600; }

.prose a:not(.doc__pill) {
  color: var(--slate-2);
  text-decoration: underline;
  text-underline-offset: .18em;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--slate-2) 45%, transparent);
  transition: color var(--dur-fast) var(--ease), text-decoration-color var(--dur-fast) var(--ease);
}

.prose a:not(.doc__pill):hover {
  color: var(--white);
  text-decoration-color: var(--white);
}

/* ---------- callout ---------- */
.callout {
  margin-top: 1.5rem;
  padding: 1.25rem 1.4rem;
  background: var(--surface-low);
  border: 1px solid var(--outline-variant);
  border-radius: 5px;
}

.callout > .mono-label { display: block; margin-bottom: .55rem; }
.callout p { font-size: .945rem; }
.callout p + p { margin-top: .7rem; }

/* ---------- data table ---------- */
.doc__table-wrap {
  margin-top: 1.5rem;
  overflow-x: auto;
  border: 1px solid var(--outline-variant);
  border-radius: 5px;
}

.doc__table {
  width: 100%;
  min-width: 34rem;
  border-collapse: collapse;
  font-size: .9rem;
}

.doc__table th,
.doc__table td {
  text-align: left;
  padding: .85rem 1rem;
  border-bottom: 1px solid var(--outline-variant);
  vertical-align: top;
  line-height: 1.5;
}

.doc__table thead th {
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-low);
  white-space: nowrap;
}

.doc__table tbody tr:last-child th,
.doc__table tbody tr:last-child td { border-bottom: 0; }

.doc__table tbody th {
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
}

.doc__table td { color: var(--alabaster); }
.doc__table td small {
  display: block;
  margin-top: .2rem;
  font-size: .82rem;
  color: var(--muted);
}

/* ---------- store / never-store split ---------- */
.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.split__col {
  padding: 1.35rem 1.4rem;
  border: 1px solid var(--outline-variant);
  border-radius: 5px;
  background: var(--surface-low);
}

.split__col--never { background: transparent; border-style: dashed; }

.split__col > .mono-label { display: block; margin-bottom: .9rem; }

.split__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .55rem;
}

.split__col li {
  font-size: .93rem;
  line-height: 1.5;
  padding-left: 1.35rem;
  position: relative;
}

.split__col li::before {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--slate-2);
}

.split__col--stored li::before { content: "+"; }
.split__col--never li::before { content: "\00d7"; color: var(--muted); }
.split__col--never li { color: var(--muted); }

/* ---------- placeholder chip (fill before launch) ---------- */
.fill {
  display: inline-block;
  padding: .05em .45em;
  border: 1px dashed var(--outline);
  border-radius: 3px;
  font-size: .88em;
  letter-spacing: .02em;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- back / footer nav ---------- */
.doc__foot {
  border-top: 1px solid var(--outline-variant);
  padding: 2.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  align-items: center;
}

.doc__pill {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .55rem .9rem;
  border: 1px solid var(--outline);
  border-radius: 999px;
  color: var(--alabaster);
  transition: background var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}

.doc__pill:hover {
  background: var(--white);
  color: var(--onyx);
  border-color: var(--white);
}

.doc__siblings { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- responsive ---------- */
@media (max-width: 1020px) {
  .doc__body { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }

  .doc__toc {
    position: static;
    max-height: none;
    padding: 1.35rem 1.4rem;
    border: 1px solid var(--outline-variant);
    border-radius: 5px;
    background: var(--surface-low);
  }

  .doc__toc ol {
    columns: 2;
    column-gap: 2rem;
  }

  .doc__toc li { break-inside: avoid; }
  .prose { max-width: none; }
}

@media (max-width: 560px) {
  .doc__toc ol { columns: 1; }
  .doc__dates { gap: .4rem 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  .doc__toc { scroll-behavior: auto; }
}

/* ---------- print: make the whole document readable on paper ---------- */
@media print {
  .nav, .doc__toc, .doc__foot, .grain, .preloader { display: none !important; }
  body { background: #fff; color: #000; }
  .doc { padding: 0; }
  .doc__body { display: block; padding: 0; }
  .prose { max-width: none; }
  .prose h2, .prose h3, .doc__title, .doc__summary h2,
  .prose p, .prose li, .prose strong, .doc__standfirst,
  .doc__table td, .doc__table tbody th { color: #000; }
  .doc__summary, .callout, .split__col, .doc__table thead th { background: #f4f4f4; }
  .prose a:not(.doc__pill) { color: #000; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; color: #444; }
  section, .callout, .doc__table { break-inside: avoid; }
}
