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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --rail: 244px;
  --tick: 30px;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  font-weight: 400;
  overflow-x: hidden;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.045em;
}

p {
  margin: 0;
}

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

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

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

.skip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  padding: 0.7rem 1.1rem;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  font-size: 0.9rem;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

.skip:focus {
  transform: translateY(0);
}

/* 顶部细条 */
.ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--tick);
  z-index: 40;
  display: flex;
  align-items: center;
  background: var(--ink);
  color: var(--paper);
  padding: 0 var(--pad);
  overflow: hidden;
}

.ticker-in {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  white-space: nowrap;
}

/* 左侧竖排导航 */
.rail {
  position: fixed;
  top: var(--tick);
  bottom: 0;
  left: 0;
  z-index: 30;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.75rem 1.4rem 1.5rem;
  background: var(--paper);
  border-right: 2px solid var(--ink);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  text-decoration: none;
}

.mark {
  width: 0.95rem;
  height: 0.95rem;
  background: var(--ink);
  border-radius: 0 50% 50% 50%;
  flex: none;
  transition: transform 0.2s ease;
}

.brand:hover .mark {
  transform: rotate(90deg);
}

.nav {
  order: 2;
  min-width: 0;
}

.nav p {
  display: flex;
  flex-direction: column;
}

.nav-a {
  display: block;
  padding: 0.62rem 0.15rem;
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
  transition: background 0.16s ease, color 0.16s ease, padding 0.16s ease;
}

.nav-a:first-child {
  border-top: 1px solid rgba(0, 0, 0, 0.14);
}

.nav-a:hover,
.nav-a:focus-visible {
  background: var(--ink);
  color: var(--paper);
  padding-left: 0.6rem;
}

.drop {
  order: 5;
  margin-top: auto;
  border-top: 2px solid var(--ink);
  padding-top: 0.3rem;
}

.drop summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

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

.drop summary::after {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(45deg);
  margin-left: auto;
  transition: transform 0.18s ease;
}

.drop[open] summary::after {
  transform: rotate(225deg);
}

.drop-list {
  display: flex;
  flex-direction: column;
  padding-bottom: 0.5rem;
}

