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

:root {
  --pink: #ff0080;
  --violet: #ff00ff;
  --ink: #26171f;
  --ink-deep: #180e14;
  --paper: #fbf1f7;
  --dim: rgba(251, 241, 247, 0.72);
  --line: rgba(255, 255, 255, 0.12);
  --serif: 'Cormorant Garamond', 'Libre Baskerville', Georgia, 'Songti SC', 'Noto Serif SC', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  background: var(--ink-deep);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.78;
  color: var(--paper);
  background: transparent;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: -25%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 34% at 18% 22%, rgba(255, 0, 128, 0.55), transparent 66%),
    radial-gradient(34% 30% at 82% 16%, rgba(255, 0, 255, 0.42), transparent 64%),
    radial-gradient(46% 44% at 62% 84%, rgba(150, 20, 120, 0.55), transparent 70%),
    radial-gradient(30% 26% at 32% 72%, rgba(255, 64, 160, 0.32), transparent 70%),
    conic-gradient(from 200deg at 50% 50%, #26171f, #3a1930, #241521, #33192a, #26171f);
  background-size: 180% 180%, 180% 180%, 180% 180%, 180% 180%, cover;
  animation: aurora 28s ease-in-out infinite alternate;
}

@keyframes aurora {
  0% {
    background-position: 0% 0%, 100% 0%, 60% 100%, 20% 80%, 0 0;
    filter: hue-rotate(0deg) saturate(1.08);
  }
  100% {
    background-position: 28% 22%, 68% 30%, 40% 70%, 52% 40%, 0 0;
    filter: hue-rotate(-26deg) saturate(1.28);
  }
}

::selection {
  background: rgba(255, 0, 128, 0.45);
  color: #fff;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: 0.01em;
  color: #fff;
  margin: 0 0 0.55em;
}

p { margin: 0 0 1em; }

a {
  color: #ffc7e2;
  text-decoration: none;
}

a:hover { color: #fff; }

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid rgba(255, 0, 128, 0.85);
  outline-offset: 2px;
}

[id] { scroll-margin-top: 96px; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 99;
  padding: 0.65rem 1.1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  background: #fff;
  color: var(--ink);
  border-radius: 0 0 14px 14px;
  transition: top 0.22s ease;
}

.skip:focus { top: 0; color: var(--ink); }

/* 页头 */
.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(38, 23, 31, 0.78), rgba(38, 23, 31, 0.22));
}

.masthead__row {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem clamp(0.75rem, 3vw, 2rem);
}

.spine__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.12rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.spine--l .spine__list { justify-content: flex-end; }
.spine--r .spine__list { justify-content: flex-start; }

.spine__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.72rem;
  border-radius: 10px;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  color: var(--dim);
  transition: color 0.25s ease, background 0.25s ease;
}

