/* Clash of Rust site.
   The world: a country railway junction where a blue cat works the points.
   Colours are sampled from the illustrations: dawn-sky cream and powder blue,
   deep teal shadows, rust for roofs, rails and the "of" in the wordmark. */

@font-face {
  font-family: "National Park";
  src: url(assets/fonts/national-park.woff2) format("woff2");
  font-weight: 200 800;
  font-display: optional;
}
@font-face {
  font-family: "Departure Mono";
  src: url(assets/fonts/departure-mono.woff2) format("woff2");
  font-display: optional;
}
@font-face {
  font-family: "Noto Sans SC Display";
  src: url(assets/fonts/noto-sans-sc-display.woff2) format("woff2");
  font-weight: 500;
  font-display: optional;
}

:root {
  color-scheme: light;
  --paper: #f8f3e7;
  --card: #fffdf8;
  --sky: #d9e9f1;
  --ink: #1c2b2c;
  --soft: #55645f;
  --line: #1c2b2c26;
  --rust: #b0472a;
  --night: #16252b;
  --lamp-blue: #3f9dfb;
  --lamp-amber: #f0a21f;
  --lamp-green: #45b55a;
  --wash: #1c2b2c12;
  --switch: #1c2b2c08;
  --switch-hover: #1c2b2c0d;
  --core-block: #1c2b2c40;
  --yours-ink: #155b24;
  --source-line: #b0472a38;
  --source-wash: #b0472a08;
  --command-paper: #1c2b2c;
  --command-ink: #e6efe8;
  --hover-ink: #fff;
  --px: 3px;
  --radius: 18px;
  --cjk: "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC";
  --text: "National Park", var(--cjk), system-ui, sans-serif;
  --display: "National Park", "Noto Sans SC Display", var(--cjk), system-ui, sans-serif;
  --label: 0.6875rem/1.4 "Departure Mono", "Cascadia Mono", Consolas, monospace;
  --pixel: "Departure Mono", "Cascadia Mono", Consolas, "SF Mono", Menlo, var(--cjk), monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #101d23;
  --card: #182b32;
  --sky: #20353e;
  --ink: #e5eee9;
  --soft: #adbfba;
  --line: #d3e6df38;
  --rust: #f0a17c;
  --night: #0b161c;
  --wash: #d3e6df14;
  --switch: #d3e6df0c;
  --switch-hover: #d3e6df18;
  --core-block: #b6cdc46b;
  --yours-ink: #95d7a0;
  --source-line: #f0a17c66;
  --source-wash: #f0a17c0c;
  --command-paper: #0b1518;
  --hover-ink: #101d23;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #101d23;
    --card: #182b32;
    --sky: #20353e;
    --ink: #e5eee9;
    --soft: #adbfba;
    --line: #d3e6df38;
    --rust: #f0a17c;
    --night: #0b161c;
    --wash: #d3e6df14;
    --switch: #d3e6df0c;
    --switch-hover: #d3e6df18;
    --core-block: #b6cdc46b;
    --yours-ink: #95d7a0;
    --source-line: #f0a17c66;
    --source-wash: #f0a17c0c;
    --command-paper: #0b1518;
    --hover-ink: #101d23;
  }
}

