:root {
  --paper: #faf7f1;
  --paper-2: #f3eee5;
  --ink: #1d1b18;
  --ink-2: #57514a;
  --ink-3: #8a8279;
  --line: #e5ddd0;
  --accent: #b2542f;
  --accent-soft: #f6e7df;
  --gold: #a9822f;
  --shadow: 0 10px 30px rgba(50, 38, 20, .08);
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

html[data-theme="dark"] {
  --paper: #14130f;
  --paper-2: #1c1a16;
  --ink: #f0eade;
  --ink-2: #b5ac9c;
  --ink-3: #8b8272;
  --line: #2e2a23;
  --accent: #e08355;
  --accent-soft: #2a201a;
  --gold: #d3aa55;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}

body {
  font-family: var(--sans);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: min(1080px, calc(100% - 44px));
  margin: 0 auto;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 0;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  text-decoration: none;
  color: var(--ink);
  flex: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0;
}

.brand-text b { font-family: var(--serif); font-size: 17px; letter-spacing: .04em; }
.brand-text small { display: block; color: var(--ink-3); font-size: 11px; letter-spacing: .12em; margin-top: -2px; }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
}
.nav a:hover { background: var(--paper-2); color: var(--ink); }

.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search input {
  width: 210px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: width .25s ease, border-color .2s;
}
.search input:focus { width: 260px; border-color: var(--accent); }

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
  display: grid;
  place-items: center;
  transition: .18s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }

/* ---------- hero ---------- */
.hero { padding: 64px 0 40px; }

.hero-kicker {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: .28em;
  color: var(--accent);
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(30px, 4.6vw, 52px);
  line-height: 1.28;
  margin: 0 0 16px;
  letter-spacing: .01em;
  font-weight: 600;
}

.hero-sub {
  max-width: 640px;
  color: var(--ink-2);
  margin: 0 0 26px;
  font-size: 15px;
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 14px;
  cursor: pointer;
  transition: .18s;
  font-family: inherit;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { padding: 8px 16px; font-size: 13px; }

.stats { display: flex; gap: 22px; margin-top: 30px; color: var(--ink-3); font-size: 13px; }
.stats b { color: var(--ink); font-family: var(--serif); font-size: 17px; margin-right: 2px; }

/* ---------- category cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 56px;
}

.cat-card {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: 16px;
  padding: 22px;
  cursor: pointer;
  transition: .22s;
  color: var(--ink);
  font-family: inherit;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent); }

.cat-card .cat-idx {
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .2em;
  color: var(--accent);
}
.cat-card h3 { font-family: var(--serif); font-size: 22px; margin: 8px 0 6px; font-weight: 600; }
.cat-card p { margin: 0; color: var(--ink-2); font-size: 13px; }
.cat-card .cat-count { margin-top: 14px; font-size: 12px; color: var(--ink-3); }

/* ---------- list ---------- */
.list-section { padding-bottom: 20px; }

.list-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  transition: .18s;
}
.tab:hover { color: var(--ink); border-color: var(--ink-3); }
.tab.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.list-count { margin-left: auto; color: var(--ink-3); font-size: 12px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.item {
  position: relative;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 14px;
  padding: 20px 20px 16px;
  cursor: pointer;
  transition: .2s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}
.item:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }

.item-badge {
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--accent);
  text-transform: uppercase;
}
.item h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
.item p {
  margin: 0;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.8;
  flex: 1;
}
.item-body-full { font-size: 15px; line-height: 1.85; }
.quote-line { font-family: var(--serif); font-size: 17px; line-height: 1.9; letter-spacing: .01em; }

.item-tech {
  display: flex;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 11.5px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}

.empty { text-align: center; color: var(--ink-3); padding: 40px 0; }

/* ---------- about ---------- */
.about {
  border-top: 1px solid var(--line);
  margin-top: 50px;
  padding: 34px 0 60px;
}
.about h2 { font-family: var(--serif); font-size: 20px; margin: 0 0 10px; font-weight: 600; }
.about p { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 720px; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--paper-2); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 0;
  color: var(--ink-3);
  font-size: 12.5px;
  letter-spacing: .04em;
}

/* ---------- reader ---------- */
.reader { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; }
.reader-mask { position: absolute; inset: 0; background: rgba(20, 16, 12, .45); backdrop-filter: blur(3px); }

.reader-panel {
  position: relative;
  width: min(680px, calc(100% - 32px));
  max-height: 86vh;
  overflow: auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 26px 30px 22px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, .25);
  animation: pop .24s ease;
}
@keyframes pop { from { transform: translateY(14px) scale(.985); } }

.reader-top { display: flex; align-items: center; justify-content: space-between; }
.reader-type { font-size: 11px; letter-spacing: .18em; color: var(--accent); text-transform: uppercase; }
.reader-tools { display: flex; gap: 8px; }

.reader-title {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 30px);
  margin: 14px 0 18px;
  font-weight: 600;
  line-height: 1.35;
}

.reader-body { color: var(--ink); font-size: 16px; line-height: 1.95; }
.reader-body p { margin: 0 0 1em; }
.reader-body.quote-body {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.9;
  color: var(--ink);
}
.reader-body.joke-body { font-size: 17px; }

.reader-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .cards { grid-template-columns: 1fr; }
  .nav { display: none; }
  .search input { width: 140px; }
  .search input:focus { width: 170px; }
  .hero { padding: 44px 0 30px; }
}

@media (max-width: 520px) {
  .brand-text small { display: none; }
  .stats { gap: 14px; font-size: 12px; }
  .reader-panel { padding: 20px 18px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