.spine__link:hover {
  color: #fff;
  background: rgba(255, 0, 128, 0.2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.3rem 0.55rem;
  color: #fff;
  font-family: var(--serif);
  font-size: 1.12rem;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
  white-space: nowrap;
}

.brand:hover { color: #ffd9ec; }

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: 0;
  text-indent: 0;
  box-shadow: 0 0 22px rgba(255, 0, 128, 0.55);
}

.brand__logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

/* 粘性锚点条 */
.rails {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(24, 14, 20, 0.86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.rails__nav {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.3rem clamp(0.4rem, 2vw, 1rem);
}

.rails__list {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.rails__list::-webkit-scrollbar { display: none; }

.rails__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.9rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  color: var(--dim);
  white-space: nowrap;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.rails__link:hover,
.rails__link.is-on {
  color: #fff;
  border-color: rgba(255, 0, 128, 0.7);
  background: rgba(255, 0, 128, 0.2);
}

/* 主区 */
main {
  padding: 0 clamp(1rem, 4vw, 2.5rem) 3rem;
}

.hero {
  min-height: 45vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(1.8rem, 6vw, 4rem) 0.5rem clamp(1.4rem, 4vw, 2.6rem);
}

.hero__title {
  margin: 0;
  font-size: clamp(2.05rem, 8vw, 4.6rem);
  line-height: 1.14;
  letter-spacing: 0.03em;
  background: linear-gradient(180deg, #ffffff 10%, #ffd2e9 58%, #ff8cc8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: #fff;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 52px rgba(255, 0, 128, 0.35);
  max-width: 20ch;
}

.chapter {
  max-width: 1160px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 272px;
  gap: clamp(1rem, 2.5vw, 2.2rem);
  align-items: start;
}

.chapter__body {
  display: grid;
  gap: 1.15rem;
  min-width: 0;
}

.chapter__body > article {
  position: relative;
  overflow-x: auto;
  padding: clamp(1.15rem, 2.6vw, 2rem);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.028));
  box-shadow: 0 22px 46px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(6px);
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.chapter__body > article::before {
  content: "";
  position: absolute;
  left: clamp(1.15rem, 2.6vw, 2rem);
  top: 0;
  width: 56px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--pink), var(--violet));
}

.chapter__body > article:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 0, 128, 0.45);
  box-shadow: 0 30px 62px -34px rgba(255, 0, 128, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.chapter__body h2 {
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  margin: 0 0 0.6rem;
}

.chapter__body h3 {
  font-size: clamp(1.15rem, 2.4vw, 1.4rem);
  margin: 1.5rem 0 0.4rem;
  color: #ffd7ec;
}

.chapter__body ul,
.chapter__body ol {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.chapter__body li { margin: 0.32rem 0; }

.chapter__body a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-color: rgba(255, 0, 128, 0.6);
}

.chapter__body figure { margin: 1.2rem 0; }

.chapter__body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.chapter__body figcaption {
  margin-top: 0.5rem;
  font-family: var(--serif);
  font-size: 0.88rem;
  letter-spacing: 0.05em;
  color: var(--dim);
}

.chapter__body blockquote {
  margin: 1rem 0;
  padding: 0.7rem 1rem;
  border-left: 3px solid var(--pink);
  border-radius: 0 12px 12px 0;
  background: rgba(255, 0, 128, 0.1);
}

.chapter__body table {
  width: 100%;
  min-width: 460px;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.chapter__body th,
.chapter__body td {
  padding: 0.5rem 0.45rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chapter__body th {
  font-family: var(--serif);
  letter-spacing: 0.08em;
  color: #ffd7ec;
  border-bottom-color: rgba(255, 0, 128, 0.45);
}

/* 侧注 */
.note {
  position: sticky;
  top: 92px;
  padding: 1.1rem 1.15rem;
  border: 1px solid rgba(255, 0, 128, 0.3);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 0, 128, 0.18), rgba(255, 0, 255, 0.06));
  box-shadow: 0 18px 40px -28px #000;
}

.note__head {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  letter-spacing: 0.06em;
}

.subtitle {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.94rem;
  line-height: 1.72;
  letter-spacing: 0.05em;
  color: var(--dim);
}

/* 页脚 */
.foot {
  margin-top: 3.2rem;
  padding: clamp(1.6rem, 4vw, 2.8rem) max(1rem, calc((100vw - 1200px) / 2)) 1.4rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(20, 11, 16, 0.55), rgba(12, 6, 10, 0.95));
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  grid-template-areas:
    "intro index"
    "form form"
    "base base";
  gap: clamp(1.3rem, 3vw, 2.2rem);
  align-items: start;
}

.foot__intro { grid-area: intro; }
.foot__index { grid-area: index; }
.foot__form { grid-area: form; }
.foot__base { grid-area: base; }

.foot__brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--serif);
  font-size: 1.45rem;
  letter-spacing: 0.22em;
  color: #fff;
}

.foot__desc {
  margin: 0.4rem 0 0;
  max-width: 46ch;
  font-size: 0.94rem;
  color: var(--dim);
}

.foot__dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0.1rem 0.95rem;
  margin: 0;
}

.foot__dl dt {
  flex-basis: 100%;
  margin-bottom: 0.35rem;
  font-family: var(--serif);
  font-size: 0.88rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: #ff9ccb;
}

.foot__dl dd { margin: 0; }

.foot__dl a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.93rem;
  color: var(--dim);
}

.foot__dl a:hover { color: #fff; }

.sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 20px 44px -34px #000;
}

.sub__label {
  font-family: var(--serif);
  font-size: 0.88rem;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  color: #ff9ccb;
}

.sub__input {
  flex: 1 1 220px;
  min-height: 46px;
  padding: 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--paper);
  font: inherit;
  font-size: 0.95rem;
}

.sub__input::placeholder { color: rgba(251, 241, 247, 0.5); }

.sub__btn {
  min-height: 46px;
  padding: 0 1.5rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(120deg, var(--pink), var(--violet));
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-indent: 0.14em;
  cursor: pointer;
  transition: filter 0.25s ease;
}

.sub__btn:hover { filter: brightness(1.14); }

.foot__base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.copy {
  margin: 0;
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0.14em;
  color: var(--dim);
}

.foot__mini {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 1rem;
}

.foot__mini a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.9rem;
  color: var(--dim);
}

.foot__mini a:hover { color: #fff; }
.totop { color: #ffb3d9; }

/* 动效 */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.3, 1);
  }
  .reveal.in {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  body::before { animation: none; }
  .chapter__body > article,
  .spine__link,
  .rails__link,
  .sub__btn,
  .skip { transition: none; }
  .chapter__body > article:hover { transform: none; }
}

@media (max-width: 880px) {
  body { font-size: 16.5px; }

  .masthead__row {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    gap: 0.1rem;
    padding-top: 0.6rem;
  }

  .brand { order: -1; }

  .spine__list { justify-content: center; }
  .spine--l .spine__list,
  .spine--r .spine__list { justify-content: center; }
  .spine__link { padding: 0 0.55rem; font-size: 0.93rem; }

  .chapter { grid-template-columns: minmax(0, 1fr); }
  .note { position: static; }

  .hero { min-height: 38vh; padding-top: 1.4rem; }

  .foot {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "intro"
      "index"
      "form"
      "base";
  }

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

@media (max-width: 420px) {
  .hero__title { font-size: clamp(1.95rem, 10.5vw, 2.6rem); }
  .sub__label { flex-basis: 100%; }
  .sub__btn { flex: 1 1 140px; }
}

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