@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Josefin+Sans:wght@300;400;500;600;700&display=swap');

:root {
  --paper: #fafaf8;
  --grey: #4a4a4a;
  --ink: #1a1a1a;
  --line: rgba(74, 74, 74, 0.34);
  --line-soft: rgba(26, 26, 26, 0.13);
  --disp: 'Cinzel', 'Songti SC', 'Noto Serif SC', 'SimSun', serif;
  --body: 'Josefin Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --rail: 252px;
}

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

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(74, 74, 74, 0.045) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 18% 26%, rgba(26, 26, 26, 0.05), transparent 52%),
    radial-gradient(circle at 79% 71%, rgba(74, 74, 74, 0.05), transparent 48%);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.78;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  border: 6px solid #fff;
  box-shadow: 6px 8px 0 rgba(26, 26, 26, 0.08);
  transform: rotate(-0.7deg);
}

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

/* ---------- 左侧栏 ---------- */
.rail {
  position: fixed;
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  z-index: 40;
  width: var(--rail);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 26px 22px 26px;
  border-right: 1px dashed var(--line);
  background-color: rgba(250, 250, 248, 0.95);
  background-image: repeating-linear-gradient(0deg, rgba(74, 74, 74, 0.05) 0 1px, transparent 1px 6px);
}

.mark {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  text-decoration: none;
  color: var(--ink);
}

.mark-glyph {
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-family: var(--disp);
  font-size: 17px;
  color: var(--paper);
  background: var(--ink);
  border-radius: 44% 56% 52% 48% / 55% 42% 58% 45%;
  transform: rotate(-4deg);
}

.mark-glyph--img {
  background: none;
  border-radius: 0;
  transform: rotate(-2deg);
}

.mark-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border: 0;
  box-shadow: none;
  transform: none;
}

.mark-word {
  font-family: var(--disp);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.toc summary {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 4px 2px;
  cursor: pointer;
  list-style: none;
  color: var(--grey);
  font-size: 16px;
  letter-spacing: 0.14em;
}

.toc summary::-webkit-details-marker {
  display: none;
}

.bar {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
}

.sum-word {
  margin-left: 4px;
}

menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-list {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
}

.toc-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 3px 5px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
  text-decoration: none;
  border-bottom: 1px dotted rgba(26, 26, 26, 0.17);
  transition: transform 0.08s steps(2), background 0.08s steps(2);
}

.pin {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--grey);
  border-radius: 60% 40% 55% 45%;
  transform: rotate(12deg);
}

.toc-list a:hover,
.toc-list a:focus-visible {
  transform: translateX(3px) rotate(-0.5deg);
  background: rgba(26, 26, 26, 0.055);
}

.scan {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.scan-label {
  width: 100%;
  font-size: 15px;
  letter-spacing: 0.14em;
  color: var(--grey);
}

.scan input {
  flex: 1 1 96px;
  min-height: 44px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
  background: #fff;
  border: 1px dashed var(--grey);
  border-radius: 6px;
}

.scan button {
  min-height: 44px;
  padding: 0 15px;
  font-family: inherit;
  font-size: 16px;
  color: var(--paper);
  background: var(--ink);
  border: 0;
  border-radius: 8px 4px 9px 5px;
  cursor: pointer;
  transform: rotate(-1deg);
}

/* ---------- 首屏 ---------- */
main {
  margin-left: var(--rail);
}

.stage {
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  padding: 92px clamp(20px, 5vw, 72px) 120px;
  text-align: right;
  clip-path: polygon(0 0, 100% 0, 100% 90%, 58% 100%, 0 95%);
  background: linear-gradient(180deg, rgba(74, 74, 74, 0.06), transparent 62%);
}

.stage-ghost {
  position: absolute;
  top: 7%;
  right: -3vw;
  font-family: var(--disp);
  font-size: clamp(130px, 26vw, 330px);
  line-height: 0.9;
  letter-spacing: 0.06em;
  color: transparent;
  -webkit-text-stroke: 1.4px rgba(26, 26, 26, 0.18);
  pointer-events: none;
  user-select: none;
  animation: drift 12s steps(6) infinite;
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-1deg); }
  50% { transform: translate3d(-10px, 7px, 0) rotate(-0.3deg); }
}

.stage-side {
  position: absolute;
  left: clamp(20px, 5vw, 72px);
  top: 15%;
  width: 2px;
  height: 86px;
  background: var(--ink);
  opacity: 0.32;
  transform: rotate(2deg);
}

