/* legal.css - the content rules of the legal pages under .aw-legal (UI
   overhaul R3, track D; docs/spec-ui-overhaul-r3-build.md §3, D2, D3): one
   stylesheet for the server-rendered pages (legal_pages.py: <main
   class="aw-legal">) and for the in-app legal sheet (AW.legal, static/ui/
   legal.js), so the two cannot drift.

   Colours are tokens only (static/ui/tokens.css; scripts/test_ui_tokens.py
   checks), so the pages and the sheet follow Light, Dark and System; print
   on --print-* only. Type: Barlow (var(--sans)) throughout and JetBrains
   Mono for code; Barlow Condensed and Share Tech Mono are not used (design
   §4.13). No layout value of app.css is used either: the server-rendered
   pages load tokens.css and this file only. Every margin is set here,
   because the app page zeroes them (its * rule) and a browser does not, so
   the page and the sheet read the same. Referenced as
   /static/ui/legal.css?v=<CACHE_VERSION number>. */

.aw-legal {
  color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.6;
  overflow-wrap: anywhere;
}
.aw-legal > :first-child { margin-top: 0; }
.aw-legal h1, .aw-legal h2, .aw-legal h3, .aw-legal h4 {
  color: var(--text-hi); font-family: var(--sans); font-weight: 600; letter-spacing: 0;
  scroll-margin-top: 16px;
}
.aw-legal h1 { margin: 32px 0 6px; font-size: 26px; line-height: 1.25; }
.aw-legal > h1:first-child { margin-bottom: 4px; }
.aw-legal h2 { margin: 30px 0 8px; font-size: 21px; line-height: 1.3; }
.aw-legal h3 { margin: 22px 0 6px; font-size: 18px; line-height: 1.35; }
.aw-legal h4 { margin: 18px 0 4px; font-size: 16px; line-height: 1.4; }
.aw-legal [tabindex="-1"]:focus { outline: none; }
.aw-legal p { margin: 0 0 12px; }
.aw-legal ul, .aw-legal ol { margin: 0 0 12px; padding: 0 0 0 1.5em; }
.aw-legal li { margin: 0 0 6px; }
.aw-legal li > p { margin: 0 0 6px; }
.aw-legal li > ul, .aw-legal li > ol { margin: 6px 0 0; }
.aw-legal strong { font-weight: 600; color: var(--text-hi); }
.aw-legal em { font-style: italic; }
.aw-legal a { color: var(--amber-text); text-decoration: underline; text-underline-offset: 2px; }
.aw-legal a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
.aw-legal hr { margin: 28px 0; border: 0; border-top: 1px solid var(--border); }
.aw-legal blockquote {
  margin: 12px 0 16px; padding: 4px 0 4px 14px;
  border-left: 3px solid var(--border-hi); color: var(--text-dim);
}
.aw-legal blockquote > :last-child { margin-bottom: 0; }
.aw-legal code { font-family: var(--mono); font-size: 0.9em; }
/* a wide table scrolls on its own, never the page */
.aw-legal table {
  display: block; max-width: 100%; overflow-x: auto; margin: 0 0 16px;
  border-collapse: collapse; font-size: 14px; line-height: 1.5;
}
.aw-legal th, .aw-legal td {
  padding: 6px 8px; border: 1px solid var(--border);
  text-align: left; vertical-align: top; overflow-wrap: normal;
}
.aw-legal th { background: var(--raised); color: var(--text-hi); font-weight: 600; }

/* the effective-date line and the draft banner (legal_pages.py writes them) */
.aw-legal .effective { margin: 0 0 18px; font-size: 14px; line-height: 20px; color: var(--muted); }
.aw-legal li .effective { margin: 0; }
.aw-legal .banner {
  margin: 0 0 18px; padding: 10px 14px;
  border: 1px solid var(--warn-line); border-radius: 12px;
  background: var(--warn-bg); color: var(--amber-text);
  font-size: 15px; line-height: 22px; font-weight: 600;
}

/* the FAQ's questions (help_pages.disclosures): each question with its
   answer a <details>, the first open. The summary is the question's own
   heading, a 44 px row with a chevron drawn by two borders (no text glyph)
   that points down when closed and up when open. Print shows every answer
   open (the print block below). */
.aw-legal details.aw-faq { margin: 0; border-bottom: 1px solid var(--border); }
.aw-legal h2 + details.aw-faq { border-top: 1px solid var(--border); }
.aw-legal details.aw-faq > summary {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px 2px;
  list-style: none; cursor: pointer; border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
}
.aw-legal details.aw-faq > summary::-webkit-details-marker { display: none; }
.aw-legal details.aw-faq > summary::marker { content: ''; }
.aw-legal details.aw-faq > summary > h3 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 17px; line-height: 1.4; }
.aw-legal details.aw-faq > summary::after {
  content: ''; flex: none; width: 8px; height: 8px; margin: 0 6px 4px 0;
  border-right: 2px solid var(--text-dim); border-bottom: 2px solid var(--text-dim);
  transform: rotate(45deg); transition: transform 150ms ease;
}
.aw-legal details.aw-faq[open] > summary::after { margin-bottom: 0; margin-top: 4px; transform: rotate(-135deg); }
.aw-legal details.aw-faq > summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.aw-legal details.aw-faq > .aw-faq-a { padding: 2px 2px 8px; }
.aw-legal details.aw-faq > .aw-faq-a > :last-child { margin-bottom: 4px; }
@media (hover: hover) {
  .aw-legal details.aw-faq > summary:hover > h3 { color: var(--amber-text); }
  .aw-legal details.aw-faq > summary:hover::after { border-color: var(--amber-text); }
}
@media (prefers-reduced-motion: reduce) {
  .aw-legal details.aw-faq > summary::after { transition: none; }
}

/* the in-app sheet (AW.legal): its status line, and the policy's top */
.aw-legal-sheet { min-height: 120px; }
.aw-legal-sheet .aw-legal-status { max-width: none; margin: 4px 0 0; font-size: 15px; line-height: 22px; }
.aw-legal-sheet .aw-legal-status > svg { flex: none; margin-top: 1px; }
.aw-legal-sheet .aw-legal-status > .aw-spin { margin-top: 4px; }

@media print {
  .aw-legal, .aw-legal h1, .aw-legal h2, .aw-legal h3, .aw-legal h4, .aw-legal strong, .aw-legal a { color: var(--print-ink); }
  .aw-legal blockquote, .aw-legal .effective { color: var(--print-dim); }
  .aw-legal blockquote { border-left-color: var(--print-rule); }
  .aw-legal hr { border-top-color: var(--print-rule); }
  .aw-legal th, .aw-legal td { border-color: var(--print-edge); }
  .aw-legal th { background: var(--print-band); color: var(--print-ink); }
  .aw-legal .banner { border-color: var(--print-ink); background: var(--print-paper); color: var(--print-ink); }
  .aw-legal table { display: table; overflow: visible; }
  /* every answer printed, open or not; no chevron */
  .aw-legal details.aw-faq { border-color: var(--print-rule); break-inside: avoid; }
  .aw-legal details.aw-faq::details-content { content-visibility: visible; display: block; }
  .aw-legal details.aw-faq > summary { min-height: 0; padding: 6px 0 2px; }
  .aw-legal details.aw-faq > summary::after { display: none; }
}
