@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400&family=Playfair+Display:ital@1&display=swap');

:root {
  --paper: #fdfbf7;
  --paper-2: #f5f5f5;
  --ink: #1a1a1a;
  --ink-2: #4d4941;
  --line: #e3ded4;
  --seam: #e0e0e0;
}

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

html {
  scroll-behavior: smooth;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Playfair Display', 'Songti SC', 'Noto Serif SC', 'Source Han Serif SC', Georgia, serif;
  font-size: 17px;
  line-height: 1.72;
  transition: none;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.32;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

img {
  max-width: 100%;
}

a {
  color: var(--ink);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  font-size: 16px;
  text-decoration: none;
}

.skip:focus {
  left: 10px;
  top: 10px;
}

/* ---------- 顶栏 ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--seam);
}

.bar__mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  text-decoration: none;
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1;
  overflow: hidden;
}

.bar__mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
}

.bar__find {
  display: flex;
  align-items: center;
  flex: 0 1 230px;
  min-width: 0;
  margin-left: auto;
  border: 1px solid var(--seam);
  border-radius: 10px;
  background: var(--paper-2);
  overflow: hidden;
}

.bar__find label {
  padding-left: 10px;
  font-size: 16px;
  color: var(--ink-2);
  white-space: nowrap;
}

.bar__find input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  padding: 9px 8px;
  color: var(--ink);
}

.bar__find input:focus {
  outline: none;
}

.bar__find button {
  flex: 0 0 auto;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

.bar__nav {
  margin-left: 4px;
  min-width: 0;
}

.bar__nav ol {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bar__nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 10px 10px;
  font-size: 16px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.bar__nav a::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  flex: 0 0 auto;
}

.bar__nav a:hover,
.bar__nav a:focus-visible {
  border-bottom-color: var(--ink);
}

/* ---------- 首屏 ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  min-height: 100svh;
  padding: 120px 6vw 9vh;
  overflow: hidden;
  border-bottom: 1px solid var(--seam);
}

.hero__fig {
  position: absolute;
  inset: 0;
  margin: 0;
  z-index: 0;
}

.hero__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(253, 251, 247, 0.7);
}

.hero--bare::after {
  background: var(--paper-2);
}

.hero__cap {
  position: absolute;
  left: 6vw;
  bottom: 5vh;
  z-index: 2;
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--ink-2);
}

.hero__ghost {
  position: absolute;
  left: 0;
  right: 0;
  top: 44%;
  transform: translateY(-50%);
  z-index: 1;
  margin: 0;
  font-family: 'Playfair Display', 'Songti SC', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(3.2rem, 13vw, 12.5rem);
  line-height: 0.88;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  opacity: 0.11;
  pointer-events: none;
  user-select: none;
}

.hero__body {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 760px;
  margin-left: auto;
  text-align: right;
}

.hero__h1 {
  margin: 0;
  font-size: clamp(1.95rem, 5.8vw, 4.3rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  font-weight: 700;
  word-break: break-word;
}

/* ---------- 主体 ---------- */

.wrap {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 64px) 20px 0;
}

.side {
  position: sticky;
  top: 86px;
  border-top: 2px solid var(--ink);
  padding-top: 12px;
}

.side__eb {
  display: block;
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--ink-2);
}

.side__h {
  margin: 0.15em 0 0.7em;
  font-size: 1.3rem;
  line-height: 1.3;
  font-weight: 700;
}

.side__list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: s;
}

.side__list li {
  border-bottom: 1px solid var(--seam);
}

.side__list li:last-child {
  border-bottom: 0;
}

.side__list a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 9px 0;
  font-size: 16px;
  text-decoration: none;
}

.side__list a::before {
  counter-increment: s;
  content: counter(s, decimal-leading-zero);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 16px;
  color: var(--ink-2);
}

.side__list a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.prose {
  max-width: 70ch;
  min-width: 0;
}

