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

:root {
  --paper: #fdfbf7;
  --wash: #f5f5f5;
  --ink: #1a1a1a;
  --rule: #e0e0e0;
  --mute: #5d5952;
  --serif: "Libre Baskerville", "Cormorant Garamond", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, "SimSun", serif;
}

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

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

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

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

a { color: inherit; text-decoration: none; }

img { max-width: 100%; }

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

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

/* 页头：品牌独占一行 + 菜单行 */
.site-head {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.brandrow {
  margin: 0;
  padding: 14px 24px 4px;
  font-size: 21px;
  letter-spacing: .22em;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.mark img, .mark svg {
  display: block;
  width: auto;
  height: 26px;
}

.marktext {
  border: 1px solid var(--ink);
  padding: 2px 8px;
  font-size: 17px;
  letter-spacing: .18em;
}

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 24px 10px;
  border-top: 1px solid var(--rule);
}

.tabs p {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 11px;
  font-size: 16px;
  letter-spacing: .07em;
  border-bottom: 2px solid transparent;
}

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

.tabs a.gp {
  border-left: 1px solid var(--rule);
}

.tabs a:first-child { padding-left: 0; }

.find {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
}

.find input {
  flex: 1 1 auto;
  width: 148px;
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px;
}

.find input:focus { outline: none; }

.find button {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 2px;
  background: var(--ink);
  color: var(--paper);
  font: inherit;
  font-size: 16px;
  letter-spacing: .12em;
  cursor: pointer;
}

/* 首图 */
.hero-band { margin: 0; }

.hero {
  position: relative;
  margin: 0;
  height: 70vh;
  min-height: 360px;
  max-height: 760px;
  background: var(--ink);
  overflow: hidden;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.06);
}

.veil {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 24px;
  text-align: center;
  background: rgba(26, 26, 26, .58);
}

.veil h1 {
  margin: 0;
  max-width: 22ch;
  color: var(--paper);
  font-weight: 600;
  font-size: clamp(28px, 4.6vw, 50px);
  line-height: 1.28;
  letter-spacing: .05em;
}

/* 正文区：左栏 + 长文 */
.sheet {
  display: grid;
  grid-template-columns: 194px minmax(0, 1fr);
  gap: 0 48px;
  align-items: start;
  max-width: 1080px;
  margin: 0 auto;
  padding: 52px 24px 96px;
}

.rail {
  position: sticky;
  top: 20px;
  padding: 18px 16px 14px;
  background: var(--wash);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(26, 26, 26, .06);
}

.rail-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .2em;
}

.subtitle {
  margin: 4px 0 12px;
  font-size: 16px;
  letter-spacing: .14em;
  color: var(--mute);
}

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

.rail-list li {
  counter-increment: rail;
  border-top: 1px solid var(--rule);
}

.rail-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 0;
  font-size: 16px;
  line-height: 1.4;
}

.rail-list a::before {
  content: counter(rail, decimal-leading-zero);
  flex: 0 0 auto;
  font-size: 14px;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

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

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

.prose > article[id] { scroll-margin-top: 24px; }

.prose > article + article {
  margin-top: 52px;
  padding-top: 52px;
  border-top: 1px solid var(--rule);
}

.prose h2 {
  margin: 0 0 12px;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.35;
  letter-spacing: .03em;
  font-weight: 600;
}

.prose h3 {
  margin: 28px 0 8px;
  font-size: 20px;
  letter-spacing: .03em;
}

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

.prose ul, .prose ol { margin: 0 0 1.05em; padding-left: 1.4em; }
.prose li { margin: .32em 0; }

.prose a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
  word-break: break-word;
}

.prose blockquote {
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  border-left: 2px solid var(--ink);
  color: var(--mute);
}

.prose figure {
  margin: 1.5em 0;
  padding: 8px;
  background: var(--wash);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(26, 26, 26, .06);
}

.prose img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.prose figcaption {
  padding-top: 8px;
  font-size: 16px;
  color: var(--mute);
}

.prose hr {
  height: 0;
  margin: 2em 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

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

.prose th, .prose td {
  padding: 8px 10px;
  border: 1px solid var(--rule);
  text-align: left;
}

.prose pre {
  overflow-x: auto;
  padding: 14px;
  background: var(--wash);
  border: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.6;
}

.hit {
  outline: 2px solid var(--ink);
  outline-offset: 8px;
}

/* 页脚 */
.colophon {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px 18px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 24px 44px;
  border-top: 1px solid var(--ink);
  font-size: 16px;
}

.f-brand {
  margin: 0;
  letter-spacing: .22em;
}

.f-copy {
  margin: 0;
  text-align: center;
  color: var(--mute);
}

.f-links {
  justify-self: end;
  display: flex;
  gap: 16px;
  font-size: 16px;
}

.f-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

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

.totop {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 20;
  min-height: 46px;
  padding: 0 15px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  letter-spacing: .1em;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
}

.totop.on {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .16s linear, transform .16s linear;
  }
  .reveal.in {
    opacity: 1;
    transform: none;
  }
  .totop { transition: opacity .12s linear; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

@media (min-width: 881px) {
  .site-head {
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .prose > article[id] { scroll-margin-top: 104px; }
}

@media (max-width: 880px) {
  .brandrow { padding: 12px 16px 2px; font-size: 19px; }

  .bar {
    flex-direction: column;
    align-items: stretch;
    padding: 0 16px 12px;
  }

  .tabs a { padding: 0 9px; }
  .tabs a:first-child { padding-left: 0; }

  .find { width: 100%; }
  .find input { width: auto; }

  .hero { height: 62vh; min-height: 340px; }

  .veil { padding: 24px 20px; }

  .sheet {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding: 26px 16px 72px;
  }

  .rail {
    position: static;
    order: 0;
  }

  .prose { max-width: none; }

  .colophon {
    grid-template-columns: 1fr;
    padding: 24px 16px 40px;
    gap: 6px;
  }

  .f-copy { text-align: left; }

  .f-links {
    justify-self: start;
    gap: 20px;
  }

  .totop { right: 12px; bottom: 12px; }
}

@media (max-width: 420px) {
  .tabs a { font-size: 16px; padding: 0 7px; }
}

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