/* 名人去世录 - 样式 */
:root {
  --bg: #f6f4ef;
  --card: #fffdf9;
  --ink: #2c2a25;
  --muted: #8a857a;
  --line: #e6e1d6;
  --accent: #9a3324;
  --accent-soft: #f5e9e5;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", STSong, SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- 页头 ---------- */
.site-header {
  text-align: center;
  padding: 40px 16px 22px;
}

.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 26px;
  border-radius: 8px;
  transform: rotate(-4deg);
  box-shadow: 0 2px 6px rgba(154, 51, 36, .3);
  margin-bottom: 12px;
}

.site-header h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  letter-spacing: 6px;
  text-indent: 6px; /* 平衡 letter-spacing */
  font-weight: 700;
}

.site-header .subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 1px;
}

/* ---------- 筛选区 ---------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(246, 244, 239, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 10px 0 8px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 4px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-label {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--muted);
  margin-right: 2px;
}

.chip {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  padding: 3px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
  white-space: nowrap;
}

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

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.search-row { overflow: visible; }

.search-row input {
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease;
}

.search-row input:focus { border-color: var(--accent); }
.search-row input::placeholder { color: #b8b2a5; }

/* ---------- 统计 ---------- */
.count {
  max-width: 1080px;
  margin: 14px auto 10px;
  padding: 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.count b { color: var(--accent); font-weight: 600; }

/* ---------- 卡片 ---------- */
.cards {
  list-style: none;
  max-width: 1080px;
  margin: 0 auto;
  padding: 4px 16px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.card {
  display: flex;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 1px 3px rgba(60, 50, 30, .05);
  transition: box-shadow .2s ease, transform .2s ease;
}

.card:hover {
  box-shadow: 0 4px 14px rgba(60, 50, 30, .1);
  transform: translateY(-1px);
}

.avatar {
  width: 64px;
  height: 82px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #eceae4;
}

.card-info {
  min-width: 0;
  flex: 1;
}

.card-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.name {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gender {
  flex-shrink: 0;
  font-size: 12px;
  line-height: 1;
}

.gender.m { color: #5b7fb4; }
.gender.f { color: #c2586e; }

.age-badge {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.industry {
  display: inline-block;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  margin: 4px 0 2px;
}

.dates {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: .2px;
}

.dates .sep { margin: 0 4px; color: #c9c3b6; }

.desc {
  font-size: 12.5px;
  color: #6f6a5e;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 生平弹窗 ---------- */
.avatar-clickable {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}

.avatar-clickable:hover {
  transform: scale(1.04);
  box-shadow: 0 2px 8px rgba(60, 50, 30, .18);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.open { display: flex; }

.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(40, 34, 24, .55);
}

.modal-box {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  max-width: 420px;
  width: 100%;
  padding: 22px;
  box-shadow: 0 12px 40px rgba(40, 34, 24, .35);
  animation: modal-in .18s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

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

.modal-body {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.modal-avatar {
  width: 96px;
  height: 124px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #eceae4;
}

.modal-info { min-width: 0; }

.modal-name {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
}

.modal-dates {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
}

.modal-desc {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.8;
  color: #4d483d;
}

/* ---------- 空状态 ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 48px 16px;
  font-size: 14px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 20px 16px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

/* ---------- 移动端 ---------- */
@media (max-width: 560px) {
  .site-header { padding: 30px 16px 16px; }
  .site-header h1 { font-size: 25px; letter-spacing: 4px; }

  .cards { grid-template-columns: 1fr; gap: 10px; }
  .avatar { width: 56px; height: 72px; }
  .name { font-size: 16px; }

  .filter-label { display: none; }
  .search-row input { max-width: none; }
}

@media (min-width: 561px) and (max-width: 760px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
}
