:root {
  color-scheme: light;
  --paper: #f7f4ed;
  --paper-deep: #efeae0;
  --ink: #201f1c;
  --muted: #77726a;
  --line: rgba(32, 31, 28, 0.16);
  --accent: #8d3f2b;
  --serif-cn: "Songti SC", STSong, "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --serif-en: "New York", ui-serif, "Iowan Old Style", "Times New Roman", serif;
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "PingFang SC",
    "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% -10%, rgba(255, 255, 255, 0.72), transparent 38rem),
    var(--paper);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}

.shell {
  width: min(100% - 40px, 760px);
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 46px 0 24px;
  border-bottom: 1px solid var(--line);
}

.site-title {
  font-family: var(--serif-cn);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.site-note {
  color: var(--muted);
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.controls {
  padding: 27px 0 20px;
  border-bottom: 1px solid var(--line);
}

.search-wrap {
  position: relative;
}

.search-label {
  position: absolute;
  left: 0;
  top: 50%;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 14px;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 58px 0 26px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 400;
  appearance: none;
}

.search-input::placeholder {
  color: #9a958d;
}

.search-input:focus {
  border-bottom-color: var(--ink);
  outline: none;
}

.search-clear {
  position: absolute;
  right: 0;
  top: 50%;
  display: none;
  padding: 6px 0 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--ui);
  font-size: 12px;
  transform: translateY(-50%);
}

.search-clear.is-visible {
  display: block;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 18px;
}

.filters {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 16px;
}

.filter-button {
  padding: 0 0 5px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 400;
}

.filter-button:hover,
.filter-button.is-active {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.xhs-link {
  margin-left: auto;
  color: var(--muted);
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  transition: color 160ms ease;
}

.xhs-link:hover {
  color: var(--accent);
}

.article-list {
  padding: 15px 0 80px;
}

.article-card {
  display: block;
  padding: 31px 0 35px;
  border-bottom: 1px solid var(--line);
}

.article-card:hover .article-card-title {
  color: var(--accent);
}

.article-meta,
.result-count,
.empty-state,
.article-kicker,
.article-tags,
.figure-caption,
.back-link,
.site-footer {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 400;
}

.article-meta {
  display: flex;
  gap: 14px;
  margin-bottom: 12px;
  color: var(--muted);
}

.article-card-title {
  max-width: 690px;
  margin: 0;
  font-family: var(--serif-cn);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.55;
  transition: color 160ms ease;
}

.article-summary {
  margin: 14px 0 0;
  color: #4f4c46;
  font-family: var(--serif-cn);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.9;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 15px;
  margin-top: 17px;
  color: var(--muted);
  font-size: 13px;
}

.tag::before {
  content: "#";
  margin-right: 2px;
  color: #aaa49a;
}

.result-count {
  display: none;
  margin: 25px 0 0;
  color: var(--muted);
}

.result-count.is-visible {
  display: block;
}

.empty-state {
  display: none;
  padding: 54px 0;
  color: var(--muted);
}

.empty-state.is-visible {
  display: block;
}

.article-page .site-header {
  padding-bottom: 22px;
}

.article-main {
  padding: 55px 0 88px;
}

.back-link {
  display: inline-block;
  margin-bottom: 49px;
  color: var(--muted);
}

.back-link:hover {
  color: var(--ink);
}

.article-kicker {
  display: flex;
  gap: 15px;
  margin-bottom: 15px;
  color: var(--muted);
}

.article-title {
  margin: 0;
  font-family: var(--serif-cn);
  font-size: 30px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.005em;
}

.article-deck {
  margin: 23px 0 0;
  color: #5f5a52;
  font-family: var(--serif-cn);
  font-size: 16px;
  line-height: 1.9;
}

.article-header .article-tags {
  margin-top: 24px;
  padding-bottom: 38px;
  border-bottom: 1px solid var(--line);
}

.article-body {
  padding-top: 37px;
  font-family: var(--serif-cn);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.95;
  letter-spacing: 0.004em;
}

.article-body p {
  margin: 0 0 1.55em;
}

.article-body .latin {
  font-family: var(--serif-en);
}

.article-body h2 {
  margin: 2.7em 0 1.2em;
  font-family: var(--serif-cn);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.6;
}

.article-body h3 {
  margin: 2em 0 0.7em;
  font-family: var(--serif-cn);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.8;
}

.article-body figure {
  width: min(100vw - 40px, 920px);
  margin: 3.3em 0 3.45em;
  transform: translateX(calc((760px - min(100vw - 40px, 920px)) / 2));
}

.article-body img {
  display: block;
  width: 100%;
  max-height: 78vh;
  background: var(--paper-deep);
  object-fit: contain;
}

.article-body .portrait {
  width: min(76vw, 570px);
  margin-right: auto;
  margin-left: auto;
}

.figure-caption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  letter-spacing: 0.015em;
}

.article-conclusion {
  margin: 3.2em 0 2.7em;
  padding: 1.65em 0 0.05em;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.article-conclusion p {
  padding-left: 1.6em;
  text-indent: -1.6em;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 25px 0 45px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 799px) {
  .article-body figure {
    transform: none;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 30px, 760px);
  }

  .site-header {
    align-items: flex-start;
    padding-top: 30px;
  }

  .site-note {
    display: none;
  }

  .controls {
    padding-top: 21px;
  }

  .filter-row {
    gap: 12px;
  }

  .filters {
    gap: 13px;
  }

  .article-card {
    padding: 26px 0 30px;
  }

  .article-card-title {
    font-size: 22px;
  }

  .article-summary {
    font-size: 15px;
  }

  .article-main {
    padding: 36px 0 66px;
  }

  .back-link {
    margin-bottom: 35px;
  }

  .article-title {
    font-size: 28px;
  }

  .article-body {
    font-size: 17px;
    line-height: 1.92;
  }

  .article-body figure {
    width: calc(100vw - 30px);
  }

  .site-footer {
    flex-direction: column;
  }
}

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