/* Chesdo legal document page (standalone). Plain CSS3, no build step. Colors match the app's Palette (ContentView.swift). */

:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --border: #e4dfd5;
  --text: #1c2230;
  --text-2: #4c5563;
  --text-3: #6b7280;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.09);
  --header: rgba(246, 244, 239, 0.82);
  --shadow: 0 1px 2px rgba(28, 34, 48, 0.04), 0 8px 24px rgba(28, 34, 48, 0.06);
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --wrap: 720px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --surface: #171c24;
    --surface-2: #1d232d;
    --border: #272e3a;
    --text: #eef0f3;
    --text-2: #b9c0cb;
    --text-3: #8d95a1;
    --accent: #5ec4b6;
    --accent-soft: rgba(94, 196, 182, 0.11);
    --header: rgba(15, 19, 25, 0.8);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* Header */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: none;
  padding: 12px max(16px, calc((100% - var(--wrap)) / 2 + 16px));
  background: var(--header);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--text);
  text-decoration: none;
  font: 600 17px/1 var(--display);
  letter-spacing: -0.01em;
}
.logo { border-radius: 8px; box-shadow: 0 0 0 1px var(--border); }

.top nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  font-size: 14px;
  line-height: 1;
}
.top nav::-webkit-scrollbar { display: none; }
.top nav a {
  flex-shrink: 0;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
}
.top nav a:hover { background: var(--surface-2); color: var(--text); }
.top nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.top nav .lang { border: 1px solid var(--border); margin-left: 4px; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 10px; }
  .top nav { margin-left: -12px; margin-right: -16px; padding-right: 16px; width: calc(100% + 28px); }
}

/* Layout */

main, .foot { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-left: 16px; padding-right: 16px; }
main { flex: 1; padding-top: 32px; padding-bottom: 64px; }

.foot {
  padding-top: 24px;
  padding-bottom: 40px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 13px;
}
.foot p { margin: 0; }

/* Legal documents */

.doc-head { padding-bottom: 8px; }

.updated {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 12px/1.4 var(--sans);
}
.doc-head .updated { order: -1; }

.doc h1 {
  font: 700 clamp(30px, 7vw, 42px)/1.12 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 14px;
}
.doc-head { display: flex; flex-direction: column; align-items: flex-start; }

.intro { font-size: 18px; line-height: 1.6; color: var(--text-2); margin: 0 0 28px; }

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px 20px 16px;
  margin-bottom: 16px;
}
.toc-title {
  margin: 0 0 10px;
  color: var(--text-3);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.toc ol { margin: 0; padding-left: 22px; columns: 2 240px; column-gap: 28px; font-size: 15px; line-height: 1.5; }
.toc li { break-inside: avoid; padding: 3px 0; color: var(--text-3); }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { color: var(--accent); text-decoration: underline; }

.doc { counter-reset: sec; }
.doc section { padding-top: 28px; margin-top: 28px; border-top: 1px solid var(--border); }
.doc section:first-of-type { border-top: 0; }
.doc h2 {
  font: 650 21px/1.3 var(--display);
  letter-spacing: -0.015em;
  margin: 0 0 12px;
}
.doc h2::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  display: inline-block;
  min-width: 2.2em;
  color: var(--accent);
  font: 600 14px/1 var(--mono);
  vertical-align: 2px;
}
.doc section p,
.doc section li { color: var(--text-2); }
.doc section p { margin: 0 0 14px; }

.doc ul { list-style: none; margin: 0 0 14px; padding: 0; }
.doc ul li { position: relative; padding-left: 22px; margin-bottom: 10px; }
.doc ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.72em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
