/*
 * site.css — mobile-first, tuned for one device.
 *
 * Target: 2800 × 1260 physical, 452 PPI.
 * Measured Chrome mobile viewport: 360 × 704 CSS px, DPR 3.5.
 * There are deliberately no desktop media queries, and no dark mode:
 * 全站只有浅色一套配色，与 assets/css/math.css 的系列页一致。
 */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --fg: #15171b;
  --muted: #6c737d;
  --line: #e3e6ea;
  --accent: #1f5f8f;
  --accent-soft: #eaf1f7;
  --code-bg: #f2f4f7;
  --radius: 14px;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

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

html {
  /* Keep the home page readable on the measured 360 CSS px viewport. */
  font-size: clamp(16px, 4.05vw, 18px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

.wrap {
  max-width: 520px;
  margin-inline: auto;
  padding-top: calc(28px + env(safe-area-inset-top));
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
  padding-left: max(20px, env(safe-area-inset-left));
  padding-right: max(20px, env(safe-area-inset-right));
}

/* ---------- site head ---------- */

.site-head h1 {
  margin: 0 0 0.3rem;
  font-size: 1.65rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.site-head .lede {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* ---------- index list ---------- */

.doc-list {
  margin: 1.7rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.doc-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.doc-list a:active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.doc-list .title {
  font-size: 1rem;
  font-weight: 600;
}

.doc-list .meta {
  flex: none;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

/* ---------- document page ---------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-bottom: 0.4rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.back:active {
  color: var(--accent);
}

.doc h1 {
  margin: 0.2rem 0 1rem;
  font-size: 1.5rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.doc h2 {
  margin: 2.1rem 0 0.7rem;
  font-size: 1.18rem;
  line-height: 1.4;
}

.doc h3 {
  margin: 1.7rem 0 0.6rem;
  font-size: 1.02rem;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 1rem;
}

.doc ul,
.doc ol {
  padding-left: 1.25em;
}

.doc li {
  margin-bottom: 0.3rem;
}

.doc a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.doc strong {
  font-weight: 600;
}

.doc code {
  padding: 0.1em 0.36em;
  border-radius: 6px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}

.doc pre {
  margin: 0 0 1.2rem;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.8rem;
  line-height: 1.62;
}

.doc pre code {
  padding: 0;
  background: none;
  font-size: inherit;
  white-space: pre;
  overflow-wrap: normal;
}

.doc blockquote {
  margin: 0 0 1.2rem;
  padding: 0.2rem 0 0.2rem 0.9rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.doc img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 1.2rem;
  border-radius: 10px;
}

.doc hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.doc table {
  display: block;
  width: 100%;
  margin: 0 0 1.2rem;
  border-collapse: collapse;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: 0.85rem;
}

.doc th,
.doc td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.doc th {
  background: var(--surface);
  font-weight: 600;
  white-space: nowrap;
}

/* long URLs / hashes must not widen the viewport */
.doc p,
.doc li,
.doc td {
  overflow-wrap: anywhere;
}

/* ---------- 404 ---------- */

.notice {
  margin-top: 2.2rem;
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

.notice p {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.92rem;
}
