/* sai-assets · 极简外壳
   设计取向:目录即作品。没有卡片、没有阴影、没有圆角堆叠;
   只有字、留白、发丝线,和一份被悬停唤起的真实预览。
   颜色与字阶来自库内 ouuut-editorial 包(构建时拷入),本文件只写它没有的东西。 */

:root {
  --line: color-mix(in srgb, var(--ink) 11%, transparent);
  --line-2: color-mix(in srgb, var(--ink) 22%, transparent);
  --plate: color-mix(in srgb, var(--ink) 3%, var(--bg));
  --fs-micro: 14px;
  --fs-body: 15px;
  --fs-lead: 17px;
  --fs-mid: 22px;
  --fs-hero: clamp(2.1rem, 4.6vw, 3.9rem);
  --pad: clamp(20px, 4vw, 64px);
  --maxw: 1440px;
  --row-h: 84px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --dur: .42s;
  --nav-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0E0E0C;
    --ink: #EDEBE4;
    --muted: #A3A199;
    --surface: rgba(237, 235, 228, .055);
    --accent-ink-mix: 86%;
    --accent-ink-target: #FFFDF5;
    --accent-soft-mix: 14%;
  }
}

* { box-sizing: border-box; }

html {
  scrollbar-color: var(--line-2) transparent;
  scrollbar-width: thin;
  -webkit-text-size-adjust: 100%;
}
html::-webkit-scrollbar { width: 8px; height: 8px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  border-radius: 99px;
}
html::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--ink) 32%, transparent); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--zh-sans);
  font-size: var(--fs-body);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.028em; line-height: 1.14; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
code, pre, kbd { font-family: var(--mono); font-size: 1em; font-variant-ligatures: none; }
strong { font-weight: 600; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: 16px; top: -64px; z-index: 40;
  background: var(--bg); border: 1px solid var(--line-2); padding: 10px 16px;
  font-size: var(--fs-micro); transition: top .2s var(--ease);
}
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }

/* ---------------------------------------------------------------- 顶栏 */
.top {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in {
  max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad);
  height: var(--nav-h); display: flex; align-items: center; gap: 28px;
}
.mark { font-size: var(--fs-body); font-weight: 600; letter-spacing: -.02em; }
.mark-sub { font-size: var(--fs-micro); color: var(--muted); font-weight: 400; letter-spacing: .02em; margin-left: 10px; }
.top-nav { display: flex; gap: 20px; font-size: var(--fs-micro); color: var(--muted); }
.top-nav a { letter-spacing: .04em; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  background: none; border: 0; color: var(--ink); cursor: pointer; border-radius: 2px;
}
.icon-btn:hover { background: var(--plate); }
[data-theme="paper"] .moon, :root:not([data-theme]) .moon { display: none; }
[data-theme="charcoal"] .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .sun { display: none; }
  :root:not([data-theme]) .moon { display: block; }
}
.ghost {
  font-size: var(--fs-micro); letter-spacing: .04em; color: var(--ink);
  border: 1px solid var(--line-2); padding: 8px 14px; border-radius: 2px;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.ghost:hover { background: var(--plate); border-color: var(--ink); text-decoration: none; }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad) 96px; }

/* ---------------------------------------------------------------- 首屏 */
.hero { padding: clamp(48px, 9vw, 112px) 0 clamp(32px, 5vw, 64px); }
.hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 48px; flex-wrap: wrap; }
.hero h1 { font-size: var(--fs-hero); letter-spacing: -.045em; text-wrap: balance; }
.hero h1 em { font-style: normal; color: var(--muted); }
.lede { margin-top: 24px; max-width: 48ch; color: var(--muted); font-size: var(--fs-lead); line-height: 1.65; }
.lede strong { color: var(--ink); font-weight: 600; }
.counts { display: flex; gap: 40px; padding-bottom: 6px; }
.counts div { display: flex; flex-direction: column; gap: 2px; }
.counts b { font-size: var(--fs-mid); font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.counts span { font-size: var(--fs-micro); color: var(--muted); letter-spacing: .08em; }

/* ---------------------------------------------------------------- 筛选条 */
.toolbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  position: sticky; top: var(--nav-h); z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
}
.filters { display: flex; gap: 20px; flex-wrap: wrap; }
.filter {
  font: inherit; font-size: var(--fs-micro); letter-spacing: .04em; color: var(--muted);
  background: none; border: 0; padding: 6px 0; cursor: pointer; position: relative;
}
.filter:hover { color: var(--ink); }
.filter.on { color: var(--ink); }
.filter.on::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--ink);
}
.filter em { font-style: normal; color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }
.search { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search input {
  font: inherit; font-size: var(--fs-micro); letter-spacing: .02em; color: var(--ink);
  background: none; border: 0; border-bottom: 1px solid var(--line-2);
  padding: 6px 2px; width: 200px; transition: border-color .2s var(--ease), width .3s var(--ease);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--ink); width: 260px; }
.search kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 1px 5px; }

