@font-face {
  font-family: "Qingjian Serif";
  src: url("assets/noto-serif-sc-subset.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #faf9f5;
  --surface: #fffefa;
  --ink: #23352c;
  --muted: #5b655b;
  --green: #254c3c;
  --green-hover: #173e2e;
  --line: #e5e4db;
  --serif: "Qingjian Serif", "Songti SC", "Noto Serif CJK SC", SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--serif); font-weight: 700; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid #48745e; outline-offset: 3px; }

.shell {
  width: min(74rem, calc(100% - 5rem));
  margin-inline: auto;
}

.icon-library, .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.icon-library { pointer-events: none; }

svg:has(use) {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  z-index: 5;
  top: .75rem;
  left: .75rem;
  transform: translateY(-200%);
  border-radius: .4rem;
  padding: .6rem .9rem;
  background: var(--green);
  color: white;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner, .site-nav, .brand { display: flex; align-items: center; }

.header-inner {
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
}

.brand { gap: .7rem; white-space: nowrap; }

.brand-mark {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border-radius: .55rem;
  background: var(--green);
  color: #fffdf5;
}

.brand-mark svg { width: 1.45rem; height: 1.45rem; }
.brand-name { font: 700 1.45rem/1.2 var(--serif); letter-spacing: .07em; }

.brand-context {
  border-inline-start: 1px solid #dddcd2;
  padding-inline-start: .75rem;
  color: var(--muted);
  font-size: .875rem;
}

.site-nav { gap: 1.9rem; color: var(--muted); font-size: .9375rem; white-space: nowrap; }

.site-nav a {
  position: relative;
  display: inline-grid;
  min-height: 4.5rem;
  align-items: center;
}

.site-nav .home-link { color: var(--green); font-weight: 650; }

.home-link::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #3e644f;
  content: "";
}

.site-nav a:hover { color: var(--green); }

.nav-guide, .subject-reset, .primary-button, .secondary-button, .download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
}

.nav-guide {
  min-height: 2.4rem;
  border: 1px solid #e3e5da;
  border-radius: .4rem;
  padding: .2rem .7rem;
  background: transparent;
  color: var(--green);
  white-space: nowrap;
}

.nav-guide:hover, .secondary-button:hover { background: #edf1e9; }

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 22rem;
  margin-block-start: 1.75rem;
  border: 1px solid #e9e4d5;
  border-radius: .9rem;
  background: #f3eddf;
}

.hero-image {
  position: absolute;
  z-index: -2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 63%;
}

.hero-content { padding: 2.5rem clamp(2.4rem, 5vw, 4.25rem) 2.35rem; }

.hero-kicker {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: #4e5e4c;
  font-size: .875rem;
  font-weight: 650;
  letter-spacing: .19em;
}

.hero-kicker::before {
  width: 1.5rem;
  height: 1px;
  background: #72816a;
  content: "";
}

.hero h1 {
  margin-block-start: .65rem;
  color: #22382d;
  font-size: clamp(2.25rem, 4vw, 3.45rem);
  line-height: 1.22;
  letter-spacing: .035em;
}

.hero-description {
  margin-block-start: 1.05rem;
  color: #414e41;
  font-size: 1rem;
}

.primary-button {
  min-height: 2.8rem;
  margin-block-start: 1.25rem;
  border-radius: .4rem;
  padding: .45rem 1rem;
  background: var(--green);
  color: white;
  font-size: .9375rem;
  font-weight: 600;
}

.primary-button:hover { background: var(--green-hover); }

.subjects, .catalog { margin-block-start: 2.15rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: .85rem;
}

.section-head h2, .guide-dialog h2 {
  font-size: 1.55rem;
  line-height: 1.35;
  letter-spacing: .035em;
}

.subject-reset {
  min-height: 2.25rem;
  border: 1px solid #dfe4d9;
  border-radius: .4rem;
  padding: .15rem .65rem;
  background: var(--surface);
  color: var(--green);
  font-size: .875rem;
}

.subject-reset[aria-pressed="true"], .subject-reset:hover { background: #eef1e9; }
.subject-reset svg { width: 1rem; height: 1rem; }

.subject-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .9rem;
}

