@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Libre+Baskerville:wght@400;700&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: #6b6b6b;
  --soft: #f3f3f3;
  --radius: 18px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Libre Baskerville", "Cormorant Garamond", "Songti SC", "SimSun", Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.78;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

/* ---------- 左侧竖栏 ---------- */
.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 268px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 1.8rem;
  padding: 2rem 1.5rem 1.5rem;
  background: var(--ink);
  color: var(--paper);
  border-right: 1px solid var(--ink);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--paper);
  text-decoration: none;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.03em;
}

.brand__mark { display: block; border-radius: 8px; }
.brand__t { display: block; }

.rail__nav { flex: 1 1 auto; }
.rail__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
}

.rail__nav > ul > li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.rail__nav a {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 46px;
  padding: 0 0.15rem;
  color: var(--paper);
  text-decoration: none;
  font-size: 1.02rem;
  letter-spacing: 0.05em;
  transition: background 0.2s ease, color 0.2s ease, padding 0.2s ease;
}

.rail__nav a:hover,
.rail__nav a:focus-visible {
  background: var(--paper);
  color: var(--ink);
  padding-left: 0.55rem;
  outline: none;
}

.has-sub > a::after {
  content: "+";
  margin-left: auto;
  font-family: system-ui, sans-serif;
  font-size: 0.95rem;
  opacity: 0.65;
}

.sub {
  list-style: none;
  margin: 0;
  padding: 0 0 0.35rem 0.85rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.has-sub:hover .sub,
.has-sub:focus-within .sub { max-height: 14rem; }

.sub li { border-bottom: 0; border-left: 1px solid rgba(255, 255, 255, 0.32); }
.sub a { min-height: 42px; font-size: 0.95rem; opacity: 0.9; }

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 1rem;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-size: 0.98rem;
  letter-spacing: 0.08em;
  transition: background 0.2s ease, color 0.2s ease;
}

.cta:hover,
.cta:focus-visible {
  background: var(--ink);
  color: var(--paper);
  box-shadow: inset 0 0 0 1px var(--paper);
}

/* ---------- 内容区 ---------- */
.shell { margin-left: 268px; }

main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  column-gap: clamp(2rem, 5vw, 5rem);
  padding: 0 clamp(1.2rem, 5vw, 5rem);
}

main div[id] { scroll-margin-top: 3rem; }

/* ---------- 首屏 ---------- */
.hero {
  grid-column: 1 / -1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 45vh;
  padding: 3rem 0 2.6rem;
  border-bottom: 2px solid var(--ink);
}

.band {
  position: absolute;
  left: -2%;
  bottom: 0.9rem;
  width: 104%;
  height: clamp(12px, 2.2vw, 24px);
  background: var(--ink);
  transform: rotate(-1.5deg);
  clip-path: polygon(0 55%, 100% 0, 100% 45%, 0 100%);
}

.hero__h {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 58%;
  font-size: clamp(2.6rem, 7.5vw, 7rem);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero__d {
  position: relative;
  z-index: 2;
  margin: 1.1rem 0 0;
  max-width: 32rem;
  font-size: 1.02rem;
  color: #1a1a1a;
}

.ph {
  position: absolute;
  z-index: 1;
  margin: 0;
  width: clamp(108px, 14vw, 190px);
  aspect-ratio: 4 / 5;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--soft);
}

