/* Legal pages: the four WP-267 policies, rendered by tools/legal_pages.py. Only those pages load this file, after
   site.css, and every rule is scoped to them; the landing page never loads it. No script and no motion: the text is
   complete without either, and it prints.

   One frame holds the header, the rail + document grid and the footer, so the wordmark, the rail and the footer
   share one left edge. The frame is a container: the rail sits beside the document only when both fit at a reading
   measure, the same at any width, zoom or root size. */

html:has(> body.legal-page) { scroll-padding-top: 1.5rem; }
.legal-page { --legal-rail: 15rem; --legal-measure: 42rem; --legal-max: 63rem; }
.legal-shell { width: min(100% - 2 * var(--gutter), var(--legal-max)); margin-inline: auto; }

/* ---------------------------------------------------------------- header: the wordmark and a text link home */
.legal-head { border-bottom: 1px solid var(--line); }
.legal-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--nav); }
.legal-mark { display: flex; align-items: center; min-height: var(--target); }
.legal-mark img { width: 6.25rem; height: auto; }
.legal-home { display: inline-flex; align-items: center; justify-content: center; min-width: var(--target);
              min-height: var(--target); color: var(--ink-2); font-size: var(--meta); text-decoration: none; }
.legal-home:hover { color: var(--ink); }

/* ---------------------------------------------------------------- layout */
.legal-frame { container: legal / inline-size; }
.legal-layout { display: grid; gap: 1.75rem; padding-block: clamp(1.5rem, .5rem + 3vw, 4.5rem) var(--section); }
.legal-layout > * { min-width: 0; }

/* the rail. Narrow: the four policies as one wrapping row above the title, and "On this page" under the date.
   Wide: a sticky list beside the text, with the open policy's sections under it. */
.legal-label { display: none; margin-bottom: .75rem; font: 500 var(--meta)/1.2 var(--mono); letter-spacing: .08em;
               text-transform: uppercase; color: var(--ink-3); }
.legal-policies { display: flex; flex-wrap: wrap; gap: .375rem; }
.legal-policies a { position: relative; display: flex; align-items: center; min-height: var(--target);
                    padding: .5rem .625rem; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2);
                    font-size: var(--meta); line-height: 1.3; text-decoration: none; }
.legal-policies a:hover { color: var(--ink); border-color: var(--line-2); }
.legal-policies a[aria-current="page"] { color: var(--ink); font-weight: 600; border-color: rgb(var(--glow) / .9);
                                          background: rgb(var(--glow) / .14); }
.legal-toc { display: none; }

.legal-sections { border-bottom: 1px solid var(--line); }
.legal-sections + * { margin-top: 2.5rem; }
.legal-sections summary { display: flex; align-items: center; gap: 1rem; min-height: var(--target); cursor: pointer;
                          list-style: none; color: var(--ink-2); font-size: var(--meta); }
.legal-sections summary::-webkit-details-marker { display: none; }
.legal-sections summary::after { content: ""; flex: none; width: .45rem; height: .45rem; margin: -.2rem .25rem 0 auto;
                                 border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
                                 transform: rotate(45deg); }
.legal-sections[open] summary::after { margin-top: .2rem; transform: rotate(-135deg); }
.legal-sections summary:hover { color: var(--ink); }
.legal-sections ul { padding-bottom: .5rem; }
.legal-sections a { display: flex; align-items: center; min-height: var(--target); padding-block: .25rem;
                    color: var(--ink-2); font-size: var(--meta); line-height: 1.35; text-decoration: none; }
.legal-sections a:hover { color: var(--ink); }

@container legal (min-width: 54rem) {
  .legal-layout { grid-template-columns: var(--legal-rail) minmax(0, 1fr); column-gap: clamp(3rem, 8cqi, 6rem); }
  .legal-rail { position: sticky; top: 2rem; align-self: start; max-height: calc(100svh - 4rem); overflow-y: auto;
                overscroll-behavior: contain; }
  .legal-label { display: block; padding-top: .35rem; }
  .legal-policies { display: block; border-left: 1px solid var(--line); }
  .legal-policies a { padding: .5rem 0 .5rem 1rem; border: 0; border-radius: 0; background: none; font-size: 1rem; }
  .legal-policies a[aria-current="page"] { background: none; }
  .legal-policies a[aria-current="page"]::before { content: ""; position: absolute; left: -1px; top: .7rem;
      bottom: .7rem; width: 2px; border-radius: 1px; background: var(--beam); box-shadow: 0 0 12px rgb(var(--glow) / .9); }
  .legal-toc { display: block; padding: 0 0 .75rem 1rem; }
  .legal-toc a { color: var(--ink-3); font-size: var(--meta); font-weight: 400; }
  .legal-toc a:hover { color: var(--ink); }
  .legal-sections { display: none; }
}

/* ---------------------------------------------------------------- the policy */
.legal-doc { max-width: var(--legal-measure); container: doc / inline-size; }
.legal-doc:focus { outline: none; }                     /* focused only by the skip link, which moves reading there */
.legal-doc h1 { font: 600 clamp(2.25rem, 1.4rem + 2.6vw, 3.5rem)/1.05 var(--font); letter-spacing: -.035em;
                text-wrap: balance; }
