/* Legal pages (site/tools/build-legal.mjs, 21.10): the site's header and footer around a readable document.
   Colours only from the five families of tokens.css (neutral, warm, sky; yellow only in the draft view for [NEED]).
   Light world only, as the rest of the site (tokens.css: no dark theme). Layout: one centred text column of ~72
   characters; from 1100 px the contents list sits beside it and stays in view. Print: only the text. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
html, body { overflow-x: clip; }
body.lg-page { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.65 var(--font); -webkit-font-smoothing: antialiased; }
.lg-page .kfab { display: none; }   /* no floating Kaia button over a text to read (the header menu and the footer keep theirs) */

.lg-skip { position: absolute; left: var(--edge-vw); top: 8px; z-index: 60; padding: 10px 16px; border-radius: var(--r-pill); background: var(--ink); color: #fff;
  font-weight: 600; text-decoration: none; transform: translateY(-160%); }
.lg-skip:focus-visible { transform: none; outline: 2px solid var(--sky); outline-offset: 2px; }

/* ---------- grid: head and text in one column of ~72 characters; the contents list beside it from 1100 px ---------- */
.lg { --measure: 72ch; display: grid; grid-template-columns: minmax(0, var(--measure)); justify-content: center; column-gap: clamp(40px, 5vw, 80px);
  padding: clamp(96px, 12vw, 152px) var(--edge) 0; }
.lg-head, .lg-doc, .lg-more, .lg-toc--phone { grid-column: 1; min-width: 0; }
@media (min-width: 1100px) {
  .lg { grid-template-columns: 240px minmax(0, var(--measure)); }
  .lg-head, .lg-doc, .lg-more { grid-column: 2; }
  .lg-toc--side { grid-column: 1; grid-row: 2 / span 2; }
}

/* ---------- head: breadcrumb, title, «Stand», languages ---------- */
.lg-head { position: relative; padding-bottom: clamp(24px, 3vw, 40px); }
.lg-crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; font: 600 var(--fs-label)/1.3 var(--font); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-2); }
.lg-crumbs a { color: inherit; text-decoration: none; }
.lg-crumbs a:hover { color: var(--ink); }
.lg-crumbs a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
.lg-head h1 { margin: 0; font: 600 clamp(32px, 5.2vw, 56px)/1.06 var(--font); letter-spacing: var(--track-display); text-wrap: balance; overflow-wrap: anywhere; hyphens: auto; hyphenate-limit-chars: 10 4 4; }
.lg-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 20px; }
.lg-stand { margin: 0; display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 15px; }
.lg-stand::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--warm); box-shadow: 0 0 0 4px var(--warm-tint); }   /* the warm circle of the brand */
.lg-langs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--card); box-shadow: var(--shadow-1); }
.lg-langs a { display: grid; place-items: center; min-width: 40px; height: 36px; padding: 0 10px; border-radius: var(--r-pill); color: var(--text-2);
  font: 600 13px/1 var(--font); letter-spacing: .04em; text-decoration: none; transition: background-color var(--d-micro), color var(--d-micro); }
.lg-langs a:hover { color: var(--ink); background: var(--fill); }
.lg-langs a[aria-current="page"] { background: var(--ink); color: #fff; }
.lg-langs a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.lg-banner { margin: 20px 0 0; padding: 14px 18px; border-radius: var(--r-s); background: var(--sky-tint); color: var(--sky-ink); font-size: 15px; line-height: 1.5; }
.lg-banner--draft { background: #fff3bf; color: #5c4800; box-shadow: inset 0 0 0 1px #f0d264; font-weight: 600; }

/* ---------- contents: a closed row on phones, a sticky column on desktop ---------- */
.lg-toc ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.lg-toc a { display: grid; grid-template-columns: 2.2em 1fr; align-items: baseline; gap: 4px; min-height: 40px; padding: 9px 12px; border-radius: var(--r-s);
  color: var(--text-2); font-size: 14.5px; line-height: 1.35; text-decoration: none; transition: background-color var(--d-micro), color var(--d-micro); }
.lg-toc a:hover { background: var(--card); color: var(--ink); }
.lg-toc a:focus-visible { outline: 2px solid var(--sky); outline-offset: 1px; }
.lg-toc a[aria-current] { background: var(--card); color: var(--ink); box-shadow: var(--shadow-1); }
.lg-toc__n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.lg-toc a > span:only-child { grid-column: 1 / -1; }
.lg-toc__h { margin: 0 0 8px 12px; font: 600 var(--fs-label)/1.3 var(--font); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-2); }
.lg-toc--side { display: none; }
@media (min-width: 1100px) {
  .lg-toc--phone { display: none; }
  .lg-toc--side { display: block; position: sticky; top: 96px; align-self: start; max-height: calc(100vh - 120px); overflow: auto; overscroll-behavior: contain; padding-bottom: 24px; }
}
.lg-toc--phone { margin-bottom: 16px; border-radius: var(--r-l); background: var(--card); box-shadow: var(--shadow-1); }
.lg-toc--phone summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 0 12px 0 20px; cursor: pointer; list-style: none;
  font: 600 16px/1.3 var(--font); border-radius: var(--r-l); }
.lg-toc--phone summary::-webkit-details-marker { display: none; }
.lg-toc--phone summary:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.lg-toc--phone nav { padding: 0 8px 12px; }