.ph--a { right: 21%; top: 7%; transform: rotate(-3deg); }
.ph--b { right: 2%; top: 27%; transform: rotate(2deg); background: #e5e5e5; }
.hero__img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ---------- 正文 ---------- */
.sheet {
  grid-column: 1;
  padding: 4.5rem 0 6rem;
}

.sheet > * { max-width: 44rem; }

.sheet > div {
  padding: 3.6rem 0;
  border-top: 1px solid var(--ink);
}

.sheet > div:first-child { border-top: 0; padding-top: 0; }

.sheet small {
  display: block;
  margin-bottom: 0.5rem;
  font-family: system-ui, sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  color: var(--mute);
}

.sheet h2 {
  margin: 0 0 1.1rem;
  font-size: clamp(1.8rem, 3.4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.sheet h3 {
  margin: 2rem 0 0.6rem;
  font-size: clamp(1.28rem, 2vw, 1.7rem);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

.sheet p { margin: 0 0 1.1rem; }
.sheet ul, .sheet ol { margin: 0 0 1.2rem; padding-left: 1.35rem; }
.sheet li { margin: 0.4rem 0; }

.sheet a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.sheet a:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

.sheet blockquote {
  margin: 1.6rem 0;
  padding: 0.9rem 1.3rem;
  border-left: 4px solid var(--ink);
  font-size: 1.14rem;
}

.sheet figure {
  margin: 1.6rem 0;
  padding: 0.6rem;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
}

.sheet img { border-radius: var(--radius); border: 1px solid var(--ink); height: auto; }

/* ---------- 右侧栏 ---------- */
.side {
  grid-column: 2;
  align-self: start;
  position: sticky;
  top: 3rem;
  margin-top: 4.5rem;
  padding-top: 0.9rem;
  border-top: 4px solid var(--ink);
}

.side__k {
  display: block;
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: var(--mute);
  margin-bottom: 0.35rem;
}

.side__t {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

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

.side__list li {
  counter-increment: toc;
  border-bottom: 1px solid var(--ink);
}

.side__list a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.97rem;
  transition: background 0.2s ease, padding 0.2s ease, color 0.2s ease;
}

.side__list a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: system-ui, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--mute);
}

.side__list a:hover,
.side__list a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  padding-left: 0.4rem;
  outline: none;
}

.side__list a:hover::before { color: var(--paper); }

.totop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 1.4rem;
  padding: 0 1.15rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
}

.totop:hover { background: var(--ink); color: var(--paper); }

/* ---------- 页脚 ---------- */
.foot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.2rem;
  margin-top: 2rem;
  padding: 2rem clamp(1.2rem, 5vw, 5rem) 2.4rem;
  border-top: 2px solid var(--ink);
}

.foot__logo {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.foot__copy {
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  color: var(--mute);
}

.foot__nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.1rem 0.9rem;
}

.foot__nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 0.84rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot__nav a:hover { border-color: var(--ink); }

/* ---------- 动效 ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

.js .reveal { opacity: 0; }
.js .reveal.in { animation: reveal 0.55s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.js .side__list li.reveal.in { animation-delay: calc(var(--i, 0) * 45ms); }

/* ---------- 窄屏 ---------- */
@media (max-width: 1000px) {
  .rail {
    position: static;
    width: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.9rem;
    padding: 1rem 1.2rem 1.1rem;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
    overflow: visible;
  }

  .brand { order: 1; font-size: 1.45rem; }
  .cta { order: 2; margin-top: 0; margin-left: auto; min-height: 44px; padding: 0 1rem; font-size: 0.9rem; }
  .rail__nav { order: 3; flex: 1 1 100%; }
  .rail__nav ul { display: grid; grid-template-columns: 1fr 1fr; gap: 0 0.9rem; }
  .rail__nav a { min-height: 44px; font-size: 0.95rem; }
  .sub { max-height: none; overflow: visible; padding-left: 0.6rem; }
  .has-sub > a::after { content: ""; }

  .shell { margin-left: 0; }

  main { grid-template-columns: minmax(0, 1fr); padding: 0 1.2rem; }

  .hero { min-height: 0; padding: 2rem 0 7rem; }
  .hero__h { max-width: 100%; font-size: clamp(2.2rem, 10vw, 3.6rem); }
  .hero__d { max-width: 100%; }
  .band { bottom: 0.5rem; width: 110%; left: -5%; }
  .ph { width: 84px; }
  .ph--a { right: 0; top: auto; bottom: 1.4rem; }
  .ph--b { right: 94px; top: auto; bottom: 2.4rem; }

  .sheet { padding: 2.8rem 0 3.4rem; }
  .sheet > div { padding: 2.6rem 0; }

  .side { grid-column: 1; position: static; margin-top: 1.6rem; margin-bottom: 1rem; }

  .foot {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 0.5rem;
    padding: 1.8rem 1.2rem 2.2rem;
  }
  .foot__nav ul { justify-content: center; }
  .foot__copy { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; }
  .rail__nav > ul > li { opacity: 1; }
}

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