/* Legal pages (legal/render.ts). Colours and font come from @cxview/tokens (served as
   /legal/tokens.css); data-theme is set by /theme-init.js like the app. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  font-family: var(--cx-font-family);
  font-size: 15px;
  line-height: 1.65;
  color: var(--cx-color-text);
  background: var(--cx-color-bg-page);
}

a {
  color: var(--cx-color-primary-active);
}

[data-theme='dark'] a {
  color: var(--cx-color-primary);
}

a:focus-visible {
  outline: 2px solid var(--cx-color-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  padding: 8px 12px;
  background: var(--cx-color-surface);
  border-radius: 8px;
  z-index: 10;
}

.skip:focus {
  top: 8px;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--cx-color-surface);
  border-bottom: 1px solid var(--cx-color-divider);
}

.top-inner,
.layout,
.foot-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
}

.logo {
  height: 31px;
  width: auto;
}

.logo-dark,
[data-theme='dark'] .logo-light {
  display: none;
}

[data-theme='dark'] .logo-dark {
  display: block;
}

.lang {
  font-weight: 600;
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid var(--cx-color-border);
  border-radius: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding-top: 24px;
  padding-bottom: 48px;
}

@media (min-width: 992px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 40px;
  }

  .side {
    position: sticky;
    top: 88px;
    align-self: start;
    max-height: calc(100vh - 104px);
    overflow: auto;
  }
}

.docs ul,
.toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs li a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--cx-color-text);
}

.docs li a[aria-current='page'] {
  background: var(--cx-color-primary-bg);
  color: var(--cx-color-text);
  font-weight: 600;
}

.toc {
  margin-top: 16px;
  font-size: 14px;
}

.toc-title {
  margin: 0 0 4px;
  padding: 0 12px;
  font-weight: 600;
  color: var(--cx-color-text-secondary);
}

.toc li a {
  display: block;
  padding: 4px 12px;
  text-decoration: none;
  color: var(--cx-color-text-secondary);
}

@media (max-width: 991px) {
  .toc {
    display: none;
  }

  .docs ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }
}

.doc {
  min-width: 0;
  background: var(--cx-color-surface);
  border: 1px solid var(--cx-color-divider);
  border-radius: 12px;
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .doc {
    padding: 40px 48px;
  }
}

.doc.index {
  max-width: 720px;
  margin: 24px auto 48px;
}

.index-block + .index-block {
  margin-top: 32px;
}

.draft {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid var(--cx-color-warning-border);
  background: var(--cx-color-warning-bg);
  color: var(--cx-color-warning-text);
  border-radius: 8px;
  font-weight: 600;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.3;
}

h2 {
  margin: 32px 0 8px;
  font-size: 20px;
  line-height: 1.35;
}

h3 {
  margin: 20px 0 4px;
  font-size: 16px;
}

.updated {
  margin: 4px 0 24px;
  color: var(--cx-color-text-secondary);
}

p,
ul,
ol {
  margin: 8px 0;
}

.doc li + li {
  margin-top: 4px;
}

.table-wrap {
  overflow-x: auto;
  margin: 12px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 8px 12px;
  border-bottom: 1px solid var(--cx-color-divider);
}

th {
  background: var(--cx-color-surface2);
  font-weight: 600;
}

.note {
  padding: 12px 16px;
  border-radius: 8px;
  background: var(--cx-color-info-bg);
  border: 1px solid var(--cx-color-info-border);
}

.foot {
  border-top: 1px solid var(--cx-color-divider);
  background: var(--cx-color-surface);
  color: var(--cx-color-text-secondary);
  font-size: 13px;
}

.foot-inner {
  padding-top: 20px;
  padding-bottom: 24px;
}

.foot p {
  margin: 2px 0;
}

.foot-company {
  font-weight: 600;
  color: var(--cx-color-text);
}
