:root {
  --paper: #f7f6f1;
  --ink: #171a1f;
  --muted: #62676f;
  --line: #d9d8d1;
  --surface: #ffffff;
  --blue: #1d5fd1;
  --red: #c53f32;
  --green: #16836f;
  --gold: #ba7b13;
  --violet: #7151a2;
  --cyan: #167b9a;
  --radius: 8px;
  --content: min(1180px, calc(100% - 48px));
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "DM Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  width: var(--content);
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: #fff;
  background: var(--ink);
  border-radius: 6px;
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
}

.header-note {
  color: var(--muted);
  font-size: 14px;
}

.intro {
  position: relative;
  width: var(--content);
  min-height: 390px;
  margin: 0 auto;
  overflow: hidden;
  border-radius: var(--radius);
  background: #bda77e;
}

.intro-image,
.intro-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-image { object-fit: cover; }

.intro-shade {
  right: auto;
  width: 58%;
  background: rgba(18, 22, 27, .78);
}

.intro-copy {
  position: relative;
  z-index: 1;
  max-width: 590px;
  padding: 68px 64px 58px;
  color: #fff;
}

.eyebrow,
.section-kicker {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
}

.eyebrow { color: #d8e5ff; }
.section-kicker { color: var(--blue); }

h1,
h2,
h3,
p { margin-top: 0; }

h1 {
  margin-bottom: 24px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 43px;
  line-height: 1.36;
  letter-spacing: 0;
}

.intro-summary {
  margin-bottom: 0;
  color: rgba(255, 255, 255, .82);
  font-size: 15px;
}

.directory {
  width: var(--content);
  margin: 0 auto;
  padding: 64px 0 84px;
}

.directory-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin-bottom: 0;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: 0;
}

.search-box {
  position: relative;
  width: min(340px, 100%);
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 15px;
  height: 15px;
  border: 2px solid #737982;
  border-radius: 50%;
  transform: translateY(-58%);
  pointer-events: none;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -5px;
  bottom: -4px;
  width: 6px;
  height: 2px;
  background: #737982;
  transform: rotate(45deg);
  transform-origin: left center;
}

.search-box input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 41px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  font: inherit;
}

.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(29, 95, 209, .12);
}

.filters {
  display: flex;
  gap: 6px;
  margin: 22px 0 30px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filters::-webkit-scrollbar { display: none; }

.filter-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 15px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.filter-button:hover { color: var(--ink); }

.filter-button[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  position: relative;
  display: flex;
  min-height: 230px;
  flex-direction: column;
  padding: 24px;
  overflow: hidden;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.project-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.project-card:hover {
  z-index: 1;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 14px 34px rgba(27, 34, 44, .09);
  transform: translateY(-3px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-domain,
.project-count {
  color: var(--muted);
  font-size: 12px;
}

.subject-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--accent);
  border-radius: 7px;
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
}

.project-card h3 {
  margin: 26px 0 9px;
  font-family: "Noto Serif SC", "Songti SC", serif;
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: 0;
}

.project-description {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.72;
}

.subprojects {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 13px;
  margin-top: auto;
  padding-top: 17px;
  border-top: 1px solid #ecebe6;
}

.subproject-link {
  position: relative;
  z-index: 2;
  color: #444a52;
  font-size: 12px;
  text-decoration: none;
}

.subproject-link:hover { color: var(--accent); text-decoration: underline; }

.empty-state {
  padding: 64px 0;
  color: var(--muted);
  text-align: center;
}

footer {
  width: var(--content);
  margin: 0 auto;
  padding: 24px 0 42px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

@media (max-width: 880px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .intro { min-height: 360px; }
  .intro-copy { padding: 58px 42px; }
}

@media (max-width: 620px) {
  :root { --content: min(100% - 28px, 1180px); }
  .site-header { height: 62px; }
  .intro { min-height: 410px; }
  .intro-image { object-position: 61% center; }
  .intro-shade { width: 100%; background: rgba(18, 22, 27, .66); }
  .intro-copy { padding: 50px 26px; }
  h1 { font-size: 34px; }
  .directory { padding: 50px 0 64px; }
  .directory-head { align-items: stretch; flex-direction: column; }
  .search-box { width: 100%; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 215px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .project-card { transition: none; }
}

.update-status {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  padding: 11px 15px;
  color: #fff;
  background: #171a1f;
  border-radius: 7px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  font-size: 13px;
}
