@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #080807;
  --surface: #11110f;
  --surface-strong: #181714;
  --paper: #f7f3ea;
  --paper-soft: #ebe4d7;
  --paper-line: #d7cfc0;
  --text: #f8f4ec;
  --text-strong: #ffffff;
  --ink: #171512;
  --muted: #a7a096;
  --muted-strong: #6f675c;
  --line: rgba(247, 243, 234, 0.14);
  --accent: #ff2d20;
  --accent-soft: rgba(255, 45, 32, 0.14);
  --accent-line: rgba(255, 45, 32, 0.44);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
  --max: 1440px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(255, 45, 32, 0.09), transparent 360px),
    var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.legal-top {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 18px;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  width: 180px;
}

.brand-link img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  background: #000000;
}

.legal-top__text p,
.reader-kicker,
.sidebar-head,
.section-nav-wrap > span,
.doc-index,
.doc-kind,
.legal-footer {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  text-transform: uppercase;
  letter-spacing: 0;
}

.legal-top__text p,
.reader-kicker,
.section-nav-wrap > span {
  margin: 0;
  color: var(--muted);
}

.legal-top h1 {
  margin: 6px 0 0;
  color: var(--text-strong);
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1;
}

.back-link {
  position: fixed;
  right: max(24px, calc((100vw - var(--max)) / 2));
  bottom: 24px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: rgba(8, 8, 7, 0.92);
  box-shadow: 0 22px 64px rgba(0, 0, 0, 0.34);
  font-size: 14px;
  font-weight: 800;
  backdrop-filter: blur(14px);
}

.back-link:hover {
  border-color: var(--accent-line);
  color: var(--text-strong);
}

.legal-shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 24px 72px;
  display: grid;
  grid-template-columns: 312px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.legal-shell > * {
  min-width: 0;
}

.legal-sidebar {
  position: sticky;
  top: 18px;
  min-width: 0;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 17, 15, 0.92);
  box-shadow: var(--shadow);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.sidebar-head strong {
  color: var(--text);
}

.document-nav {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.document-link {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
}

.document-link:hover,
.document-link.is-active {
  border-color: var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
}

.doc-index {
  color: var(--accent);
}

.document-link strong {
  display: block;
  color: inherit;
  font-size: 14px;
  line-height: 1.25;
}

.document-link small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.section-nav-wrap {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.section-nav {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.section-nav a {
  display: block;
  padding: 7px 10px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.section-nav a:hover {
  border-left-color: var(--accent);
  color: var(--text);
}

.legal-reader {
  min-width: 0;
}

.reader-intro {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.reader-intro h2 {
  max-width: 820px;
  margin: 8px 0 14px;
  color: var(--text-strong);
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.05;
}

.reader-intro p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.documents {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.doc-panel {
  min-width: 0;
  padding: clamp(24px, 4vw, 54px);
  border: 1px solid var(--paper-line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.doc-panel--loading {
  background: var(--surface);
  color: var(--text);
}

.doc-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.doc-kind {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid rgba(23, 21, 18, 0.16);
  border-radius: 8px;
  color: var(--muted-strong);
}

.doc-body {
  max-width: 840px;
  overflow-wrap: anywhere;
}

.doc-body h1,
.doc-body h2,
.doc-body h3 {
  color: var(--ink);
  letter-spacing: 0;
}

.doc-body h1 {
  margin: 0 0 22px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.02;
}

.doc-body h2 {
  margin: 34px 0 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(23, 21, 18, 0.12);
  font-size: clamp(22px, 2.4vw, 30px);
  line-height: 1.12;
}

.doc-body h3 {
  margin: 24px 0 10px;
  font-size: 18px;
  line-height: 1.25;
}

.doc-body p,
.doc-body li {
  color: #34302a;
  font-size: 17px;
  line-height: 1.78;
}

.doc-body p {
  margin: 0 0 16px;
}

.doc-body ul,
.doc-body ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

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

.doc-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: rgba(255, 45, 32, 0.12);
  color: #8e170f;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

.doc-body pre {
  max-width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid rgba(23, 21, 18, 0.14);
  border-radius: 8px;
  background: #fffaf1;
  color: #211d18;
  font-size: 14px;
  line-height: 1.6;
}

.doc-body a {
  color: #8e170f;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.legal-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px 32px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .legal-top {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .back-link {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .legal-shell {
    grid-template-columns: 1fr;
  }

  .legal-sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    max-height: none;
    overflow: hidden;
  }

  .document-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(220px, 240px);
    max-width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .section-nav-wrap {
    display: none;
  }
}

@media (max-width: 640px) {
  .legal-top {
    padding: 20px 16px 10px;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 14px;
  }

  .brand-link {
    width: 118px;
  }

  .back-link {
    left: 14px;
    right: 14px;
    bottom: 14px;
    width: calc(100% - 28px);
    min-height: 50px;
  }

  .legal-shell {
    display: block;
    width: 100%;
    max-width: 100vw;
    padding: 14px 12px 84px;
    overflow-x: hidden;
  }

  .legal-sidebar,
  .legal-reader,
  .reader-intro,
  .documents,
  .doc-panel,
  .doc-body {
    min-width: 0;
    max-width: 100%;
  }

  .legal-sidebar,
  .reader-intro,
  .doc-panel {
    width: 100%;
    border-radius: 8px;
  }

  .legal-reader,
  .documents {
    overflow-x: hidden;
  }

  .document-nav {
    grid-auto-columns: minmax(208px, 72vw);
  }

  .legal-sidebar,
  .reader-intro {
    padding: 14px;
  }

  .reader-intro {
    margin-top: 14px;
  }

  .reader-intro h2 {
    font-size: 29px;
    line-height: 1.08;
  }

  .reader-intro p {
    max-width: 100%;
    font-size: 15px;
    line-height: 1.6;
  }

  .document-link {
    min-height: 64px;
  }

  .doc-panel {
    padding: 22px 18px;
  }

  .doc-body h1 {
    font-size: 31px;
    line-height: 1.08;
  }

  .reader-intro h2,
  .doc-body h1,
  .doc-body h2,
  .doc-body h3,
  .doc-body p,
  .doc-body li {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .doc-body p,
  .doc-body li {
    font-size: 16px;
    line-height: 1.72;
  }

  .legal-footer {
    padding: 0 16px 28px;
    flex-direction: column;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .legal-top,
  .legal-sidebar,
  .reader-intro,
  .legal-footer {
    display: none;
  }

  .legal-shell {
    display: block;
    padding: 0;
  }

  .doc-panel {
    box-shadow: none;
    border: 0;
    break-after: page;
  }
}