:lang(zh-CN) { --label: 500 0.8125rem/1.5 "National Park", var(--cjk), sans-serif; }
[data-space-top="0.9"] { margin-top: 0.9rem; }
[data-space-top="1"] { margin-top: 1rem; }
[data-space-top="1.1"] { margin-top: 1.1rem; }
[data-space-top="1.2"] { margin-top: 1.2rem; }
[data-space-top="1.3"] { margin-top: 1.3rem; }
[data-space-top="1.4"] { margin-top: 1.4rem; }
[data-space-top="1.6"] { margin-top: 1.6rem; }
.js-only { display: none !important; }
.js .js-only { display: flex !important; }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1.5rem; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: anywhere;
}
:lang(zh-CN) body { font-size: 1rem; line-height: 1.85; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p, ul, ol, dl, dd, figure, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
h1, h2, h3, summary, dt, th { font-family: var(--display); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.022em; line-height: 1.06; text-wrap: balance; }
:lang(zh-CN) :is(h1, h2, h3) { font-weight: 500; letter-spacing: 0; line-height: 1.3; }
h1 { font-size: clamp(2.6rem, 6.3vw, 5rem); }
h2 { font-size: clamp(1.85rem, 3.5vw, 2.9rem); }
h3 { font-size: 1.25rem; letter-spacing: -0.01em; line-height: 1.25; }
/* Chinese emphasis uses the real medium weight of the display face, never a synthesised bold. */
:lang(zh-CN) { font-synthesis-weight: none; }
:lang(zh-CN) :is(b, strong, th, dt, summary, .btn, .more, .chip, .features a, .switch button, .top nav a, .lang, .toc a[aria-current]) {
  font-family: var(--display); font-weight: 500;
}
:lang(zh-CN) h1 { font-size: clamp(2.3rem, 5.4vw, 4.2rem); }
:lang(zh-CN) h2 { font-size: clamp(1.7rem, 3.1vw, 2.5rem); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
a:hover { color: var(--rust); }
code, kbd, pre { font-family: var(--pixel); font-size: 0.86em; }
:not(pre) > code { background: var(--wash); padding: 0.12em 0.4em; border-radius: 5px; white-space: nowrap; }
kbd { border: 1px solid var(--line); border-bottom-width: 3px; border-radius: 5px; padding: 0 0.4em; background: var(--card); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--lamp-blue); outline-offset: 3px; }
::selection { background: var(--ink); color: var(--paper); }

.wrap { width: min(1180px, 100% - 3rem); margin-inline: auto; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 10; padding: 0.6rem 1rem; background: var(--ink); color: var(--paper); }
.skip:focus { top: 1rem; }
.lead { font-size: clamp(1.1rem, 1.6vw, 1.3rem); line-height: 1.55; color: var(--soft); max-width: 34em; }
:lang(zh-CN) .lead { line-height: 1.8; max-width: 30em; }
.fine { font-size: 0.875rem; line-height: 1.6; color: var(--soft); max-width: 46em; }
.label { font: var(--label); color: var(--soft); }

.btn, .chip, .frame, .card, .term, .tag {
  --edge: var(--ink);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
}

.btn {
  display: inline-flex; align-items: center; gap: 0.6rem;
  min-height: 3rem; padding: 0 1.35rem; margin: 0;
  background: var(--ink); color: var(--paper);
  font: 600 1rem/1.35 var(--display); text-decoration: none; white-space: normal;
  justify-content: center; text-align: center;
  border-radius: 12px;
  transition: background-color .18s, color .18s, border-color .18s, transform .18s;
}
.btn:hover { background: var(--rust); --edge: var(--rust); color: var(--hover-ink); transform: translateY(-2px); }
.btn:active { transform: translateY(2px); }
.btn.ghost { background: var(--card); color: var(--ink); }
.btn.ghost:hover { background: var(--ink); --edge: var(--ink); color: var(--paper); }
.btn.small { min-height: 2.25rem; padding: 0 0.85rem; font-size: 0.9rem; gap: 0.45rem; }
.btn .star { width: 0.8em; height: 0.8em; fill: var(--lamp-amber); }
.btn [data-stars]:empty { display: none; }
.btn [data-stars] { font: 0.75rem/1 var(--pixel); padding-left: 0.55rem; border-left: 1px solid currentColor; opacity: 0.85; }
.more { font-weight: 600; text-decoration: underline; }

/* Header */
.top .wrap { display: flex; align-items: center; gap: clamp(.8rem, 2vw, 1.6rem); min-height: 5rem; }
.header-actions { display: flex; align-items: center; gap: clamp(.5rem, 1.3vw, 1.2rem); flex-shrink: 0; }
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); cursor: pointer; }
.theme-toggle:hover { border-color: var(--rust); color: var(--rust); }
.theme-toggle [hidden] { display: none; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; margin-right: auto; color: var(--ink); min-width: 0; }
.brand > img:not(.wordmark) { flex-shrink: 0; }
.brand-wordmark { display: block; min-width: 0; }
.brand:hover { color: var(--ink); }
.wordmark { height: auto; width: 122px; min-width: 0; }
.top nav { display: flex; gap: clamp(1rem, 2.4vw, 2rem); }
.mobile-menu { display: none; }
.top nav a, .lang { font: 500 0.95rem/1 var(--display); text-decoration: none; padding: 0.5rem 0; }
.top nav a { justify-self: start; width: fit-content; }
.top nav a[aria-current] { box-shadow: 0 var(--px) 0 var(--rust); }
.lang { color: var(--soft); }
.top nav a, .lang, .more { transition: color .18s; }
@media (max-width: 1000px) {
  .top .wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; padding: .8rem 0 .6rem; min-height: 0; }
  .top .main-nav, .top .btn.small { display: none; }
  .top .lang { display: inline-flex; align-items: center; min-height: 44px; }
  .mobile-menu { display: block; grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
  .mobile-menu summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 .9rem; cursor: pointer; font-weight: 500; }
  .mobile-menu summary::after { content: "+"; font-size: 1.25rem; color: var(--rust); }
  .mobile-menu[open] summary::after { content: "−"; }
  .top .mobile-menu nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .2rem .8rem; padding: 0 .9rem .8rem; }
  .top .mobile-menu nav a { padding: .7rem 0; line-height: 1.4; }
}