/* ---------------------------------------------------------------- 索引行 */
.index { position: relative; }
.rows { border-bottom: 1px solid var(--line); }
.row { border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row a {
  display: grid;
  grid-template-columns: 48px minmax(0, 1.35fr) minmax(0, 1.05fr) 64px 96px;
  align-items: center; gap: 24px;
  min-height: var(--row-h); padding: 14px 0;
  transition: background .25s var(--ease), padding-left .35s var(--ease);
}
.row a:hover, .row a:focus-visible { background: var(--plate); padding-left: 12px; text-decoration: none; }
.no { font-family: var(--mono); font-size: var(--fs-micro); color: var(--muted); font-variant-numeric: tabular-nums; }
.name {
  font-size: var(--fs-mid); font-weight: 500; letter-spacing: -.02em; line-height: 1.22;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.name small { display: block; font-size: var(--fs-micro); font-weight: 400; color: var(--muted); letter-spacing: .02em; margin-top: 2px; }
.desc { color: var(--muted); font-size: var(--fs-body); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat { font-size: var(--fs-micro); color: var(--muted); letter-spacing: .06em; }
.ver { font-family: var(--mono); font-size: var(--fs-micro); color: var(--muted); display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.arrow { color: var(--muted); font-size: var(--fs-body); line-height: 1; transition: transform .3s var(--ease), color .2s var(--ease); }
.row a:hover .arrow { transform: translateX(4px); color: var(--ink); }
.row[data-external] .arrow::after { content: "↗"; }
.row .dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-right: 8px; vertical-align: 1px; opacity: 0; transition: opacity .2s; }
.row a:hover .dot { opacity: 1; }

.empty { padding: 64px 0; color: var(--muted); font-size: var(--fs-body); }

/* 悬停预览:右侧浮层,只在够宽的屏上出现 */
.peek {
  position: fixed; right: calc(var(--pad) + 8px); top: 50%;
  width: min(38vw, 560px); aspect-ratio: 16 / 10;
  transform: translateY(-50%) scale(.985);
  border: 1px solid var(--line-2); background: var(--plate);
  opacity: 0; pointer-events: none; z-index: 25;
  transition: opacity .28s var(--ease), transform .38s var(--ease);
  overflow: hidden;
}
.peek.on { opacity: 1; transform: translateY(-50%) scale(1); }
.peek iframe { border: 0; transform-origin: 0 0; display: block; background: #fff; }
.peek .peek-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: 20px; font-size: var(--fs-micro); color: var(--muted);
}
.peek .peek-empty b { font-size: var(--fs-mid); color: var(--ink); font-weight: 500; letter-spacing: -.02em; }
@media (max-width: 1100px) { .peek { display: none; } }

/* ---------------------------------------------------------------- 详情页 */
.crumbs {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 28px 0 20px; font-size: var(--fs-micro); color: var(--muted); letter-spacing: .03em;
}
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs span[aria-current] { color: var(--ink); }

.item-head { padding-bottom: 24px; }
.item-head h1 { font-size: clamp(1.9rem, 3.6vw, 3rem); letter-spacing: -.045em; text-wrap: balance; }
.item-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px;
  margin-top: 18px; font-size: var(--fs-micro); color: var(--muted); letter-spacing: .03em;
}
.item-meta code { color: var(--ink); }
.item-meta .sep { color: var(--muted); opacity: .55; }
.lede-row { margin-top: 22px; max-width: 62ch; color: var(--muted); font-size: var(--fs-lead); line-height: 1.65; }
.lede-row strong { color: var(--ink); }

.stage-wrap { position: relative; border-top: 1px solid var(--line); padding: 20px 0 0; }
.stage {
  position: relative; border: 1px solid var(--line-2); overflow: hidden; background: var(--plate);
  height: min(74vh, 760px);
}
.stage iframe { border: 0; transform-origin: 0 0; display: block; transition: margin .3s var(--ease); }
.stage .poster {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: var(--fs-micro); color: var(--muted); letter-spacing: .04em;
}
.run {
  font: inherit; font-size: var(--fs-micro); color: var(--ink); cursor: pointer;
  background: none; border: 1px solid var(--line-2); padding: 8px 16px; border-radius: 2px;
}
.run:hover { background: var(--bg); border-color: var(--ink); }

.stage-head {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 0 0 12px;
}
.stage-head .spacer { margin-left: auto; }
.stage-head button, .stage-head a {
  font: inherit; font-size: var(--fs-micro); letter-spacing: .03em; color: var(--muted);
  background: none; border: 0; padding: 6px 12px; cursor: pointer; border-radius: 2px;
}
.stage-head button:hover, .stage-head a:hover { color: var(--ink); background: var(--plate); text-decoration: none; }
.stage-head .on { color: var(--ink); background: var(--plate); }
.stage-head .divider { width: 1px; height: 14px; background: var(--line); margin: 0 6px; }

.demos { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 0 0; }
.demos a {
  font-size: var(--fs-micro); color: var(--muted); border-bottom: 1px solid var(--line-2); padding: 3px 0;
}
.demos a:hover { color: var(--ink); border-color: var(--ink); }

.intro { padding: 32px 0 8px; max-width: 74ch; }
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 72px); padding-top: 56px; }
.cols > * { min-width: 0; }
.block { padding-top: 40px; border-top: 1px solid var(--line); }
.block:first-child { border-top: 0; padding-top: 0; }
.block h2 {
  font-size: var(--fs-micro); font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 20px;
}
.meta-list { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px 20px; font-size: var(--fs-body); }
.meta-list dt { font-size: var(--fs-micro); color: var(--muted); letter-spacing: .04em; padding-top: 2px; }
.meta-list dd { color: var(--ink); overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { font-size: var(--fs-micro); color: var(--muted); border: 1px solid var(--line); padding: 2px 10px; border-radius: 99px; }
.notfor { margin-top: 28px; font-size: var(--fs-body); color: var(--muted); }
.notfor summary { cursor: pointer; color: var(--ink); width: fit-content; font-size: var(--fs-micro); letter-spacing: .04em; }
.notfor p { margin-top: 12px; max-width: 60ch; }
.evidence { margin-top: 12px; background: var(--plate); border: 1px solid var(--line); padding: 14px; overflow-x: auto; font-size: var(--fs-micro); line-height: 1.8; }
.attr { display: flex; flex-direction: column; gap: 14px; font-size: var(--fs-body); }
.attr .what { color: var(--muted); font-size: var(--fs-micro); }

.snips { display: flex; flex-direction: column; gap: 0; border-top: 1px solid var(--line); }
.snip { border-bottom: 1px solid var(--line); }
.snip-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; font-size: var(--fs-micro); color: var(--muted); letter-spacing: .04em;
}
.snip pre { padding: 0 0 14px; overflow-x: auto; font-size: var(--fs-micro); line-height: 1.75; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.copy {
  font: inherit; font-size: var(--fs-micro); color: var(--muted); cursor: pointer;
  background: none; border: 0; border-bottom: 1px solid var(--line-2); padding: 2px 0;
}
.copy:hover { color: var(--ink); border-color: var(--ink); }
.copy[data-done="1"] { color: var(--accent-ink); border-color: var(--accent-ink); }

.code-box { border-top: 1px solid var(--line); }
.tabs { display: flex; flex-wrap: wrap; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.tab {
  font: inherit; font-size: var(--fs-micro); font-family: var(--mono); color: var(--muted);
  background: none; border: 0; padding: 0 0 4px; cursor: pointer; border-bottom: 1px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab.selected { color: var(--ink); border-color: var(--ink); }
.pane { display: none; }
.pane.selected { display: block; }
.pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; font-size: var(--fs-micro); color: var(--muted);
}
.pane pre { max-height: 62vh; overflow: auto; padding: 0 0 20px; font-size: var(--fs-micro); line-height: 1.8; }
.pane pre code { display: block; white-space: pre; }
.tk-c { color: var(--muted); font-style: italic; }
.tk-s { color: color-mix(in oklab, var(--c-crime) 62%, var(--ink)); }
.tk-n { color: color-mix(in oklab, var(--c-cabinet) 55%, var(--ink)); }
.tk-k { color: color-mix(in oklab, var(--c-weather) 55%, var(--ink)); }
.muted { color: var(--muted); font-size: var(--fs-body); }
.back { padding-top: 56px; font-size: var(--fs-micro); }
.back a { color: var(--muted); }

/* ---------------------------------------------------------------- 页脚 */
.foot {
  max-width: var(--maxw); margin: 0 auto; padding: 40px var(--pad) 72px;
  border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-micro);
  display: flex; flex-wrap: wrap; gap: 12px 32px; letter-spacing: .02em;
}
.foot a { color: var(--muted); }
.foot a:hover { color: var(--ink); }

/* ---------------------------------------------------------------- 404 */
.notfound { padding-top: 96px; }
.notfound h1 { font-size: var(--fs-hero); letter-spacing: -.04em; }
.plain { margin-top: 32px; display: flex; flex-direction: column; gap: 10px; font-size: var(--fs-body); }

/* ---------------------------------------------------------------- 滚动入场(无 JS / 打印时一律可见) */
.reveal { opacity: 1; }
html.js .reveal { opacity: 0; transform: translateY(10px); }
html.js .reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); }
@media print { .reveal, html.js .reveal { opacity: 1 !important; transform: none !important; } }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 900px) {
  .cols { grid-template-columns: 1fr; gap: 40px; }
  .row a { grid-template-columns: 40px minmax(0, 1fr) 72px 80px; gap: 16px; }
  .desc, .cat { display: none; }
  .stage { height: min(58vh, 520px); }
  .counts { gap: 24px; }
  .hero-top { align-items: flex-start; }
}
@media (max-width: 560px) {
  .top-nav { display: none; }
  .mark-sub { display: none; }
  .ghost { display: none; }
  .row a { grid-template-columns: 32px minmax(0, 1fr) 64px; }
  .arrow { display: none; }
  .name { font-size: var(--fs-lead); }
  .search { width: 100%; margin-left: 0; }
  .search input { width: 100%; }
  .toolbar { gap: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}


/* 跨页过渡(渐进增强:支持的浏览器直接淡入,不支持的照常跳转) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vt-out .18s var(--ease) both; }
::view-transition-new(root) { animation: vt-in .28s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(4px); } }
