/* =============================================================================
   styles/TerraLegal.css  -  the Terms and the Privacy Policy
   -----------------------------------------------------------------------------
   These two pages are generated by tools/build-legal-pages.mjs from the
   markdown in documentation/. This is the only part of them that is
   hand-written.

   ⚠️ IT IS THE QUICK START'S TYPE AND PALETTE, DELIBERATELY. The Terms, the
   Privacy Policy, the Quick Start guide and the Appraisal Sourcebook are the
   four documents a customer is handed, and they are read one after the other.
   They should not be four designs. Every colour below is a --qs-* token, which
   is itself an alias onto the shared role tokens in TerraTheme.css - one hop,
   not a second copy of the palette.

   ⚠️ THE BRAND BAR RULES ARE DUPLICATED FROM TerraQuickStart.html's inline
   <style>, and that is a known cost. They are inline there because that page is
   inlined WHOLESALE into the self-contained copy the welcome email attaches, so
   it cannot link a stylesheet. If a third page ever needs the bar, move these
   into a shared sheet and leave the quick start's copy alone - it is the odd
   one out for a reason that has nothing to do with these pages.
   ========================================================================== */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--qs-bg);
  color: var(--qs-text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    Helvetica, Arial, sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

/* ---------- the brand bar ---------- */

.qs-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--qs-panel);
  border-bottom: 1px solid var(--qs-border);
}
.qs-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Matching .nav-brand in TerraNav.css exactly, so the brand does not shift
   between this page and the rest of the site. */
.qs-brand {
  font-family: 'Days One', sans-serif;
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  color: var(--wordmark);
  text-decoration: none;
}
.qs-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qs-applogo {
  color: var(--qs-text);
  display: block;
}
.qs-applogo svg {
  height: 24px;
  width: auto;
  display: block;
}
.qs-close {
  color: var(--qs-muted);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1;
  border: 1px solid var(--qs-border);
  border-radius: 6px;
  width: 2em;
  height: 2em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.qs-close:hover {
  color: var(--qs-text);
  border-color: var(--qs-accent);
}

/* ---------- the document ---------- */

/* ⚠️ NARROWER THAN THE QUICK START'S 840px. A legal document is read
   sentence by sentence rather than scanned, and a measure of about 75
   characters is where that is comfortable. The sub-processor table is the one
   thing wider than the measure, and it scrolls inside its own container. */
.legal-doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 22px 80px;
}
.legal-doc h1 {
  color: var(--qs-heading);
  font-size: 2rem;
  margin: 0 0 0.3em;
}
.legal-meta {
  color: var(--qs-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  margin: 0 0 1.4em;
}

/* ⚠️ THE DRAFT MARKER IS LOUD ON PURPOSE. Both documents are pending solicitor
   review, and a legal page that looks finished and is not is worse than no page
   at all. It is removed by setting LEGAL_DOCUMENTS_ARE_DRAFT to false in
   shared/legalDocuments.js and rebuilding - not by editing the HTML. */
.legal-draft {
  border: 1px solid var(--qs-accent);
  border-left-width: 4px;
  border-radius: 0 6px 6px 0;
  background: var(--qs-callout-bg);
  padding: 12px 16px;
  margin: 0 0 2em;
  font-size: 0.95rem;
}

/* Section headings. The border is the divider between clauses - there are no
   <hr /> elements between sections, for the reason the quick start records:
   a rule plus a heading border reads as an empty box rather than a divider. */
.legal-doc h2 {
  color: var(--qs-heading);
  font-size: 1.25rem;
  margin: 1.9em 0 0.6em;
  padding-top: 0.7em;
  border-top: 1px solid var(--qs-border);
}
.legal-doc h3 {
  color: var(--qs-heading);
  font-size: 1.05rem;
  margin: 1.5em 0 0.4em;
}
.legal-doc p {
  margin: 0.7em 0;
}
.legal-doc a {
  color: var(--qs-accent);
}
.legal-doc strong {
  color: var(--qs-heading);
}
.legal-doc code {
  background: var(--qs-code-bg);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: Consolas, 'SF Mono', ui-monospace, Menlo, monospace;
  font-size: 0.9em;
}
.legal-doc ul,
.legal-doc ol {
  padding-left: 1.4em;
}
.legal-doc li {
  margin: 0.35em 0;
}

/* The clause 8.2 disclaimer is a blockquote, and it is the one block on the
   page a reader is most likely to be looking for. */
.legal-doc blockquote {
  margin: 1.2em 0;
  padding: 14px 18px;
  background: var(--qs-callout-bg);
  border-left: 4px solid var(--qs-accent);
  border-radius: 0 6px 6px 0;
  color: var(--qs-text);
}
.legal-doc blockquote p {
  margin: 0.5em 0;
}
.legal-doc blockquote p:first-child {
  margin-top: 0;
}
.legal-doc blockquote p:last-child {
  margin-bottom: 0;
}

/* ⚠️ THE TABLE SCROLLS INSIDE ITS OWN BOX, NOT THE PAGE. The sub-processor
   table is five columns of prose; without this the whole document scrolls
   sideways on a phone and the body text goes with it. */
.legal-table-wrap {
  overflow-x: auto;
}
.legal-doc table {
  border-collapse: collapse;
  width: 100%;
  margin: 1em 0;
  font-size: 0.92rem;
}
.legal-doc th,
.legal-doc td {
  border: 1px solid var(--qs-border);
  padding: 8px 12px;
  text-align: left;
  vertical-align: top;
}
.legal-doc th {
  background: var(--qs-callout-bg);
  color: var(--qs-heading);
}

.legal-doc hr {
  border: none;
  border-top: 1px solid var(--qs-border);
  margin: 2.4em 0 1.2em;
}

.legal-footer-links {
  color: var(--qs-muted);
  font-size: 0.9rem;
}
.legal-footer-links a {
  color: var(--qs-accent);
}

/* ---------- print ----------
   A legal document is something people print and keep. Nothing elaborate: the
   brand bar and the close control are screen furniture, and the type comes down
   to a size that fits a page. */
@media print {
  .qs-topbar,
  .legal-footer-links {
    display: none !important;
  }
  body {
    background: #fff;
    color: #111;
    font-size: 10pt;
  }
  .legal-doc {
    max-width: none;
    padding: 0;
  }
  .legal-doc h2 {
    break-after: avoid;
    page-break-after: avoid;
  }
  .legal-doc blockquote,
  .legal-doc table {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
