/* policy_doc.css — Privacy Policy, Terms of Service, FAQ.

   These are reading pages: they open with the SHARED `.rdg-head` (layout.css,
   emitted by the `reading_head` macro) exactly as /whats-new does, and when
   someone is signed in they render inside the v3 nav rail. What they do NOT
   share is how you move through them — /whats-new stamps a date in the margin
   because it is a chronological record; a policy is a reference document you
   jump into, so the two long ones carry a section index instead, and the FAQ
   is a list you scan. (An earlier draft put `§ n` margin stamps on all three;
   it read as bureaucratic clutter and every legal page surveyed navigates by
   an index instead — Filip + Mobbin, 2026-07-22.)

   `.legal-title-row` / `.legal-back` / `.legal-eyebrow` / `.legal-title` /
   `.legal-sub` / `.legal-meta` were this file's private fork of that head and
   are GONE — the macro owns it now.

   All values token-driven; nothing hardcoded. */

/* This file used to carry `body { background: var(--surface) }` — a global
   rule for a three-page concern, which repainted any page that loaded the
   stylesheet (the styleguide, once it grew specimens for these components).
   Dropped: the reading pages now sit on `--bg` paper like every other page,
   which is also what /whats-new does, so the four look like one family. */

/* Measure. Inside the shell `.main-col .page` already caps at 920px, so this
   only has to hold the standalone (signed-out) case to the same pitch. */
.legal-page { max-width: 920px; }

/* -- Prose column + section index ---------------------------------------- */

/* Index sits on the RIGHT: our left edge is the nav rail, and two left
   columns would fight. Below 1100px it retires — the prose keeps the full
   measure, and on a phone a 16-entry index above the document is a wall. */
.legal-doc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 188px;
  gap: var(--sp-8);
  align-items: start;
  margin-top: var(--sp-7);
}

/* The signed-in v3 shell gives `.main-col` `overflow-y: auto` (dashboard-v2.css,
   loaded only when someone is logged in) so the review page can scroll under its
   own sticky toolbar. That makes `.main-col` a scroll CONTAINER — but a reading
   page isn't height-bounded: it scrolls on the viewport, and `.main-col` never
   actually scrolls. A `position: sticky` descendant sticks to its nearest scroll
   container, so the index below was pinned inside a box that never moves — it
   rode the page up and vanished after a section jump. Reading pages don't need
   `.main-col` to clip (the review page, which does, carries no `.legal-page`), so
   let it fall back to the viewport scroller and the index sticks for real.
   Signed-out this is a no-op — `.main-col` has no overflow there. */
.main-col:has(.legal-page) { overflow: visible; }

.legal-idx {
  position: sticky;
  top: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  border-left: 1px solid var(--border);
  padding-left: var(--sp-4);
  max-height: calc(100vh - var(--sp-10));
  overflow-y: auto;
}
.legal-idx__cap {
  margin: 0 0 var(--sp-2);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-3);
}
/* The active row paints a gold segment ON the hairline rather than beside it:
   the negative margin pulls the link over the rule, so the border replaces
   that stretch of it instead of adding a second vertical line. */
.legal-idx__lnk {
  padding: 3px 0 3px var(--sp-4);
  margin-left: calc(var(--sp-4) * -1 - 1px);
  border-left: var(--bw-2) solid transparent;
  font-size: var(--fs-sm);
  line-height: 1.35;
  color: var(--fg-2);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.legal-idx__lnk:hover { color: var(--fg); }
.legal-idx__lnk:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.legal-idx__lnk.is-on {
  color: var(--fg);
  font-weight: var(--fw-semibold);
  border-left-color: var(--accent);
}

/* Anchor targets clear the sticky index's top edge when jumped to. */
.legal-doc__prose h2 { scroll-margin-top: var(--sp-6); }

/* -- HR-locale notice (legal copy is canonical in English for now) -------- */

.legal-locale-notice {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  margin-bottom: var(--sp-7);
  padding: var(--sp-4) var(--sp-5);
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
}
.legal-locale-notice__icon {
  flex-shrink: 0;
  margin-top: 2px;
  opacity: 0.85;
}

/* -- Prose article -------------------------------------------------------- */

.policy-doc {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--fg);
  max-width: 70ch;
}

.policy-doc h2 {
  margin: var(--sp-10) 0 var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-sans);
  font-size: var(--fs-2xl);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-snug);
}
.policy-doc h2:first-child { margin-top: 0; }

.policy-doc h3 {
  margin: var(--sp-7) 0 var(--sp-2);
  font-family: var(--font-sans);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--fg);
}

.policy-doc p {
  margin: 0 0 var(--sp-4);
  color: var(--fg-2);
}

.policy-doc strong { color: var(--fg); font-weight: var(--fw-semibold); }
.policy-doc em { color: var(--fg-2); }

.policy-doc a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  transition: color var(--dur-fast) var(--ease),
              text-decoration-color var(--dur-fast) var(--ease);
}
.policy-doc a:hover {
  color: var(--accent-strong);
  text-decoration-color: var(--accent-strong);
}

.policy-doc code {
  padding: 1px var(--sp-1);
  background: var(--surface-muted);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--fg);
}

.policy-doc ul,
.policy-doc ol {
  margin: 0 0 var(--sp-4);
  padding-left: var(--sp-6);
  color: var(--fg-2);
}
.policy-doc li { margin-bottom: var(--sp-2); }
.policy-doc li::marker { color: var(--fg-3); }