/* Home hero: the text sits on paper and the picture rises into it. */
.hero { position: relative; padding-top: clamp(2rem, 6vw, 5rem); overflow: hidden; }
.hero-copy { position: relative; z-index: 1; animation: intro .45s ease-out both; }
.hero h1 { max-width: 11.5em; }
.hero .lead { margin-top: 1.4rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.9rem 1.1rem; margin-top: 2rem; }
.hero .fine { margin-top: 1.1rem; }
.hero-start { margin-top: 1rem; }

.scene {
  position: relative; overflow: hidden; width: 100%; min-width: 0;
}
.scene picture {
  display: block; width: 100%;
  -webkit-mask: url(assets/dither-in.png) 0 0 / auto 96px repeat-x,
                linear-gradient(#000, #000) 0 95px / 100% calc(100% - 190px) no-repeat,
                url(assets/dither-out.png) 0 100% / auto 96px repeat-x;
          mask: url(assets/dither-in.png) 0 0 / auto 96px repeat-x,
                linear-gradient(#000, #000) 0 95px / 100% calc(100% - 190px) no-repeat,
                url(assets/dither-out.png) 0 100% / auto 96px repeat-x;
}
.scene img { display: block; width: 100%; max-width: none; }
.hero .scene { margin-top: clamp(-7rem, -6vw, -2rem); }
.hero .scene img { height: auto; }
.tag {
  position: absolute; z-index: 1; margin: 2px; border-radius: 10px;
  background: var(--card); padding: 0.45rem 0.7rem 0.5rem;
  font: var(--label); color: var(--soft);
}
.tag b { display: block; font: 600 0.95rem/1.2 var(--display); color: var(--ink); }
.tag::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 0.45rem; background: var(--lamp); }
.tag b { display: inline; }
.tag span { display: block; }
.tag.proxy { left: 4%; bottom: 61%; --lamp: var(--lamp-blue); }
.tag.direct { left: 47.5%; bottom: 59%; --lamp: var(--lamp-amber); }
.tag.reject { left: 55%; bottom: 19%; --lamp: var(--lamp-green); }
.scene-note { display: none; }

/* Sub-page headers */
.page-head { padding: clamp(1.5rem, 5vw, 4rem) 0 0; }
.page-head h1 { font-size: clamp(2.3rem, 5vw, 4rem); max-width: 14em; }
.page-head .lead { margin-top: 1.1rem; }
.banner { margin-top: clamp(1.5rem, 3vw, 2.5rem); }
.banner.scene picture { -webkit-mask-size: auto 64px, 100% calc(100% - 126px), auto 64px; mask-size: auto 64px, 100% calc(100% - 126px), auto 64px;
  -webkit-mask-position: 0 0, 0 63px, 0 100%; mask-position: 0 0, 0 63px, 0 100%; }
.banner img { height: clamp(11rem, 27vw, 26rem); object-fit: cover; }

/* Sections */
.part { padding-top: clamp(4rem, 9vw, 7.5rem); }
.part > .wrap > h2 { max-width: 16em; }
.part > .wrap > h2 + p { margin-top: 1.1rem; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.split > div > p + p { margin-top: 1rem; }
.split > div > h2 + p { margin-top: 1.1rem; }
.prose p { max-width: 38em; }
.prose p + p { margin-top: 1rem; }

/* Rows divided by a line of sleepers */
.sleepers { background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 15px) 0 0 / 100% 3px no-repeat; }
.facts > div { display: grid; grid-template-columns: 9.5rem 1fr; gap: 0.2rem 1.5rem; padding: 1rem 0 1.05rem; }
.facts dt { font-weight: 600; }
.facts dd { color: var(--soft); }

/* App screenshot */
.shot { margin-top: clamp(2.5rem, 5vw, 4rem); }
.frame { margin: 0; background: var(--ink); position: relative; overflow: hidden; box-shadow: 0 8px 26px #1c2b2c0b; }
.frame img { width: 100%; }
.frame img[hidden] { display: none; }
.shot figcaption { display: flex; flex-wrap: wrap; gap: 0.6rem 1.5rem; align-items: center; justify-content: space-between; margin-top: 1.1rem; }
.switch { display: inline-flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--switch); }
.switch button {
  font: 500 0.875rem/1 var(--display); min-height: 2.25rem; padding: 0 0.9rem; cursor: pointer;
  background: transparent; color: var(--ink); border: 0; border-radius: 10px;
  transition: background-color .18s, color .18s;
}
.switch button:hover { background: var(--switch-hover); }
.switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* Memory: one block is two mebibytes */
.memory { margin-top: clamp(3rem, 6vw, 5rem); display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.memory h3 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
.memory h3 + p { margin-top: 0.8rem; color: var(--soft); }
.blocks { --b: clamp(7px, 1.05vw, 12px); display: grid; gap: 1.2rem; }
.blocks dt { font-weight: 600; font-size: 0.95rem; display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.blocks dt span { font: var(--label); color: var(--soft); text-align: right; }
.blocks dd { margin-top: 0.4rem; height: calc(var(--b) * 2.2); width: calc(var(--total) * var(--b) / 2);
  background:
    repeating-linear-gradient(90deg, var(--lamp-blue) 0 calc(var(--b) - 2px), transparent 0 var(--b)) 0 0 / calc(var(--client) * var(--b) / 2) 100% no-repeat,
    repeating-linear-gradient(90deg, var(--core-block) 0 calc(var(--b) - 2px), transparent 0 var(--b)); }
.key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 1.2rem; font: var(--label); color: var(--soft); }
.key li::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 0.45rem; background: var(--c); }
.memory .fine { margin-top: 1rem; }

/* Feature grid */
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(1.5rem, 4vw, 3.5rem); margin-top: clamp(2rem, 4vw, 3rem); }
.features li { padding: 1.3rem 0 2rem; }
.features p { margin-top: 0.55rem; color: var(--soft); font-size: 0.98rem; }
.features a { display: inline-block; margin-top: 0.7rem; font-size: 0.9rem; font-weight: 600; }

