/* ==========================================================================
   组件室 · 索引站样式
   设计语言：Anthropic / Claude —— 暖色羊皮纸底、单一字重衬线标题、
   环状阴影、陶土色只用于最高信号点。
   ========================================================================== */

:root {
  --parchment: #f5f4ed;
  --ivory: #faf9f5;
  --white: #ffffff;
  --sand: #e8e6dc;
  --dark-surface: #30302e;
  --deep-dark: #141413;

  --terra: #c96442;
  --coral: #d97757;

  --ink: #141413;
  --ink-2: #5e5d59;
  --ink-3: #87867f;
  --charcoal: #4d4c48;
  --warm-dark: #3d3d3a;
  --warm-silver: #b0aea5;

  --border-cream: #f0eee6;
  --border-warm: #e8e6dc;
  --ring-warm: #d1cfc5;
  --ring-deep: #c2c0b6;

  --serif: "Source Serif 4", "Anthropic Serif", Georgia, "Songti SC",
    "Source Han Serif SC", "Noto Serif SC", "Times New Roman", serif;
  --sans: "Anthropic Sans", system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "Anthropic Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --whisper: rgba(0, 0, 0, 0.05) 0 4px 24px;
  --nav-h: 64px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 132px; }

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

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- 排版 ---------- */

.serif { font-family: var(--serif); font-weight: 500; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; margin: 0; }

.overline {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tnum { font-variant-numeric: tabular-nums lining-nums; }
.mono { font-family: var(--mono); }
.muted { color: var(--ink-3); }

/* ---------- 导航 ---------- */

.nav {
  position: sticky; top: 0; z-index: 60;
  background: rgba(245, 244, 237, 0.86);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border-cream);
}
.nav-inner {
  height: var(--nav-h);
  display: flex; align-items: center; gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 20px; height: 20px; flex: 0 0 auto;
  border-radius: 6px;
  background: var(--terra);
  position: relative;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 5px;
  border-radius: 2px; background: var(--ivory);
}
.brand-name { font-family: var(--serif); font-size: 19px; font-weight: 500; }
.brand-sub {
  font-size: 11px; color: var(--ink-3); letter-spacing: 0.12px;
  border-left: 1px solid var(--border-warm); padding-left: 10px; margin-left: 2px;
}
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  font-size: 15px; color: var(--ink-2); padding: 6px 12px; border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-links a:hover { background: var(--border-cream); color: var(--ink); }
.nav-count {
  font-size: 12px; letter-spacing: 0.12px; color: var(--charcoal);
  background: var(--sand); border-radius: 999px; padding: 5px 12px;
  box-shadow: 0 0 0 1px var(--ring-warm);
  white-space: nowrap;
}

/* ---------- Hero ---------- */

