/* farfarfun 包仓库的样式。
 *
 * 设计语言沿用 funclash 的站点：同一套颜色 token、同一套圆角和弹簧曲线、同样的
 * 「左边一条窄栏写标题、右边放内容」的分节骨架 —— 一个组织的两个站点不该看起来像
 * 两家公司。funclash 那边 app 落地页专属的东西（平台轮播、canvas 粒子场、滚动视差）
 * 没有搬过来：这是一个加源页面，它该快。
 *
 * 深浅两套主题都走 CSS 变量，页面上的脚本只改 <html data-theme>。
 */

:root {
  --bg: #f3efea;
  --surface: #fbf9f6;
  --raise: #e9e3dc;
  --chip: #fbf9f6;
  --ink: #262122;
  --ink-2: #5c5354;
  --ink-3: #72686a;
  --line: rgb(38 33 34 / 0.1);
  --line-strong: rgb(38 33 34 / 0.2);
  --accent: #6b5059;
  --accent-soft: #e5d9da;
  --on-accent: #fbf7f4;

  --g1: #7d79b0;
  --g2: #58738f;
  --g3: #92b1ca;

  --feat: #74876c;
  --fix: #677d91;
  --perf: #b08568;
  --breaking: #ad5d57;
  --revert: #8c8284;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei",
    "Noto Sans CJK SC", "Noto Sans SC", system-ui, Roboto, sans-serif;
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
    "Segoe UI", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", "Roboto Mono", Menlo, Consolas,
    monospace;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --rail: 280px;
  --nav-h: 60px;
  --gutter: clamp(16px, 4vw, 40px);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-pop: cubic-bezier(0.34, 1.56, 0.64, 1);

  color-scheme: light;
}

@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --spring: linear(0, 0.0072, 0.0283 2.4%, 0.1123 5.1%, 0.5374 16.4%, 0.7337 22.6%, 0.8682 28.6%,
      0.9203 31.6%, 0.9601 34.8%, 0.9914 38.6%, 1.0131 42.8%, 1.0247 47.7%, 1.0276 53.5%, 1.0206 61.3%,
      1.0054 75.6%, 0.9994 90%, 1);
    --spring-pop: linear(0, 0.0284 1.4%, 0.1185 3%, 0.4925 8.5%, 0.8077 14.1%, 1.0074 19.3%, 1.1146 24.4%,
      1.1471 28.3%, 1.1445 31.8%, 1.0986 38.6%, 1.0294 47.4%, 0.9906 55.6%, 0.9826 61.5%, 0.9918 71.8%,
      1.0019 85%, 1);
  }
}

