:root {
  --ink: #20211f;
  --muted: #60635d;
  --paper: #f7f4ee;
  --surface: #fffdf9;
  --line: #ded7cb;
  --teal: #146c62;
  --teal-dark: #0e4f49;
  --brick: #9a3f2b;
  --amber: #c88d35;
  --shadow: 0 18px 44px rgba(32, 33, 31, 0.14);
  color-scheme: light;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.75;
}

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

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: 4px;
  background: rgba(20, 108, 98, 0.12);
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--brick);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid rgba(222, 215, 203, 0.88);
  background: rgba(255, 253, 249, 0.9);
  backdrop-filter: blur(16px);
}

.brand,
.top-nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fffdf9;
  font-size: 0.82rem;
  letter-spacing: 0;
}

.top-nav {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  color: var(--muted);
  font-size: 0.94rem;
}

.top-nav a {
  border-bottom: 2px solid transparent;
}

.top-nav a:hover,
.top-nav a.active {
  color: var(--teal-dark);
  border-color: var(--amber);
}

.hero {
  position: relative;
  min-height: min(620px, 84vh);
  display: flex;
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

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

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(18, 20, 18, 0.84), rgba(18, 20, 18, 0.5) 54%, rgba(18, 20, 18, 0.18)),
    linear-gradient(0deg, rgba(247, 244, 238, 0.8), rgba(247, 244, 238, 0) 24%);
}

.hero-content {
  width: min(860px, calc(100% - 36px));
  margin-left: clamp(18px, 7vw, 104px);
  padding: 82px 0 122px;
  color: #fffdf9;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 860px;
  margin: 0;
  font-size: clamp(2.3rem, 6.4vw, 5.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-lede {
  max-width: 760px;
  margin: 28px 0 0;
  color: rgba(255, 253, 249, 0.9);
  font-size: clamp(1.02rem, 1.8vw, 1.22rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.primary-link,
.secondary-link,
.copy-button {
  min-height: 42px;
  border-radius: 8px;
  font-weight: 700;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
}

.primary-link {
  background: #fffdf9;
  color: var(--ink);
}

.secondary-link {
  border: 1px solid rgba(255, 253, 249, 0.5);
  color: #fffdf9;
}

.summary-strip {
  width: min(1320px, calc(100% - 36px));
  margin: -58px auto 0;
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  box-shadow: var(--shadow);
}

.summary-strip article {
  min-height: 132px;
  padding: 24px;
  background: var(--surface);
}

.summary-strip strong {
  display: block;
  margin-bottom: 8px;
  color: var(--teal-dark);
  font-size: 1.03rem;
}

.summary-strip span {
  color: var(--muted);
}

.full-page-shell {
  width: min(1320px, calc(100% - 36px));
  margin: 68px auto 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
}

.toc {
  position: sticky;
  top: 84px;
  align-self: start;
  padding: 18px;
  border-left: 3px solid var(--teal);
  color: var(--muted);
  font-size: 0.94rem;
}

.toc p {
  margin: 0 0 10px;
  color: var(--ink);
  font-weight: 800;
}

.toc a {
  display: block;
  padding: 8px 0;
}

.toc a:hover,
.toc a.active {
  color: var(--teal-dark);
  font-weight: 700;
}

.full-document-area {
  min-width: 0;
}

.overview-grid,
.document-card-list {
  display: grid;
  gap: 16px;
  margin: 22px 0;
}

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

.overview-grid article,
.doc-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.overview-grid article {
  padding: 20px;
}

.overview-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--teal-dark);
}

.overview-grid p {
  margin: 0;
  color: var(--muted);
}

.document-card-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.doc-card {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  transition:
    border-color 160ms ease,
    transform 160ms ease;
}

.doc-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.doc-card span,
.doc-card em {
  color: var(--muted);
  font-size: 0.92rem;
  font-style: normal;
}

.doc-card strong {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.4;
}

.document-block {
  scroll-margin-top: 92px;
  padding-bottom: 72px;
}

.document-head {
  margin-bottom: 20px;
}

.doc-index {
  margin: 0 0 8px;
  color: var(--brick);
  font-weight: 800;
}

.document-head h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.55rem);
  line-height: 1.22;
  letter-spacing: 0;
}

.source-path {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  word-break: break-all;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.doc-meta span,
.doc-meta a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.92rem;
}

.doc-meta a {
  color: var(--teal-dark);
  font-weight: 700;
}

.viewer-card,
.text-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 28px rgba(32, 33, 31, 0.08);
}

.viewer-card {
  overflow: hidden;
  margin-bottom: 18px;
}

