/* legal.css — shared layout of the legal and security pages (tools/legal.py writes the sidebar).
   Desktop: a sticky side column (these pages + "On this page") and a reading column of about 46rem.
   Phone and tablet: the page list becomes a row of links above the title and "On this page" is a
   collapsed <details> (the Trust Center keeps its own contents list in the page). The site nav is fixed
   and 56px tall (rr.css .nav), so sticky offsets and scroll margins add --nav-h. Print hides the chrome.
   Colours and sizes come from rr.css. */

.lg-shell { --nav-h: 56px; }

.lg-shell { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--container-px); }
.lg-shell > article.container { max-width: 46rem; margin: 0; padding-inline: 0; }

/* side column */
.lg-side { font-family: var(--font-ui); }
.lg-label { margin: 0 0 var(--sp-2); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-3); }
.lg-side ul { margin: 0; padding: 0; list-style: none; }
.lg-side a { display: block; min-height: 24px; color: var(--color-text-2); text-decoration: none; }
.lg-side a:hover { color: var(--color-text); text-decoration: underline; text-underline-offset: 0.2em; }
.lg-side a:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--r-sm, 4px); }
.lg-docs a[aria-current="page"] { color: var(--color-text); font-weight: 700; }

/* phone and tablet: page list as a wrapping row */
.lg-side { padding: var(--sp-4) 0 0; }
.lg-docs ul { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-4); }
.lg-docs a { font-size: var(--text-sm); padding: 2px 0; }
.lg-docs a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.3em; }
.lg-toc { display: none; }
/* phone and tablet: "On this page" as a collapsed list */
.lg-toc-m { margin-top: var(--sp-3); }
.lg-toc-m summary { display: inline-block; min-height: 24px; cursor: pointer; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-3); list-style: none; }
.lg-toc-m summary::-webkit-details-marker { display: none; }
.lg-toc-m summary::before { content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-right: 0.5em; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-0.15em) rotate(-45deg); transition: transform 0.2s; }
.lg-toc-m[open] summary::before { transform: translateY(-0.25em) rotate(45deg); }
.lg-toc-m summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; border-radius: var(--r-sm, 4px); }
.lg-toc-m ul { margin-top: var(--sp-2); }
.lg-toc-m li a { padding: 5px 0; font-size: var(--text-sm); line-height: 1.45; }
@media (max-width: 1023.98px) {
  .lg-side { padding: var(--sp-4) 0 var(--sp-3); margin-bottom: var(--sp-2); border-bottom: 1px solid var(--color-border); }
}

@media (min-width: 1024px) {
  /* the sidebar carries "On this page", so the page's own contents box is not repeated */
  .lg-shell .doc > nav.toc, .lg-shell .doc > .tr-toc { display: none; }
  .lg-shell { display: grid; grid-template-columns: 15rem minmax(0, 46rem); justify-content: center; align-items: start; column-gap: clamp(2.5rem, 5vw, 5rem); }
  .lg-side { position: sticky; top: calc(var(--nav-h) + var(--sp-6)); max-height: calc(100vh - var(--nav-h) - 2 * var(--sp-6)); overflow-y: auto; padding: var(--sp-16) var(--sp-2) var(--sp-6) 0; overscroll-behavior: contain; }
  .lg-toc-m { display: none; }
  .lg-docs ul { display: block; }
  .lg-docs li a { padding: 6px 0 6px var(--sp-3); border-left: 2px solid var(--color-border); font-size: var(--text-sm); line-height: 1.45; }
  .lg-docs a[aria-current="page"] { border-left-color: var(--color-primary); text-decoration: none; }
  .lg-toc { display: block; margin-top: var(--sp-8); }
  .lg-toc li a { padding: 5px 0; font-size: var(--text-sm); line-height: 1.45; color: var(--color-text-3); }
  .lg-toc li a:hover { color: var(--color-text); }
}

/* reading column: metadata as a quiet panel, section headings with a rule (as on Anthropic's legal pages) */
.lg-shell .doc > .meta { display: inline-block; margin-top: var(--sp-2); padding: 6px 12px; border-radius: var(--r-md); background: var(--color-bg-inset); color: var(--color-text-2); }
.lg-shell .doc section > h2,
.lg-shell .doc section > div > h2,
.lg-shell .doc section > .lang-block > h2 { padding-bottom: var(--sp-3); border-bottom: 1px solid var(--color-border); }
.lg-shell .doc section, .lg-shell .doc .anchor, .lg-shell .doc [id] { scroll-margin-top: calc(var(--nav-h) + var(--sp-6)); }
.lg-shell .doc section > h2:first-child { margin-top: var(--sp-8); }

/* a short summary box at the top of a legal document (Terms, Consumer Health Data) */
.lg-shell .doc .lg-summary { margin: var(--sp-5) 0 var(--sp-2); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--color-border); border-radius: var(--r-lg); background: var(--color-bg-subtle); }
.lg-shell .doc .lg-summary p { margin: 0 0 var(--sp-2); font-family: var(--font-ui); font-size: var(--text-sm); font-weight: 600; color: var(--color-text-3); }
.lg-shell .doc .lg-summary ul { margin: 0; padding-left: 1.2em; display: grid; gap: var(--sp-1); }
.lg-shell .doc .lg-summary li { font-size: var(--text-body); line-height: var(--lh-ja); color: var(--color-text); }
.lg-shell .doc .lg-summary li a { color: var(--color-primary-hover); }

.lg-shell .doc table { width: 100%; }
@media (min-width: 1024px) {
  .lg-shell .doc .page-title { font-size: clamp(2.25rem, 1.6rem + 1.6vw, 3rem); }
}

/* print: the document only, full width */
@media print {
  .nav, .mobile-menu, .footer, .skip-link, .status-banner, .lg-side, .lg-toc-m, #rr-cb, .lang-toggle, .consent-reset { display: none !important; }
  .page { padding-top: 0; }
  .lg-shell { display: block; max-width: none; padding: 0; }
  .lg-shell > article.container { max-width: none; }
  .lg-shell .doc a { color: inherit; text-decoration: none; }
  .lg-shell .doc a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.85em; }
  .lg-shell .doc details { border: 0; }
  .lg-shell .doc details > *:not(summary) { display: block; }
}
