:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --text: #24211f;
  --muted: #6a625a;
  --line: #d9d1c5;
  --accent: #8f2f25;
  --accent-dark: #612019;
  --green: #526f5d;
  --blue: #4f6777;
  --shadow: 0 18px 48px rgba(54, 43, 35, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
}

.site-header,
main,
.site-footer {
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2.1rem, 4vw, 4rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 10px;
  line-height: 1.35;
}

.lede {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.05rem;
}

.header-link,
.link-row a,
button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.header-link {
  padding: 11px 16px;
  white-space: nowrap;
}

main {
  padding: 34px 0 48px;
}

.section-heading {
  margin-bottom: 18px;
}

.topics-section {
  margin-bottom: 42px;
}

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

.topic-card,
.literature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.topic-card {
  padding: 20px;
}

.card-topline,
.literature-head,
.library-meta,
.link-row,
.tag-row,
.topic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.card-topline,
.literature-head,
.library-meta {
  justify-content: space-between;
}

.card-topline p,
.card-topline span,
.meta,
.original-title,
.citation {
  color: var(--muted);
}

.card-topline p,
.meta {
  margin-bottom: 0;
  font-size: 0.88rem;
  font-weight: 700;
}

.card-topline span,
.status-pill {
  border-radius: 999px;
  background: #efe4d5;
  color: var(--accent-dark);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 4px 10px;
}

.tag-row span,
.topic-row span {
  border: 1px solid #d6c7b3;
  border-radius: 999px;
  color: #574d43;
  font-size: 0.84rem;
  padding: 4px 9px;
}

.topic-row span {
  border-color: #c8d1ca;
  color: var(--green);
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr minmax(240px, 1.6fr);
  gap: 12px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.library-meta {
  margin-bottom: 14px;
}

.library-meta p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

button {
  padding: 8px 12px;
}

.literature-list {
  display: grid;
  gap: 14px;
}

.literature-card {
  padding: 22px;
}

.literature-head {
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.original-title {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
}

.relevance {
  border-left: 3px solid var(--blue);
  color: #3f4e56;
  padding-left: 12px;
}

.citation {
  margin-top: 14px;
  font-size: 0.9rem;
}

.link-row {
  margin-top: 14px;
}

.link-row a {
  display: inline-flex;
  padding: 8px 12px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.7);
  color: var(--muted);
  padding: 28px;
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 24px 0 36px;
}

@media (max-width: 900px) {
  .site-header,
  .filters {
    grid-template-columns: 1fr;
  }

  .topic-grid {
    grid-template-columns: 1fr;
  }

  .header-link {
    width: fit-content;
  }
}

@media (max-width: 560px) {
  .site-header,
  main,
  .site-footer {
    width: min(100vw - 28px, 1180px);
  }

  .site-header {
    padding-top: 32px;
  }

  .literature-head {
    display: block;
  }

  .status-pill {
    display: inline-flex;
    margin-top: 10px;
  }
}