.pdf-like-viewer,
.overview-papers {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ece6da;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(32, 33, 31, 0.08);
}

.viewer-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #ede7db;
}

.viewer-toolbar strong {
  color: var(--teal-dark);
}

.viewer-toolbar span {
  color: var(--muted);
  font-size: 0.94rem;
}

.pdf-viewer {
  display: block;
  width: 100%;
  height: min(920px, 82vh);
  border: 0;
  background: #fff;
}

.page-stack,
.overview-papers {
  display: grid;
  gap: 24px;
  max-height: min(980px, 86vh);
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(32, 33, 31, 0.04) 1px, transparent 1px),
    #ece6da;
  background-size: 24px 24px;
}

.overview-papers {
  margin-top: 20px;
}

.paper-page {
  width: min(100%, 820px);
  min-height: 1080px;
  margin: 0 auto;
  padding: 40px 46px 52px;
  border: 1px solid #d4cbbb;
  border-radius: 4px;
  background: #fffdf9;
  box-shadow: 0 16px 36px rgba(32, 33, 31, 0.16);
}

.compact-paper {
  min-height: 620px;
}

.paper-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e3ddd1;
  color: var(--muted);
  font-size: 0.86rem;
}

.paper-page-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paper-page-head b {
  color: var(--teal-dark);
  white-space: nowrap;
}

.paper-page-body p {
  margin: 0 0 12px;
  color: #2f302d;
  font-size: 1rem;
  line-height: 1.82;
  text-align: justify;
  word-break: break-word;
}

.paper-page-body .paper-heading {
  margin: 18px 0 10px;
  color: var(--teal-dark);
  font-size: 1.08rem;
  font-weight: 800;
  text-align: left;
}

.text-panel {
  overflow: hidden;
}

.text-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff7e8;
  cursor: pointer;
  font-weight: 800;
}

.text-panel summary::marker {
  color: var(--teal-dark);
}

.copy-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  padding: 8px 12px;
  background: #fffdf9;
  color: var(--teal-dark);
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
}

.copy-button:hover {
  border-color: var(--teal);
}

.copy-button.copied {
  background: var(--teal);
  color: #fffdf9;
}

.source-text {
  max-height: 760px;
  margin: 0;
  padding: 22px;
  overflow: auto;
  color: #2f302d;
  background: #fffdf9;
  white-space: pre-wrap;
  word-break: break-word;
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Consolas,
    monospace;
  font-size: 0.98rem;
  line-height: 1.72;
}

.site-footer {
  width: min(1320px, calc(100% - 36px));
  margin: 0 auto;
  padding: 46px 0 60px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--teal-dark);
  font-weight: 800;
}

@media (max-width: 1020px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-nav {
    justify-content: flex-start;
  }

  .summary-strip,
  .full-page-shell,
  .overview-grid,
  .document-card-list {
    grid-template-columns: 1fr;
  }

  .full-page-shell {
    margin-top: 48px;
  }

  .toc {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-left: 0;
    border-top: 3px solid var(--teal);
    background: rgba(255, 253, 249, 0.64);
  }

  .toc p {
    grid-column: 1 / -1;
  }

  .pdf-viewer {
    height: 760px;
  }
}

@media (max-width: 720px) {
  .site-header {
    padding-inline: 16px;
  }

  .top-nav {
    gap: 10px 14px;
    font-size: 0.9rem;
  }

  .hero {
    min-height: 610px;
  }

  .hero-overlay {
    background:
      linear-gradient(90deg, rgba(18, 20, 18, 0.9), rgba(18, 20, 18, 0.54)),
      linear-gradient(0deg, rgba(247, 244, 238, 0.8), rgba(247, 244, 238, 0) 18%);
  }

  .hero-content {
    width: calc(100% - 32px);
    margin-inline: 16px;
    padding-top: 64px;
  }

  .hero h1 {
    font-size: clamp(2.05rem, 12vw, 3.25rem);
  }

  .summary-strip {
    margin-top: -42px;
  }

  .summary-strip article {
    min-height: 0;
    padding: 20px;
  }

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

  .viewer-toolbar,
  .text-panel summary,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .pdf-viewer {
    height: 680px;
  }

  .page-stack,
  .overview-papers {
    max-height: 760px;
    padding: 14px;
  }

  .paper-page {
    min-height: auto;
    padding: 24px 20px 30px;
  }

  .paper-page-body p {
    font-size: 0.95rem;
    line-height: 1.75;
    text-align: left;
  }

  .source-text {
    max-height: 680px;
    padding: 16px;
    font-size: 0.94rem;
  }

  .primary-link,
  .secondary-link {
    width: 100%;
    justify-content: center;
  }
}
