/* ============================================================
   WriteBoard — legal / long-form document pages
   ------------------------------------------------------------
   Loaded AFTER css/styles.css, which is a landing-page sheet:
   it zeroes every margin (* { margin: 0 }), strips list markers
   (ul { list-style: none }), removes link underlines, sets h1 to
   64px and runs a 1320px container. None of that suits a document.

   Everything below re-establishes document defaults and is scoped
   to .legal, so index.html is untouched. Palette and line colour
   come from the :root block in styles.css.
   ============================================================ */

:root {
  --legal-body: #33405e;   /* softer than --navy for long reading */
  --legal-measure: 78ch;
  --tbc-bg: #fff6e0;
  --tbc-border: #d9a300;
  --tbc-text: #6b4c00;
}

/* ---------- Page shell ---------- */

.legal {
  max-width: var(--legal-measure);
  margin: 0 auto;
  padding: 64px 24px 104px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--legal-body);
}

.legal > * + * { margin-top: 20px; }

/* ---------- Masthead ---------- */

.legal-head { margin-bottom: 40px; }

.legal h1 {
  font-size: clamp(32px, 6vw, 44px);
  line-height: 1.15;
  color: var(--navy);
  margin-bottom: 12px;
}

.legal-standfirst {
  font-size: 19px;
  line-height: 1.5;
  color: var(--ph-text);
  font-weight: 500;
}

.legal-meta {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.legal-meta dl {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 1fr;
}

.legal-meta dt,
.legal-meta dd {
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.legal-meta dt { font-weight: 700; color: var(--navy); background: #fafbfe; }
.legal-meta dd { color: var(--legal-body); }
.legal-meta dt:last-of-type,
.legal-meta dd:last-of-type { border-bottom: 0; }

/* ---------- Table of contents ---------- */

.legal-toc {
  margin: 40px 0 56px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fafbfe;
}

.legal .legal-toc h2 {
  /* An h2 by tag, a navigation label by function. Luckiest Guy is unreadable
     at 13px with 0.08em tracking, so this opts back out of the display face
     and keeps its own bold. */
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ph-text);
  margin: 0 0 14px;
  max-width: none;
  /* cancels the section-divider treatment .legal h2 applies */
  border-top: 0;
  padding-top: 0;
}

.legal .legal-toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 32px;
  counter-reset: toc;
}

.legal .legal-toc li {
  break-inside: avoid;
  margin: 0 0 7px;
  counter-increment: toc;
  font-size: 15px;
}

.legal .legal-toc li::before {
  content: counter(toc) ".";
  color: var(--ph-text);
  font-weight: 700;
  margin-right: 7px;
}

.legal .legal-toc li.no-count::before { content: ""; margin-right: 0; }
.legal-toc a { color: var(--legal-body); text-decoration: none; }
.legal-toc a:hover { color: var(--blue); text-decoration: underline; }

@media (max-width: 640px) {
  .legal .legal-toc ol { columns: 1; }
}

/* ---------- Headings ---------- */

.legal h2,
.legal h3,
.legal h4 {
  color: var(--navy);
  scroll-margin-top: 96px;   /* clears the 76px sticky navbar */
}

.legal h2 {
  font-size: 27px;
  line-height: 1.25;
  max-width: none;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 2px solid var(--line);
}

.legal h3 {
  font-size: 20px;
  line-height: 1.3;
  margin-top: 36px;
}

.legal h4 {
  font-size: 17px;
  margin-top: 28px;
}

/* ---------- Body copy ---------- */

.legal p { margin-top: 16px; }
.legal strong { color: var(--navy); font-weight: 700; }

.legal a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal a:hover { text-decoration-thickness: 2px; }

.legal ul,
.legal ol {
  list-style: revert;
  margin-top: 16px;
  padding-left: 26px;
}

.legal li { margin-top: 8px; }
.legal li > ul,
.legal li > ol { margin-top: 8px; }

.legal code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  background: var(--ph-bg);
  border-radius: 5px;
  padding: 1px 5px;
}

/* ---------- Tables ---------- */

/* Every table is wrapped in .table-scroll so a wide table scrolls
   inside its own box instead of forcing the page sideways. */
.table-scroll {
  margin-top: 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
}

.legal table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.legal thead th {
  background: #fafbfe;
  color: var(--navy);
  font-weight: 800;
  text-align: left;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.legal th,
.legal td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

.legal tbody th { font-weight: 700; color: var(--navy); }
.legal tbody tr:last-child th,
.legal tbody tr:last-child td { border-bottom: 0; }
.legal tbody tr:hover { background: #fcfdff; }

/* Two-column key/value tables (§1, §21) read better without a header row */
.legal table.kv { min-width: 0; }
.legal table.kv th { width: 34%; white-space: normal; }

/* ---------- Callouts ---------- */

.callout {
  margin-top: 28px;
  padding: 20px 24px;
  background: var(--ph-bg);
  border-left: 4px solid var(--blue);
  border-radius: 0 12px 12px 0;
}

.callout > *:first-child { margin-top: 0; }

.callout h4 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--navy);
}

.callout p { font-size: 16px; }

/* ---------- Unresolved facts ---------- */

/* Deliberately loud. Nothing marked .tbc may reach a published page. */
.tbc {
  display: inline-block;
  background: var(--tbc-bg);
  border: 1px dashed var(--tbc-border);
  border-radius: 5px;
  padding: 0 6px;
  color: var(--tbc-text);
  font-size: 0.92em;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Print ---------- */

@media print {
  .navbar,
  .footer,
  .legal-toc { display: none; }

  .legal {
    max-width: none;
    padding: 0;
    font-size: 11pt;
    line-height: 1.45;
    color: #000;
  }

  .legal h2 {
    font-size: 16pt;
    margin-top: 24pt;
    break-after: avoid;
  }

  .legal h3, .legal h4 { break-after: avoid; }
  .legal a { color: #000; text-decoration: underline; }

  .table-scroll { overflow: visible; break-inside: auto; }
  .legal table { min-width: 0; font-size: 9.5pt; }
  .legal thead { display: table-header-group; }
  .legal tr { break-inside: avoid; }
  .callout { border-left: 2pt solid #000; background: none; }
}