.stage-h1 {
  position: relative;
  margin: 0;
  max-width: 19ch;
  font-family: var(--disp);
  font-weight: 600;
  font-size: clamp(32px, 5.4vw, 68px);
  line-height: 1.16;
  letter-spacing: 0.03em;
  transform: rotate(-0.7deg);
  text-wrap: balance;
}

.stage-lede {
  position: relative;
  margin: 0;
  max-width: 34ch;
  color: var(--grey);
  font-size: 17px;
  line-height: 1.8;
}

.stage-plate {
  position: absolute;
  left: clamp(20px, 5vw, 72px);
  bottom: 15%;
  margin: 0;
  width: clamp(150px, 20vw, 250px);
  height: clamp(110px, 15vw, 168px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: #fff;
  border: 1px dashed var(--line);
  box-shadow: 9px 11px 0 rgba(26, 26, 26, 0.07);
  transform: rotate(-3.2deg);
}

.plate-tape {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 74px;
  height: 22px;
  margin-left: -37px;
  background: rgba(74, 74, 74, 0.15);
  border-left: 1px dashed rgba(250, 250, 248, 0.9);
  border-right: 1px dashed rgba(250, 250, 248, 0.9);
  transform: rotate(2.5deg);
}

.plate-rule {
  display: block;
  height: 1px;
  background: var(--grey);
  opacity: 0.5;
}

.plate-rule:nth-of-type(1) { width: 100%; }
.plate-rule:nth-of-type(2) { width: 72%; transform: rotate(-1.1deg); }
.plate-rule:nth-of-type(3) { width: 91%; transform: rotate(0.7deg); }

.plate-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: 0;
  box-shadow: none;
  transform: rotate(-1.4deg);
}

.stage-drop {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 2px;
  color: var(--ink);
  font-size: 16px;
  letter-spacing: 0.2em;
  text-decoration: none;
  border-bottom: 1px dashed var(--grey);
}

.stage-drop span::after {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(45deg) translate(-2px, -2px);
}

/* ---------- 正文与侧注 ---------- */
.spread {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: clamp(24px, 4vw, 56px);
  align-items: start;
  max-width: 1120px;
  box-sizing: border-box;
  padding: 0 clamp(20px, 5vw, 72px) 90px;
}

.flow {
  min-width: 0;
}

.flow section {
  scroll-margin-top: 96px;
  margin-top: 64px;
  padding-top: 26px;
  border-top: 1px dashed var(--line);
}

.flow section:first-child {
  margin-top: 0;
}

.flow small {
  display: block;
  margin-bottom: 0.35em;
  color: var(--grey);
  font-family: var(--body);
  font-size: 15px;
  letter-spacing: 0.22em;
  transform: rotate(-0.6deg);
}

.flow h2,
.flow h3 {
  font-family: var(--disp);
  font-weight: 600;
  line-height: 1.32;
  letter-spacing: 0.02em;
}

.flow h2 {
  margin: 0 0 0.7em;
  font-size: clamp(23px, 3vw, 32px);
  transform: rotate(-0.3deg);
}

.flow h3 {
  margin: 1.4em 0 0.55em;
  font-size: clamp(19px, 2.2vw, 22px);
}

.flow p {
  margin: 0 0 1.1em;
}

.flow a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed var(--grey);
}

.flow a:hover {
  background: rgba(26, 26, 26, 0.06);
}

.flow ul,
.flow ol {
  margin: 0 0 1.1em;
  padding-left: 1.4em;
}

.flow li {
  margin: 0.35em 0;
}

.flow li::marker {
  color: var(--grey);
}

.flow blockquote {
  margin: 1.5em 0;
  padding: 14px 18px;
  border-left: 3px solid var(--ink);
  background: rgba(26, 26, 26, 0.035);
  transform: rotate(-0.4deg);
}

.flow figure {
  margin: 1.5em 0;
}

.flow figcaption {
  margin-top: 8px;
  color: var(--grey);
  font-size: 15px;
}

.flow table {
  width: 100%;
  margin: 0 0 1.3em;
  border-collapse: collapse;
  font-size: 16px;
}

.flow th,
.flow td {
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px dashed var(--line);
}

.flow th {
  font-family: var(--disp);
  letter-spacing: 0.06em;
}

.margin {
  position: sticky;
  top: 26px;
  align-self: start;
  padding: 4px 0 4px 18px;
  border-left: 2px dashed var(--line);
  transform: rotate(0.35deg);
}

