/*
 * One stylesheet, no fonts to fetch, no framework.
 *
 * This page is read by people who are about to paste a command into a root
 * shell on a server, often over a link that is the slow part of the operation.
 * Anything it has to download from somewhere else is a way for it to arrive
 * broken, so there is nothing here but text and one SVG icon.
 *
 * Colours are named by what they mean, and the dark scheme is a second set of
 * the same variables rather than a second stylesheet.
 */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --fg: #1c1f23;
  --fg-soft: #5b6570;
  --line: #e2e6ea;
  --link: #0b62c4;
  --code-bg: #f3f5f7;
  --warn: #9a3412;
  --radius: 8px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --bg-soft: #1b1f24;
    --fg: #e7ebef;
    --fg-soft: #9aa5b1;
    --line: #2a3037;
    --link: #6cb0ff;
    --code-bg: #1e232a;
    --warn: #fca97a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.7 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
}

.wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* ---------------------------------------------------------------- header -- */

.top {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

.top .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: .5px;
  color: var(--fg);
  text-decoration: none;
}

.top nav { display: flex; gap: 18px; flex-wrap: wrap; }
.top nav a { color: var(--fg-soft); text-decoration: none; font-size: 15px; }
.top nav a:hover { color: var(--link); }

/* ------------------------------------------------------------------ hero -- */

.hero { padding: 48px 0 8px; }
/*
 * balance, not pretty: a headline of two or three lines should have them all
 * about the same length rather than a long one and a stub.
 *
 * 32px rather than 34: with full-width commas the headline is 816px against an
 * 820px column at 34px — four pixels, which is less than the difference between
 * one Chinese font and another. A visitor on a Mac would get a two-line
 * headline for no reason. At 32px there is ~50px of slack for the font to
 * disagree in.
 */
.hero h1 { font-size: 32px; line-height: 1.35; margin: 0 0 12px; text-wrap: balance; }
.lead { font-size: 18px; color: var(--fg-soft); margin: 0 0 24px; max-width: 62ch; }

.cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 0 0 12px; }

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: var(--radius);
  background: var(--link);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.btn.ghost { background: transparent; color: var(--link); border: 1px solid var(--line); }
.btn:hover { opacity: .9; }

/* The front page has exactly one thing to click, so it is allowed to look like
   the one thing to click. */
.btn.big { padding: 16px 40px; font-size: 19px; border-radius: 10px; }

.get { margin: 28px 0 8px; }
.get .ver { margin: 12px 0 16px; }
.get .note { max-width: 60ch; }

/*
 * Two rules about breaking Chinese lines.
 *
 * text-wrap: pretty stops the last line of a paragraph being a single orphaned
 * character, which is what a ragged Chinese column looks worst doing.
 *
 * .nb is for short inline links. Chinese may break between ANY two characters,
 * so a two-character word at the end of a line gets split down the middle —
 * inside a link that reads as a typo rather than as a wrap.
 */
p, li, dd { text-wrap: pretty; }
.nb { white-space: nowrap; }

/* The safety net, and it should almost never fire: if a phrase is ever wider
   than the column, nowrap would push the page sideways instead of wrapping.
   Measured at 320px the widest phrase is 270px against a 280px column, so the
   cut-off sits below every real device — 375px was too eager and broke
   "共享文件" down the middle on an ordinary phone. */
@media (max-width: 300px) {
  .nb { white-space: normal; }
}

.ver { color: var(--fg-soft); font-size: 14px; margin: 0; }

/* ---------------------------------------------------------------- 首页 ---- */

.steps { padding-left: 22px; }
.steps li { margin-bottom: 12px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--bg-soft);
}

/* The two roles are a pair, so they get a pair of columns rather than whatever
   the auto-fit grid would do with them. */
.cards.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card h3 { margin: 0 0 8px; font-size: 16px; }
.card p { margin: 0 0 8px; color: var(--fg-soft); font-size: 15px; }
.card p:last-child { margin-bottom: 0; }

/* The one line somebody skimming for "which one am I" needs to land on. */
.pick-when { color: var(--fg) !important; }

/* Statements, not bullets: no marker, one clear line each. */
.plain { list-style: none; padding: 0; }
.plain li { margin-bottom: 10px; }

/* --------------------------------------------------------------- content -- */

main { padding-bottom: 48px; }

section { padding-top: 40px; }

h2 {
  font-size: 24px;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  /* So an anchor from the nav does not land under the sticky header. */
  scroll-margin-top: 70px;
}

section { scroll-margin-top: 70px; }

h3 { font-size: 18px; margin: 28px 0 10px; }
h4 { font-size: 15px; margin: 22px 0 8px; color: var(--fg-soft); text-transform: lowercase; }

p, ul, ol, dl { margin: 0 0 14px; }
li { margin-bottom: 6px; }

a { color: var(--link); }

.note { color: var(--fg-soft); font-size: 15px; }
.warn { color: var(--warn); }
.loading { color: var(--fg-soft); }

dt { font-weight: 600; margin-top: 14px; }
dd { margin: 4px 0 0; color: var(--fg-soft); }

/* --------------------------------------------------------------- tables --- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}

th, td {
  text-align: left;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th { font-weight: 600; color: var(--fg-soft); font-size: 14px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: none; }

.files .plat { white-space: nowrap; }
.files .num { white-space: nowrap; color: var(--fg-soft); }
.files .sum code { font-size: 12px; color: var(--fg-soft); background: none; padding: 0; }
.files .file { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14px; }

/* ----------------------------------------------------------------- code --- */

code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .9em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

pre {
  position: relative;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 16px;
}

pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.6; }

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--fg-soft);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s;
}

pre:hover .copy, .copy:focus { opacity: 1; }
.copy:hover { color: var(--link); }

/* --------------------------------------------------------------- footer --- */

footer {
  border-top: 1px solid var(--line);
  padding: 20px 20px 40px;
  color: var(--fg-soft);
  font-size: 14px;
}

footer p { margin: 0 0 4px; }

/* Touch screens have no hover, so the copy button would never appear. */
@media (hover: none) {
  .copy { opacity: 1; }
}

@media (max-width: 600px) {
  .hero { padding-top: 32px; }
  .hero h1 { font-size: 27px; }
  .lead { font-size: 16px; }
}