/* ---------- the document: a white sheet on paper ---------- */
.lg-doc { padding: clamp(24px, 4.4vw, 56px); border-radius: var(--r-xl); background: var(--card); box-shadow: var(--shadow-1); overflow-wrap: break-word; hyphens: auto; hyphenate-limit-chars: 10 4 4; }   /* only long words break: no «klaum-o.ch» */
.lg-doc > :first-child { margin-top: 0; }
.lg-doc > :last-child { margin-bottom: 0; }
.lg-doc p, .lg-doc ul, .lg-doc ol, .lg-doc blockquote { margin: 0 0 1em; }
.lg-doc h2 { display: flex; gap: .45em; margin: 2.2em 0 .7em; padding-top: 1.1em; border-top: 1px solid var(--line); font: 600 clamp(21px, 2.3vw, 26px)/1.25 var(--font); letter-spacing: -0.015em; text-wrap: balance; }
.lg-doc > h2:first-child { padding-top: 0; border-top: 0; }
.lg-h__n { flex: none; min-width: 1.5em; color: var(--text-3); font-variant-numeric: tabular-nums; }
.lg-doc h3 { margin: 1.8em 0 .5em; font: 600 18.5px/1.35 var(--font); letter-spacing: -0.01em; }
.lg-doc h4 { margin: 1.5em 0 .4em; font: 600 17px/1.4 var(--font); }
.lg-doc h2 + h3 { margin-top: 0; }
.lg-doc strong { font-weight: 600; }
.lg-doc a { color: var(--sky-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.lg-doc a:hover { text-decoration-thickness: 2px; }
.lg-doc a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 3px; }
.lg-doc ul, .lg-doc ol { padding-left: 1.4em; }
.lg-doc li { margin: .3em 0; padding-left: .2em; }
.lg-doc li::marker { color: var(--text-3); }
.lg-doc ol li::marker { font-variant-numeric: tabular-nums; }
.lg-doc hr { margin: 2em 0; border: 0; border-top: 1px solid var(--line); }
.lg-doc blockquote p { margin: 0 0 .6em; } .lg-doc blockquote p:last-child { margin: 0; }
.lg-doc blockquote { padding: 12px 18px; border-left: 3px solid var(--sky); border-radius: 0 var(--r-s) var(--r-s) 0; background: var(--grey-2); color: var(--text-2); }
/* a numbered clause «1.1 …»: the number hangs in its own column */
.lg-cl { display: grid; grid-template-columns: 3em minmax(0, 1fr); column-gap: .4em; }
.lg-cl__n { color: var(--text-3); font-variant-numeric: tabular-nums; }
.lg-cl + ol, .lg-cl + ul { margin-left: 3.4em; }
.lg-note { color: var(--text-2); font-style: italic; }
.lg-need { padding: 0 .2em; border-radius: 4px; background: #ffe066; color: #3d3000; font-style: normal; font-weight: 600; }

/* tables: the site's grey head row, rounded, scroll sideways on narrow screens (focusable for the keyboard) */
.lg-table { margin: 1.2em 0 1.6em; overflow-x: auto; border-radius: var(--r-s); box-shadow: inset 0 0 0 1px var(--line); -webkit-overflow-scrolling: touch; }
.lg-table:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
.lg-table table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; line-height: 1.45; hyphens: auto; hyphenate-limit-chars: 10 4 4; }
.lg-table th { background: var(--grey-2); font-weight: 600; text-align: left; }
.lg-table th, .lg-table td { padding: 10px 12px; vertical-align: top; border-bottom: 1px solid var(--line); }
.lg-table td + td, .lg-table th + th { border-left: 1px solid var(--line); }
.lg-table tbody tr:last-child td { border-bottom: 0; }
.lg-table td:first-child { font-weight: 600; }

/* ---------- other documents ---------- */
.lg-more { margin-top: clamp(32px, 4vw, 48px); }
.lg-more__h { margin: 0 0 12px; font: 600 var(--fs-label)/1.3 var(--font); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--text-2); }
.lg-more ul { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.lg-more a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border-radius: var(--r-pill); background: var(--card); color: var(--ink);
  font: 600 15px/1 var(--font); text-decoration: none; box-shadow: var(--shadow-1); transition: box-shadow var(--d-micro); }
.lg-more a:hover { box-shadow: var(--shadow-2); }
.lg-more a:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }

@media (max-width: 599px) {
  body.lg-page { font-size: 16.5px; }
  .lg-doc { border-radius: var(--r-l); }
  .lg-cl { grid-template-columns: 2.6em minmax(0, 1fr); }
  .lg-cl + ol, .lg-cl + ul { margin-left: 1em; }
}

/* ---------- print: only the document, black on white ---------- */
@media print {
  @page { margin: 18mm 16mm; }
  body.lg-page { background: #fff; color: #000; font-size: 10.5pt; line-height: 1.5; }
  .sh, .sh-scrim, .sh-sheet, .kfab, .ft-host, .lg-toc, .lg-langs, .lg-more, .lg-skip, .lg-crumbs, dialog { display: none !important; }
  .lg { display: block; padding: 0; }
  .lg-head h1 { font-size: 22pt; }
  .lg-stand::before { display: none; }
  .lg-doc { padding: 0; border-radius: 0; box-shadow: none; }
  .lg-doc h2 { break-after: avoid; page-break-after: avoid; font-size: 14pt; }
  .lg-doc h3, .lg-doc h4 { break-after: avoid; page-break-after: avoid; }
  .lg-doc p, .lg-doc li, .lg-table tr { break-inside: avoid; page-break-inside: avoid; }
  .lg-doc a { color: #000; }
  .lg-doc a[href^="http"]::after, .lg-doc a[href^="/"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #444; }
  .lg-table { overflow: visible; box-shadow: none; }
  .lg-table table { min-width: 0; font-size: 9pt; }
  .lg-table th, .lg-table td { border: 1px solid #999; }
  .lg-table th { position: static; background: #eee; }
}
