@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: #fafaf8;
  --ink: #1a1a1a;
  --grey: #4a4a4a;
  --line: rgba(26, 26, 26, 0.22);
  --soft: rgba(26, 26, 26, 0.06);
  --serif: "Playfair Display", Georgia, "Songti SC", serif;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.7;
  font-weight: 400;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(rgba(26, 26, 26, 0.14) 0.8px, transparent 0.9px),
    repeating-linear-gradient(0deg, rgba(26, 26, 26, 0.045) 0 1px, transparent 1px 4px);
  background-size: 3px 3px, 100% 4px;
}

a { color: var(--ink); }
a:focus-visible { outline: 3px dashed var(--ink); outline-offset: 3px; }

/* ---------- 左侧固定栏 ---------- */
.rail {
  position: fixed;
  left: 0;
  top: 0;
  width: 252px;
  height: 100vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 22px 20px;
  background: var(--paper);
  border-right: 2px solid var(--ink);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rail::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, rgba(26, 26, 26, 0.05) 0 1px, transparent 1px 22px);
}
.rail > * { position: relative; }

.brand {
  display: block;
  font-size: 1.5rem;
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  padding: 6px 0 12px;
  border-bottom: 3px solid var(--ink);
  transform: rotate(-0.6deg);
}
.brand-mark {
  display: block;
  max-width: 62px;
  height: auto;
  margin-bottom: 10px;
  border: 2px solid var(--ink);
  border-radius: 10px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.98rem;
}
.rail-nav details { border-bottom: 1px dashed var(--line); }
.rail-nav summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 12px 2px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-bottom: 2px dotted transparent;
}
.rail-nav summary::-webkit-details-marker { display: none; }
.rail-nav summary::after {
  content: "+";
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--grey);
}
.rail-nav details[open] > summary::after { content: "−"; }
.rail-nav ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0 0 0 10px;
  border-left: 2px solid var(--line);
}
.rail-nav a {
  display: block;
  min-height: 44px;
  padding: 12px 4px;
  text-decoration: none;
  color: var(--grey);
  border-bottom: 1px dotted var(--line);
}
.rail-nav a:hover { color: var(--ink); background: var(--soft); }

.rail-contact {
  margin-top: auto;
  border-top: 2px solid var(--ink);
  padding-top: 12px;
}
.rail-contact small {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.92rem;
  letter-spacing: 0.16em;
  color: var(--grey);
}
.rail-contact p {
  margin: 4px 0 0;
  font-size: 0.94rem;
  word-break: break-all;
}

/* ---------- 首屏 ---------- */
.hero {
  position: relative;
  margin-left: 252px;
  min-height: 70vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-bottom: 3px solid var(--ink);
  background: var(--paper);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.75;
  background-image: radial-gradient(rgba(26, 26, 26, 0.18) 1.1px, transparent 1.2px);
  background-size: 16px 16px;
}
.hero-img {
  position: absolute;
  left: 0;
  right: 0;
  top: -7%;
  height: 114%;
  z-index: 1;
}
.hero-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.12);
  opacity: 0.78;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(178deg, rgba(250, 250, 248, 0.86) 0%, rgba(250, 250, 248, 0.26) 46%, rgba(250, 250, 248, 0.92) 100%);
}
.hero-copy {
  position: relative;
  z-index: 3;
  padding: 16vh 40px 44px;
  max-width: 660px;
}
h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6.4vw, 5rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  font-weight: 800;
  transform: rotate(-0.8deg);
}
.hero-lead {
  margin: 18px 0 0;
  max-width: 36ch;
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--grey);
}

/* ---------- 主体 ---------- */
.wrap {
  margin-left: 252px;
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr);
  align-items: start;
}

