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

:root {
  --ink: #0E1B16;
  --ink-2: #13241C;
  --cream: #F4EFE6;
  --gold: #B08A4F;
  --line: rgba(244, 239, 230, 0.14);
  --line-strong: rgba(244, 239, 230, 0.24);
  --muted: rgba(244, 239, 230, 0.64);
  --serif: "Playfair Display", Georgia, "Songti SC", "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--ink);
  color: var(--cream);
  font: 400 16px/1.75 var(--sans);
  letter-spacing: 0.008em;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------- 分层视差背景 ---------- */
.veil {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: var(--ink);
}

.veil-layer {
  position: absolute;
  left: -12%;
  width: 124%;
  display: block;
  will-change: transform;
}

.l1 {
  top: -14%;
  height: 64%;
  background: radial-gradient(58% 62% at 26% 18%, rgba(176, 138, 79, 0.20), transparent 72%);
}

.l2 {
  top: 26%;
  height: 78%;
  background: radial-gradient(52% 48% at 82% 58%, rgba(244, 239, 230, 0.075), transparent 70%);
}

.l3 {
  top: 62%;
  height: 70%;
  background: linear-gradient(180deg, transparent 0%, rgba(176, 138, 79, 0.10) 100%);
}

.veil-grain {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    115deg,
    rgba(244, 239, 230, 0.022) 0 1px,
    transparent 1px 5px
  );
  opacity: 0.7;
}

/* ---------- 外壳 ---------- */
.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- 页头 ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.55rem clamp(0.9rem, 4vw, 2.2rem) 0;
  background: rgba(14, 27, 22, 0.9);
  -webkit-backdrop-filter: blur(9px);
  backdrop-filter: blur(9px);
  border-bottom: 1px solid var(--line);
}

.brandline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(176, 138, 79, 0.22);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 40px;
  padding: 0.25rem 0;
  color: var(--cream);
  font-family: var(--serif);
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
}

.brand:hover { text-decoration: none; color: var(--gold); }

.brand-mark {
  width: 11px;
  height: 11px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--gold), rgba(176, 138, 79, 0.35));
  flex: 0 0 auto;
}

.brand-logo { width: 26px; height: 26px; object-fit: contain; }

.brand-name { white-space: nowrap; }

.contact {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(176, 138, 79, 0.5);
  color: var(--gold);
  font-size: 0.84rem;
  letter-spacing: 0.14em;
  text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease;
}

.contact:hover {
  background: rgba(176, 138, 79, 0.14);
  color: var(--cream);
  text-decoration: none;
}

.menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.35rem;
  padding: 0.3rem 0 0.45rem;
}

.menu-link {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 44px;
  padding: 0.5rem 0.6rem;
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0.09em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.menu-link:hover,
.menu-link:focus-visible {
  color: var(--cream);
  border-bottom-color: var(--gold);
  text-decoration: none;
}

.ni {
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  background: var(--gold);
  opacity: 0.75;
  flex: 0 0 auto;
}

/* ---------- 主视觉 ---------- */
.stage { flex: 1 0 auto; }

.hero {
  position: relative;
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(1.6rem, 6vh, 3.4rem) clamp(1rem, 5vw, 2rem) clamp(3.6rem, 9vh, 5.4rem);
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 6.4vw, 4.3rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
  color: var(--cream);
  text-wrap: balance;
}

.band {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: clamp(46px, 9vh, 96px);
  margin: 0;
  overflow: hidden;
  will-change: transform;
}

.band-a {
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(176, 138, 79, 0.95), rgba(176, 138, 79, 0.08));
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.band-b {
  position: absolute;
  inset: 0;
  background: var(--cream);
  opacity: 0.07;
  clip-path: polygon(0 100%, 100% 38%, 100% 100%);
}

/* ---------- 正文与侧栏 ---------- */
.spread {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 1.4rem) 4.5rem;
  display: block;
}

.chapters {
  min-width: 0;
  max-width: 74ch;
}

.chapters > section {
  scroll-margin-top: 10.5rem;
  padding: 2.5rem 0 0.6rem;
  border-top: 1px solid var(--line);
}

.chapters > section:first-child {
  border-top: 0;
  padding-top: 1rem;
}

.chapters > section + section { margin-top: 1.4rem; }

.chapters h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.6vw, 2.05rem);
  line-height: 1.25;
  letter-spacing: -0.005em;
  margin: 0 0 0.9rem;
  color: var(--cream);
}

.chapters h3 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.04em;
  margin: 2rem 0 0.7rem;
  color: var(--gold);
}

.chapters h4 {
  font-weight: 600;
  font-size: 1rem;
  margin: 1.5rem 0 0.5rem;
  color: var(--cream);
}

