/* Legal documents: terms.html and privacy.html.
 *
 * Its own stylesheet rather than page-level <style>, because two pages share it and a third
 * (a data processing addendum, a security overview) is likely.
 *
 * Two constraints shaped everything here.
 *
 * NO JAVASCRIPT. These pages load no api.js, no site.js and no Alpine — see the note in
 * their heads. An app store reviewer opens the URL cold, and a client's attorney may open it
 * in a browser with scripting disabled. So nothing below depends on a class being toggled at
 * runtime, and the contents list is real anchors.
 *
 * IT HAS TO PRINT. A store reviewer, an insurer or a client will want this as a PDF, and
 * the browser's own print is the only mechanism that needs no work from us. The print block
 * at the bottom is therefore part of the feature, not a nicety.
 */

.doc {
  /* Narrower than the marketing page. Long-form prose is read at 65–75 characters a line;
     the 1080px the landing page uses would give roughly 130 and make this unreadable. */
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ---------------- header ---------------- */
.doc-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0 0;
  margin-bottom: 34px;
  flex-wrap: wrap;
}
.doc-nav { display: flex; gap: 14px; margin-left: auto; }
.doc-nav a { color: var(--muted); font-size: 13.5px; }
.doc-nav a:hover { color: var(--text); }

/* ---------------- headings ---------------- */
.doc h1 {
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: -.02em;
  margin: 0 0 8px;
}
.doc-meta {
  color: var(--muted-2);
  font-size: 13px;
  margin: 0 0 26px;
}

.doc h2 {
  font-size: 17px;
  margin: 34px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
  letter-spacing: -.01em;
}
/* The contents block has its own h2 and does not want the rule above it. */
.doc-toc h2 { border-top: 0; padding-top: 0; margin-top: 0; font-size: 14px; }

.doc h3 { font-size: 15px; margin: 18px 0 8px; }

/* ---------------- body ---------------- */
.doc p,
.doc li {
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.7;
}
.doc p { margin: 0 0 13px; }
.doc ul, .doc ol { margin: 0 0 14px; padding-left: 22px; }
.doc li { margin-bottom: 8px; }
/* Emphasis in a legal document is load-bearing rather than decorative, so it gets the full
   text colour instead of the muted body grey. */
.doc strong { color: var(--text); font-weight: 600; }
.doc a { color: var(--cyan); }

/* ---------------- contents ---------------- */
.doc-toc {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px 6px;
  background: var(--panel);
  margin: 0 0 10px;
}
.doc-toc ol {
  /* Two columns on a wide screen: nineteen numbered sections in one column is a wall. */
  columns: 2;
  column-gap: 28px;
  margin: 0;
  padding-left: 20px;
}
@media (max-width: 620px) { .doc-toc ol { columns: 1; } }
.doc-toc li { margin-bottom: 6px; font-size: 13.5px; break-inside: avoid; }

/* ---------------- callouts ---------------- */

/* A neutral note: the "this is not legal advice" block, and the pointer to section 2. */
.doc-note {
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: 8px;
  padding: 14px 16px;
  background: var(--panel);
  margin: 0 0 26px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}
.doc-note-end { margin: 40px 0 0; border-left-color: var(--warn); }

/* The one section a reader must not skim: what the service is not. Amber and boxed, because
   in a document that is mostly grey text an ordinary heading would not stop anybody. */
.doc-warn {
  border: 1px solid rgba(245, 165, 36, .3);
  border-radius: 10px;
  padding: 18px 20px 4px;
  background: rgba(245, 165, 36, .05);
  margin: 18px 0 8px;
}
.doc-warn h3 { color: var(--warn); margin-top: 0; }

/* A field somebody still has to fill in. Deliberately loud: an unreplaced placeholder that
   reaches production is worse than no clause at all, so it should be impossible to miss on
   the rendered page rather than only visible in the source. */
.doc-fill {
  border: 1px dashed var(--warn);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(245, 165, 36, .06);
  font-size: 13.5px;
}

/* ---------------- footer ---------------- */
.doc-foot {
  border-top: 1px solid var(--border);
  margin-top: 44px;
  padding-top: 22px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted-2);
  font-size: 13px;
}
.doc-foot a { color: var(--muted); }

/* ---------------- print ----------------
 *
 * Producing a PDF is the whole reason this block exists: it is how the document gets attached
 * to an app store submission, sent to an insurer, or filed by a client. Black on white,
 * because a dark theme printed is a wasted cartridge and an unreadable page.
 */
@media print {
  /* Colour is set on the elements rather than inherited, since the app's dark palette comes
     from custom properties this block cannot rely on being overridden. */
  html, body { background: #fff !important; }
  .doc, .doc p, .doc li, .doc h1, .doc h2, .doc h3, .doc strong, .doc-meta {
    color: #000 !important;
  }
  .doc { max-width: none; padding: 0; }

  /* Navigation and the contents list are useless on paper — nothing to click — and the
     contents would push the substance onto page two. */
  .doc-head, .doc-nav, .doc-toc, .doc-foot { display: none !important; }

  .doc a { color: #000 !important; text-decoration: underline; }
  /* Print the target of a real link, so a printed copy is still navigable. Skips in-page
     anchors, which would print as noise. */
  .doc a[href^="http"]::after,
  .doc a[href^="mailto"]::after { content: " (" attr(href) ")"; font-size: 90%; }

  .doc-note, .doc-warn, .doc-fill {
    border: 1px solid #666 !important;
    background: none !important;
    break-inside: avoid;
  }
  .doc-warn h3 { color: #000 !important; }

  /* A heading alone at the foot of a page, with its section overleaf, reads as a mistake. */
  .doc h2, .doc h3 { break-after: avoid; page-break-after: avoid; }
  .doc h2 { border-top: 1px solid #999 !important; }
  .doc li, .doc p { orphans: 3; widows: 3; }
}