.hero { padding: 88px 0 40px; }
.hero h1 {
  font-size: 64px; line-height: 1.1; letter-spacing: -0.015em;
  margin: 14px 0 0; max-width: 15em;
}
.hero-sub {
  font-size: 20px; line-height: 1.6; color: var(--ink-2);
  max-width: 40em; margin: 20px 0 0;
}
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 48px;
  margin: 40px 0 0; padding: 24px 0 0; border-top: 1px solid var(--border-cream);
}
.stat .n {
  font-family: var(--serif); font-size: 36px; font-weight: 500; line-height: 1.1;
  font-variant-numeric: tabular-nums lining-nums;
}
.stat .l { font-size: 12px; letter-spacing: 0.12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- 搜索 ---------- */

.search {
  margin: 36px 0 0;
  display: flex; align-items: center; gap: 12px;
  background: var(--white);
  border: 1px solid var(--border-warm);
  border-radius: 12px;
  padding: 4px 16px;
  box-shadow: var(--whisper);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search:focus-within {
  border-color: #3898ec;
  box-shadow: 0 0 0 3px rgba(56, 152, 236, 0.15);
}
.search svg { flex: 0 0 auto; color: var(--ink-3); }
.search input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 14px 0; font-size: 17px;
}
.search input::placeholder { color: var(--ink-3); }
.search kbd {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  background: var(--parchment); border: 1px solid var(--border-warm);
  border-radius: 6px; padding: 2px 7px;
}
.search .clear {
  border: 0; background: transparent; cursor: pointer; color: var(--ink-3);
  font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 6px; display: none;
}
.search .clear:hover { background: var(--border-cream); color: var(--ink); }
.search.has-value .clear { display: block; }
.search.has-value kbd { display: none; }

/* ---------- 分类 chips ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0 0; }
.chip {
  cursor: pointer; border: 1px solid var(--border-warm); background: var(--ivory);
  color: var(--charcoal); border-radius: 999px;
  padding: 7px 15px; font-size: 14px; line-height: 1.25;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.chip:hover { background: var(--sand); }
.chip .c { color: var(--ink-3); font-size: 12px; margin-left: 6px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: var(--ivory);
}
.chip[aria-pressed="true"] .c { color: var(--warm-silver); }

/* ---------- 筛选条 ---------- */

.filters {
  position: sticky; top: var(--nav-h); z-index: 50;
  margin: 32px 0 0; padding: 14px 0;
  background: rgba(245, 244, 237, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-cream);
  border-bottom: 1px solid var(--border-cream);
}
.filters-inner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filters select {
  appearance: none; -webkit-appearance: none;
  background: var(--ivory) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235e5d59' stroke-width='1.4' stroke-linecap='round'/></svg>") no-repeat right 12px center;
  border: 1px solid var(--border-warm); border-radius: 10px;
  padding: 8px 32px 8px 13px; font-size: 14px; color: var(--charcoal); cursor: pointer;
}
.filters select:focus { outline: none; border-color: #3898ec; box-shadow: 0 0 0 3px rgba(56, 152, 236, 0.15); }
.switch { display: inline-flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--sand);
  box-shadow: inset 0 0 0 1px var(--ring-warm); position: relative;
  transition: background 0.18s ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.18s ease;
}
.switch input:checked + .track { background: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(56, 152, 236, 0.35); }
.result { margin-left: auto; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------- 组件网格 ---------- */

.grid-wrap { padding: 40px 0 96px; }
.grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fill, minmax(296px, 1fr));
}
.wcard {
  background: var(--ivory);
  border: 1px solid var(--border-cream);
  border-radius: 16px;
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.wcard:hover {
  transform: translateY(-2px);
  border-color: var(--ring-warm);
  box-shadow: var(--whisper), 0 0 0 1px var(--ring-warm);
}
.preview {
  position: relative; height: 196px; overflow: hidden;
  background: var(--parchment);
  border-bottom: 1px solid var(--border-cream);
}
.preview iframe {
  width: 100%; height: 100%; border: 0; display: block; background: transparent;
}
.preview .skeleton {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: linear-gradient(100deg, var(--parchment) 30%, #efece2 50%, var(--parchment) 70%);
  background-size: 300% 100%;
  animation: sheen 1.6s linear infinite;
  color: var(--ink-3); font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase;
}
@keyframes sheen { from { background-position: 150% 0; } to { background-position: -150% 0; } }
.preview.loaded .skeleton { display: none; }
.preview .hit {
  position: absolute; inset: 0; border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px;
}
.preview .hit span {
  opacity: 0; transform: translateY(4px);
  background: rgba(20, 20, 19, 0.82); color: var(--ivory);
  font-size: 12px; padding: 5px 11px; border-radius: 999px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.preview .hit:hover span, .wcard:focus-within .preview .hit span { opacity: 1; transform: none; }

.wbody { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.wtitle { font-family: var(--serif); font-size: 20.8px; font-weight: 500; line-height: 1.25; }
.wdesc {
  font-size: 14px; color: var(--ink-2); margin: 7px 0 0; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.wmeta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 14px 0 0; }
.tag {
  font-size: 11.5px; letter-spacing: 0.12px; padding: 3px 9px; border-radius: 999px;
  background: var(--parchment); color: var(--ink-2); border: 1px solid var(--border-warm);
}
.tag.ok { background: var(--sand); color: var(--charcoal); border-color: var(--border-warm); }
.tag.warn { background: rgba(201, 100, 66, 0.1); color: var(--terra); border-color: rgba(201, 100, 66, 0.25); }
.wacts { display: flex; gap: 8px; margin: auto 0 0; padding-top: 18px; }
.btn {
  cursor: pointer; border-radius: 10px; font-size: 14px; line-height: 1.25;
  padding: 8px 14px; border: 1px solid var(--border-warm); background: var(--sand);
  color: var(--charcoal); box-shadow: 0 0 0 1px var(--ring-warm);
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { background: #e0ded2; }
.btn:active { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.15); }
.btn-ghost { background: transparent; box-shadow: none; border-color: var(--border-warm); color: var(--ink-2); }
.btn-ghost:hover { background: var(--parchment); color: var(--ink); }
.btn-terra {
  background: var(--terra); border-color: var(--terra); color: var(--ivory);
  box-shadow: 0 0 0 1px var(--terra);
}
.btn-terra:hover { background: #b95a3b; }
.btn-dark { background: var(--dark-surface); border-color: var(--dark-surface); color: var(--ivory); box-shadow: none; }
.btn-dark:hover { background: var(--warm-dark); }
.btn.copied { background: var(--ink); border-color: var(--ink); color: var(--ivory); box-shadow: none; }

.loadmore { display: flex; justify-content: center; margin: 48px 0 0; }
.loadmore .btn { padding: 11px 26px; }
.empty {
  display: none; text-align: center; padding: 96px 24px; color: var(--ink-3);
}
.empty.show { display: block; }
.empty .big { font-family: var(--serif); font-size: 32px; color: var(--ink-2); margin-bottom: 8px; }

/* ---------- 深色区块 ---------- */

.dark { background: var(--deep-dark); color: var(--ivory); }
.dark .overline { color: var(--warm-silver); }
.dark h2 { font-size: 52px; line-height: 1.2; letter-spacing: -0.01em; }
.dark p { color: var(--warm-silver); }
.section { padding: 104px 0; }
.steps { display: grid; gap: 20px; grid-template-columns: repeat(3, 1fr); margin-top: 48px; }
.step {
  background: var(--dark-surface); border: 1px solid #3d3d3a; border-radius: 16px; padding: 28px;
}
.step .num {
  font-family: var(--serif); font-size: 13px; color: var(--coral);
  letter-spacing: 0.5px; text-transform: uppercase;
}
.step h3 { font-size: 22px; margin: 12px 0 10px; }
.step p { font-size: 15px; line-height: 1.6; margin: 0; }
.step .snippet {
  margin-top: 16px; background: #0f0f0e; border: 1px solid #3d3d3a; border-radius: 10px;
  padding: 12px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  color: var(--warm-silver); overflow-x: auto; white-space: pre;
}

.srclist { margin-top: 44px; border-top: 1px solid #30302e; }
.srcrow {
  display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap;
  padding: 18px 0; border-bottom: 1px solid #30302e;
}
.srcrow .nm { font-family: var(--serif); font-size: 19px; min-width: 210px; }
.srcrow .rp { font-size: 13px; color: var(--warm-silver); }
.srcrow .rp a { border-bottom: 1px solid #4d4c48; }
.srcrow .rp a:hover { color: var(--ivory); border-color: var(--warm-silver); }
.srcrow .lic { margin-left: auto; font-size: 12px; color: var(--warm-silver); white-space: nowrap; }
.srcrow .nt { flex-basis: 100%; font-size: 13px; color: var(--ink-3); }
.notice {
  margin-top: 28px; border-left: 2px solid var(--terra); padding: 4px 0 4px 18px;
  font-size: 14px; color: var(--warm-silver);
}

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

.foot { background: var(--deep-dark); color: var(--warm-silver); padding: 40px 0; border-top: 1px solid #30302e; }
.foot-inner { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; font-size: 13px; }
.foot a { color: var(--ivory); border-bottom: 1px solid #4d4c48; }
.foot a:hover { border-color: var(--warm-silver); }
.foot .sp { margin-left: auto; }

/* ---------- 弹窗 ---------- */

.modal {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(20, 20, 19, 0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  padding: 32px;
}
.modal.open { display: grid; place-items: center; }
.panel {
  width: 100%; max-width: 1080px; max-height: 88vh;
  background: var(--ivory); border: 1px solid var(--border-warm); border-radius: 24px;
  overflow: hidden; display: grid; grid-template-columns: 1.45fr 1fr;
  box-shadow: rgba(0, 0, 0, 0.18) 0 24px 64px;
  animation: rise 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(0.99); } }
.pane-left {
  background: var(--parchment); border-right: 1px solid var(--border-cream);
  display: flex; align-items: center; justify-content: center; padding: 20px; min-height: 380px;
}
.pane-left iframe {
  width: 100%; height: 100%; min-height: 480px; border: 0; border-radius: 12px;
  background: var(--white); box-shadow: var(--whisper);
}
.pane-right { padding: 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.pane-right h3 { font-size: 32px; line-height: 1.15; }
.pane-right .close {
  position: absolute; top: 14px; right: 15px; width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--border-warm); background: var(--white); cursor: pointer;
  color: var(--ink-2); font-size: 17px; line-height: 1;
}
.pane-right .close:hover { background: var(--sand); color: var(--ink); }
.panel { position: relative; }

.kv { display: grid; grid-template-columns: 84px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--ink-3); font-size: 13px; }
.kv dd { margin: 0; color: var(--ink-2); word-break: break-all; }

.codebox { position: relative; }
.codebox pre {
  margin: 0; background: var(--parchment); border: 1px solid var(--border-warm);
  border-radius: 12px; padding: 14px 14px; font-family: var(--mono); font-size: 12px;
  line-height: 1.7; color: var(--ink-2); overflow: auto; white-space: pre-wrap; word-break: break-all;
  max-height: 150px;
}
.sizebar { display: flex; gap: 6px; flex-wrap: wrap; }
.sz {
  cursor: pointer; font-size: 12.5px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border-warm); background: var(--white); color: var(--ink-2);
}
.sz:hover { background: var(--sand); }
.sz[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ivory); }
.pane-right .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; }

/* ---------- 提示条 ---------- */

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 12px);
  background: var(--ink); color: var(--ivory); font-size: 14px;
  padding: 10px 18px; border-radius: 999px; z-index: 200;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

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

@media (max-width: 991px) {
  .hero h1 { font-size: 52px; }
  .dark h2 { font-size: 40px; }
  .steps { grid-template-columns: 1fr; }
  .panel { grid-template-columns: 1fr; max-height: 90vh; overflow-y: auto; }
  .pane-left { border-right: 0; border-bottom: 1px solid var(--border-cream); }
  .pane-left iframe { min-height: 340px; }
}
@media (max-width: 767px) {
  .wrap { padding: 0 18px; }
  .nav-links { display: none; }
  .brand-sub { display: none; }
  .hero { padding: 56px 0 32px; }
  .hero h1 { font-size: 34px; }
  .hero-sub { font-size: 17px; }
  .hero-stats { gap: 28px; }
  .stat .n { font-size: 28px; }
  .section { padding: 68px 0; }
  .dark h2 { font-size: 30px; }
  .grid { gap: 16px; grid-template-columns: 1fr; }
  .result { margin-left: 0; flex-basis: 100%; }
  .modal { padding: 12px; }
  .pane-right { padding: 20px; }
  .pane-right h3 { font-size: 25px; }
}
@media (max-width: 479px) {
  .hero h1 { font-size: 28px; }
  .brand-name { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}