.chapters p {
  margin: 0 0 1.15rem;
  color: rgba(244, 239, 230, 0.86);
  line-height: 1.9;
}

.chapters ul,
.chapters ol {
  margin: 0 0 1.3rem;
  padding-left: 1.25rem;
}

.chapters li {
  margin: 0 0 0.55rem;
  line-height: 1.85;
  color: rgba(244, 239, 230, 0.84);
}

.chapters li::marker { color: var(--gold); }

.chapters strong { color: var(--cream); font-weight: 600; }

.chapters blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--gold);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.05rem;
}

.chapters table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0 1.6rem;
  font-size: 0.94rem;
}

.chapters th,
.chapters td {
  border: 1px solid var(--line);
  padding: 0.65rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.chapters th {
  background: rgba(176, 138, 79, 0.12);
  color: var(--cream);
  font-weight: 600;
}

.chapters figure { margin: 1.5rem 0; }

.chapters figcaption {
  margin-top: 0.5rem;
  font-size: 0.82rem;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.chapters hr,
.rail hr {
  border: 0;
  border-top: 1px solid var(--gold);
  opacity: 0.45;
  margin: 0.7rem 0 1.5rem;
}

.chapters code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: rgba(244, 239, 230, 0.08);
  padding: 0.1em 0.35em;
}

.rail {
  margin-top: 2.6rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 10.5rem;
}

.rail h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--gold);
  margin: 0 0 0.6rem;
}

.rail hr { margin: 0 0 1rem; opacity: 0.35; }

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

.toc li {
  counter-increment: toc;
  border-bottom: 1px solid rgba(244, 239, 230, 0.08);
}

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

.toc a {
  display: flex;
  gap: 0.7rem;
  align-items: baseline;
  min-height: 40px;
  padding: 0.48rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  transition: color 0.25s ease, padding-left 0.25s ease;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--serif);
  font-size: 0.76rem;
  color: var(--gold);
  opacity: 0.8;
}

.toc a:hover {
  color: var(--cream);
  padding-left: 0.3rem;
  text-decoration: none;
}

/* ---------- 页脚 ---------- */
.foot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem 1.4rem;
  padding: 1.1rem clamp(0.9rem, 4vw, 2.2rem) 1.5rem;
  border-top: 1px solid var(--line-strong);
  background: rgba(14, 27, 22, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.foot .brand { font-size: 0.95rem; }

.foot-nav { min-width: 0; }

.foot-nav dl {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 0.9rem;
  margin: 0;
}

.foot-nav dt {
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--gold);
  text-transform: uppercase;
}

.foot-nav dd { margin: 0; }

.foot-nav dd a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.35rem 0;
  font-size: 0.83rem;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.foot-nav dd a:hover {
  color: var(--cream);
  border-bottom-color: var(--gold);
  text-decoration: none;
}

.foot-copy {
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  color: rgba(244, 239, 230, 0.45);
}

/* ---------- 回到顶部 ---------- */
.totop {
  position: fixed;
  right: 0.9rem;
  bottom: 0.9rem;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.5rem 0.9rem;
  background: rgba(14, 27, 22, 0.94);
  border: 1px solid rgba(176, 138, 79, 0.55);
  color: var(--cream);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  text-decoration: none;
}

.totop.on { opacity: 1; visibility: visible; transform: none; }
.totop:hover { text-decoration: none; border-color: var(--gold); color: var(--gold); }

/* ---------- 滚动揭示 ---------- */
.rv {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.75s ease, transform 0.75s cubic-bezier(0.22, 0.7, 0.28, 1);
  will-change: opacity, transform;
}

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

/* ---------- 断点 ---------- */
@media (min-width: 1000px) {
  .spread {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 244px;
    gap: 3.2rem;
    align-items: start;
    padding-inline: clamp(1.4rem, 3vw, 2.2rem);
  }

  .chapters { max-width: none; }

  .rail {
    position: sticky;
    top: 8.5rem;
    margin-top: 1rem;
    border-top: 0;
    border-left: 1px solid var(--line);
    padding: 0.2rem 0 0.6rem 1.15rem;
  }

  .rail hr { margin-left: 0; }
}

@media (max-width: 999px) {
  .chapters { max-width: none; }

  .rail .toc {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 1rem;
  }
}

@media (max-width: 560px) {
  body { font-size: 16px; }

  .hero { min-height: 46vh; }

  .menu { gap: 0; }

  .menu-link {
    padding: 0.5rem 0.45rem;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
  }

  .foot { justify-content: flex-start; }

  .foot-copy { flex-basis: 100%; }
}

@media (max-width: 400px) {
  .rail .toc { grid-template-columns: 1fr; }
  .ni { display: none; }
  .menu-link { padding-inline: 0.35rem; }
}

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

  .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .veil-layer,
  .band { transform: none !important; }
}

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