/* Legal pages (/terms, /privacy, /cookie-policy, /dpa) — on top of nmos-glass-site.css.
   The foundation sets the prose (720px measure, h2 20/28, h3 16/24, lists, quiet "last updated").
   This layer adds the table of contents, heading anchors, the related-documents list
   and horizontal scrolling for any table. Wording is untouched. */

/* Document + contents: the contents column sits right of the text on wide screens */
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-body.has-toc {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(200px, 264px);
  grid-template-areas: "doc toc";
  justify-content: space-between;
  column-gap: 64px;
  align-items: start;
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-body.has-toc > .sentinel-legal-doc { grid-area: doc; min-width: 0; }
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-body.has-toc > .legal-toc {
  grid-area: toc;
  position: sticky;
  top: calc(var(--nav-height) + 32px);
  max-height: calc(100vh - var(--nav-height) - 64px);
  overflow-y: auto;
}

body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-toc {
  padding-left: 16px;
  border-left: 1px solid var(--border-subtle);
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-toc .legal-toc-title {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 20px;
  color: var(--outline);
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-toc ul { margin: 0; padding: 0; list-style: none; }
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-toc li { margin: 0; }
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-toc a {
  display: block;
  padding: 4px 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--on-surface-variant);
  transition: color var(--t-fast) var(--ease);
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-toc a:hover { color: var(--on-surface); }

/* Anchored headings land below the sticky header */
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-legal-doc :is(h2, h3)[id] { scroll-margin-top: calc(var(--nav-height) + 24px); }

/* Long addresses and URLs wrap instead of widening the page */
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-legal-doc { overflow-wrap: break-word; }

/* Related documents: a plain list of links under a hairline */
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-prose ul.legal-related {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin: 40px 0 16px;
  padding: 24px 0 0;
  list-style: none;
  border-top: 1px solid var(--border-subtle);
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-prose ul.legal-related li { margin: 0; font-size: 15px; line-height: 24px; }

/* Tables inside legal text scroll sideways on narrow screens */
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-legal-doc table {
  display: block;
  max-width: 100%;
  margin: 0 0 16px;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 20px;
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-legal-doc :is(th, td) {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: left;
  vertical-align: top;
}
body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .sentinel-legal-doc th { font-weight: 500; color: var(--on-surface); }

/* Below desktop the contents come first, as a short list above the text */
@media (max-width: 1079px) {
  body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-body.has-toc { display: block; }
  body.sentinel-body:is(.sentinel-flow, .sentinel-home):not(.auth-body) .legal-body.has-toc > .legal-toc {
    position: static;
    max-width: 720px;
    max-height: none;
    margin-bottom: 40px;
    overflow: visible;
  }
}