.is-math { --accent: #345844; --tint: #eaf0e6; }
.is-chinese { --accent: #864d43; --tint: #f6ebe6; }
.is-english { --accent: #3a566a; --tint: #eaf0f3; }
.is-science { --accent: #74592e; --tint: #f4eee0; }

.subject-card {
  display: flex;
  min-height: 5.25rem;
  align-items: center;
  gap: .85rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  padding: .95rem 1.1rem;
  background: var(--surface);
  text-align: start;
  transition: background-color 150ms, border-color 150ms;
}

.subject-card:hover { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }

.subject-card[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent) 57%, var(--line));
  background: color-mix(in srgb, var(--tint) 49%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 12%, transparent);
}

.subject-icon {
  display: grid;
  flex: none;
  width: 2.7rem;
  height: 2.7rem;
  place-items: center;
  border-radius: .55rem;
  background: var(--tint);
  color: var(--accent);
}

.subject-icon svg { width: 1.48rem; height: 1.48rem; }
.subject-copy { display: grid; gap: .13rem; }
.subject-copy strong { font-size: 1.0625rem; line-height: 1.35; }
.subject-copy [data-subject-count] { color: var(--muted); font-size: .875rem; white-space: nowrap; }

.catalog { scroll-margin-block-start: 1.25rem; }
.result-count { color: var(--muted); font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

.catalog-panel {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
}

.catalog-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .6rem 1rem;
  padding: .85rem 1rem;
}

.search-field, .select-field {
  position: relative;
  display: flex;
  min-height: 2.6rem;
  align-items: center;
  border: 1px solid #e4e5dc;
  border-radius: .4rem;
  background: #fbfaf7;
}

.search-field { flex: 1 1 16rem; max-width: 24rem; padding-inline-start: .7rem; color: #677566; }
.search-field:focus-within, .select-field:focus-within { outline: 2px solid #48745e; outline-offset: 1px; }

.search-field input, .select-field select {
  min-width: 0;
  min-height: 2.6rem;
  border: 0;
  background: transparent;
  font-size: .9375rem;
}

.search-field input { width: 100%; outline: none; padding: .2rem .75rem .2rem .55rem; color: var(--ink); }
.search-field input::placeholder { color: #676d63; }
.filter-group { display: flex; gap: .6rem; }

.select-field select {
  width: 100%;
  min-width: 8rem;
  appearance: none;
  outline: none;
  padding: .2rem 2rem .2rem .7rem;
}

.select-field svg { position: absolute; right: .55rem; color: #647264; pointer-events: none; }

table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #f4f4ed; color: #536054; }
thead th { border-block: 1px solid #eeeee6; font-size: .875rem; font-weight: 600; }
th, td { padding: .65rem 1rem; }
th:first-child { padding-inline-start: 1.15rem; }
td:last-child, .actions-heading { padding-inline-end: 1.1rem; }
thead th:first-child { width: 47%; }
thead th:nth-child(2), thead th:nth-child(3) { width: 12%; }
thead th:nth-child(4) { width: 13%; }
.actions-heading, .row-actions { text-align: right; }
tbody tr:not(:last-child) { border-bottom: 1px solid #eeeee6; }
tbody tr:hover { background: #fbfbf6; }
tbody td { color: #49584b; font-size: .9375rem; }
tbody th { font-weight: 400; }

.resource-main { display: flex; align-items: center; gap: .7rem; }

.file-icon {
  display: grid;
  flex: none;
  width: 2.45rem;
  height: 2.55rem;
  place-items: center;
  border-radius: .42rem;
}

.file-icon.is-docx { background: #eaf0f4; color: #426780; }
.file-icon.is-pdf { background: #f6ebe6; color: #925246; }
.resource-copy { display: grid; gap: .12rem; min-width: 0; }
.resource-title { color: #26382d; font-size: .9875rem; font-weight: 650; }
.resource-meta { color: var(--muted); font-size: .8125rem; }

.subject-tag {
  display: inline-block;
  border-radius: .28rem;
  padding: .1rem .4rem;
  background: var(--tint, #edf0ea);
  color: var(--accent, #475e4f);
  font-size: .875rem;
  white-space: nowrap;
}

.row-actions { display: flex; justify-content: flex-end; align-items: center; gap: .55rem; white-space: nowrap; }

.preview-link {
  display: inline-flex;
  min-height: 2.25rem;
  align-items: center;
  padding-inline: .35rem;
  color: #4c5d50;
  font-size: .875rem;
}

.preview-link:hover { text-decoration: underline; text-underline-offset: .2rem; }

.download-link, .secondary-button {
  min-height: 2.25rem;
  border: 1px solid #dce5da;
  border-radius: .35rem;
  padding: .1rem .5rem;
  background: #f2f5ef;
  color: var(--green);
  font-size: .875rem;
  font-weight: 600;
}

.download-link:hover { background: #e5ede3; border-color: #b9cabb; }

.catalog-note {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-block: .85rem 2.65rem;
  color: var(--muted);
  font-size: .875rem;
}

.catalog-note svg { width: 1.1rem; height: 1.1rem; }

.empty-state { display: grid; justify-items: center; gap: .6rem; padding: 2.5rem 1rem; border-top: 1px solid var(--line); text-align: center; }
.empty-state h3 { font-size: 1.1rem; }
.empty-state p, .no-script { color: var(--muted); }
.no-script { padding: 1rem; }
.empty-icon, .guide-icon { display: grid; width: 2.8rem; height: 2.8rem; place-items: center; border-radius: .55rem; background: #eaf0e6; color: var(--green); }
.empty-icon svg, .guide-icon svg { width: 1.55rem; height: 1.55rem; }
.empty-state .secondary-button { margin-top: .15rem; padding-inline: .8rem; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .875rem; }
.footer-inner { display: flex; min-height: 4.3rem; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-inner strong { color: var(--green); font: 700 1rem var(--serif); }
.footer-divider { display: inline-block; width: 1px; height: .75rem; margin-inline: .6rem; background: #d9dcd2; }
.footer-inner a:hover { text-decoration: underline; }

.guide-dialog {
  width: min(31rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  border: 1px solid var(--line);
  border-radius: .75rem;
  padding: 1.4rem;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1rem 3rem #192b2340;
}

.guide-dialog::backdrop { background: #18292177; }
.guide-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: .8rem; }
.icon-button { display: grid; width: 2.5rem; height: 2.5rem; place-items: center; border: 0; border-radius: .4rem; background: transparent; color: var(--muted); }
.icon-button:hover { background: #edf1e9; }
.guide-dialog ol { padding-inline-start: 1.4rem; }
.guide-dialog li + li { margin-block-start: .45rem; }
.guide-note { padding-top: .8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9375rem; }

@media (max-width: 64rem) {
  .shell { width: calc(100% - 3rem); }
  .hero-image { object-position: 60% 61%; }
  .subject-card { padding-inline: .85rem; }
  th, td { padding-inline: .75rem; }
}

@media (max-width: 45rem) {
  .shell { width: calc(100% - 2rem); }
  .header-inner { min-height: 4rem; }
  .site-nav { gap: .75rem; }
  .site-nav a { min-height: 4rem; }
  .brand-context, .site-nav .home-link { display: none; }

  .hero { min-height: auto; margin-block-start: 1rem; }
  .hero::after { position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #f6efe2ef 6%, #f6efe2c9 48%, #f6efe23b 100%); content: ""; }
  .hero-content { padding: 1.7rem 1.35rem 1.8rem; }
  .hero-image { object-position: 62% 58%; }
  .hero h1 { font-size: clamp(2rem, 6.3vw, 2.65rem); }
  .hero-description { max-width: 19rem; }

  .subjects, .catalog { margin-block-start: 1.6rem; }
  .section-head h2 { font-size: 1.35rem; }
  .subject-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  .subject-card { min-height: 4.7rem; gap: .65rem; padding: .65rem .7rem; }

  .catalog-tools { flex-direction: column; }
  .search-field { flex: auto; max-width: none; }
  .filter-group .select-field { flex: 1; min-width: 0; }
  .select-field select { min-width: 0; }

  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    align-items: center;
    gap: .25rem .55rem;
    padding: .75rem 1rem;
  }
  tbody tr:first-child { border-top: 1px solid #eeeee6; }
  tbody th, tbody td { padding: 0; }
  tbody th:first-child { grid-column: 1 / -1; padding: 0 0 .15rem; }
  tbody td:last-child { grid-column: 1 / -1; padding: .18rem 0 0; }
  .row-actions { justify-content: flex-start; padding-inline-start: 3.15rem; }
  tbody td[data-label="学科"] { margin-inline-start: 3.15rem; }
  tbody td[data-label="年级"], .type-label { font-size: .875rem; }
  .download-link, .preview-link { min-height: 2.5rem; }
  .catalog-note { margin-block-end: 1.7rem; }
}

@media (max-width: 24rem) {
  .site-nav .nav-guide svg { display: none; }
  .brand { gap: .45rem; }
  .site-nav { gap: .55rem; }
  .nav-guide { padding-inline: .4rem; }
}

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