/* kingwren.com: one shared stylesheet. No web fonts, no external requests. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #4f5660;
  --line: #dcd8cf;
  --accent: #1f5f4a;
  --accent-hover: #15473a;
  --focus: #b4541a;
  --notice-bg: #f1efe8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181b;
    --surface: #1d2125;
    --text: #e9e6df;
    --muted: #b3b8bf;
    --line: #353b42;
    --accent: #8fd3b6;
    --accent-hover: #b4e5cf;
    --focus: #f2a66b;
    --notice-bg: #20262a;
  }
}

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

html {
  font-size: 100%; /* 16px base */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.wrap {
  max-width: 44rem; /* about 70 characters per line */
  margin: 0 auto;
  padding: 0 1rem;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
a:focus-visible,
.skip:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -999rem;
  top: 0.5rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}
.skip:focus { left: 0.5rem; }

/* Header and footer */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1.5rem;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}
.brand {
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
}
.nav,
.footer-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}
.nav a,
.footer-nav a { text-decoration: none; }
.nav a:hover,
.footer-nav a:hover { text-decoration: underline; }
.nav a[aria-current="page"],
.footer-nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.site-footer {
  margin-top: 4rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9375rem;
}
.site-footer .wrap { padding-top: 1.5rem; padding-bottom: 2.5rem; }
.site-footer p { margin: 0.75rem 0 0; }

/* Content */
main { padding-top: 2rem; }
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 2rem; margin: 0 0 1rem; letter-spacing: -0.01em; }
h2 { font-size: 1.3125rem; margin: 2.5rem 0 0.75rem; scroll-margin-top: 1rem; }
h3 { font-size: 1.0625rem; margin: 1.75rem 0 0.5rem; }
p, ul, ol, address { margin: 0 0 1rem; }
ul, ol { padding-left: 1.5rem; }
li { margin-bottom: 0.5rem; }
address { font-style: normal; }
[id] { scroll-margin-top: 1rem; }

.lede { font-size: 1.1875rem; line-height: 1.55; }
.hero { padding: 1rem 0 0.5rem; }

.doc-meta { color: var(--muted); margin-bottom: 1.5rem; }
.doc-meta p { margin: 0 0 0.25rem; }
.doc-meta strong { color: var(--text); }

.toc {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem 1.25rem 0.5rem;
  margin: 1.5rem 0 2rem;
}
.toc h2 { font-size: 1rem; margin: 0 0 0.5rem; }
.toc ol { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.toc li { margin-bottom: 0.25rem; }
/* 条目文字里已经带编号（“1. …”）的目录不再让列表自己编号，免得出现“1. 1.” */
.toc ol.titled { list-style: none; padding-left: 0; }

.notice {
  background: var(--notice-bg);
  border-left: 4px solid var(--accent);
  padding: 0.25rem 1.25rem 0.25rem;
  margin: 2rem 0;
  border-radius: 0 8px 8px 0;
}
.notice h2 { font-size: 1.0625rem; margin-top: 1rem; }

.cards { list-style: none; padding: 0; display: grid; gap: 0.75rem; }
.cards li { margin: 0; }
.cards a {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
}
.cards a:hover { border-color: var(--accent); }
.cards strong { display: block; color: var(--accent); font-size: 1.0625rem; }
.cards span { display: block; color: var(--muted); }

.plain-links { padding-left: 1.25rem; }
.to-top { margin-top: 2.5rem; font-size: 0.9375rem; }

@media (min-width: 40rem) {
  h1 { font-size: 2.375rem; }
  .cards { grid-template-columns: repeat(3, 1fr); }
}

/* Print: legal pages read as a plain document */
@media print {
  :root {
    --bg: #fff; --surface: #fff; --text: #000; --muted: #333; --line: #999; --accent: #000; --notice-bg: #fff;
  }
  body { font-size: 11pt; line-height: 1.45; }
  .wrap { max-width: none; padding: 0; }
  .skip, .site-header nav, .site-footer nav, .toc, .to-top { display: none; }
  .site-header { border: 0; }
  main { padding-top: 0.5rem; }
  h2 { break-after: avoid; page-break-after: avoid; }
  li, p { orphans: 3; widows: 3; }
  a { color: #000; text-decoration: none; }
}
