/* 印染百科 - 样式表
   配色铁律：不使用绿色。主色为深蓝，辅助色为中性灰与琥珀色。 */

:root {
  --blue: #1a4d8f;
  --blue-light: #2f6fbf;
  --blue-bg: #eaf1f9;
  --blue-line: #c5d8ee;
  --ink: #202122;
  --ink-2: #54595d;
  --ink-3: #72777d;
  --line: #d8dde3;
  --line-soft: #eaecf0;
  --bg: #f6f7f8;
  --card: #ffffff;
  --amber: #b8860b;
  --amber-bg: #fdf6e3;
  --purple: #6b4ba8;
  --red: #b32424;
  --radius: 3px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
a:visited { color: var(--purple); }
a.new { color: var(--red); }

/* ============ 顶部栏 ============ */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px;
  background: var(--blue);
  color: #fff;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  flex-shrink: 0;
  align-self: center;
}
.brand-text { line-height: 1.2; }
.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 1px;
}
.brand-slogan { font-size: 11px; color: var(--ink-3); letter-spacing: .5px; }

.search-box { flex: 1; max-width: 520px; position: relative; }
.search-box input {
  width: 100%;
  padding: 8px 38px 8px 34px;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 14px;
  font-family: var(--sans);
  background: #fff url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2372777d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 10px center;
  outline: none;
}
.search-box input:focus { border-color: var(--blue-light); box-shadow: 0 0 0 2px var(--blue-bg); }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: none; color: var(--ink-3); cursor: pointer;
  font-size: 16px; padding: 2px 6px; display: none;
}
.search-clear:hover { color: var(--ink); }

