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

:root {
  --paper: #fdfbf7;
  --soft: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0ddd4;
  --line-2: #e8e5dc;
  --muted: #6f6b62;
  --rail: 106px;
  --toc: 234px;
  --r: 28px;
  --serif: "Noto Serif TC", "Songti TC", Georgia, "Times New Roman", serif;
  --sans: "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding-left: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.85;
  letter-spacing: .01em;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/></filter><rect width='140' height='140' filter='url(%23n)' opacity='0.55'/></svg>");
}

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

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

::selection { background: var(--ink); color: var(--paper); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* ---------- 左侧固定竖排导航 ---------- */
.rail {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(253, 251, 247, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.rail .mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1;
  text-decoration: none;
}

.find { flex: 0 0 auto; }

.find input {
  width: 92px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.2;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 12px;
  appearance: none;
}

.find input::placeholder { color: var(--muted); }

.rail nav { flex: 1 1 auto; min-width: 0; }

.rail nav ul {
  display: flex;
  flex-direction: row;
  gap: 8px;
  margin: 0;
  padding: 2px 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.rail nav ul::-webkit-scrollbar { display: none; }

.rail nav a {
  display: block;
  white-space: nowrap;
  padding: 12px 15px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
}

.rail nav a[aria-current] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.rail .top { display: none; }

/* ---------- 版面骨架 ---------- */
.shell {
  padding: 18px 16px 0;
  max-width: 1200px;
  margin: 0 auto;
}

main { min-width: 0; }

.wrap { max-width: 820px; }

.toc { display: none; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  min-height: 58vh;
  display: flex;
  align-items: flex-end;
  padding: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background-color: var(--soft);
  background-image: radial-gradient(var(--line) 1px, transparent 1px);
  background-size: 16px 16px;
}

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

.hero-fig img,
.hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.04);
  transform: scale(1.06);
  will-change: transform;
}

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

.hero-in {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 22px 20px;
  border: 1px solid rgba(26, 26, 26, .18);
  border-radius: var(--r);
  background: rgba(253, 251, 247, .82);
  backdrop-filter: blur(9px);
}

.hero h1 {
  margin: 0 0 .5em;
  font-size: clamp(27px, 8vw, 44px);
  line-height: 1.32;
  letter-spacing: .015em;
  font-weight: 600;
}

.lede {
  margin: 0;
  font-size: 16px;
  line-height: 1.8;
  color: #3a3833;
}

/* ---------- 正文纸面 ---------- */
.paper {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255, 255, 255, .56);
  backdrop-filter: blur(7px);
}

.paper article {
  padding: 24px 20px 28px;
}

article section[id] { scroll-margin-top: 92px; }

article > section { margin: 0; }

article section + section {
  margin-top: 2.1em;
  padding-top: 2.1em;
  border-top: 1px solid var(--line-2);
}

article :is(h2, h3) {
  margin: 0 0 .65em;
  line-height: 1.45;
  letter-spacing: .015em;
  font-weight: 600;
}

article h2 { font-size: 23px; }

article h3 { font-size: 19px; }

article h2::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 2px;
  margin: 0 10px 6px 0;
  background: var(--ink);
}

section p { margin: 0 0 1.05em; }

section :is(ul, ol) { margin: 0 0 1.05em; padding-left: 1.35em; }

section li { margin: 0 0 .45em; }

section a { text-decoration: underline; }

section :is(h2, h3, p, li) a { text-decoration-thickness: 1px; }

section blockquote {
  margin: 0 0 1.05em;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

section hr {
  border: 0;
  border-top: 1px solid var(--line-2);
  margin: 1.6em 0;
}

section img {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 1em;
}

section table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

section :is(th, td) {
  border: 1px solid var(--line-2);
  padding: 8px 10px;
  text-align: left;
}

section strong { font-weight: 600; }

/* ---------- 右侧目录 ---------- */
.toc {
  position: sticky;
  top: 34px;
  align-self: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: rgba(245, 245, 245, .78);
  backdrop-filter: blur(8px);
}

.toc small,
footer small {
  display: block;
  margin-bottom: 6px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: .24em;
  color: var(--muted);
}

.toc h2 {
  margin: 0 0 10px;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}

.toc ul,
footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc a,
footer a {
  display: block;
  padding: 10px 0;
  font-size: 16px;
  line-height: 1.45;
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
}

.toc a:hover,
footer a:hover,
.rail nav a:hover { text-decoration: underline; }

.toc li:last-child a,
footer li:last-child a { border-bottom: 0; }

/* ---------- 页脚 ---------- */
footer {
  max-width: 1200px;
  margin: 42px auto 0;
  padding: 30px 16px 34px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  border-top: 1px solid var(--line);
}

footer article { min-width: 0; }

footer h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.4;
  font-weight: 600;
}

.f-mark {
  margin: 0;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}

.f-name {
  margin: 12px 0 0;
  font-size: 17px;
  letter-spacing: .12em;
}

.f-legal p {
  margin: 0;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.9;
  color: var(--muted);
}

/* ---------- 轻动效 ---------- */
.will {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .22s linear, transform .22s cubic-bezier(.2, .7, .3, 1);
}

.will.in {
  opacity: 1;
  transform: none;
}

/* ---------- 桌面 ---------- */
@media (min-width: 901px) {
  body { padding-left: var(--rail); }

  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--rail);
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px 10px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    background: rgba(253, 251, 247, .92);
  }

  .find input { width: 100%; padding: 9px 10px; text-align: center; }

  .rail nav { flex: 1 1 auto; width: 100%; overflow-y: auto; scrollbar-width: none; }

  .rail nav ul {
    flex-direction: column;
    align-items: center;
    gap: 9px;
    overflow: visible;
    padding: 4px 0;
  }

  .rail nav a {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 14px 7px;
    letter-spacing: .16em;
    background: rgba(255, 255, 255, .65);
  }

  .rail .top {
    display: block;
    width: 100%;
    padding: 11px 4px;
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.25;
    writing-mode: vertical-rl;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 999px;
    cursor: pointer;
  }

  .shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--toc);
    gap: 40px;
    align-items: start;
    padding: 40px 34px 0;
  }

  .toc { display: block; }

  .wrap { max-width: 800px; }

  .hero { min-height: 70vh; padding: 34px; }

  .hero-in { max-width: 620px; padding: 30px 28px; }

  .paper section { padding: 34px 34px 40px; }

  footer {
    grid-template-columns: 1fr 1.1fr 1fr;
    gap: 36px;
    padding: 36px 34px 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-fig img, .hero-img { transform: none; }
  .will { opacity: 1; transform: none; transition: none; }
}

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