:root {
  color-scheme: light;
  --bg: #eef1ec;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --ink: #111827;
  --muted: #5f6b7a;
  --soft: #e9eee5;
  --line: #d7ded2;
  --accent: #0f766e;
  --accent-dark: #104f49;
  --accent-2: #a43b2a;
  --accent-3: #244f91;
  --blue: #244f91;
  --red: #a43b2a;
  --gold: #a76513;
  --shadow: 0 22px 70px rgba(17, 24, 39, 0.1);
  --font-sans:
    "IBM Plex Sans", "Noto Sans SC", Inter, ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  --font-serif:
    Georgia, "Times New Roman", "Songti SC", "Noto Serif SC",
    "Source Han Serif SC", serif;
  --font-mono:
    "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), transparent 360px),
    repeating-linear-gradient(
      90deg,
      rgba(17, 24, 39, 0.035) 0 1px,
      transparent 1px 80px
    ),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.paper-page {
  background: var(--surface);
}

body.paper-page .nav,
body.paper-page .page-shell {
  width: min(1640px, calc(100% - clamp(32px, 5vw, 96px)));
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(215, 222, 210, 0.9);
  background: rgba(238, 241, 236, 0.88);
  backdrop-filter: blur(16px);
}

.site-header.paper {
  background: rgba(255, 253, 248, 0.94);
}

.nav {
  display: flex;
  width: min(1180px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  text-decoration: none;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  font-weight: 900;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav-links a {
  text-decoration: none;
  transition: color 160ms ease;
}

.nav-links a:hover,
.text-link:hover {
  color: var(--accent-dark);
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.paper-shell {
  width: min(1640px, calc(100% - clamp(32px, 5vw, 96px)));
}

.hero {
  display: grid;
  min-height: calc(100vh - 68px);
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  gap: 54px;
  align-items: center;
  padding: 54px 0 70px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 850;
}

.hero h1,
.page-title {
  margin: 0;
  max-width: 820px;
  font-family: var(--font-serif);
  font-size: clamp(44px, 7vw, 84px);
  font-weight: 780;
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-copy,
.page-copy {
  max-width: 690px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(18px, 2vw, 21px);
}

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

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 20px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 850;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.secondary {
  background: transparent;
  color: var(--accent-dark);
}

.button.ghost {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.insight-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-image {
  aspect-ratio: 16 / 10;
  background: var(--soft);
}

.panel-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.panel-body {
  padding: 24px;
}

.panel-body h2 {
  margin: 0 0 10px;
  font-size: 22px;
  letter-spacing: 0;
}

.panel-body p {
  margin: 0;
  color: var(--muted);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-strong);
}

.metric strong {
  display: block;
  color: var(--accent-dark);
  font-size: 22px;
  line-height: 1.15;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.section {
  padding: 58px 0;
  border-top: 1px solid var(--line);
}

.section.tight {
  padding-top: 42px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.section h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
}

.section-head p,
.section > p {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
}

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.82);
  padding: 22px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 19px;
  letter-spacing: 0;
}

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

.card-link {
  display: inline-flex;
  margin-top: 18px;
  color: var(--accent-dark);
  font-weight: 850;
  text-decoration: none;
}

.paper-card {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(24, 34, 47, 0.07);
}

.paper-thumb {
  min-height: 270px;
  background: var(--soft);
}

.paper-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.paper-card-body {
  padding: 28px;
}

.paper-card h3 {
  margin: 0 0 12px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.paper-card p {
  margin: 0 0 18px;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 18px;
}

.tag {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  background: rgba(255, 254, 250, 0.76);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.route {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 18px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}

.route:first-child {
  border-top: 0;
}

.route strong {
  color: var(--accent-dark);
}

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

.page-hero {
  padding: 58px 0 42px;
}

.library-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.filter-panel {
  position: sticky;
  top: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 18px;
}

.filter-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.filter-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  font: inherit;
}

.filter-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.filter-list a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

.paper-list {
  display: grid;
  gap: 18px;
}

.compact-paper {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  overflow: hidden;
}

.compact-paper img {
  width: 100%;
  height: 100%;
  min-height: 210px;
  object-fit: cover;
  object-position: top center;
}

.compact-body {
  padding: 22px;
}

.compact-body h2 {
  margin: 0 0 10px;
  font-size: 23px;
  line-height: 1.22;
}

.compact-body p {
  margin: 0;
  color: var(--muted);
}

.status {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 0 10px;
  background: #e6f4f1;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
}

.placeholder-paper {
  border: 1px dashed #c7cec5;
  border-radius: 8px;
  padding: 24px;
  background: rgba(255, 253, 248, 0.62);
}

.placeholder-paper h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.placeholder-paper p {
  margin: 0;
  color: var(--muted);
}

.paper-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 36px;
  align-items: end;
  padding: 46px 0 34px;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.breadcrumb a {
  text-decoration: none;
}

.paper-title {
  margin: 0;
  max-width: 880px;
  font-size: clamp(36px, 5.8vw, 62px);
  line-height: 1.04;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.paper-dek {
  max-width: 820px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 20px;
}

.paper-meta {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.paper-meta dl {
  display: grid;
  gap: 14px;
  margin: 0;
}

.paper-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.paper-meta dd {
  margin: 3px 0 0;
  font-weight: 800;
}

.article-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 760px) minmax(220px, 1fr);
  gap: 30px;
  align-items: start;
  padding: 36px 0 70px;
}

.toc {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--line);
  padding: 2px 18px 18px 0;
  scrollbar-color: rgba(99, 112, 131, 0.44) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.toc a {
  display: block;
  border-left: 2px solid transparent;
  border-radius: 4px;
  padding: 3px 0 3px 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
  text-decoration: none;
}

.toc a:hover {
  border-left-color: rgba(15, 118, 110, 0.48);
  background: rgba(15, 118, 110, 0.06);
  color: var(--accent-dark);
}

.toc::-webkit-scrollbar,
.side-notes::-webkit-scrollbar {
  width: 6px;
}

.toc::-webkit-scrollbar-thumb,
.side-notes::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(99, 112, 131, 0.34);
}

.article {
  min-width: 0;
}

.article-section {
  padding: 30px 0;
  border-top: 1px solid var(--line);
}

.article-section:first-child {
  padding-top: 0;
  border-top: 0;
}

.article h2 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.18;
  letter-spacing: 0;
}

.article h3 {
  margin: 24px 0 8px;
  font-size: 21px;
  letter-spacing: 0;
}

.article p {
  margin: 12px 0;
  color: #334155;
}

.article ul,
.article ol {
  margin: 12px 0 0;
  padding-left: 22px;
  color: #334155;
}

.article li + li {
  margin-top: 7px;
}

.quote-box {
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #edf7f4;
  padding: 16px 18px;
  color: var(--accent-dark);
  font-weight: 850;
}

.formula {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 16px;
  color: #243142;
  font-family: var(--font-mono);
  font-size: 14px;
}

.figure {
  margin: 22px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.figure img {
  width: 100%;
  background: #ffffff;
}

.figure figcaption {
  border-top: 1px solid var(--line);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 13px;
}

.data-table {
  width: 100%;
  margin-top: 16px;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.side-notes {
  position: sticky;
  top: 92px;
  align-self: start;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 116px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-color: rgba(99, 112, 131, 0.44) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.note-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.note-block strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
}

.note-block p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--muted);
  font-size: 14px;
}

.site-footer .page-shell {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.home-page,
.library-page {
  background:
    linear-gradient(180deg, #f9faf6 0%, #eef1ec 56%, #ffffff 100%),
    repeating-linear-gradient(
      90deg,
      rgba(17, 24, 39, 0.035) 0 1px,
      transparent 1px 80px
    );
}

.home-hero {
  display: grid;
  min-height: auto;
  grid-template-columns: minmax(500px, 0.92fr) minmax(420px, 1.08fr);
  gap: clamp(34px, 5vw, 72px);
  align-items: start;
  padding: clamp(42px, 6vw, 78px) 0 76px;
}

.home-hero-copy {
  min-width: 0;
}

.home-hero h1 {
  max-width: none;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(56px, 4.9vw, 70px);
  font-weight: 780;
  letter-spacing: 0;
  line-height: 0.98;
  white-space: nowrap;
}

.home-lede {
  max-width: 660px;
  margin: 26px 0 0;
  color: #3d4856;
  font-size: clamp(18px, 2vw, 22px);
  line-height: 1.72;
}

.home-stats {
  display: grid;
  max-width: 560px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 38px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.home-stats div {
  padding: 16px 18px 18px 0;
  border-right: 1px solid var(--line);
}

.home-stats div:last-child {
  border-right: 0;
}

.home-stats dt,
.library-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-stats dd,
.library-summary dd {
  margin: 3px 0 0;
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 760;
  line-height: 1.1;
}

.recent-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.16);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: var(--shadow);
}

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

.recent-panel-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1;
}

.recent-panel-head > span {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border: 1px solid rgba(164, 59, 42, 0.24);
  border-radius: 999px;
  background: #fff7ed;
  color: var(--accent-2);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.recent-scroll {
  display: grid;
  max-height: min(760px, calc(100svh - 190px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(95, 107, 122, 0.38) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.recent-scroll::-webkit-scrollbar {
  width: 10px;
}

.recent-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(95, 107, 122, 0.42);
  background-clip: content-box;
}

.recent-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 17px 22px;
  text-decoration: none;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.recent-item:hover {
  background: rgba(15, 118, 110, 0.055);
}

.recent-index {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(164, 59, 42, 0.28);
  border-radius: 999px;
  background: #fff7ed;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
}

.recent-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.recent-main strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 26px;
  line-height: 1.02;
}

.recent-main em {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  font-style: normal;
  line-height: 1.3;
}

.recent-main small {
  color: #3d4856;
  font-size: 14px;
  line-height: 1.55;
}

.recent-date {
  justify-self: end;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
  white-space: nowrap;
}

.recent-more {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: var(--surface);
  font-weight: 900;
  text-decoration: none;
}

.compact-page-hero {
  padding-bottom: 30px;
}

.library-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 42px;
  align-items: end;
  padding: 76px 0 38px;
}

.library-summary {
  display: grid;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, 0.2);
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
}

.library-summary div {
  padding: 16px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.library-summary div:first-child {
  border-top: 0;
}

.library-summary dt {
  color: rgba(255, 254, 250, 0.58);
}

.library-summary dd {
  color: var(--surface);
  font-size: 24px;
}

.library-toolbar {
  position: sticky;
  top: 72px;
  z-index: 11;
  display: grid;
  grid-template-columns: minmax(260px, 680px) auto;
  gap: 16px;
  align-items: end;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(238, 241, 236, 0.9);
  backdrop-filter: blur(14px);
}

.search-box {
  display: grid;
  gap: 7px;
}

.search-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.search-box input:focus {
  border-color: rgba(15, 118, 110, 0.56);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.result-count {
  margin: 0;
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.library-simple {
  display: grid;
  gap: 0;
  padding: 26px 0 82px;
}

.library-paper {
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.library-paper:first-child {
  border-top: 1px solid var(--line);
}

.library-body {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  padding: 22px 0;
  text-decoration: none;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.library-body:hover {
  background: rgba(255, 254, 250, 0.66);
  transform: translateX(3px);
}

.library-index {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(164, 59, 42, 0.26);
  border-radius: 999px;
  background: #fff7ed;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 950;
}

.library-main {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.library-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.library-main strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 760;
  line-height: 1.12;
}

.library-main small {
  max-width: 820px;
  color: #3d4856;
  font-size: 15px;
  line-height: 1.58;
}

.paper-subtitle {
  max-width: 820px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 20px;
}

.paper-layout {
  display: grid;
  grid-template-columns: minmax(200px, 240px) minmax(0, min(1280px, 70vw));
  gap: clamp(28px, 2.4vw, 42px);
  align-items: start;
  justify-content: center;
  padding: 36px 0 72px;
}

.paper-toc {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 2px 18px 18px 0;
}

.paper-toc p {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.paper-toc a {
  display: block;
  border-left: 2px solid transparent;
  border-radius: 4px;
  padding: 3px 0 3px 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
  text-decoration: none;
}

.paper-toc a.toc-l1 {
  margin-top: 7px;
  color: #4b5b6d;
  font-size: 14.5px;
  font-weight: 850;
}

.paper-toc a.toc-l2 {
  padding-left: 22px;
  color: #647386;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.42;
}

.paper-toc a.toc-l3 {
  padding-left: 34px;
  color: #718093;
  font-size: 12.5px;
  font-weight: 680;
  line-height: 1.38;
}

.paper-toc a:hover {
  border-left-color: rgba(15, 118, 110, 0.48);
  background: rgba(15, 118, 110, 0.06);
  color: var(--accent-dark);
}

.paper-content {
  min-width: 0;
}

.note-hero {
  align-items: start;
}

.note-layout {
  grid-template-columns:
    minmax(210px, 260px)
    minmax(0, 940px)
    minmax(230px, 280px);
  column-gap: clamp(28px, 3.2vw, 58px);
  justify-content: center;
}

.toc a.toc-l2 {
  padding-left: 22px;
}

.toc a.toc-l3 {
  padding-left: 34px;
  font-size: 13px;
}

.markdown-body h1 {
  margin: 0 0 18px;
  font-size: 38px;
  line-height: 1.16;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.markdown-body h1:not(:first-child) {
  margin-top: 46px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.markdown-body h2 {
  margin-top: 34px;
  overflow-wrap: anywhere;
}

.markdown-body h3 {
  margin-top: 26px;
  overflow-wrap: anywhere;
}

.markdown-body p,
.markdown-body li {
  overflow-wrap: anywhere;
}

.markdown-body .math-inline {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  vertical-align: -0.12em;
}

.markdown-body h4 {
  margin: 22px 0 8px;
  font-size: 18px;
}

.markdown-body mark {
  border-radius: 4px;
  background: #fff0b8;
  color: var(--ink);
  padding: 1px 4px;
}

.markdown-body blockquote {
  margin: 18px 0;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: #edf7f4;
  padding: 14px 18px;
  color: var(--accent-dark);
}

.markdown-body pre {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 16px;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.markdown-body :not(pre) > code {
  border-radius: 4px;
  background: #eef2f7;
  padding: 2px 5px;
}

.markdown-body table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 18px 0;
  font-size: 14px;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
}

.markdown-body th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 850;
}

.markdown-body img {
  width: auto;
  max-height: 760px;
  margin: 22px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 26px 0;
}

.markdown-body mjx-container {
  max-width: 100%;
  vertical-align: -0.08em;
}

.markdown-body mjx-container:not([display="true"]) {
  display: inline-block;
  overflow-x: visible;
  overflow-y: visible;
  padding: 0 1px;
}

.markdown-body mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 6px 0;
}

.side-links {
  display: grid;
  gap: 8px;
}

.side-links a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
}

@media (min-width: 1021px) and (max-width: 1200px) {
  body.paper-page .nav,
  body.paper-page .page-shell {
    width: min(1120px, calc(100% - 40px));
  }

  .note-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    column-gap: 28px;
  }

  .note-layout .side-notes {
    position: static;
    grid-column: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 1020px) {
  .hero,
  .home-hero,
  .library-hero,
  .paper-hero,
  .article-layout,
  .library-layout,
  .library-toolbar,
  .paper-layout,
  .note-layout {
    grid-template-columns: 1fr;
  }

  .hero,
  .home-hero {
    min-height: auto;
  }

  .library-toolbar {
    position: static;
    align-items: start;
  }

  .toc,
  .paper-toc,
  .side-notes,
  .filter-panel {
    position: static;
    max-height: none;
    overflow: visible;
    border-right: 0;
    padding-right: 0;
  }

  .toc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
  }

  .paper-toc {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 18px;
  }
}

@media (max-width: 720px) {
  .nav,
  .site-footer .page-shell {
    display: block;
  }

  .nav {
    padding: 14px 0;
  }

  .nav-links {
    margin-top: 12px;
    flex-wrap: wrap;
  }

  .page-shell,
  .nav {
    width: min(100% - 28px, 680px);
  }

  body.paper-page .page-shell,
  body.paper-page .nav {
    width: min(100% - 28px, 680px);
  }

  .hero h1,
  .page-title {
    font-size: 42px;
  }

  .home-hero {
    padding: 42px 0 48px;
  }

  .home-hero h1 {
    font-size: 44px;
  }

  .home-stats,
  .library-summary {
    grid-template-columns: 1fr;
  }

  .home-stats div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .home-stats div:last-child {
    border-bottom: 0;
  }

  .recent-panel-head {
    align-items: start;
    padding: 18px;
  }

  .recent-scroll {
    max-height: 560px;
  }

  .recent-item {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    padding: 15px 16px;
  }

  .recent-date {
    grid-column: 2;
    justify-self: start;
  }

  .recent-main strong {
    font-size: 24px;
  }

  .library-hero {
    padding-top: 46px;
  }

  .library-toolbar {
    gap: 12px;
  }

  .grid-3,
  .grid-2,
  .metric-row,
  .paper-card,
  .compact-paper {
    grid-template-columns: 1fr;
  }

  .paper-thumb,
  .compact-paper img {
    min-height: 190px;
  }

  .section-head {
    display: block;
  }

  .compact-head {
    display: flex;
    align-items: end;
  }

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

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

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

  .library-body {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 12px;
    padding: 18px 0;
  }

  .library-main strong {
    font-size: 23px;
  }

  .site-footer .page-shell {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
