:root {
  color-scheme: light;
  --ink: #202938;
  --muted: #596579;
  --line: #e0e6ed;
  --paper: #ffffff;
  --canvas: #f4f7fb;
  --accent: #3769c8;
  --notice: #fff4d7;
  --notice-ink: #704e08;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: var(--accent); text-underline-offset: 0.18em; overflow-wrap: anywhere; }
a:focus-visible { outline: 3px solid #91b6ff; outline-offset: 3px; }

.site-header {
  padding: 22px max(24px, calc((100vw - 1100px) / 2));
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-weight: 750;
  letter-spacing: 0.01em;
}

.site-header a { color: var(--ink); text-decoration: none; }
.site-header span { color: var(--muted); font-weight: 500; }

.draft-banner {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 14px 18px;
  border: 1px solid #f0d58a;
  border-radius: 12px;
  background: var(--notice);
  color: var(--notice-ink);
  font-weight: 700;
}

.language-switch {
  max-width: 1100px;
  margin: 18px auto 0;
  display: flex;
  gap: 10px;
}

.language-switch a {
  display: inline-block;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  text-decoration: none;
  font-weight: 650;
}

.language-switch a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.action-link {
  display: inline-block;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  text-decoration: none;
}

.action-link:hover { background: #2857ad; }
.delete-link { display: inline-block; margin-top: 8px; font-weight: 700; }

.layout {
  width: min(1100px, calc(100% - 40px));
  margin: 22px auto 64px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Legal pages without a table of contents use one readable centered column. */
.layout--single {
  max-width: 860px;
  grid-template-columns: minmax(0, 1fr);
}

.toc, .document {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 8px 28px rgb(27 43 69 / 4%);
}

.toc {
  position: sticky;
  top: 20px;
  padding: 16px;
}

.toc strong { display: block; margin: 2px 8px 9px; }
.toc ol { margin: 0; padding-left: 28px; color: var(--muted); }
.toc li { padding: 3px 0; }
.toc a { color: inherit; text-decoration: none; }
.toc a:hover { color: var(--accent); }

.document { min-width: 0; padding: clamp(24px, 5vw, 52px); }

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 5vw, 2.65rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.lede { margin: 0; color: var(--muted); font-size: 1.05rem; }
.meta { margin: 20px 0 0; padding: 14px 16px; border-radius: 10px; background: #f5f8fc; color: var(--muted); }
.meta p { margin: 3px 0; }
.review-note { margin: 22px 0; padding: 14px 16px; border-left: 4px solid #e8ad24; border-radius: 8px; background: #fffaf0; }
.review-note strong { color: #704e08; }

section { padding-top: 28px; scroll-margin-top: 18px; }
section + section { margin-top: 20px; border-top: 1px solid var(--line); }
h2 { margin: 0 0 10px; font-size: 1.35rem; line-height: 1.35; }
h3 { margin: 18px 0 6px; font-size: 1.05rem; }
p { margin: 8px 0 12px; }
ul, ol { padding-left: 1.35em; }
li + li { margin-top: 4px; }
.muted { color: var(--muted); }
.data-card { margin: 14px 0; padding: 16px; border: 1px solid var(--line); border-radius: 12px; }
.data-card h3 { margin-top: 0; }
.footer { width: min(1100px, calc(100% - 40px)); margin: -34px auto 40px; color: var(--muted); font-size: .9rem; }

@media (max-width: 760px) {
  .draft-banner, .language-switch { width: calc(100% - 28px); }
  .draft-banner { margin-top: 14px; }
  .layout { width: calc(100% - 28px); margin-top: 14px; grid-template-columns: 1fr; gap: 12px; }
  .toc { position: static; }
  .toc ol { columns: 2; column-gap: 24px; }
  .document { padding: 24px 20px; }
  .footer { width: calc(100% - 28px); }
}

@media print {
  body { background: #fff; }
  .site-header, .language-switch, .toc { display: none; }
  .draft-banner, .layout, .document { width: 100%; max-width: none; margin: 0; border-radius: 0; box-shadow: none; }
  .layout { display: block; }
  .document { padding: 12mm; }
  a { color: inherit; }
}