.prose > section {
  border: 1px solid var(--line);
  border-bottom: 2px solid var(--ink);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
  padding: clamp(20px, 3vw, 34px);
  margin-bottom: clamp(24px, 3.5vw, 42px);
  scroll-margin-top: 100px;
}

.prose small {
  display: block;
  font-size: 16px;
  letter-spacing: 0.28em;
  color: var(--ink-2);
  margin: 0 0 6px;
}

.prose h2 {
  margin: 0.1em 0 0.7em;
  font-size: clamp(1.45rem, 2.6vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.prose h3 {
  margin: 1.6em 0 0.5em;
  font-size: 1.16rem;
  line-height: 1.4;
  font-weight: 700;
}

.prose p {
  margin: 0 0 1em;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.prose ul,
.prose ol {
  margin: 0 0 1em;
  padding-left: 1.3em;
}

.prose li {
  margin: 0.35em 0;
}

.prose img {
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.prose figure {
  margin: 1.4em 0;
  padding: 12px;
  border-left: 3px solid var(--ink);
  border-radius: 0 10px 10px 0;
  background: var(--paper-2);
}

.prose figure img {
  margin: 0 0 8px;
  border-radius: 8px;
}

.prose figcaption {
  font-size: 16px;
  color: var(--ink-2);
}

.prose blockquote {
  margin: 1.2em 0;
  padding: 8px 0 8px 18px;
  border-left: 3px solid var(--ink);
  color: var(--ink-2);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

.prose th,
.prose td {
  border-bottom: 1px solid var(--seam);
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

.prose code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.95em;
  background: var(--paper-2);
  padding: 1px 5px;
  border-radius: 4px;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--seam);
  margin: 1.6em 0;
}

/* ---------- 页脚 ---------- */

.foot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  max-width: 1180px;
  margin: clamp(40px, 7vw, 72px) auto 0;
  padding: 26px 20px 20px;
  border-top: 2px solid var(--ink);
}

.foot dl {
  margin: 0;
}

.foot dt {
  font-size: 16px;
  letter-spacing: 0.3em;
  color: var(--ink-2);
  margin-bottom: 6px;
}

.foot dd {
  margin: 0;
  font-size: 16px;
}

.foot dd a {
  display: inline-block;
  padding: 8px 0;
  min-height: 40px;
  text-decoration: none;
  border-bottom: 1px solid var(--seam);
}

.foot dd a:hover {
  border-bottom-color: var(--ink);
}

.foot__cr {
  grid-column: 1 / -1;
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--seam);
  text-align: center;
  font-size: 16px;
  color: var(--ink-2);
}

/* ---------- 揭示 ---------- */

.js .rv {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s linear, transform 0.2s linear;
  transition-delay: calc(var(--i, 0) * 40ms);
}

.js .rv.is-in {
  opacity: 1;
  transform: none;
}

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

  .js .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------- 窄屏 ---------- */

@media (max-width: 900px) {
  .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .side {
    position: static;
  }

  .side__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0 18px;
  }

  .side__list li {
    border-bottom: 0;
  }
}

@media (max-width: 820px) {
  .bar {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .bar__mark {
    order: 1;
  }

  .bar__nav {
    order: 2;
    flex: 1 1 0;
    min-width: 0;
    margin-left: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .bar__nav::-webkit-scrollbar {
    display: none;
  }

  .bar__find {
    order: 3;
    flex: 1 0 100%;
    margin-left: 0;
  }

  .hero {
    padding: 110px 22px 8vh;
  }

  .hero__cap {
    left: 22px;
    bottom: 3vh;
  }

  .hero__ghost {
    top: 40%;
  }

  .foot {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 22px 18px 18px;
  }
}

@media (max-width: 420px) {
  .foot {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .foot dl:first-child {
    grid-column: 1 / -1;
  }
}

button[aria-expanded]{min-width:44px;min-height:44px}
