/* ==========================================================================
   THE REGISTRAR, legal documents: /privacy, /terms, /cookies, /acceptable-use, /data-protection, /dpa.
   Loaded after /css/registrar.css. One calm editorial layout for every legal text:
     - a readable measure (68ch) for running text, wider only for tables;
     - a sticky table of contents on desktop, a collapsible one on small screens (built by /js/legal.js);
     - statute-style section marks ("§ 1") drawn by CSS counters, so the document text stays untouched;
     - a print sheet that produces a clean document.
   Rule for editors: this file only changes how the text LOOKS. Wording lives in the HTML and is guarded by
   LegalPagesTextIdentityTests.
   ========================================================================== */

/* ---- Page head: title, "last updated" line, version label ---- */
.lg-head { border-bottom: 1px solid var(--rg-rule); background: var(--rg-paper); padding-block: clamp(40px, 6vw, 84px) clamp(24px, 3.5vw, 44px); }
.lg-head__in { display: flex; flex-direction: column; gap: 12px; }
.rg .lg-title { font-size: clamp(38px, 5vw, 68px); line-height: 1.02; letter-spacing: -.026em; max-width: 16em; }
.lg-updated, .lg-version { font: 600 12px/1.4 var(--rg-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--rg-mute); }
.lg-updated::before { content: "\00A7"; font: italic 400 22px/1 var(--rg-display); letter-spacing: 0; text-transform: none; color: var(--rg-ink); margin-right: 12px; vertical-align: -2px; }
.lg-version { margin-top: -4px; padding-left: 30px; }

/* ---- Two columns: contents + document ---- */
.lg-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 clamp(32px, 5vw, 80px); padding-block: clamp(28px, 4vw, 56px) clamp(56px, 8vw, 112px); }
@media (min-width: 1000px) {
  .lg-layout { grid-template-columns: minmax(200px, 250px) minmax(0, 54rem); justify-content: center; align-items: start; }
}

/* ---- Table of contents (hidden until legal.js fills it, so there is never an empty box) ---- */
.lg-toc { font: 500 14px/1.45 var(--rg-sans); }
.lg-toc[hidden] { display: none; }
.lg-toc details { border-top: 1px solid var(--rg-ink); border-bottom: 1px solid var(--rg-rule); }
.lg-toc summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; font: 700 12px/1 var(--rg-sans); letter-spacing: .16em; text-transform: uppercase; color: var(--rg-ink); }
.lg-toc summary::-webkit-details-marker { display: none; }
.lg-toc summary::after { content: "+"; font: 400 22px/1 var(--rg-display); letter-spacing: 0; }
.lg-toc details[open] summary::after { content: "\2212"; }
.lg-toc ol { list-style: none; margin: 0; padding: 0 0 12px; counter-reset: lg-toc; }
.lg-toc li { counter-increment: lg-toc; }
.lg-toc a { display: grid; grid-template-columns: 2.9em 1fr; gap: 4px; padding: 6px 2px 6px 8px; color: var(--rg-ink-2); text-decoration: none; border-left: 2px solid transparent; }
.lg-toc a::before { content: "\00A7\00A0" counter(lg-toc); font: italic 400 15px/1.45 var(--rg-display); color: var(--rg-mute); white-space: nowrap; }
.lg-toc a:hover { color: var(--rg-ink); text-decoration: underline; text-underline-offset: 3px; }
.lg-toc a[aria-current="true"] { color: var(--rg-ink); font-weight: 700; border-left-color: var(--rg-ink); }
.lg-toc a:focus-visible, .lg-toc summary:focus-visible { outline: 2px solid var(--rg-blue); outline-offset: 2px; }
@media (max-width: 999px) { .lg-toc { margin-bottom: 28px; } .lg-toc ol { max-height: 60vh; overflow: auto; } }
@media (min-width: 1000px) {
  .lg-toc { position: sticky; top: 92px; max-height: calc(100vh - 116px); overflow: auto; overscroll-behavior: contain; }
  /* On desktop the list is always open: the summary is just the label of the list. */
  .lg-toc summary { pointer-events: none; cursor: default; }
  .lg-toc summary::after { content: none; }
}