/* Lead paragraph after a heading — slightly larger, slightly de-emphasised. */
.policy-doc .lead {
  font-size: var(--fs-lg);
  line-height: var(--lh-body);
  color: var(--fg-2);
}

/* Pull-quote / honest-caveat callout — gold accent stripe, restrained. */
.policy-doc .callout {
  display: block;
  margin: var(--sp-6) 0;
  padding: var(--sp-5) var(--sp-6);
  background: var(--surface-muted);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  color: var(--fg);
}
.policy-doc .callout > :first-child { margin-top: 0; }
.policy-doc .callout > :last-child  { margin-bottom: 0; }
.policy-doc .callout p {
  color: var(--fg);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}

/* Mono note (legal sub-clauses, definitions, technical asides). */
.policy-doc .note {
  display: block;
  margin: var(--sp-4) 0;
  padding-left: var(--sp-4);
  border-left: 2px solid var(--border-strong);
  font-size: var(--fs-sm);
  color: var(--fg-3);
}

/* Retention / subprocessor / persistence tables. */
.policy-doc table {
  width: 100%;
  margin: var(--sp-5) 0 var(--sp-6);
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.policy-doc thead th {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: left;
}
.policy-doc tbody td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  color: var(--fg-2);
  vertical-align: top;
  line-height: var(--lh-body);
}
.policy-doc tbody tr:last-child td { border-bottom: none; }

/* -- FAQ-specific: accordion-less Q&A list -------------------------------- */

/* Hairline rows, question + caret. The `01`/`02` pills are GONE: they
   numbered a list whose order carries no information, and they were the
   loudest thing on a page whose job is to reassure. None of the six FAQ
   pages surveyed numbers its questions (Mobbin, 2026-07-22). The boxed
   cards go with them — the same card-to-register move the dashboard made. */
.faq-list {
  display: flex;
  flex-direction: column;
  margin-top: var(--sp-6);
  max-width: 72ch;
  border-top: 1px solid var(--border);
}

.faq-item { border-bottom: 1px solid var(--border); }

.faq-item__q {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-4);
  padding: var(--sp-5) 0;
  cursor: pointer;
  list-style: none;
  font-family: var(--font-sans);
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-tight);
  color: var(--fg);
  line-height: var(--lh-snug);
  transition: color var(--dur-fast) var(--ease);
}
.faq-item__q::-webkit-details-marker { display: none; }
.faq-item__q:hover { color: var(--brand-soft-fg); }
.faq-item__q:focus-visible {
  outline: none;
  box-shadow: var(--sh-focus);
  border-radius: var(--r-md);
}
.faq-item[open] .faq-item__q { padding-bottom: var(--sp-3); }

.faq-item__q-text { flex: 1; min-width: 0; text-wrap: balance; }

.faq-item__caret {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 3px;
  color: var(--fg-3);
  transition: transform var(--dur-fast) var(--ease);
}
.faq-item[open] .faq-item__caret { transform: rotate(180deg); color: var(--fg); }

.faq-item__a {
  padding: 0 0 var(--sp-6);
  max-width: 64ch;
  font-size: var(--fs-body);
  line-height: var(--lh-prose);
  color: var(--fg-2);
}
.faq-item__a > :first-child { margin-top: 0; }
.faq-item__a > :last-child  { margin-bottom: 0; }
.faq-item__a p { margin: 0 0 var(--sp-3); }
.faq-item__a ul,
.faq-item__a ol { margin: 0 0 var(--sp-3); padding-left: var(--sp-6); }
.faq-item__a li { margin-bottom: var(--sp-2); }
.faq-item__a strong { color: var(--fg); }

/* -- Foot links (Privacy ↔ Terms ↔ FAQ inter-document nav) ---------------- */

.legal-foot {
  margin-top: var(--sp-11);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-5);
  font-size: var(--fs-sm);
  color: var(--fg-3);
}
.legal-foot a {
  color: var(--fg-2);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.legal-foot a:hover {
  color: var(--fg);
  border-bottom-color: var(--accent);
}
.legal-foot__sep { color: var(--fg-3); }

/* -- Responsive ---------------------------------------------------------- */

/* The index retires before the prose gets squeezed: at 1100px the pane can
   no longer hold a readable measure AND a 188px column. */
@media (max-width: 1100px) {
  .legal-doc { grid-template-columns: minmax(0, 1fr); }
  .legal-idx { display: none; }
}

@media (max-width: 720px) {
  .policy-doc { font-size: var(--fs-body); }
  .policy-doc h2 { font-size: var(--fs-xl); }
  .policy-doc h3 { font-size: var(--fs-body); }
  .policy-doc table { font-size: var(--fs-xs); }
  .faq-item__q { padding: var(--sp-4) 0; font-size: var(--fs-body); }
  .faq-item__a { padding: 0 0 var(--sp-4); }
}

@media (max-width: 420px) {
  .policy-doc table thead { display: none; }
  .policy-doc table,
  .policy-doc table tbody,
  .policy-doc table tr,
  .policy-doc table td { display: block; width: 100%; }
  .policy-doc tbody tr {
    padding: var(--sp-3) 0;
    border-bottom: 1px solid var(--border);
  }
  .policy-doc tbody td { padding: var(--sp-1) 0; border: none; }
  .policy-doc tbody td:first-child {
    font-weight: var(--fw-semibold);
    color: var(--fg);
  }
}
