/* styles.css — mobile reading layout; all sizes respect browser text settings. */
:root {
  --bg: #f7f2e8;
  --ink: #332e28;
  --muted: #746b60;
  --line: #d9d0c2;
  --accent: #76513c;
  color-scheme: light;
}
:root[data-theme="light"] {
  --bg: #fcfcfa;
  --ink: #252925;
  --muted: #667066;
  --line: #dbdfd9;
  --accent: #3e624c;
}
:root[data-theme="dark"] {
  --bg: #191c1b;
  --ink: #e1e4dd;
  --muted: #a2ada4;
  --line: #3b433e;
  --accent: #b5cdbb;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html {
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 5px; }
button { font: inherit; }
header, main, footer {
  max-width: 720px;
  margin: auto;
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}
header { padding-top: max(12px, env(safe-area-inset-top)); }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.module {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: .875rem;
  line-height: 1.5;
  letter-spacing: .04em;
}
.module span { color: var(--muted); letter-spacing: 0; white-space: nowrap; }
section > .module { padding-top: 20px; }
.themes {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 26px;
}
.themes button {
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: .75rem;
  letter-spacing: .02em;
  cursor: pointer;
}
.themes button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.font-sizes {
  display: flex;
  justify-content: flex-end;
  flex-basis: 100%;
  gap: 4px;
}
.font-sizes button {
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 22px;
  background: transparent;
  color: var(--muted);
  font-size: .875rem;
  cursor: pointer;
}
.font-sizes button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
article { padding-top: 22px; }
article + article { margin-top: 28px; border-top: 1px solid var(--line); }
h1 {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  margin: 0 0 16px;
  font-size: 1.75rem;
  line-height: 1.45;
  font-weight: 600;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.metadata {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .9375rem;
  line-height: 1.65;
}
.metadata p { margin: 2px 0; }
.prose {
  padding-top: 20px;
  font-size: var(--prose-font-size, 1.125rem);
  line-height: 1.75;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.prose p { margin: 0 0 1em; }
.prose ul { margin: 0 0 1em; padding-left: 1.35em; }
.prose li { margin: 0 0 .65em; padding-left: .1em; }
.prose > :last-child { margin-bottom: 0; }
footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  padding-top: 18px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8125rem;
}
::selection { background: var(--accent); color: var(--bg); }
@media (min-width: 700px) {
  header { padding-top: 24px; }
  h1 { font-size: 1.875rem; }
}
@media (max-width: 359px) {
  header, main, footer { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media print {
  .themes, .font-sizes, footer a { display: none; }
  :root, :root[data-theme] { --bg: white; --ink: black; --muted: #555; --line: #bbb; }
  header, main, footer { max-width: none; }
  .prose { font-size: 12pt; }
  h1 { font-size: 18pt; }
}
