@font-face {
  font-family: ZCode;
  src: url("public/assets/zcode-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --page: #161616;
  --surface: #1b1b1b;
  --surface-raised: #202020;
  --border: #303030;
  --border-strong: #444;
  --text: #f3f3f3;
  --text-muted: #b0b0b0;
  --text-dim: #898989;
  --accent: #a795ff;
  --accent-soft: rgba(167, 149, 255, 0.12);
  --card-radius: 8px;
  --card-surface: var(--surface);
  --content-width: 1180px;
  --reading-width: 760px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
  scroll-padding-top: 112px;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--page);
  color: var(--text);
  font-family: ZCode, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  overflow-anchor: none;
}

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

button,
a {
  touch-action: manipulation;
}

button {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 6px;
  background: #fff;
  color: #111;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.legal-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 50px;
  align-items: center;
  gap: 0;
  padding: 0;
  border-bottom: 0;
  background: var(--page);
  backdrop-filter: none;
  font-family: ZCode, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
}

.legal-brand {
  display: flex;
  width: 280px;
  height: 100%;
  flex: 0 0 280px;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  font-size: 18px;
  font-weight: 750;
  line-height: 1.5;
  white-space: nowrap;
}

.legal-brand img {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.legal-nav {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 8px;
  padding-left: 20px;
}

.legal-nav a {
  position: relative;
  display: flex;
  min-width: 64px;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.legal-nav a:hover,
.legal-nav a[aria-current="page"] {
  color: var(--text);
}

.legal-nav a[aria-current="page"]::after {
  position: absolute;
  right: 8px;
  bottom: 0;
  left: 8px;
  height: 2px;
  background: var(--text);
  content: "";
}

.language-toggle {
  display: inline-flex;
  height: 36px;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-right: 16px;
  margin-left: auto;
  padding: 0 13px;
  border: 1px solid #4b4b4b;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  cursor: pointer;
}

.language-toggle:hover {
  border-color: #686868;
  background: #202020;
}

.language-toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

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

.legal-hero {
  width: min(var(--content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 78px 0 54px;
  border-bottom: 1px solid var(--border);
}

.legal-hero h1 {
  max-width: 1100px;
  margin: 0;
  font-size: 72px;
  line-height: 1.04;
  letter-spacing: 0;
  text-wrap: balance;
}

.legal-hero p {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--text-muted);
  font-size: 17px;
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 29px;
  color: var(--text-dim);
  font-size: 13px;
}

.legal-layout {
  display: grid;
  width: min(var(--content-width), calc(100% - 48px));
  grid-template-columns: 220px minmax(0, var(--reading-width));
  justify-content: space-between;
  gap: 72px;
  margin: 0 auto;
  padding: 64px 0 104px;
}

.table-of-contents {
  position: sticky;
  top: 102px;
  align-self: start;
  max-height: calc(100vh - 126px);
  padding-right: 10px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.table-of-contents strong {
  display: block;
  margin-bottom: 12px;
  color: var(--text);
  font-size: 12px;
  text-transform: uppercase;
}

.table-of-contents a {
  display: block;
  padding: 7px 0;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
}

.table-of-contents a:hover {
  color: var(--text);
}

.legal-document {
  min-width: 0;
  overflow-wrap: anywhere;
}

.legal-section {
  padding: 0 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.legal-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
  margin-bottom: 0;
}

.legal-section h2 {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: 0;
}

.legal-section h3 {
  margin: 30px 0 10px;
  color: #dedede;
  font-size: 17px;
  line-height: 1.4;
}

.legal-section p,
.legal-section li {
  color: var(--text-muted);
  white-space: pre-wrap;
}

.legal-section p {
  margin: 0 0 16px;
}

.legal-section strong {
  color: #ededed;
  font-weight: 700;
}

.legal-welcome {
  color: var(--text) !important;
  font-size: 18px;
}

.legal-outline {
  margin-top: 22px !important;
}

.legal-outline p {
  margin-bottom: 6px;
}

.legal-item {
  padding-left: 22px;
}

.legal-section ul,
.legal-section ol {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding-left: 22px;
}

.legal-section a,
.support-card a {
  color: #c7bbff;
  text-decoration: underline;
  text-decoration-color: #695c9e;
  text-underline-offset: 3px;
}

.legal-section a:hover,
.support-card a:hover {
  color: #fff;
  text-decoration-color: #fff;
}

.data-flow-list,
.support-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.data-flow,
.support-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--card-surface);
}

.data-flow h3,
.support-card h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 15px;
}

.data-flow p,
.support-card p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.55;
}

.support-card a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 700;
}

.report-template {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  background: var(--card-surface);
}

.report-template code {
  color: #d7d7d7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}

.legal-footer {
  border-top: 1px solid var(--border);
}

.legal-footer-inner {
  display: flex;
  width: min(var(--content-width), calc(100% - 48px));
  min-height: 112px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 12px;
}

.legal-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
}

.legal-footer a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
}

.legal-footer a:hover {
  color: var(--text);
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  html {
    scroll-padding-top: 152px;
  }

  .legal-header {
    height: auto;
    min-height: 58px;
    flex-wrap: wrap;
    padding: 0 12px;
  }

  .legal-brand {
    width: auto;
    height: 58px;
    flex: 0 1 auto;
    padding: 0;
    font-size: 16px;
  }

  .legal-nav {
    order: 3;
    width: 100%;
    height: 44px;
    padding-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .legal-nav::-webkit-scrollbar {
    display: none;
  }

  .legal-nav a {
    flex: 0 0 auto;
    height: 44px;
  }

  .language-toggle {
    width: 40px;
    height: 40px;
    margin-left: auto;
    margin-right: 0;
    padding: 0;
  }

  .language-toggle span {
    display: none;
  }

  .legal-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .legal-hero h1 {
    font-size: 54px;
  }

  .table-of-contents {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 20px;
    max-height: none;
    padding-right: 0;
    padding-bottom: 28px;
    overflow-y: visible;
    border-bottom: 1px solid var(--border);
  }

  .table-of-contents strong {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .legal-header {
    padding-inline: 12px;
  }

  .legal-brand {
    font-size: 16px;
  }

  .legal-brand img {
    width: 28px;
    height: 28px;
  }

  .legal-nav {
    margin-inline: -4px;
  }

  .legal-nav a {
    padding-inline: 10px;
    font-size: 13px;
  }

  .legal-brand span {
    display: none;
  }

  .language-toggle {
    padding-inline: 0;
  }

  .legal-hero,
  .legal-layout,
  .legal-footer-inner {
    width: calc(100% - 32px);
  }

  .legal-hero {
    padding: 50px 0 38px;
  }

  .legal-hero h1 {
    font-size: 39px;
  }

  .legal-hero p {
    font-size: 15px;
  }

  .legal-layout {
    padding: 44px 0 72px;
  }

  .table-of-contents {
    grid-template-columns: 1fr;
  }

  .legal-section {
    padding-bottom: 38px;
    margin-bottom: 38px;
  }

  .legal-section h2 {
    font-size: 22px;
  }

  .data-flow-list,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .legal-footer-inner {
    display: block;
    padding: 28px 0;
  }

  .legal-footer nav {
    margin-top: 12px;
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .legal-header {
    position: static;
  }

  .legal-hero {
    padding-top: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
