:root {
  color-scheme: light;
  --bg: #f3efe6;
  --bg-deep: #e8e0d2;
  --surface: rgba(255, 252, 245, 0.76);
  --surface-solid: #fbf8f1;
  --ink: #1c1b18;
  --muted: #716b60;
  --faint: #9a9285;
  --line: rgba(28, 27, 24, 0.14);
  --line-strong: rgba(28, 27, 24, 0.28);
  --accent: #b4472d;
  --accent-deep: #8f321f;
  --panel: #201e19;
  --panel-ink: #f4efe4;
  --panel-muted: #a8a093;
  --shadow: 0 22px 60px rgba(52, 41, 26, 0.09);
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", "STSong", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #171612;
    --bg-deep: #211f1a;
    --surface: rgba(37, 35, 29, 0.8);
    --surface-solid: #24221c;
    --ink: #f1eadc;
    --muted: #b1a897;
    --faint: #827a6c;
    --line: rgba(241, 234, 220, 0.13);
    --line-strong: rgba(241, 234, 220, 0.27);
    --accent: #dc6a4d;
    --accent-deep: #ef8467;
    --panel: #0f0e0b;
    --panel-ink: #f5eddf;
    --panel-muted: #968d7d;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 88% 2%, rgba(180, 71, 45, 0.09), transparent 25rem),
    linear-gradient(90deg, transparent 0 49.92%, rgba(28, 27, 24, 0.022) 50%, transparent 50.08%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--accent);
  color: #fff7ec;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 14px;
  transform: translateY(-160%);
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 72px;
  padding: 0 4.5vw;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(18px) saturate(1.2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.brand-mark,
.footer-mark {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.07em;
  color: var(--accent);
}

.brand-text {
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-text i {
  padding: 0 4px;
  color: var(--faint);
  font-family: var(--sans);
  font-style: normal;
  font-weight: 400;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.header-nav a {
  text-decoration: none;
  transition: color 180ms ease;
}

.header-nav a:hover {
  color: var(--accent);
}

.header-divider {
  width: 1px;
  height: 14px;
  background: var(--line-strong);
}

main {
  width: min(1240px, 91vw);
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: clamp(54px, 8vw, 120px);
  align-items: center;
  min-height: min(700px, calc(100vh - 72px));
  padding: clamp(68px, 9vw, 118px) 0 clamp(78px, 9vw, 126px);
}

.hero-copy {
  animation: rise-in 700ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.eyebrow,
.section-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 23px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.eyebrow span {
  width: 26px;
  height: 1px;
  background: var(--accent);
}

.hero h1 {
  max-width: 850px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(3.5rem, 7.4vw, 7.2rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.lede {
  max-width: 650px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 1.9;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  margin-top: 38px;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  gap: 30px;
  padding: 13px 17px 13px 20px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: background 180ms ease, transform 180ms ease;
}

.primary-action:hover {
  background: var(--accent);
  transform: translateY(-2px);
}

.text-action {
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  transition: border-color 180ms ease, color 180ms ease;
}

.text-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.archive-panel {
  position: relative;
  padding: 25px 27px 30px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--panel-ink);
  animation: rise-in 800ms 100ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.archive-panel::before {
  content: "";
  position: absolute;
  top: -100px;
  right: -90px;
  width: 230px;
  height: 230px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.panel-rule {
  display: flex;
  justify-content: space-between;
  padding-bottom: 13px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--panel-muted);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel-count {
  margin-top: 24px;
  font-family: var(--serif);
  font-size: clamp(5.6rem, 9vw, 8.7rem);
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.08em;
}

.panel-caption {
  max-width: 230px;
  margin: 21px 0 28px;
  color: var(--panel-muted);
  font-family: var(--serif);
  font-size: 0.94rem;
  line-height: 1.65;
}

.panel-facts {
  margin: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.panel-facts div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.77rem;
}

.panel-facts dt {
  color: var(--panel-muted);
}

.panel-facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.panel-decoration {
  display: flex;
  align-items: end;
  gap: 5px;
  height: 26px;
  margin-top: 21px;
}

.panel-decoration span {
  width: 18%;
  height: 20%;
  background: var(--accent);
  opacity: 0.7;
}

.panel-decoration span:nth-child(2) {
  height: 46%;
}

.panel-decoration span:nth-child(3) {
  height: 31%;
}

.panel-decoration span:nth-child(4) {
  height: 68%;
}

.panel-decoration span:nth-child(5) {
  height: 100%;
}

.library {
  padding: 66px 0 96px;
  border-top: 1px solid var(--line-strong);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 34px;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--accent);
}

.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.3rem);
  letter-spacing: -0.04em;
}

.result-meta {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.79rem;
  letter-spacing: 0.025em;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: grid;
  grid-template-columns: minmax(280px, 390px) 1fr;
  gap: 22px;
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 46px;
  padding: 0 12px 0 14px;
  border: 1px solid var(--line-strong);
  background: var(--surface-solid);
  color: var(--muted);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 71, 45, 0.1);
}

.search-box svg {
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.86rem;
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-box kbd {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 2px 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.66rem;
  line-height: 1.2;
  text-align: center;
}

.filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  transition: background 170ms ease, border-color 170ms ease, color 170ms ease;
}

.filter-chip:hover {
  border-color: var(--line);
  color: var(--ink);
}

.filter-chip.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.filter-count {
  color: var(--faint);
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
}

.filter-chip.is-active .filter-count {
  color: color-mix(in srgb, var(--bg) 62%, transparent);
}

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

.paper-card {
  --cat: var(--accent);
  position: relative;
  display: flex;
  min-height: 330px;
  padding: 24px 24px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  flex-direction: column;
  transition: border-color 180ms ease, box-shadow 220ms ease, transform 220ms ease, background 220ms ease;
  animation: card-in 480ms calc(var(--i, 0) * 24ms) cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.paper-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--cat);
  transform: scaleX(0.16);
  transform-origin: left;
  transition: transform 260ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.paper-card[data-category="spec"] {
  --cat: #c85a3d;
}

.paper-card[data-category="model"] {
  --cat: #58736b;
}

.paper-card[data-category="system"] {
  --cat: #4e6385;
}

.paper-card[data-category="quant"] {
  --cat: #a27b31;
}

.paper-card[data-category="other"] {
  --cat: #7b7468;
}

.paper-card:hover {
  z-index: 2;
  transform: translateY(-5px);
  border-color: var(--line-strong);
  background: var(--surface-solid);
  box-shadow: var(--shadow);
}

.paper-card:hover::before {
  transform: scaleX(1);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.card-category {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.card-category::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--cat);
  border-radius: 50%;
}

.card-index {
  position: absolute;
  top: 50px;
  right: 23px;
  color: var(--line-strong);
  font-family: var(--serif);
  font-size: 2.6rem;
  line-height: 1;
  letter-spacing: -0.06em;
  pointer-events: none;
}

.paper-card h3 {
  max-width: 90%;
  margin: 43px 0 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 1.55vw, 1.52rem);
  line-height: 1.4;
  letter-spacing: -0.025em;
}

.card-subtitle {
  max-width: 94%;
  margin: 9px 0 0;
  color: var(--faint);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  line-height: 1.5;
}

.card-description {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.75;
}

.card-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: auto;
  padding-top: 28px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.64rem;
  line-height: 1.4;
}

.card-read {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 0.71rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.card-read span {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.paper-card:hover .card-read span {
  transform: rotate(45deg);
  border-color: var(--accent);
  background: var(--accent);
  color: #fff7ec;
}

.empty-state {
  margin-top: 26px;
  padding: 84px 30px;
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.empty-state > span {
  color: var(--accent);
  font-family: var(--serif);
  font-size: 3rem;
}

.empty-state h3 {
  margin: 11px 0 7px;
  font-family: var(--serif);
  font-size: 1.5rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state button {
  margin-top: 25px;
  padding: 10px 16px;
  border: 1px solid var(--line-strong);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
}

.empty-state button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.noscript-list {
  margin-top: 30px;
}

.noscript-list ul {
  padding-left: 1.2rem;
}

.noscript-list li {
  margin: 10px 0;
}

.noscript-list span {
  margin-left: 10px;
  color: var(--muted);
  font-size: 0.75rem;
}

.site-footer {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  width: min(1240px, 91vw);
  margin: 0 auto;
  padding: 34px 0 46px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.73rem;
}

.site-footer > div {
  display: flex;
  align-items: baseline;
  gap: 13px;
}

.site-footer p {
  margin: 0;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(13px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 46px;
  }

  .paper-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .site-header {
    min-height: 62px;
    padding: 0 5vw;
  }

  .brand-text i,
  .header-divider,
  .header-nav span:last-child {
    display: none;
  }

  main,
  .site-footer {
    width: min(100% - 36px, 620px);
  }

  .hero {
    display: block;
    min-height: 0;
    padding: 66px 0 74px;
  }

  .hero h1 {
    font-size: clamp(3.2rem, 15.4vw, 5.5rem);
  }

  .lede {
    margin-top: 27px;
    font-size: 0.98rem;
  }

  .archive-panel {
    margin-top: 56px;
  }

  .panel-count {
    font-size: 7rem;
  }

  .library {
    padding-top: 50px;
  }

  .section-heading {
    display: block;
  }

  .result-meta {
    margin-top: 12px;
  }

  .controls {
    padding: 13px;
  }

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

  .paper-card {
    min-height: 305px;
    padding: 21px;
  }

  .paper-card h3 {
    max-width: 88%;
    margin-top: 36px;
    font-size: 1.38rem;
  }

  .card-index {
    top: 45px;
    right: 20px;
  }

  .site-footer {
    display: block;
  }

  .site-footer > p {
    margin-top: 12px;
  }
}

@media (max-width: 430px) {
  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 18px;
  }

  .filter-chip {
    padding-right: 8px;
    padding-left: 8px;
  }

  .card-footer {
    align-items: start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