.toc {
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  padding: 38px 20px 40px 40px;
  border-right: 2px dashed var(--line);
}
.toc small {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  color: var(--grey);
}
.toc h2 {
  margin: 2px 0 14px;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 8px;
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc a {
  display: block;
  min-height: 44px;
  padding: 11px 0;
  font-size: 0.96rem;
  color: var(--grey);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
.toc a:hover { color: var(--ink); }

.doc {
  min-width: 0;
  max-width: 840px;
  padding: 40px 40px 72px;
}
.doc div {
  padding: 44px 0 8px;
  border-top: 3px dashed var(--ink);
  scroll-margin-top: 18px;
}
.doc div:first-of-type { border-top: 0; padding-top: 6px; }

.doc h2 {
  margin: 0 0 14px;
  font-size: clamp(1.6rem, 3.2vw, 2.1rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 800;
  transform: rotate(-0.3deg);
}
.doc h3 {
  margin: 26px 0 10px;
  font-size: 1.2rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.doc small {
  display: block;
  margin-bottom: 6px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.94rem;
  letter-spacing: 0.14em;
  color: var(--grey);
}
.doc p { margin: 0 0 1.05em; }
.doc ul, .doc ol { margin: 0 0 1.1em; padding-left: 1.35em; }
.doc li { margin: 0.35em 0; }
.doc a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
.doc a:hover { background: var(--soft); }
.doc img {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--ink);
  border-radius: 10px;
  filter: contrast(1.05) grayscale(0.2);
  transform: rotate(-0.4deg);
}
.doc figure, .doc blockquote, .doc .card {
  margin: 0 0 1.2em;
  padding: 14px 16px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: none;
}
.doc blockquote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
}
.doc table {
  width: 100%;
  margin: 0 0 1.2em;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.doc th, .doc td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.doc code, .doc pre {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.9rem;
}
.doc pre {
  overflow-x: auto;
  padding: 12px;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: #ffffff;
}

/* ---------- 页脚 ---------- */
.foot {
  margin-left: 252px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 20px 26px;
  padding: 34px 40px 30px;
  border-top: 4px solid var(--ink);
}
.foot-id { max-width: 48%; }
.foot-logo {
  display: block;
  font-size: clamp(1.8rem, 5.4vw, 3.4rem);
  line-height: 0.92;
  font-weight: 800;
  letter-spacing: -0.045em;
  transform: rotate(-0.7deg);
}
.foot-copy { margin: 10px 0 0; font-size: 0.88rem; color: var(--grey); }
.foot-nav { margin-left: auto; }
.foot-nav dl {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 18px;
  margin: 0;
}
.foot-nav dt {
  flex-basis: 100%;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.86rem;
  letter-spacing: 0.16em;
  color: var(--grey);
}
.foot-nav dd { margin: 0; }
.foot-nav a {
  display: inline-block;
  min-height: 44px;
  padding: 11px 2px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}
.foot-nav a:hover { border-bottom-color: var(--ink); }
.foot-top {
  display: inline-block;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--ink);
  border-radius: 10px;
  transform: rotate(-1deg);
}

/* ---------- 揭示 ---------- */
.rv { opacity: 0; }
.rv.on { animation: rv 0.34s steps(4, end) forwards; }
@keyframes rv {
  from { opacity: 0; transform: translateY(14px) rotate(-0.4deg); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rv { opacity: 1; transform: none; animation: none !important; }
}

/* ---------- 小屏 ---------- */
@media (max-width: 900px) {
  .rail {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 18px 18px 14px;
    border-right: 0;
    border-bottom: 3px solid var(--ink);
  }
  .hero, .wrap, .foot { margin-left: 0; }
  .hero { min-height: 46vh; }
  .hero-copy { padding: 12vh 18px 30px; }
  .wrap { grid-template-columns: minmax(0, 1fr); }
  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 24px 18px;
    border-right: 0;
    border-bottom: 2px dashed var(--line);
  }
  .toc ul { display: flex; flex-wrap: wrap; gap: 0 14px; }
  .toc li { width: calc(50% - 7px); }
  .doc { padding: 26px 18px 56px; }
  .foot { padding: 26px 18px 30px; }
  .foot-id { max-width: 100%; }
  .foot-nav { margin-left: 0; }
  .foot-top { margin-left: auto; }
}

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