/* Toolbox on the home page */
.tool-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem clamp(1.5rem, 4vw, 3.5rem); margin-top: clamp(2rem, 4vw, 3rem); }
.tool-group h3 { font: var(--label); color: var(--soft); letter-spacing: 0; padding-bottom: 0.7rem; }
.tool-list a { display: grid; grid-template-columns: 10.5rem 1fr; gap: 0.15rem 1.2rem; padding: 0.8rem 0 0.85rem; text-decoration: none;
  background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 15px) 0 0 / 100% 3px no-repeat; }
.tool-list b { font-family: var(--display); font-weight: 600; }
.tool-list span { color: var(--soft); font-size: 0.95rem; }
.tool-list a:hover span { color: var(--ink); }

/* Night band for the command line */
.night { --soft: #a9bab5; margin-top: clamp(4rem, 9vw, 7.5rem); background: var(--night); color: #e8eee9; position: relative; padding: clamp(3rem, 7vw, 6rem) 0; }
.night::before, .night::after, .memory-section::after { content: ""; position: absolute; left: 0; right: 0; height: 48px; background: var(--night);
  -webkit-mask: url(assets/dither-in.png) 0 0 / auto 48px repeat-x; mask: url(assets/dither-in.png) 0 0 / auto 48px repeat-x; }
.night::before { bottom: 100%; margin-bottom: -1px; }
.night::after, .memory-section::after { top: 100%; margin-top: -1px; -webkit-mask-image: url(assets/dither-out.png); mask-image: url(assets/dither-out.png); }
.night .lead, .night .fine { color: #a9bab5; }
.night a:hover { color: var(--lamp-amber); }
.night :not(pre) > code { background: #ffffff1a; }
.night .frame { --edge: #0b1518; background: #0b1518; }
.night .frame img { height: auto; }
.term { --edge: #0b1518; margin: var(--px); background: #0b1518; color: #dfe9e2; padding: 1.2rem 1.3rem 1.3rem; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.875rem/1.9 var(--pixel); }
.term .p { color: var(--lamp-green); user-select: none; }
.term .c { color: #7f958f; }
.doc .term { margin-top: 1.1rem; }
.doc .term + p, .doc .cards + h3, .doc table + h3 { margin-top: 1.3rem; }
.night .term { margin-top: 1.8rem; }

/* Closing ask */
.ask { padding: clamp(4.5rem, 10vw, 8rem) 0 clamp(3rem, 7vw, 5rem); }
.ask .wrap { display: grid; grid-template-columns: auto 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.ask img { width: clamp(88px, 13vw, 150px); image-rendering: auto; }
.ask h2 { max-width: 14em; }
.ask p { margin-top: 1rem; max-width: 34em; color: var(--soft); }

/* Footer with a length of track */
.foot { margin-top: clamp(3rem, 7vw, 6rem); padding-bottom: 3rem; font-size: 0.9rem; color: var(--soft); }
.track { height: 27px; margin-bottom: 2.5rem;
  background:
    linear-gradient(var(--rust), var(--rust)) 0 6px / 100% 3px no-repeat,
    linear-gradient(var(--rust), var(--rust)) 0 18px / 100% 3px no-repeat,
    repeating-linear-gradient(90deg, #6f5a45 0 9px, transparent 9px 24px); }
.foot .wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) auto auto; gap: 2rem clamp(2rem, 6vw, 5rem); }
.foot .brand { margin-bottom: 0.9rem; }
.foot p { max-width: 30em; }
.site-visitors:not([hidden]) {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
  font-size: 0.875rem;
}
.site-visitors-icon {
  position: relative;
  width: 0.875rem;
  height: 0.875rem;
  flex: none;
  color: var(--rust);
}
.site-visitors-icon::before,
.site-visitors-icon::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.site-visitors-icon::before {
  inset: 0.0625rem auto auto 0.265625rem;
  width: 0.34375rem;
  height: 0.34375rem;
  border-radius: 50%;
}
.site-visitors-icon::after {
  inset: auto 0.0625rem 0.0625rem;
  height: 0.34375rem;
  border-radius: 0.35rem 0.35rem 0.1rem 0.1rem;
}
.site-visitors strong {
  color: var(--ink);
  font-family: var(--pixel);
  font-weight: normal;
}
.foot nav { display: grid; gap: 0.45rem; align-content: start; }
.foot nav a { text-decoration: none; color: var(--ink); }
.foot nav a:hover { color: var(--rust); }

/* Document pages: tools, guide, download */
.doc { padding-top: clamp(2.5rem, 5vw, 4rem); }
.doc h2 { font-size: clamp(1.6rem, 2.6vw, 2.1rem); }
.doc section + section, .doc .group-head { margin-top: clamp(3rem, 6vw, 4.5rem); }
.doc section > h2 + p, .group-head p { margin-top: 0.8rem; }
.doc section > p, .doc section > ul, .doc section > ol { max-width: 42em; }
.doc section > p + p, .doc section > * + h3, .doc section > p + ul, .doc section > ul + p, .doc section > ol + p, .doc section > p + ol { margin-top: 1rem; }
.doc section > * + h3 { margin-top: 2rem; }
.doc section > h3 + p { margin-top: 0.5rem; }
.doc ul.dots li, .doc ol.steps li { position: relative; padding-left: 1.5rem; margin-top: 0.45rem; }
.doc ul.dots li::before { content: ""; position: absolute; left: 0.2rem; top: 0.72em; width: 6px; height: 6px; background: var(--rust); }
.doc ol.steps { counter-reset: step; }
.doc ol.steps li { counter-increment: step; padding-left: 2.2rem; margin-top: 0.7rem; }
.doc ol.steps li::before { content: counter(step); position: absolute; left: 0; top: 0.22em; width: 1.45rem; height: 1.45rem; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 0.75rem/1 var(--pixel); }
.group-head p { color: var(--soft); }
.with-toc { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); align-items: start; }
.toc { position: sticky; top: 1.5rem; font-size: 0.92rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: .7rem; }
.toc summary { cursor: pointer; padding: .5rem; }
.toc nav { display: grid; gap: .15rem; margin-top: .4rem; }
.toc a { text-decoration: none; padding: 0.3rem 0 0.3rem 0.9rem; color: var(--soft); border-left: var(--px) solid transparent; }
.toc a:hover { color: var(--ink); }
.toc a[aria-current] { color: var(--ink); border-left-color: var(--rust); font-weight: 600; }

.table-scroll { overflow-x: auto; margin-top: 1.2rem; }
table.plain { width: 100%; border-collapse: collapse; margin-top: 1.2rem; font-size: 0.95rem; }
.table-scroll table.plain { margin-top: 0; }
.plain th, .plain td { text-align: left; vertical-align: top; padding: 0.7rem 1.2rem 0.75rem 0; }
.plain thead th { font: var(--label); color: var(--soft); border-bottom: var(--px) solid var(--ink); white-space: nowrap; }
.plain tbody tr { background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 15px) 0 100% / 100% 3px no-repeat; }
.plain tbody th { font-weight: 600; }
.plain td { color: var(--soft); }
.plain td code, .plain th code { white-space: nowrap; }
.chip { display: inline-block; margin: 0.2rem 0.5rem 0.2rem 0; padding: 0.2rem 0.6rem 0.25rem; border-radius: 8px; background: var(--card); color: var(--ink); text-decoration: none; font: 500 0.9rem/1.4 var(--display); transition: background-color .18s, color .18s; }
.chip:hover { background: var(--ink); color: var(--paper); }

.tool { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 1rem clamp(1.5rem, 5vw, 4rem); padding: 1.8rem 0 2rem; margin-top: 1.5rem;
  background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 15px) 0 0 / 100% 3px no-repeat; scroll-margin-top: 1rem; }
.tool h3 { font-size: 1.45rem; }
.tool .command { display: inline-block; max-width: 100%; margin-top: 0.8rem; border-radius: 9px; background: var(--command-paper); color: var(--command-ink); padding: 0.4rem 0.65rem; font-size: 0.8rem; line-height: 1.5; white-space: normal; overflow-wrap: anywhere; }
.tool .label { margin-top: 1.2rem; }
.options { margin-top: 0.35rem; font-size: 0.85rem; color: var(--soft); display: grid; gap: 0.25rem; }
.options code { background: none; padding: 0; color: var(--ink); }
.tool-body { display: grid; gap: 1rem; }
.tool-body dt { font: var(--label); color: var(--soft); }
.tool-body dd { margin-top: 0.2rem; max-width: 40em; }
.tool:target h3 { color: var(--rust); }

.card { --edge: var(--line); margin: 0; background: var(--card); padding: 1.3rem 1.4rem 1.4rem; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem; margin-top: 1.5rem; }
.card h3 { font-size: 1.1rem; }
.card p { margin-top: 0.5rem; font-size: 0.95rem; color: var(--soft); }
.card pre { margin-top: 0.8rem; font-size: 0.78rem; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }

/* Download page */
.release { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; margin-top: 1.5rem; }
.release-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; align-items: baseline; font-size: 0.92rem; color: var(--soft); }
.release-meta b { font: 0.9rem/1 var(--pixel); color: var(--ink); }
.os { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem clamp(1.5rem, 5vw, 4rem); padding: 2rem 0 2.2rem; margin-top: 0 !important; scroll-margin-top: 1rem;
  background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 15px) 0 0 / 100% 3px no-repeat; }
.os-list { margin-top: 2rem; }
.os h2 { font-size: 1.6rem; }
.os h2 + p { color: var(--soft); font-size: 0.92rem; margin-top: 0.3rem; }
.yours { display: inline-block; margin-top: 0.8rem; border-radius: 6px; font: var(--label); line-height: 1; padding: 0.4rem 0.55rem; background: #45b55a30; color: var(--yours-ink); }
.yours:empty { display: none; }
.pkgs { display: grid; gap: 0.9rem; }
.pkgs li { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; align-items: center; }
.pkgs .btn { min-width: 15.5rem; justify-content: space-between; }
.pkgs .btn span { font: 0.75rem/1 var(--pixel); opacity: 0.8; }
.pkgs .sum { display: inline-flex; align-items: center; min-height: 2.75rem; font-size: 0.9rem; }
.pkgs em { font-style: normal; font-size: 0.9rem; color: var(--soft); }
.how { margin-top: 1.3rem; max-width: 40em; font-size: 0.97rem; }
.how + .how { margin-top: 0.7rem; }
.qa { margin-top: 1.5rem; max-width: 46em; }
.qa details { background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 15px) 0 0 / 100% 3px no-repeat; }
.qa summary { cursor: pointer; padding: 1rem 0; font-weight: 600; }
:lang(zh-CN) .qa summary { font-weight: 500; }
.qa details p { padding: 0 0 1.2rem; color: var(--soft); }
noscript p { margin-top: 1.5rem; padding: 1rem 1.2rem; background: #f0a21f33; }

@media (max-width: 900px) {
  .split, .memory, .with-toc { grid-template-columns: 1fr; }
  .features, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-groups { grid-template-columns: 1fr; }
  .tool, .os { grid-template-columns: 1fr; }
  .toc { position: static; }
  .toc summary { min-height: 44px; }
  .toc nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc a { padding-block: .65rem; line-height: 1.5; }
  .foot .wrap { grid-template-columns: 1fr 1fr; }
  .foot .wrap > div { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .wrap { width: calc(100% - 2.2rem); }
  .hero .scene { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .5rem; }
  .hero .scene picture { grid-column: 1 / -1; grid-row: 1; }
  .scene picture { -webkit-mask-size: auto 48px, 100% calc(100% - 94px), auto 48px; mask-size: auto 48px, 100% calc(100% - 94px), auto 48px;
    -webkit-mask-position: 0 0, 0 47px, 0 100%; mask-position: 0 0, 0 47px, 0 100%; }
  .hero .tag { position: static; grid-row: 1; align-self: start; min-width: 0; margin: .5rem 2px 0; padding: .35rem .45rem; font-size: .75rem; line-height: 1.4; }
  .hero .tag b { font-size: .875rem; }
  .hero .tag::before { width: 6px; height: 6px; margin-right: .3rem; }
  .hero .tag.proxy { grid-column: 1; }
  .hero .tag.direct { grid-column: 2; }
  .hero .tag.reject { grid-column: 3; }
  .chip { display: inline-flex; align-items: center; min-height: 44px; }
  :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
  .scene-note { display: block; margin-top: 0.8rem; }
  .features, .cards { grid-template-columns: 1fr; }
  .facts > div, .tool-list a { grid-template-columns: 1fr; }
  .ask .wrap { grid-template-columns: 1fr; }
  .pkgs .btn { flex: 1 1 100%; }
  .plain.symptoms :is(thead) { display: none; }
  .plain.symptoms :is(tr, th, td) { display: block; padding-right: 0; }
  .plain.symptoms th { padding-bottom: 0.1rem; }
  .plain.symptoms td { padding-top: 0; }
}
/* Version notes share the same paper and railway rhythm as the rest of the site. */
.version-heading { display:flex; align-items:baseline; justify-content:space-between; flex-wrap:wrap; gap:1.5rem; margin-bottom:2.5rem; }
.version-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:2.5rem; margin-top:2rem; }
.version-entry { min-width:0; border-top:2px solid var(--line); padding-top:1.5rem; }
.version-label { color:var(--rust); font-size:1rem; margin-bottom:1rem; }
.version-number { font-family:var(--pixel); font-size:.95rem; overflow-wrap:anywhere; margin-top:.6rem; }
.version-entry ul { list-style:disc; padding-left:1.2rem; margin-top:1.2rem; color:var(--soft); }
.version-entry li + li { margin-top:.6rem; }
.version-entry h2 { font-size:1.7rem; }
.release-history { margin-top:3rem; padding-top:2rem; border-top:3px dashed var(--line); }
.doc .release-archive { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 2.5rem; max-width:none; list-style:none; padding:0; }
.release-archive > li { padding:1.25rem 0; border-bottom:1px solid var(--line); }
.release-archive h3 { display:inline; font-size:1.1rem; margin-right:1rem; }
.release-archive time { color:var(--soft); font-size:.9rem; white-space:nowrap; }
.release-archive p { margin:.5rem 0 0; }
.version-links { display:flex; flex-wrap:wrap; gap:1.4rem; margin-top:1.5rem; }
.release-known { margin-top:1.2rem; color:var(--soft); }
@media(max-width:640px) { .version-grid, .doc .release-archive { grid-template-columns:1fr; } .version-entry h3 { font-size:1.35rem; } }
.split > *, .memory > *, .with-toc > *, .cards > * { min-width:0; }
.term { max-width:100%; }
.terminal-shot { min-width: 0; }
.night .wrap.split { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
.night .term { max-width: none; }
.part:not(.memory-section) + .part > .wrap {
  border-top: 3px dashed var(--line); padding-top: clamp(2rem, 4vw, 3rem);
}
.foot nav a { justify-self: start; width: fit-content; }
.mobile-menu { overflow: clip; }
.mobile-menu summary::after { transition: transform .2s; }
.mobile-menu[open] summary::after { transform: rotate(180deg); }
main { animation: page-enter .24s ease-out both; }
.capture-open img { transition: filter .18s; }
.capture-open:hover img { filter: brightness(1.04); }
.scene img, .brand-wordmark { transition: opacity .14s ease-out; }
.theme-loading .scene img, .theme-loading .brand-wordmark { opacity: 0; }
@keyframes page-enter { from { opacity: .35; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@media(prefers-reduced-motion:no-preference) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root) { animation: page-leave .12s ease-in both; }
::view-transition-new(root) { animation: page-enter .2s ease-out both; }
@keyframes page-leave { to { opacity: 0; } }
/* Benchmarks are readable content, not decorative counters. */
.hero-benefit { margin-top:1.1rem; font-size:1.05rem; color:var(--ink); max-width:35em; }
.hero-benefit a { white-space:nowrap; }
.memory-section { position:relative; background:var(--sky); padding-bottom:clamp(2rem,4vw,3rem); margin-bottom:48px; }
.memory-section::after { background:var(--sky); }
.memory-section .lead { margin-top:1.3rem; }
.memory-stats { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:2rem; margin-top:2.5rem; }
.memory-tui { grid-template-columns:repeat(2,minmax(0,1fr)); }
.memory-stats > div { border-top:2px solid var(--line); padding-top:1rem; }
.memory-stats dt { font-size:1.15rem; }
.memory-stats dd { margin-top:1rem; }
.memory-stats strong { font:500 clamp(2.8rem,5vw,4.5rem)/1 var(--display); letter-spacing:-.04em; }
.memory-stats dd span { display:block; color:var(--soft); font-size:1rem; margin-top:.5rem; }
.memory-stats p { margin-top:.5rem; }
.benchmark-context { margin-top:2rem; font-size:1rem; color:var(--soft); }
.benchmark-details { margin-top:1rem; max-width:60em; overflow:clip; }
.benchmark-details summary { cursor:pointer; }
.benchmark-body { padding-top:1rem; }
.benchmark-details p { margin-top:1rem; }
.benchmark-body > :first-child { margin-top:0; }
.app-demo { margin-top:3rem; }
.app-demo > p { margin-top:1rem; color:var(--soft); }
.demo-controls { display:flex; align-items:center; flex-wrap:wrap; gap:1rem; margin:1.5rem 0; }
.demo-controls .switch { flex-wrap:wrap; }
.demo-controls button { min-height:44px; }
.demo-view { background:var(--sky); border:1px solid var(--line); border-radius:var(--radius); padding:1.2rem; }
.demo-view { display: grid; grid-template-columns: minmax(0, 1fr); }
.demo-view > [data-demo-frame] { grid-area: 1 / 1; }
.demo-view [data-demo-frame][hidden] { display:block; visibility:hidden; pointer-events:none; }
.demo-view [data-demo-frame]:not([hidden]) { animation:demo-reveal .3s ease-out; }
.demo-view .frame { max-width:100%; }
.demo-view figure.phone .frame { max-width:360px; margin-inline:auto; }
.demo-view img { width:100%; height:auto; }
.demo-view figure.phone img { max-height:650px; object-fit:contain; }
.demo-view figcaption { margin-top:1rem; font-size:1rem; }
.demo-status { min-height:1.6em; }
@keyframes demo-reveal { from {opacity:.3;transform:translateY(6px)} to {opacity:1;transform:none} }
@keyframes intro { from {opacity:.6;transform:translateY(8px)} to {opacity:1;transform:none} }
@media(max-width:640px) { .memory-stats { grid-template-columns:1fr; gap:1.5rem; } .memory-stats strong { font-size:3.5rem; } .demo-view { padding:.7rem; } .demo-controls .switch { max-width:100%; } }
.product-shot { margin-top:1.5rem; }
.capture-open { display: block; cursor: zoom-in; }
.capture-script, .capture-fallback-dark { display: none; }
.js .capture-script { display: block; }
@media (prefers-color-scheme: dark) {
  .capture-fallback-light { display: none; }
  .capture-fallback-dark { display: block; }
}
.image-view { width: min(1500px, 96vw); max-height: 94dvh; padding: .8rem; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); }
.image-view::backdrop { background: #0b1518c9; }
.image-tools { display: flex; justify-content: flex-end; margin-bottom: .8rem; }
.image-view img { width: 100%; }
.manual-nav { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.manual-nav a { display: inline-flex; align-items: center; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; padding: .5rem 1rem; background: var(--card); text-decoration: none; transition: color .18s, background-color .18s; }
.manual-nav a[aria-current], .manual-nav a:hover { background: var(--ink); color: var(--paper); }
.manual-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.manual-cards .more { margin-top: .8rem; display: inline-block; }
.night .product-shot { margin-top:0; }
.product-shot figcaption { margin-top:.7rem; color:var(--soft); font-size:.85rem; }
.product-shot.phone .frame { max-width:340px; margin-inline:auto; }
.tool-side, .tool-body { min-width:0; }
.source-note { padding:1rem 1.2rem; border:1px solid var(--source-line); border-radius:var(--radius); background:var(--source-wash); font-size:.95rem; }
.interface-links { display:flex; flex-wrap:wrap; gap:.7rem; margin-top:1.1rem; }
.terminal-title { padding:.6rem 1rem; border:1px solid #294047; border-bottom:0; border-radius:var(--radius) var(--radius) 0 0; background:#1b3037; color:#bcd2ce; font:.8rem/1.5 var(--pixel); }
.terminal-capture { margin:0; padding:1rem; white-space:pre-wrap; overflow-wrap:anywhere; border:1px solid #294047; border-radius:0 0 var(--radius) var(--radius); background:#0b1518; color:#dfe9e2; font:.8rem/1.55 var(--pixel); tab-size:4; }
.terminal-capture .terminal-rule { display:inline-block; max-inline-size:100%; overflow:hidden; white-space:pre; vertical-align:top; }
.terminal-capture .tone-muted { color:#9ab2aa; }
.terminal-capture .tone-accent { color:#71d1ab; }
.terminal-capture .tone-warning { color:#efad88; }
.terminal-capture .tone-selected { color:#0b1518; background:#71d1ab; }
@media(max-width:640px) {
  .manual-nav a { flex: 1 1 auto; justify-content: center; padding-inline: .6rem; }
  .manual-cards { grid-template-columns: 1fr; }
  .doc .term, .terminal-capture { font-size: .75rem; padding: .8rem; }
  .plain th, .plain td { padding-right: .8rem; }
  .tool-options, .tool-options tbody, .tool-options tr, .tool-options tbody th, .tool-options td { display:block; }
  .tool-options thead { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip-path:inset(50%); }
  .tool-options tr { padding-bottom:1rem; margin-bottom:1rem; border-bottom:1px dashed var(--line); }
  .tool-options tbody th, .tool-options td { border:0; padding:.35rem 0; }
  .tool-options td::before { content:attr(data-label) ": "; font-weight:600; color:var(--ink); }
}
@media(prefers-reduced-motion:reduce) {
  html { scroll-behavior:auto; }
  *, *::before, *::after { animation:none !important; transition:none !important; }
  .btn:hover, .btn:active { transform:none; }
}