.drop-a {
  display: block;
  padding: 0.6rem 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.drop-a:hover {
  background: var(--ink);
  color: var(--paper);
  padding-left: 0.55rem;
}

/* 主区 */
.main {
  margin-left: var(--rail);
  padding: calc(var(--tick) + 1.75rem) var(--pad) 0;
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  column-gap: clamp(1.5rem, 4vw, 3.75rem);
  min-width: 0;
}

.hero {
  grid-column: 1 / -1;
  position: relative;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  text-align: right;
  min-height: 45vh;
  padding: 2.5rem 0 clamp(3rem, 6vw, 4.5rem);
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  left: -4%;
  right: -4%;
  bottom: 0;
  height: clamp(1.25rem, 4vw, 3rem);
  background: var(--ink);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  z-index: 0;
}

.ghost {
  position: absolute;
  top: -0.16em;
  right: -0.04em;
  z-index: 0;
  font-size: clamp(3.5rem, 15vw, 12rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.8;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0.08;
  pointer-events: none;
  will-change: transform;
}

.hero h1 {
  position: relative;
  z-index: 1;
  font-size: clamp(2.35rem, 7.6vw, 5.6rem);
  line-height: 0.94;
  max-width: 20ch;
}

.lead {
  position: relative;
  z-index: 1;
  max-width: 44ch;
  margin-top: 1.35rem;
  padding-right: 0.95rem;
  border-right: 3px solid var(--ink);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
  line-height: 1.7;
  font-weight: 600;
}

/* 目录 */
.side {
  grid-column: 1;
  min-width: 0;
  align-self: start;
  position: sticky;
  top: calc(var(--tick) + 1.5rem);
  border-top: 3px solid var(--ink);
  padding-top: 0.85rem;
}

.side h2 {
  font-size: 0.98rem;
  letter-spacing: 0.16em;
  font-weight: 800;
}

.side h2 span {
  display: inline-block;
}

.side ol {
  list-style: none;
  counter-reset: side;
  margin: 0.75rem 0 0;
  padding: 0;
}

.side li {
  counter-increment: side;
}

.side a {
  display: block;
  padding: 0.62rem 0 0.62rem 1.85rem;
  position: relative;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
  transition: background 0.16s ease, color 0.16s ease;
}

.side a::before {
  content: counter(side, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.72rem;
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.55;
}

.side a:hover {
  background: var(--ink);
  color: var(--paper);
}

/* 正文 */
.doc {
  grid-column: 2;
  min-width: 0;
}

.content {
  min-width: 0;
  overflow-wrap: break-word;
}

.content > article {
  padding: clamp(2.5rem, 6vw, 5.5rem) 0;
  border-top: 2px solid var(--ink);
  scroll-margin-top: 1.5rem;
}

.content > article:first-child {
  border-top: 3px solid var(--ink);
}

.content h2 {
  font-size: clamp(1.75rem, 4.4vw, 3.3rem);
  line-height: 1.02;
  margin-bottom: 1.35rem;
  max-width: 24ch;
}

.content h2 span {
  display: inline;
}

.content h3 {
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  line-height: 1.25;
  margin: 2.25rem 0 1rem;
}

.content p {
  max-width: 64ch;
  margin: 0 0 1.4rem;
  line-height: 1.85;
}

.content ul,
.content ol {
  max-width: 60ch;
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
}

.content li {
  margin-bottom: 0.55rem;
  line-height: 1.7;
}

.content li::marker {
  font-weight: 800;
}

.content strong,
.content b {
  font-weight: 800;
}

.content a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

.content a:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.content blockquote {
  margin: 0 0 1.5rem;
  padding: 0.35rem 0 0.35rem 1.25rem;
  border-left: 6px solid var(--ink);
  font-size: 1.05rem;
  line-height: 1.8;
}

.content img {
  margin: 1.75rem 0;
}

.content figure {
  margin: 1.75rem 0;
}

.content figcaption {
  font-size: 0.9rem;
  margin-top: 0.5rem;
  opacity: 0.75;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
  table-layout: fixed;
}

.content th,
.content td {
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  padding: 0.7rem 0.6rem;
  text-align: left;
  overflow-wrap: anywhere;
}

.content th {
  font-weight: 800;
  border-bottom: 2px solid var(--ink);
}

/* 页脚 */
.foot {
  margin-left: var(--rail);
  margin-top: clamp(2.5rem, 7vw, 5.5rem);
  background: var(--ink);
  color: var(--paper);
  padding: clamp(2.25rem, 5vw, 4rem) var(--pad) 1.25rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem clamp(1.25rem, 3vw, 2.5rem);
}

.foot h2 {
  font-size: 0.95rem;
  letter-spacing: 0.18em;
  font-weight: 800;
  margin-bottom: 1rem;
}

.foot h2 span {
  display: inline-block;
}

.foot p {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--paper);
  overflow-wrap: anywhere;
}

.foot a {
  color: var(--paper);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  display: inline-block;
  padding: 0.42rem 0;
}

.foot a:hover {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper);
}

.f-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.sub {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

.sub input {
  flex: 1 1 7rem;
  min-width: 0;
  min-height: 44px;
  padding: 0.6rem 0.7rem;
  background: transparent;
  border: 1px solid var(--paper);
  color: var(--paper);
  font: inherit;
  font-size: 0.95rem;
}

.sub input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.sub button {
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border: 0;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.sub button:hover {
  background: var(--ink);
  color: var(--paper);
  box-shadow: inset 0 0 0 2px var(--paper);
}

.base {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.base p {
  font-size: 0.88rem;
}

/* 平板与手机 */
@media (max-width: 959px) {
  .rail {
    position: sticky;
    top: var(--tick);
    bottom: auto;
    width: auto;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 1rem;
    padding: 0.6rem var(--pad);
    border-right: 0;
    border-bottom: 2px solid var(--ink);
    overflow: visible;
    background: var(--paper);
  }

  .brand {
    order: 0;
    font-size: 1.25rem;
  }

  .drop {
    order: 1;
    margin: 0 0 0 auto;
    border-top: 0;
    padding-top: 0;
  }

  .drop summary {
    min-height: 44px;
    padding: 0.5rem 0.2rem;
  }

  .drop-list {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
    padding: 0.5rem var(--pad) 0.9rem;
    z-index: 35;
    overflow-x: hidden;
  }

  .nav {
    order: 2;
    flex: 1 0 100%;
    width: 100%;
    margin: 0 calc(var(--pad) * -1);
  }

  .nav p {
    flex-direction: row;
    gap: 0.15rem;
    overflow-x: auto;
    padding: 0 0.75rem 0.15rem;
    scrollbar-width: none;
  }

  .nav p::-webkit-scrollbar {
    display: none;
  }

  .nav-a {
    border: 1px solid rgba(0, 0, 0, 0.16);
    border-top: 1px solid rgba(0, 0, 0, 0.16);
    padding: 0.6rem 0.7rem;
    white-space: nowrap;
    font-size: 0.92rem;
  }

  .nav-a:hover,
  .nav-a:focus-visible {
    padding-left: 0.7rem;
  }

  .main {
    margin-left: 0;
    grid-template-columns: minmax(0, 1fr);
    padding: calc(var(--tick) + 1.25rem) var(--pad) 0;
  }

  .hero {
    min-height: 40vh;
    padding-top: 1.75rem;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 9.5vw, 3.6rem);
  }

  .ghost {
    font-size: clamp(2.75rem, 18vw, 7rem);
  }

  .side,
  .doc {
    grid-column: 1 / -1;
  }

  .side {
    position: static;
    margin-bottom: 1.5rem;
  }

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

  .content > article {
    scroll-margin-top: 9rem;
  }

  .foot {
    margin-left: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .foot {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.75rem;
  }

  .side ol {
    grid-template-columns: minmax(0, 1fr);
  }
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

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