.suggest {
  position: absolute; top: 100%; left: 0; right: 0;
  background: #fff; border: 1px solid var(--line); border-top: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  max-height: 400px; overflow-y: auto; z-index: 60; display: none;
}
.suggest.show { display: block; }
.suggest-item {
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: baseline; gap: 8px;
}
.suggest-item:hover, .suggest-item.active { background: var(--blue-bg); }
.suggest-item b { color: var(--ink); font-weight: 600; }
.suggest-item .sg-cat { font-size: 11px; color: #fff; background: var(--blue-light); padding: 1px 6px; border-radius: 2px; flex-shrink: 0; }
.suggest-item .sg-en { font-size: 12px; color: var(--ink-3); }

.header-nav { display: flex; gap: 16px; font-size: 13px; flex-shrink: 0; }
.header-nav a { color: var(--ink-2); white-space: nowrap; }
.header-nav a:hover { color: var(--blue); }

/* ============ 布局 ============ */
.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.sidebar { position: sticky; top: 78px; }
.side-box { margin-bottom: 20px; }
.side-title {
  font-size: 12px; font-weight: 700; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .6px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}
.side-list { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.side-list li { padding: 3px 0; }
.side-list a { color: var(--blue); display: flex; justify-content: space-between; gap: 8px; }
.side-list a:hover { text-decoration: none; }
.side-list a:hover span:first-child { text-decoration: underline; }
.side-count { color: var(--ink-3); font-size: 12px; }

.content {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 36px 48px;
  min-height: 70vh;
}

/* ============ 首页 ============ */
.hero { text-align: center; padding: 10px 0 26px; border-bottom: 1px solid var(--line-soft); margin-bottom: 26px; }
.hero h1 {
  font-family: var(--serif); font-size: 34px; font-weight: 700;
  margin: 0 0 6px; letter-spacing: 2px; color: var(--ink);
}
.hero p { color: var(--ink-2); margin: 0 0 18px; font-size: 14px; }
.hero-search { max-width: 560px; margin: 0 auto; position: relative; }
.hero-search input {
  width: 100%; padding: 13px 18px; font-size: 16px;
  border: 2px solid var(--blue-line); border-radius: 4px; outline: none;
  font-family: var(--sans);
}
.hero-search input:focus { border-color: var(--blue); }
.hero-tags { margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.hero-tags a { margin: 0 6px; color: var(--blue); }

.stat-bar {
  display: flex; justify-content: center; gap: 34px; flex-wrap: wrap;
  margin: 22px 0 0; font-size: 13px; color: var(--ink-2);
}
.stat-bar b { font-size: 20px; color: var(--blue); font-family: var(--serif); display: block; text-align: center; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 2px solid var(--blue); padding-bottom: 6px; margin: 34px 0 16px;
}
.section-head h2 { font-family: var(--serif); font-size: 20px; margin: 0; color: var(--ink); }
.section-head .more { font-size: 13px; }

.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: #fff; transition: border-color .15s, box-shadow .15s;
  display: block; text-decoration: none; color: inherit;
}
.cat-card:hover { border-color: var(--blue-light); box-shadow: 0 2px 8px rgba(26,77,143,.1); text-decoration: none; }
.cat-card h3 { font-family: var(--serif); font-size: 16px; margin: 0 0 4px; color: var(--blue); }
.cat-card p { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.cat-card .cat-n { font-size: 12px; color: var(--ink-3); }

.entry-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.entry-card {
  display: block;
  border: 1px solid var(--line-soft); border-left: 3px solid var(--blue-light);
  border-radius: var(--radius); padding: 12px 14px; background: #fff;
  color: inherit; text-decoration: none; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.entry-card:hover, .entry-card:focus {
  background: var(--blue-bg); border-color: var(--blue-line); border-left-color: var(--blue);
  box-shadow: 0 2px 8px rgba(26,77,143,.10); text-decoration: none;
}
.entry-card:visited { color: inherit; }
.entry-card h4 {
  margin: 0 0 5px; font-size: 15px; font-family: var(--serif);
  color: var(--blue); font-weight: 600;
}
.entry-card:hover h4 { text-decoration: underline; }
.entry-card .en { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.entry-card p { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.6; }

/* ============ 词条页 ============ */
.crumbs { font-size: 12.5px; color: var(--ink-3); margin-bottom: 10px; }
.crumbs a { color: var(--blue); }
.crumbs span { margin: 0 6px; color: var(--line); }

.entry-head { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 18px; }
.entry-head h1 { font-family: var(--serif); font-size: 30px; margin: 0; line-height: 1.25; color: var(--ink); }
.entry-en { color: var(--ink-3); font-size: 14px; margin-top: 4px; font-style: italic; }

.entry-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  font-size: 11.5px; padding: 2px 9px; border-radius: 10px;
  background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-line);
}
.chip.cat { background: var(--amber-bg); color: var(--amber); border-color: #e8d9a8; }

.lead {
  font-size: 15.5px; line-height: 1.8; color: var(--ink);
  background: var(--blue-bg); border-left: 3px solid var(--blue-light);
  padding: 12px 16px; margin: 0 0 22px; border-radius: 0 var(--radius) var(--radius) 0;
}

/* 信息框 */
.infobox {
  float: right; width: 280px; margin: 0 0 18px 26px;
  border: 1px solid var(--line); background: #fbfcfd;
  font-size: 13px; border-radius: var(--radius);
}
.infobox-title {
  background: var(--blue); color: #fff; padding: 7px 12px;
  font-family: var(--serif); font-weight: 700; font-size: 14px;
}
.infobox table { width: 100%; border-collapse: collapse; }
.infobox td { padding: 5px 10px; border-top: 1px solid var(--line-soft); vertical-align: top; }
.infobox td:first-child { color: var(--ink-3); width: 40%; background: #f4f6f8; }

/* 目录 */
.toc {
  border: 1px solid var(--line); background: #fbfcfd;
  padding: 12px 16px; margin-bottom: 22px; display: inline-block;
  min-width: 240px; max-width: 100%; border-radius: var(--radius);
}
.toc-title { font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .5px; margin-bottom: 6px; }
.toc ol { margin: 0; padding-left: 20px; font-size: 13.5px; }
.toc li { margin: 2px 0; }
.toc a { color: var(--blue); }
.toc a:hover span { text-decoration: underline; }

.entry-body h2 {
  font-family: var(--serif); font-size: 20px; margin: 30px 0 10px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line-soft); color: var(--ink);
}
.entry-body p { margin: 0 0 13px; text-align: justify; }
.entry-body ul { margin: 0 0 14px; padding-left: 22px; }
.entry-body li { margin-bottom: 7px; }
.entry-body strong { color: var(--ink); }

.rel-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.rel-list a {
  border: 1px solid var(--line); padding: 4px 11px; border-radius: 14px;
  font-size: 13px; background: #fff; color: var(--blue);
}
.rel-list a:hover { background: var(--blue-bg); border-color: var(--blue-line); text-decoration: none; }

.entry-foot {
  margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--ink-3); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}

/* ============ 列表页 ============ */
.page-title { font-family: var(--serif); font-size: 26px; margin: 0 0 4px; border-bottom: 2px solid var(--blue); padding-bottom: 8px; }
.page-desc { color: var(--ink-2); font-size: 14px; margin: 10px 0 20px; }

.list-group { margin-bottom: 26px; }
.list-group h3 {
  font-family: var(--serif); font-size: 17px; margin: 0 0 8px;
  color: var(--blue); border-bottom: 1px solid var(--line-soft); padding-bottom: 4px;
}
.list-items { columns: 2; column-gap: 34px; }
.list-items a { display: block; padding: 3px 0; font-size: 14px; }
.list-items a small { color: var(--ink-3); font-size: 12px; margin-left: 6px; }

/* ============ 搜索结果 ============ */
.result {
  display: block; padding: 12px; margin: 0 -12px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none; cursor: pointer;
  border-radius: var(--radius);
  transition: background .15s;
}
.result:hover, .result:focus { background: var(--blue-bg); text-decoration: none; }
.result:visited { color: inherit; }
.result h3 { margin: 0 0 3px; font-size: 16px; font-family: var(--serif); color: var(--blue); }
.result:hover h3 { text-decoration: underline; }
.result .en { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.result p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.62; }
.result mark { background: #ffeabc; color: inherit; padding: 0 1px; border-radius: 2px; }
.result-path { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty h3 { font-family: var(--serif); font-size: 20px; color: var(--ink-2); margin: 0 0 8px; }

/* ============ 关于页 ============ */
.about-block h2 { font-family: var(--serif); font-size: 19px; margin: 26px 0 8px; border-bottom: 1px solid var(--line-soft); padding-bottom: 5px; }
.about-block p, .about-block li { color: var(--ink-2); }

.site-footer {
  max-width: 1400px; margin: 0 auto; padding: 20px;
  border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12.5px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}

.back-top {
  position: fixed; right: 22px; bottom: 22px;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--blue); color: #fff; border: none; cursor: pointer;
  font-size: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.2); display: none;
  align-items: center; justify-content: center;
}
.back-top.show { display: flex; }

/* ============ 投稿 / 共建相关 ============ */
.header-nav a.nav-contrib {
  color: #fff;
  background: var(--blue);
  padding: 4px 12px;
  border-radius: 3px;
  font-weight: 600;
}
.header-nav a.nav-contrib:hover { background: var(--blue-light); text-decoration: none; color: #fff; }

.btn-contrib {
  display: inline-block;
  background: var(--blue);
  color: #fff !important;
  padding: 8px 20px;
  border-radius: 3px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--blue);
  cursor: pointer;
}
.btn-contrib:hover { background: var(--blue-light); border-color: var(--blue-light); text-decoration: none; }
.btn-contrib.block { display: block; text-align: center; margin: 8px 0 12px; }
.btn-contrib.small { padding: 3px 12px; font-size: 12.5px; margin-left: 8px; }

.btn-ghost {
  display: inline-block;
  background: #fff;
  color: var(--blue) !important;
  padding: 8px 20px;
  border-radius: 3px;
  font-size: 14px;
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--blue-bg); text-decoration: none; }

.hero-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

.side-contrib { background: var(--blue-bg); border: 1px solid var(--blue-line); border-radius: var(--radius); padding: 10px 12px 4px; }
.side-contrib .side-title { border-bottom-color: var(--blue-line); color: var(--blue); }
.side-note { font-size: 12px; color: var(--ink-2); margin: 0 0 8px; line-height: 1.6; }

.tag-user {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--amber);
  background: var(--amber-bg);
  border: 1px solid #e8d9a8;
  border-radius: 8px;
  padding: 0 6px;
  margin-left: 6px;
  vertical-align: middle;
}
.chip.user { background: var(--amber-bg); color: var(--amber); border-color: #e8d9a8; }

.entry-foot .edit-link { color: var(--blue); font-weight: 600; }

.loading { text-align: center; padding: 60px 20px; color: var(--ink-3); font-size: 14px; }
.page-tip { font-size: 13px; color: var(--ink-3); margin: -10px 0 18px; }
.muted { color: var(--ink-3); }

/* ============ 响应式 ============ */
@media (max-width: 1000px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .sidebar { display: none; }
  .content { padding: 20px 18px 36px; }
  .infobox { float: none; width: 100%; margin: 0 0 18px; }
  .list-items { columns: 1; }
  .header-nav { display: none; }
  .hero h1 { font-size: 26px; }
  .entry-head h1 { font-size: 24px; }
}
