/* Revika legal pages — light/dark via design tokens (design-tokens/tokens.json v0.4.6).
   No external fonts, no tracking. Brand color #5B4FC4; dark-mode accent #9B8FE6
   matches app_theme.dart (lightened primary for contrast on #0E0E11). */

:root {
  --brand: #5B4FC4;
  --brand-dark: #4738C8;
  --bg: #F8F9FF;
  --surface: #FFFFFF;
  --text: #1F2937;
  --text-2: #6B7280;
  --border: #E7EAF3;
  --focus: rgba(91, 79, 196, 0.45);
  --shadow: 0 10px 28px rgba(31, 41, 55, 0.08);
  --link: #5B4FC4;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E0E11;
    --surface: #232329;
    --text: #F5F5F7;
    --text-2: #AEAEB2;
    --border: rgba(245, 245, 247, 0.12);
    --focus: rgba(91, 79, 196, 0.55);
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.4);
    --link: #9B8FE6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC',
    'Noto Sans CJK SC', 'Noto Sans', Roboto, system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(32px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.wordmark {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: max(20px, env(safe-area-inset-left));
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.8px;
  color: var(--brand);
  text-decoration: none;
}
.wordmark:hover { text-decoration: none; color: var(--brand-dark); }
@media (prefers-color-scheme: dark) {
  .wordmark { color: var(--link); }
}

.lang-picker {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
}
.lang-label { white-space: nowrap; }
.lang-picker select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 32px 8px 12px;
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  min-width: 150px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-2) 50%),
    linear-gradient(135deg, var(--text-2) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) center,
    calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.lang-picker select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.container {
  max-width: 760px;
  margin: 72px auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 48px);
}

article[hidden] { display: none; }

.doc-header { margin-bottom: 32px; }
h1 {
  font-size: 28px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}
.subtitle {
  margin: 0;
  color: var(--text-2);
  font-size: 14px;
}

section { margin: 0 0 28px; }
h2 {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

ul {
  margin: 0 0 12px;
  padding-left: 1.25em;
}
li { margin-bottom: 8px; }
li:last-child { margin-bottom: 0; }

a {
  color: var(--link);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.doc-footer {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.cross { margin: 0 0 8px; font-size: 14px; }
.copyright {
  margin: 0;
  color: var(--text-2);
  font-size: 13px;
}

@media (max-width: 560px) {
  .lang-label { display: none; }
  .lang-picker select { min-width: 0; }
  .container { margin-top: 64px; border-radius: 18px; }
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
}
