/* Shared stylesheet for the static pages (guide, credits), en and zh.
   Deliberately plain: the design pick comes later. Mobile first. */

:root {
  --ink: #1d1b18;
  --muted: #5d574d;
  --line: #d6cfc0;
  --bg: #f6f3ec;
  --panel: #ede8dc;
  --link: #8f2a1d;
  --link-visited: #8f2a1d;
  --serif: "EB Garamond", "Noto Serif SC", Georgia, serif;
  --serif-zh: "Noto Serif SC", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", SimSun, serif;
  --mono: ui-monospace, Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  padding: 0 0 48px;
  background: var(--bg);
  color: var(--ink);
  font: 18px/1.5 var(--serif);
  font-variant-numeric: lining-nums;
  overflow-wrap: break-word;
}

html[lang="zh-Hans"] body {
  font-family: var(--serif-zh);
  line-height: 1.8;
}

/* One text column; header and footer rules run full width, their content sits in the column. */
main,
.site-search {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

.site-nav,
.site-foot {
  --gutter: max(16px, calc((100% - 40rem) / 2 + 16px));
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px 16px;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.site-nav > a:first-child {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  font-weight: 600;
  margin: 28px 0 8px;
}

h2 {
  font-size: 1.25rem;
  line-height: 1.3;
  font-weight: 600;
  margin: 36px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 24px 0 4px;
}

p, ul, ol, dl { margin: 0 0 14px; }

ul, ol { padding-left: 1.4em; }

li { margin: 0 0 6px; }

li > ul, li > ol { margin: 6px 0 0; }

a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.site-nav > a:first-child:visited { color: var(--ink); }
a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.lede {
  font-size: 1.08rem;
  color: var(--ink);
}

.note {
  color: var(--muted);
  font-size: 0.94rem;
}

.box {
  margin: 20px 0;
  padding: 12px 14px;
  background: var(--panel);
  border-left: 3px solid var(--line);
}

.box > :last-child { margin-bottom: 0; }

.box h2 {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  font-size: 1.1rem;
}

code, kbd, .qid {
  font-family: var(--mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

/* Long URLs written out as text must wrap on a 390 px screen. */
.url {
  font-family: var(--mono);
  font-size: 0.84em;
  overflow-wrap: anywhere;
  word-break: break-all;
}

details {
  margin: 16px 0;
  padding: 8px 12px;
  border: 1px solid var(--line);
}

summary {
  cursor: pointer;
  font-weight: 600;
}

details[open] summary { margin-bottom: 8px; }

label { display: block; margin: 8px 0 4px; }

input[type="url"] {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

dl dt { font-weight: 600; margin-top: 12px; }
dl dd { margin: 2px 0 0; }

.site-foot {
  margin-top: 40px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

[hidden] { display: none !important; }

@media (min-width: 720px) {
  h1 { font-size: 2.1rem; margin-top: 40px; }
}

.site-search { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .5rem; margin-bottom: 1rem; }
.site-search label { width: 100%; font-size: .9rem; }
.site-search input { flex: 1 1 12rem; font: inherit; padding: .4rem .5rem; min-height: 44px; border: 1px solid var(--muted); background: #fff; color: var(--ink); border-radius: 0; }
.site-search button { font: inherit; min-height: 44px; padding: .4rem .9rem; border: 1px solid var(--ink); background: #fff; color: var(--ink); cursor: pointer; border-radius: 0; }