.legal-updated { margin-top: 1rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line);
                 font: 400 var(--meta)/1.4 var(--mono); color: var(--ink-3); }
.legal-doc h2 { margin-top: 3rem; font: 600 var(--h3)/1.25 var(--font); letter-spacing: -.015em; text-wrap: balance; }
.legal-updated + * { margin-top: 2.5rem; }
.legal-doc p { margin-top: 1.1em; color: var(--ink-2); line-height: 1.65; }
.legal-doc h2 + * { margin-top: 1rem; }
.legal-doc strong { color: var(--ink); font-weight: 600; }
.legal-doc a { color: var(--ink); text-decoration-line: underline; text-decoration-thickness: 1px;
               text-underline-offset: .2em; text-decoration-color: rgb(var(--glow) / .85); }
.legal-doc a:hover { text-decoration-color: var(--beam-ink); text-decoration-thickness: 2px; }
.legal-doc ul { margin-top: 1.1em; padding-left: 1.25em; list-style: disc; color: var(--ink-2); }
.legal-doc li { padding-left: .35em; line-height: 1.65; }
.legal-doc li + li { margin-top: .75em; }
.legal-doc li::marker { color: var(--beam-ink); }

/* the retention table: two columns while they read; stacked rows in a narrow column */
.legal-table { margin-top: 1.5rem; }
.legal-table table { width: 100%; border-collapse: collapse; font-size: .9em; }
.legal-table th, .legal-table td { padding: 1rem 0; text-align: left; vertical-align: top; line-height: 1.55;
                                   border-top: 1px solid var(--line); }
.legal-table thead th { padding: 0 0 .75rem; border-top: 0; font: 500 var(--meta)/1.3 var(--mono);
                        letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.legal-table tbody th { width: 34%; padding-right: 1.5rem; color: var(--ink); font-weight: 600; }
.legal-table td { color: var(--ink-2); }
.legal-table tbody tr:last-child > * { border-bottom: 1px solid var(--line); }
@container doc (max-width: 34rem) {
  .legal-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .legal-table table, .legal-table tbody, .legal-table tr, .legal-table th, .legal-table td { display: block; width: auto; }
  .legal-table tr { padding-block: 1rem; border-top: 1px solid var(--line); }
  .legal-table tbody tr:last-child { border-bottom: 1px solid var(--line); }
  .legal-table tbody th, .legal-table td, .legal-table tbody tr:last-child > * { padding: 0; border: 0; }
  .legal-table tbody th { width: auto; margin-bottom: .35rem; }
}
/* past two columns (the service providers): each row is its name beside its labelled cells, one column when narrow.
   The labels repeat the column headers for the eye; their alt text is empty, so a screen reader hears the headers once. */
.legal-table-stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.legal-table-stacked table, .legal-table-stacked tbody { display: block; }
.legal-table-stacked tr { display: grid; grid-template-columns: 34% minmax(0, 1fr); gap: .85rem 1.5rem; padding-block: 1rem;
                          border-top: 1px solid var(--line); }
.legal-table-stacked tbody tr:last-child { border-bottom: 1px solid var(--line); }
.legal-table-stacked tbody th, .legal-table-stacked td, .legal-table-stacked tbody tr:last-child > * { width: auto; padding: 0; border: 0; }
.legal-table-stacked tbody th { grid-column: 1; grid-row: 1 / span 3; }
.legal-table-stacked td { grid-column: 2; }
.legal-table-stacked td::before { content: attr(data-label); content: attr(data-label) / ""; display: block; margin-bottom: .2rem;
                                  font: 500 var(--meta)/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
@container doc (max-width: 34rem) {
  .legal-table-stacked tr { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
  .legal-table-stacked tbody th, .legal-table-stacked td { grid-column: 1; grid-row: auto; }
}

/* ---------------------------------------------------------------- the footer, in the same frame */
.legal-page .footer { margin-top: 0; }

/* ---------------------------------------------------------------- print: the policy alone, dark on white */
@media print {
  .legal-page { background: #fff; color: #000; color-scheme: light; font-size: 11pt; }
  .legal-page .skip-link, .legal-head, .legal-rail, .legal-sections, .legal-page .footer { display: none !important; }
  .legal-shell { width: auto; }
  .legal-layout { display: block; padding: 0; }
  .legal-doc { max-width: none; }
  .legal-doc h1, .legal-doc h2, .legal-doc strong, .legal-doc a, .legal-table tbody th { color: #000; }
  .legal-doc p, .legal-doc ul, .legal-table td, .legal-updated, .legal-table thead th, .legal-table-stacked td::before { color: #222; }
  .legal-doc li::marker { color: #000; }
  .legal-doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; overflow-wrap: anywhere; }
  .legal-doc h2 { break-after: avoid; }
  .legal-table tr { break-inside: avoid; }
  .legal-updated, .legal-table th, .legal-table td, .legal-table tr { border-color: #bbb !important; }
}
