/* Main stays full content-column width; reading width lives on the article only. */
.legal-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.legal-document {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 0;
  box-sizing: border-box;
}

.legal-document-header {
  margin-bottom: 1.25rem;
}

.legal-document-header .ff-page-title {
  margin: 0;
  font-size: clamp(2.25rem, 2.6vw, 2.875rem); /* ~36–46px */
  line-height: 1.1;
}

.legal-document-header .ff-meta {
  margin: 0.45rem 0 0;
  color: var(--ff-text-secondary);
}

.legal-toc {
  margin: 0 0 1.35rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-md, 8px);
  background: color-mix(in srgb, var(--ff-surface) 88%, transparent);
}

.legal-toc[open] {
  padding: 0.7rem 0.9rem;
}

.legal-toc > summary {
  cursor: pointer;
  list-style: none;
  color: var(--ff-text);
  font: 650 0.875rem/1.3 var(--ff-font-sans, Inter, Segoe UI, sans-serif);
}

.legal-toc > summary::-webkit-details-marker {
  display: none;
}

.legal-toc > summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.4rem;
  color: var(--ff-text-muted);
  transition: transform 0.15s ease;
}

.legal-toc[open] > summary::before {
  transform: rotate(90deg);
}

.legal-toc-nav {
  margin-top: 0.65rem;
}

.legal-toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.legal-toc-list a {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
}

.legal-toc-level-3 {
  padding-left: 0.95rem;
}

.legal-document-body,
.legal-content {
  color: var(--ff-text);
  font-size: 1rem;
  line-height: 1.7;
}

.legal-document-body > :first-child,
.legal-content > :first-child {
  margin-top: 0;
}

.legal-document-body h2,
.legal-content h2 {
  margin: 2rem 0 0.85rem; /* 32px before */
  color: var(--ff-text);
  font: 650 1.35rem/1.3 var(--ff-font-serif, Cinzel, Georgia, serif);
  letter-spacing: 0.01em;
  scroll-margin-top: calc(var(--ff-shell-top, 68px) + 1rem);
}

.legal-document-body h3,
.legal-content h3 {
  margin: 1.375rem 0 0.7rem; /* ~22px before */
  color: var(--ff-text);
  font: 600 1.08rem/1.35 var(--ff-font-sans, Inter, Segoe UI, sans-serif);
  opacity: 0.92;
  scroll-margin-top: calc(var(--ff-shell-top, 68px) + 1rem);
}

.legal-document-body p,
.legal-content p {
  margin: 0 0 1.05em;
}

.legal-document-body ul,
.legal-document-body ol,
.legal-content ul,
.legal-content ol {
  margin: 0.7em 0; /* ~11px */
  padding-left: 1.5em; /* room for hanging markers */
  list-style-position: outside;
}

.legal-document-body > ul > li,
.legal-document-body > ol > li,
.legal-content > ul > li,
.legal-content > ol > li,
.legal-document-body li,
.legal-content li {
  margin: 0.2em 0; /* ~3–4px at 16px / 1.7 line-height */
  padding-left: 0.2em;
}

.legal-document-body li::marker,
.legal-content li::marker {
  color: var(--ff-text-secondary);
}

.legal-document-body li > ul,
.legal-document-body li > ol,
.legal-content li > ul,
.legal-content li > ol {
  margin: 0.2em 0 0.25em;
  padding-left: 1.2em;
}

.legal-document-body li > ul > li,
.legal-document-body li > ol > li,
.legal-content li > ul > li,
.legal-content li > ol > li {
  margin: 0.15em 0; /* nested slightly tighter */
}

.legal-document-body strong,
.legal-document-body b,
.legal-content strong,
.legal-content b {
  color: var(--ff-text);
  font-weight: 700;
}

.legal-document-body em,
.legal-document-body i,
.legal-content em,
.legal-content i {
  font-style: italic;
}

/* Beat .ff-root a:not(.ff-agreement-link) inherit; reuse agreement-link look. */
.ff-root .legal-document-body a,
.ff-root .legal-content a,
.ff-root .legal-document-body a.ff-agreement-link,
.ff-root .legal-content a.ff-agreement-link {
  color: #d8b4fe;
  font-weight: 600;
  text-decoration: none;
  transition: color var(--ff-transition, 160ms ease);
}

.ff-root .legal-document-body a:visited,
.ff-root .legal-content a:visited,
.ff-root .legal-document-body a.ff-agreement-link:visited,
.ff-root .legal-content a.ff-agreement-link:visited {
  color: #d8b4fe;
}