/* 深色的两份值是一样的：一份跟系统，一份跟页面上的开关。CSS 里没法把「媒体查询」
   和「属性选择器」写成一条或的关系，而把它拆成变量再引用会多一层间接。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181617;
    --surface: #211e1f;
    --raise: #2b2728;
    --chip: #3d3839;
    --ink: #ebe5e2;
    --ink-2: #bdb3b2;
    --ink-3: #978d8d;
    --line: rgb(235 229 226 / 0.09);
    --line-strong: rgb(235 229 226 / 0.18);
    --accent: #dcc3c8;
    --accent-soft: #3a3033;
    --on-accent: #33262a;
    --g1: #9a96cb;
    --g2: #6f90b4;
    --g3: #a2c4de;
    --feat: #a9bb9f;
    --fix: #9fb3c5;
    --perf: #d9b093;
    --breaking: #e08d85;
    --revert: #978d8d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #181617;
  --surface: #211e1f;
  --raise: #2b2728;
  --chip: #3d3839;
  --ink: #ebe5e2;
  --ink-2: #bdb3b2;
  --ink-3: #978d8d;
  --line: rgb(235 229 226 / 0.09);
  --line-strong: rgb(235 229 226 / 0.18);
  --accent: #dcc3c8;
  --accent-soft: #3a3033;
  --on-accent: #33262a;
  --g1: #9a96cb;
  --g2: #6f90b4;
  --g3: #a2c4de;
  --feat: #a9bb9f;
  --fix: #9fb3c5;
  --perf: #d9b093;
  --breaking: #e08d85;
  --revert: #978d8d;
  color-scheme: dark;
}

@supports (corner-shape: squircle) {
  :root {
    --r-sm: 12px;
    --r-md: 18px;
    --r-lg: 28px;
  }

  .tool,
  .nav-links a,
  .eyebrow,
  .btn,
  .seg,
  .seg button,
  .seg-ink,
  .file,
  .kind,
  .go,
  .tip,
  .cmd,
  .copy,
  .search,
  .card,
  .chip,
  .entry,
  .scope,
  .latest {
    corner-shape: squircle;
  }
}

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

html {
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

code {
  font-family: var(--font-mono);
}

.wrap {
  width: 100%;
  max-width: calc(1120px + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  transition: top 0.2s var(--ease-out);
}

.skip:focus {
  top: 12px;
}

/* ---- 顶栏 ---- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.3s;
}

.nav.scrolled {
  border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--nav-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.glyph {
  width: 22px;
  height: 26px;
  flex: none;
}

.sig-1 {
  fill: var(--g1);
  stroke: var(--g1);
}

.sig-2 {
  fill: var(--g2);
  stroke: var(--g2);
}

.sig-3 {
  fill: var(--g3);
  stroke: var(--g3);
}

.nav-links,
.nav-tools {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links {
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar {
  display: none;
}

.nav-tools {
  margin-inline-start: auto;
}

.nav-links a,
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  min-width: 34px;
  padding-inline: 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-2);
  font-size: 14px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.tool {
  font-size: 13px;
  font-weight: 500;
}

.nav-links a:hover,
.tool:hover {
  color: var(--ink);
  background: var(--raise);
}

.nav-links a[aria-current="true"] {
  color: var(--ink);
}

.theme-icon {
  transition: transform 0.7s var(--spring-pop);
}

:root[data-theme="dark"] .theme-icon {
  transform: rotate(180deg);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon {
    transform: rotate(180deg);
  }
}

/* ---- 首屏 ---- */

.hero {
  position: relative;
  isolation: isolate;
  padding-top: clamp(36px, 7vw, 76px);
}

.hero-inner {
  display: grid;
  justify-items: start;
  gap: 26px;
}

.deco {
  position: absolute;
  top: 0;
  right: 0;
  z-index: -1;
  width: min(1200px, 92%);
  height: 100%;
  color: var(--line-strong);
  opacity: 0.85;
  pointer-events: none;
}

.deco .sig {
  stroke: none;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 13px;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.eyebrow:hover {
  color: var(--ink);
  background: var(--raise);
  border-color: transparent;
}

.eyebrow svg {
  transition: transform 0.5s var(--spring-pop);
}

.eyebrow:hover svg {
  transform: translateX(3px);
}

.pulse {
  position: relative;
  width: 16px;
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  flex: none;
}

.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--accent);
}

.display {
  max-width: 22em;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 6.4vw, 74px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
  text-wrap: balance;
}

:root:lang(zh-CN) .display {
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.display.mono {
  font-family: var(--font-mono);
  font-size: clamp(34px, 5.4vw, 60px);
  font-weight: 650;
  letter-spacing: -0.03em;
}

.lede {
  max-width: 34em;
  margin: 0;
  color: var(--ink-2);
  font-size: clamp(16px, 1.7vw, 18px);
  line-height: 1.6;
  text-wrap: pretty;
}

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-md);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.6s var(--spring), background-color 0.2s, color 0.2s;
}

.btn:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

.btn.primary {
  min-height: 48px;
  padding: 9px 22px;
  background: var(--accent);
  color: var(--on-accent);
}

.btn.primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
}

.btn.quiet {
  position: relative;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 14px;
}

.btn.quiet::after,
.foot-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1.5px;
  border-radius: 99px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s var(--spring);
}

.btn.quiet:hover,
.foot-links a:hover {
  color: var(--ink);
}