.margin small {
  display: block;
  color: var(--grey);
  font-size: 15px;
  letter-spacing: 0.24em;
}

.margin h2 {
  margin: 0.15em 0 0.6em;
  font-family: var(--disp);
  font-size: 20px;
  letter-spacing: 0.14em;
}

.margin-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 2px 0;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dotted rgba(26, 26, 26, 0.18);
}

.margin-list li {
  animation: reveal 0.34s steps(3) both;
}

.margin-list li:nth-child(1) { animation-delay: 0.02s; }
.margin-list li:nth-child(2) { animation-delay: 0.06s; }
.margin-list li:nth-child(3) { animation-delay: 0.1s; }
.margin-list li:nth-child(4) { animation-delay: 0.14s; }
.margin-list li:nth-child(5) { animation-delay: 0.18s; }
.margin-list li:nth-child(6) { animation-delay: 0.22s; }
.margin-list li:nth-child(7) { animation-delay: 0.26s; }

@keyframes reveal {
  from { opacity: 0.3; transform: translateX(7px) rotate(-0.7deg); }
  to { opacity: 1; transform: none; }
}

.to-top {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  color: var(--grey);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dashed var(--grey);
}

/* ---------- 页脚 ---------- */
.foot {
  margin-left: var(--rail);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 18px;
  padding: clamp(28px, 4vw, 48px) clamp(20px, 5vw, 72px) 38px;
  border-top: 1px dashed var(--line);
  background: rgba(26, 26, 26, 0.03);
}

.foot-cta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
}

.foot-big {
  margin: 0;
  font-family: var(--disp);
  font-weight: 600;
  font-size: clamp(30px, 6vw, 62px);
  line-height: 1.06;
  letter-spacing: 0.1em;
  transform: rotate(-0.8deg);
}

.foot-go {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  color: var(--paper);
  background: var(--ink);
  font-size: 16px;
  letter-spacing: 0.12em;
  text-decoration: none;
  border-radius: 16px 6px 18px 8px;
  transform: rotate(1deg);
}

.foot-col {
  margin: 14px 0 0;
}

.foot-col dt {
  margin-bottom: 6px;
  color: var(--grey);
  font-size: 15px;
  letter-spacing: 0.2em;
}

.foot-col dd {
  margin: 0;
}

.foot-col a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--ink);
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px dotted rgba(26, 26, 26, 0.2);
}

.foot-base {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  color: var(--grey);
  font-size: 15px;
  border-top: 1px solid var(--line-soft);
}

.foot-base p {
  margin: 0;
}

.foot-base a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: var(--grey);
  text-decoration: none;
}

/* ---------- 窄屏 ---------- */
@media (max-width: 900px) {
  .rail {
    position: sticky;
    right: auto;
    bottom: auto;
    left: auto;
    top: 0;
    width: auto;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    border-right: 0;
    border-bottom: 1px dashed var(--line);
  }

  .mark-word {
    font-size: 17px;
    letter-spacing: 0.1em;
  }

  .toc {
    position: relative;
  }

  .toc-list {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    z-index: 60;
    width: min(78vw, 280px);
    max-height: 68vh;
    overflow: auto;
    padding: 8px 10px;
    background: var(--paper);
    border: 1px dashed var(--grey);
    box-shadow: 7px 9px 0 rgba(26, 26, 26, 0.09);
  }

  .toc-list a {
    min-height: 44px;
  }

  .scan {
    display: none;
  }

  main {
    margin-left: 0;
  }

  .stage {
    min-height: calc(100vh - 62px);
    padding: 54px 20px 86px;
    gap: 16px;
    clip-path: polygon(0 0, 100% 0, 100% 93%, 62% 100%, 0 96%);
  }

  .stage-ghost {
    top: 2%;
    right: -8vw;
    font-size: 36vw;
  }

  .stage-side {
    left: 20px;
    top: 10%;
    height: 56px;
  }

  .stage-plate {
    position: static;
    width: 100%;
    max-width: 300px;
    height: auto;
    min-height: 108px;
    margin-top: 10px;
    align-self: flex-end;
  }

  .spread {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 20px 64px;
    gap: 32px;
  }

  .flow section {
    scroll-margin-top: 82px;
  }

  .margin {
    position: static;
    order: 2;
  }

  .foot {
    margin-left: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px 10px;
    padding: 28px 20px 32px;
  }

  .foot-col a,
  .foot-base a {
    font-size: 15px;
  }
}

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

  * {
    animation: none !important;
    transition: none !important;
  }
}

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