/* ---- The document ---- */
.rg .lg-doc { counter-reset: lg-sec; min-width: 0; color: var(--rg-ink-2); }
.lg-sec { counter-increment: lg-sec; padding-block: clamp(22px, 3vw, 36px); border-top: 1px solid var(--rg-rule); scroll-margin-top: 92px; }
.lg-sec:first-child { border-top: 0; padding-top: 0; }
.rg .lg-doc h2 { font-size: clamp(26px, 2.8vw, 36px); line-height: 1.12; letter-spacing: -.016em; margin-bottom: 18px; max-width: 24em; }
/* Statute-style section mark. Generated content: it never becomes part of the document text. */
.rg .lg-doc h2::before { content: "\00A7\00A0" counter(lg-sec); display: block; font: italic 400 19px/1 var(--rg-display); letter-spacing: 0; color: var(--rg-mute); margin-bottom: 10px; }
/* Headings that already carry their own number ("1. Acceptance...") only get the section sign. */
.rg .lg-doc--own h2::before { content: "\00A7"; }
.rg .lg-doc h3 { font-family: var(--rg-sans); font-weight: 700; font-size: 17px; line-height: 1.35; color: var(--rg-ink); margin: 26px 0 8px; }
.rg .lg-doc p, .rg .lg-doc ul, .rg .lg-doc ol { max-width: 68ch; }
.rg .lg-doc p { font-size: 17px; line-height: 1.7; margin-bottom: 14px; text-wrap: pretty; }
.rg .lg-doc ul { padding-left: 1.2em; margin: 0 0 14px; }
.rg .lg-doc li { line-height: 1.65; margin-bottom: 8px; padding-left: .2em; }
.rg .lg-doc li::marker { color: var(--rg-mute); }
.rg .lg-doc a { color: var(--rg-blue); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.rg .lg-doc a:hover { color: var(--rg-blue-hover); }
.rg .lg-doc a:focus-visible { outline: 2px solid var(--rg-blue); outline-offset: 2px; border-radius: 2px; }
.rg .lg-doc code { font-family: var(--rg-mono); font-size: .86em; color: var(--rg-ink); background: var(--rg-paper-2); padding: 1px 5px; border-radius: 2px; overflow-wrap: anywhere; }
.lg-k { font-weight: 700; color: var(--rg-ink); }

/* Contact block and the DPA's "this is a template" notice */
.lg-box { border: 1px solid var(--rg-rule-ui); background: var(--rg-card); padding: 18px 22px; max-width: 68ch; }
.lg-box p:last-child, .lg-note p:last-child { margin-bottom: 0; }
.lg-note { border: 1px solid var(--rg-ink); border-left-width: 6px; background: var(--rg-card); padding: 18px 22px; margin-bottom: clamp(22px, 3vw, 36px); max-width: 68ch; }
.lg-note__h { font: 700 17px/1.4 var(--rg-sans); color: var(--rg-ink); }

/* Tables are wider than the text measure and scroll sideways on a phone instead of squeezing */
.lg-scroll { overflow-x: auto; margin: 10px 0 18px; border: 1px solid var(--rg-rule-ui); background: var(--rg-card); }
.lg-scroll:focus-visible { outline: 2px solid var(--rg-blue); outline-offset: 2px; }
.rg .lg-doc table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; }
.rg .lg-doc th { text-align: left; font: 700 12px/1.3 var(--rg-sans); letter-spacing: .1em; text-transform: uppercase; color: var(--rg-ink); background: var(--rg-paper-2); border-bottom: 1px solid var(--rg-ink); padding: 12px 14px; }
.rg .lg-doc td { padding: 12px 14px; vertical-align: top; border-bottom: 1px solid var(--rg-rule); color: var(--rg-ink-2); }
.rg .lg-doc tbody tr:last-child td { border-bottom: 0; }

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

/* ---- Print: a clean document. No site chrome, no frame, no paper grain, links spelled out. ---- */
@media print {
  @page { margin: 18mm 16mm; }
  body.rg::before, body.rg::after, .cd-nav, .cd-foot, .rg-close, .lg-toc, #cd-cookie-notice, .skip-link { display: none !important; }
  body.rg { background: #fff; color: #000; font-size: 11pt; line-height: 1.5; }
  .rg h1, .rg h2, .rg h3 { color: #000; }
  .lg-head { border: 0; padding: 0 0 8mm; background: none; }
  .rg .lg-title { font-size: 24pt; }
  .lg-layout { display: block; padding: 0; }
  .lg-sec { break-inside: auto; border-top: 0; padding-block: 5mm 0; }
  .rg .lg-doc h2 { font-size: 15pt; break-after: avoid; }
  .rg .lg-doc h3 { break-after: avoid; }
  .rg .lg-doc p, .rg .lg-doc li { font-size: 11pt; line-height: 1.5; orphans: 3; widows: 3; max-width: none; }
  .rg .lg-doc a { color: #000; text-decoration: underline; }
  .rg .lg-doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; overflow-wrap: anywhere; }
  .lg-scroll { overflow: visible; border: 0; }
  .rg .lg-doc table { min-width: 0; font-size: 9.5pt; }
  .rg .lg-doc tr { break-inside: avoid; }
  .rg .lg-doc th { background: none; border-bottom: 1px solid #000; }
  .rg .lg-doc td { border-bottom: 1px solid #999; }
  .lg-note, .lg-box { border-color: #000; background: none; }
}

/* Touch sizing (issue #871): table-of-contents links are >= 40px tall on phones/tablets. */
@media (max-width: 768px) {
  .lg-toc a { min-height: 40px; align-items: center; }
}