.ff-root .legal-document-body a:hover,
.ff-root .legal-content a:hover,
.ff-root .legal-document-body a:focus-visible,
.ff-root .legal-content a:focus-visible,
.ff-root .legal-document-body a.ff-agreement-link:hover,
.ff-root .legal-content a.ff-agreement-link:hover,
.ff-root .legal-document-body a.ff-agreement-link:focus-visible,
.ff-root .legal-content a.ff-agreement-link:focus-visible {
  color: #efe6ff;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.ff-root .legal-document-body a:focus-visible,
.ff-root .legal-content a:focus-visible,
.ff-root .legal-document-body a.ff-agreement-link:focus-visible,
.ff-root .legal-content a.ff-agreement-link:focus-visible {
  outline: 2px solid #c084fc;
  outline-offset: 2px;
  border-radius: 2px;
}

.legal-document-body blockquote,
.legal-content blockquote {
  margin: 0 0 1.15em;
  padding: 0.15em 0 0.15em 1rem;
  border-left: 3px solid color-mix(in srgb, var(--ff-primary) 55%, transparent);
  color: var(--ff-text-secondary);
}

.legal-document-body table,
.legal-content table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.15em;
  font-size: 0.95rem;
  overflow-x: auto;
  display: block;
}

.legal-document-body th,
.legal-document-body td,
.legal-content th,
.legal-content td {
  border: 1px solid var(--ff-border);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
  text-align: left;
}

.legal-document-body th,
.legal-content th {
  font-weight: 650;
  background: color-mix(in srgb, var(--ff-surface) 80%, transparent);
}

.legal-document-plain {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  color: inherit;
  line-height: 1.7;
}

body[data-theme="light"] .legal-toc,
.ff-theme-light .legal-toc {
  background: #fbfaff;
  border-color: var(--ff-border);
}

body[data-theme="light"] .legal-document-body,
body[data-theme="light"] .legal-content,
.ff-theme-light .legal-document-body,
.ff-theme-light .legal-content,
body[data-theme="light"] .legal-document-body h2,
body[data-theme="light"] .legal-content h2,
.ff-theme-light .legal-document-body h2,
.ff-theme-light .legal-content h2,
body[data-theme="light"] .legal-document-body strong,
body[data-theme="light"] .legal-content strong,
.ff-theme-light .legal-document-body strong,
.ff-theme-light .legal-content strong {
  color: var(--ff-text);
}

body[data-theme="light"] .legal-document-body h3,
body[data-theme="light"] .legal-content h3,
.ff-theme-light .legal-document-body h3,
.ff-theme-light .legal-content h3 {
  color: var(--ff-text);
  opacity: 0.92;
}

body[data-theme="light"] .legal-document-body a,
body[data-theme="light"] .legal-content a,
body[data-theme="light"] .legal-document-body a:visited,
body[data-theme="light"] .legal-content a:visited,
body[data-theme="light"].ff-root .legal-document-body a,
body[data-theme="light"].ff-root .legal-content a,
body[data-theme="light"].ff-root .legal-document-body a:visited,
body[data-theme="light"].ff-root .legal-content a:visited,
.ff-theme-light .legal-document-body a,
.ff-theme-light .legal-content a,
.ff-theme-light .legal-document-body a:visited,
.ff-theme-light .legal-content a:visited {
  color: #6d28d9;
}

body[data-theme="light"] .legal-document-body a:hover,
body[data-theme="light"] .legal-content a:hover,
body[data-theme="light"] .legal-document-body a:focus-visible,
body[data-theme="light"] .legal-content a:focus-visible,
body[data-theme="light"].ff-root .legal-document-body a:hover,
body[data-theme="light"].ff-root .legal-content a:hover,
body[data-theme="light"].ff-root .legal-document-body a:focus-visible,
body[data-theme="light"].ff-root .legal-content a:focus-visible,
.ff-theme-light .legal-document-body a:hover,
.ff-theme-light .legal-content a:hover,
.ff-theme-light .legal-document-body a:focus-visible,
.ff-theme-light .legal-content a:focus-visible {
  color: #5b21b6;
}

body[data-theme="light"] .legal-document-body a:focus-visible,
body[data-theme="light"] .legal-content a:focus-visible,
body[data-theme="light"].ff-root .legal-document-body a:focus-visible,
body[data-theme="light"].ff-root .legal-content a:focus-visible,
.ff-theme-light .legal-document-body a:focus-visible,
.ff-theme-light .legal-content a:focus-visible {
  outline-color: var(--ff-primary);
}

body[data-theme="light"] .legal-document-body blockquote,
body[data-theme="light"] .legal-content blockquote,
.ff-theme-light .legal-document-body blockquote,
.ff-theme-light .legal-content blockquote {
  color: var(--ff-text-secondary);
  border-left-color: #a78bfa;
}

body[data-theme="light"] .legal-document-body th,
body[data-theme="light"] .legal-content th,
.ff-theme-light .legal-document-body th,
.ff-theme-light .legal-content th {
  background: #f5f3ff;
}

@media (max-width: 760px) {
  .legal-document {
    padding: 1.35rem 1rem 0;
  }

  .legal-document-header .ff-page-title {
    font-size: clamp(1.9rem, 7vw, 2.4rem);
  }

  .legal-document-body h2,
  .legal-content h2 {
    font-size: 1.25rem;
    margin-top: 1.75rem;
  }
}