.btn.quiet:hover::after,
.foot-links a:hover::after {
  transform: scaleX(1);
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px 32px;
  width: 100%;
  margin: clamp(10px, 2vw, 22px) 0 0;
  padding: 28px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.facts li {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.facts li::before {
  content: "";
  width: 16px;
  height: 6px;
  margin: 4px 0 12px;
  border-radius: 99px;
  background: var(--hue, var(--accent));
  transform: rotate(-30deg);
  transform-origin: 3px 50%;
  transition: width 0.6s var(--spring-pop);
}

.facts li:hover::before {
  width: 28px;
}

.facts li:nth-child(1) {
  --hue: var(--g1);
}

.facts li:nth-child(2) {
  --hue: var(--feat);
}

.facts li:nth-child(3) {
  --hue: var(--perf);
}

.facts li:nth-child(4) {
  --hue: var(--fix);
}

.facts b {
  font-size: 14px;
  font-weight: 600;
}

.facts span {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.55;
}

/* ---- 标签 ---- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.chip.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--ink-3);
  font-weight: 500;
}

/* ---- 分节骨架 ---- */

.section {
  padding-top: clamp(72px, 10vw, 128px);
  scroll-margin-top: var(--nav-h);
}

.rail-grid {
  display: grid;
  grid-template-columns: minmax(0, var(--rail)) minmax(0, 1fr);
  gap: 32px 56px;
}

.rail {
  align-self: start;
  display: grid;
  gap: 12px;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.cap {
  width: 20px;
  height: 6px;
  border-radius: 99px;
  background: var(--accent);
  transform: rotate(-30deg);
  transform-origin: 3px 50%;
}

h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(28px, 3.8vw, 38px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  text-wrap: balance;
}

.section-sub {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.section-sub:empty {
  display: none;
}

.rail-text {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 14px;
  text-wrap: pretty;
}

.rail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 2px 0 0;
  font-size: 13.5px;
}

.rail-links a {
  color: var(--ink-2);
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  transition: color 0.2s, text-decoration-color 0.2s;
}

.rail-links a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.rail-note {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  color: var(--ink-3);
  font-size: 12.5px;
}

.rail-note code {
  font-size: 11.5px;
  line-height: 1.5;
  word-spacing: 2px;
  overflow-wrap: anywhere;
}

.col {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

/* ---- 分段控件与面板 ---- */

.panes {
  min-width: 0;
}

.seg {
  position: relative;
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--raise);
  overflow-x: auto;
  scrollbar-width: none;
}

.seg::-webkit-scrollbar {
  display: none;
}

.seg button {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  padding: 7px 16px;
  border: 0;
  border-radius: calc(var(--r-md) - 4px);
  background: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.25s, transform 0.5s var(--spring);
}

.seg button:hover,
.seg button[aria-selected="true"] {
  color: var(--ink);
}

.seg button:active {
  transform: scale(0.94);
  transition-duration: 0.12s;
}

/* 选中项底下那块「墨」。由脚本定位（宽度 + 位移），所以初次定位时要先关掉过渡，
   否则进页面会看到它从左边滑过来。 */
.seg-ink {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: 0;
  border-radius: calc(var(--r-md) - 4px);
  background: var(--chip);
  transition: transform 0.5s var(--spring), width 0.5s var(--spring);
}

.seg-ink.still {
  transition: none;
}

.pane {
  margin-top: 18px;
}

.pane-hint {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 14px;
  text-wrap: pretty;
}

.pane-note {
  margin: 0;
  color: var(--ink-3);
  font-size: 13.5px;
}

.pane-note a {
  color: var(--accent);
  text-decoration: none;
}

.pane-note a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sub-label {
  margin: 16px 0 6px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.extras {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.extras:empty {
  display: none;
}

.tip {
  display: grid;
  gap: 10px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.tip h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.tip p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  text-wrap: pretty;
}

.tip a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}

.tip a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.flow {
  margin: 0;
  overflow-x: auto;
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
}

/* ---- 命令块 ---- */

.cmd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 5px 5px 5px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

/* 命令换行而不是横向滚动：加源那三行里有一条很长的 URL，横着滚的话最关键的
   `deb stable main` 会藏在视口外面，而看不见的命令等于没给。复制走的是 textContent，
   折行不影响复制出来的内容。 */
.cmd pre {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-block: 7px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s, transform 0.5s var(--spring);
}

.copy:hover {
  color: var(--ink);
  background: var(--raise);
}

.copy:active {
  transform: scale(0.88);
  transition-duration: 0.12s;
}

.copy svg {
  grid-area: 1 / 1;
  transition: opacity 0.2s, transform 0.5s var(--spring-pop);
}

.copy .ico-check {
  opacity: 0;
  transform: scale(0.4) rotate(-30deg);
}

.copy.done {
  color: var(--accent);
}

.copy.done .ico-copy {
  opacity: 0;
  transform: scale(0.4);
}

.copy.done .ico-check {
  opacity: 1;
  transform: none;
}

/* ---- 包卡片 ---- */

/* 260px 的话宽屏上只排得出两列（右列 784px，差几个像素），九个包最后一张落单。 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, var(--surface) calc(50% - 0.5px), transparent 50%) 100% 0 / 260% 100%
    no-repeat;
  transition: background-position 0.55s var(--ease-out), border-color 0.25s;
}

.card:hover,
.card:focus-within {
  border-color: var(--line-strong);
  background-position: 0 0;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.card-head::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.card-head:focus-visible {
  outline: none;
}

.card-head:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.card-name {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

/* 显示名（uTools 插件那种中文名）不走等宽：等宽排中文是一个字一个格，而等宽的理由
   —— 这串字你要照着敲 —— 在显示名上一条都不成立。 */
.card-name.plain {
  font-family: inherit;
}

.card-head .ver {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--raise);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.card-head .go {
  margin-inline-start: auto;
}

.card-desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

.card-meta {
  margin: 0;
  color: var(--ink-3);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.go {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-2);
  overflow: clip;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s, scale 0.6s var(--spring-pop);
}

.card:hover .go,
.card:focus-within .go,
.file:hover .go,
.file:focus-within .go {
  border-color: transparent;
  background: var(--accent);
  color: var(--on-accent);
  scale: 1.08;
}

/* ---- 文件行 ---- */

.files {
  margin: 0;
  padding: 0;
  list-style: none;
}

.arch-label {
  margin: 18px 0 2px;
  padding-inline: 14px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.arch-label:first-child {
  margin-top: 2px;
}

.file {
  position: relative;
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto 36px;
  grid-template-areas: "kind main meta go";
  align-items: center;
  gap: 4px 16px;
  padding: 14px;
  border-radius: var(--r-md);
  background: linear-gradient(150deg, var(--raise) calc(50% - 0.5px), transparent 50%) 100% 0 / 260% 100%
    no-repeat;
  transition: background-position 0.55s var(--ease-out);
}

.file::before {
  content: "";
  position: absolute;
  top: 0;
  left: 14px;
  right: 14px;
  height: 1px;
  background: var(--line);
  transition: opacity 0.2s;
}

.file:first-child::before,
.arch-label + .file::before,
.file:hover::before,
.file:hover + .file::before,
.file:focus-within::before,
.file:focus-within + .file::before {
  opacity: 0;
}

.file:hover,
.file:focus-within {
  background-position: 0 0;
}

.kind {
  grid-area: kind;
  display: grid;
  place-items: center;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: transform 0.6s var(--spring-pop);
}

.file:hover .kind {
  transform: translateY(-2px) rotate(-4deg);
}

.file-main {
  grid-area: main;
  min-width: 0;
}

.file-title {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.file-title::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.file-title:focus-visible {
  outline: none;
}

.file-title:focus-visible::after {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.note {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.5;
}

.meta {
  grid-area: meta;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sha {
  position: relative;
  z-index: 1;
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
  cursor: pointer;
  transition: color 0.2s, background-color 0.2s;
}

.sha:hover {
  color: var(--ink);
  background: var(--bg);
}

.sha.done {
  color: var(--accent);
}

.file .go {
  grid-area: go;
}

/* ---- 版本行 ---- */

.rows {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: center;
  gap: 10px 24px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.row:first-child {
  border-top: 0;
}

.row-main {
  min-width: 0;
}

.row .cmd {
  width: min(100%, 420px);
}

/* 认不出结构的更新日志：一行只有版本号和日期，没有右边那条安装命令。按版本一节的
   行高一行一行铺下去，就是几个大标题吊在一片空白里 —— 铺成几列，紧一点。 */
.rows.compact {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 2px 20px;
}

/* 多列之后「第一行不画线」就不成立了：第一列不画、第二第三列画，看着像没对齐。
   每一格都画，顶上那条横跨右列的线正好当这一节的起笔。 */
.rows.compact .row {
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.rows.compact .ver {
  font-size: 18px;
}

.rows.compact .note {
  margin-top: 2px;
}

.ver-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ver {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.3;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
}

.ver svg {
  opacity: 0;
  transition: opacity 0.2s;
}

.ver:hover {
  color: var(--accent);
}

.ver:hover svg {
  opacity: 1;
}

.latest {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}

/* ---- 更新日志 ---- */

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  margin-top: 6px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-3);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.search input::placeholder {
  color: var(--ink-3);
}

.search kbd {
  padding: 0 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 18px;
  transition: opacity 0.2s, scale 0.4s var(--spring-pop);
}

.search:focus-within kbd {
  opacity: 0;
  scale: 0.6;
}

.cl-status {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
}

.cl-status:empty {
  display: none;
}

.timeline {
  display: grid;
}

.release {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  column-gap: 28px;
}

.release-head {
  align-self: start;
  display: grid;
  gap: 2px;
  padding-block: 22px;
}

.release-body {
  position: relative;
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 26px 0 26px 30px;
  border-left: 1px solid var(--line);
}

.release-body::before {
  content: "";
  position: absolute;
  top: 34px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--ink-3);
  box-shadow: 0 0 0 4px var(--bg);
  transform: rotate(-30deg);
  transform-origin: 3.5px 50%;
  transition: width 0.6s var(--spring-pop), background-color 0.2s;
}

.release:hover .release-body::before {
  width: 20px;
  background: var(--accent);
}

.when {
  color: var(--ink-3);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.when a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

.when a:hover {
  color: var(--accent);
}

.group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

:root:lang(en) .group-title {
  text-transform: uppercase;
}

.mark {
  width: 14px;
  height: 6px;
  border-radius: 3px;
  background: var(--type, var(--revert));
  transform: rotate(-30deg);
}

.group[data-type="feat"] {
  --type: var(--feat);
}

.group[data-type="fix"] {
  --type: var(--fix);
}

.group[data-type="fix"] .mark {
  width: 10px;
}

.group[data-type="perf"] {
  --type: var(--perf);
}

.group[data-type="perf"] .mark {
  width: 6px;
  border-radius: 50%;
  transform: none;
}

.group[data-type="breaking"] {
  --type: var(--breaking);
}

.entries {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  margin-inline: -10px;
  padding: 6px 10px;
  border-radius: var(--r-sm);
  line-height: 1.55;
  transition: background-color 0.15s;
}

.entry:hover {
  background: var(--raise);
}

.plain .entry {
  position: relative;
  padding-left: 26px;
}

.plain .entry::before {
  content: "";
  position: absolute;
  left: 11px;
  top: calc(6px + 0.775em - 2px);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-3);
  opacity: 0.6;
}

.entry-text {
  min-width: 0;
  overflow-wrap: anywhere;
  transition: translate 0.5s var(--spring);
}

.entry:hover .entry-text {
  translate: 4px 0;
}

.scope {
  display: inline-block;
  margin-inline-end: 8px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--raise);
  color: var(--ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
  vertical-align: 1px;
  transition: background-color 0.15s;
}

.entry:hover .scope {
  background: var(--bg);
}

.hash {
  padding-top: 2px;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.15s;
}

.entry:hover .hash,
.hash:focus-visible {
  color: var(--accent);
}

/* 「索引还没建起来」这类提示。给它一个虚线框而不是一行灰字：空着的这块本来该有东
   西，看起来得像「这里暂时没有」，而不像页面渲染漏了一段。 */
.empty {
  margin: 0;
  padding: 18px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--ink-2);
  font-size: 14px;
}

/* ---- 截图 ---- */

/* 一个包的截图里，手机竖图和桌面横图经常混着来。两种都按右列的宽度铺的话，一张
   780×1688 的竖图就是 1700px 高 —— 三张能把一页撑到七千像素，而这一节讲的只是
   「长什么样」。所以竖的并排铺成一行几张，横的占满一行但限高；两种都不许超过一屏。 */
.shots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  align-items: start;
  gap: 22px 16px;
}

.shot {
  margin: 0;
}

.shot img {
  display: block;
  width: 100%;
  height: auto;
  margin-inline: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
}

.shot.wide {
  grid-column: 1 / -1;
}

.shot.wide img {
  width: auto;
  max-width: 100%;
  max-height: min(58vh, 520px);
}

/* 横图三张以上的包（uTools 插件的截图基本都是桌面窗口）：一张一行要滚三四屏，而这
   一节只是让人看一眼长什么样。两张一行，看原图还是去项目仓库。 */
.shots.pairs {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.shots.pairs .shot.wide {
  grid-column: auto;
}

.shots.pairs .shot.wide img {
  max-height: min(42vh, 380px);
}

/* 竖图自己也有个上限：只有一张截图时列会铺满整个右列，而一张手机图放到 780px 宽
   没有任何意义 —— 它在手机上也没那么大。 */
.shot.tall {
  max-width: 340px;
  margin-inline: auto;
}

.shot.tall img {
  width: auto;
  max-width: 100%;
  max-height: min(68vh, 600px);
}

.shot figcaption {
  margin: 10px 2px 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

/* ---- 页脚 ---- */

.foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
  margin-top: clamp(80px, 11vw, 144px);
  padding-block: 32px max(48px, env(safe-area-inset-bottom, 0px));
}

.foot::before {
  content: "";
  position: absolute;
  inset: 0 var(--gutter) auto;
  border-top: 1px solid var(--line);
}

.foot-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.foot-brand .glyph {
  flex: none;
  width: 26px;
  height: 30px;
}

.foot-name,
.foot-text,
.foot-links {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
}

.foot-name {
  font-weight: 650;
}

.foot-text {
  max-width: 44em;
  margin-top: 2px;
  color: var(--ink-2);
  font-size: 13.5px;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}

.foot-links a {
  position: relative;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.2s;
}

/* ---- 动效 ---- */

@media (prefers-reduced-motion: no-preference) {
  .hero-inner > * {
    animation: rise 0.8s var(--spring) backwards;
  }

  .hero-inner > :nth-child(1) {
    animation-delay: 0.02s;
  }

  .hero-inner > :nth-child(2) {
    animation-delay: 0.08s;
  }

  .hero-inner > :nth-child(3) {
    animation-delay: 0.14s;
  }

  .hero-inner > :nth-child(4) {
    animation-delay: 0.2s;
  }

  .hero-inner > :nth-child(5) {
    animation-delay: 0.26s;
  }

  .deco {
    animation: fade-in 1.2s ease-out backwards;
  }

  .deco use {
    animation: drop 0.9s var(--spring-pop) backwards;
  }

  .deco use:nth-of-type(1) {
    animation-delay: 0.1s;
  }

  .deco use:nth-of-type(2) {
    animation-delay: 0.2s;
  }

  .deco use:nth-of-type(3) {
    animation-delay: 0.3s;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes drop {
  from {
    opacity: 0;
    transform: translateY(-22px);
  }
}

/* 主题切换时整页做一次擦除。不支持 View Transitions 的浏览器就是直接换色。 */
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(root) {
  animation: none;
  mix-blend-mode: normal;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- 响应式 ---- */

@media (min-width: 961px) {
  /* 宽屏上让装饰按自己的比例摆，而不是切一块去填满首屏的高度：`slice` 填高的时候
     整张图会被放大，三个箱子跟着往左长，1180–1366 这一段正好压在大标题的末尾上。
     按比例摆之后箱子永远落在右边那一片空地里，和标题多宽无关。窄屏仍旧填满 —— 那
     边标题是整行的，底下没有空地可留。 */
  .deco {
    height: auto;
    aspect-ratio: 1200 / 460;
  }

  .rail-sticky {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
  }

  .release-head {
    position: sticky;
    top: calc(var(--nav-h) + 24px);
  }
}

@media (max-width: 960px) {
  .rail-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    max-width: 560px;
  }

  .facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .deco {
    width: 100%;
    opacity: 0.5;
  }
}

@media (max-width: 760px) {
  .row {
    grid-template-columns: minmax(0, 1fr);
  }

  .row .cmd {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .nav-inner {
    gap: 8px;
  }

  .brand span {
    display: none;
  }

  .nav-links a,
  .tool {
    padding-inline: 8px;
  }

  .seg {
    width: 100%;
  }

  .file {
    grid-template-columns: 56px minmax(0, 1fr) 34px;
    grid-template-areas:
      "kind main go"
      ". meta .";
    gap: 6px 12px;
    padding: 12px 10px;
  }

  .file::before {
    left: 10px;
    right: 10px;
  }

  .release {
    grid-template-columns: minmax(0, 1fr);
  }

  .release + .release {
    border-top: 1px solid var(--line);
  }

  .release-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 4px 12px;
    padding-block: 20px 8px;
  }

  .release-body {
    padding: 0 0 20px;
    border-left: 0;
  }

  .release-body::before {
    display: none;
  }

  .tip {
    padding: 16px;
  }

  .card {
    padding: 16px;
  }
}

@media (max-width: 340px) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }
}
