@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400&family=Playfair+Display:ital@1&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --line: rgba(0, 0, 0, 0.16);
  --line-soft: rgba(0, 0, 0, 0.08);
  --gap: 2rem;
  --pad: 1.6rem;
  --maxw: 1200px;
}

*,
*::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, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

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

/* 顶部：品牌行 + 菜单行 */
.top {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

.top-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 60px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.9rem 0;
  min-height: 44px;
  text-decoration: none;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.mark {
  display: block;
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--ink);
}

img.mark {
  background: transparent;
  object-fit: cover;
  filter: grayscale(1) contrast(1.2);
}

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

.top-menu {
  border-bottom: 2px solid var(--ink);
}

.menu {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  margin: 0;
}

.menu-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.7rem 0.85rem;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  border-right: 1px solid var(--line-soft);
  transition: background-color 0.22s ease, color 0.22s ease;
}

.menu-link:first-child {
  padding-left: 0;
}

.menu-link:last-child {
  border-right: 0;
}

.dot {
  display: block;
  flex: none;
  width: 6px;
  height: 6px;
  background: var(--ink);
  transition: background-color 0.22s ease, box-shadow 0.22s ease;
}

.menu-link:hover {
  background: var(--ink);
  color: var(--paper);
}

.menu-link:hover .dot {
  background: var(--paper);
}

/* 骨架：左侧索引 + 主文 */
.shell {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: var(--gap);
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.2rem var(--pad) 3.5rem;
  align-items: start;
}

.rail {
  position: sticky;
  top: 1rem;
  align-self: start;
  border-top: 3px solid var(--ink);
  padding-top: 0.9rem;
}

.eyebrow {
  display: block;
  font-family: "Playfair Display", Georgia, "Songti SC", serif;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.rail-title {
  margin: 0 0 0.9rem;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.rail-list li {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.idx {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(0, 0, 0, 0.55);
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.45rem 0;
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: padding-left 0.22s ease, border-color 0.22s ease;
}

.rail-list a:hover {
  padding-left: 0.3rem;
  border-bottom-color: var(--ink);
}

/* 主文：main > article > div 直接三层 */
main {
  min-width: 0;
}

.doc > div {
  padding: 2.6rem var(--pad);
  border-top: 1px solid var(--line);
  scroll-margin-top: 90px;
}

.doc > div:first-child {
  border-top: 0;
  padding: 0;
}

.doc p {
  margin: 0 0 1.1rem;
  max-width: 66ch;
}

.doc h2,
.doc h3 {
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.doc h2 {
  font-size: clamp(1.45rem, 3.1vw, 2.05rem);
  font-weight: 800;
  margin: 0.35rem 0 1rem;
}

.doc h3 {
  font-size: clamp(1.12rem, 2.1vw, 1.32rem);
  font-weight: 700;
  margin: 2rem 0 0.7rem;
}

.doc small {
  display: block;
  font-family: "Playfair Display", Georgia, "Songti SC", serif;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-bottom: 0.15rem;
}

.doc ul,
.doc ol {
  margin: 0 0 1.1rem;
  padding-left: 1.25rem;
  max-width: 66ch;
}

.doc li {
  margin-bottom: 0.45rem;
}

.doc blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 3px solid var(--ink);
  font-size: 1.04rem;
}

.doc blockquote p:last-child {
  margin-bottom: 0;
}

.doc a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 0.2s ease;
}

.doc a:hover {
  color: rgba(0, 0, 0, 0.6);
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2rem;
  font-size: 0.95rem;
}

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

.doc th {
  font-weight: 700;
  background: rgba(0, 0, 0, 0.04);
}

/* Hero：黑底灯箱，右图左文 */
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: var(--gap);
  align-items: center;
  min-height: 45vh;
  padding: 2.4rem var(--pad) 2.8rem;
  background: var(--ink);
  color: var(--paper);
}

.hero:not(:has(.hero-media)) {
  grid-template-columns: 1fr;
}

.hero-text {
  position: relative;
  z-index: 2;
  text-align: right;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5.4vw, 3.9rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.ghost {
  position: absolute;
  left: -0.06em;
  bottom: -0.3em;
  z-index: 1;
  font-size: clamp(4rem, 15vw, 10rem);
  font-weight: 800;
  line-height: 0.78;
  letter-spacing: -0.05em;
  white-space: nowrap;
  color: var(--paper);
  opacity: 0.11;
  pointer-events: none;
}

.hero-media {
  position: relative;
  z-index: 2;
}

.hero-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
  will-change: transform;
}

/* 页脚 */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.6rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.4rem var(--pad) 2.6rem;
  border-top: 2px solid var(--ink);
}

.foot-brand {
  flex: 0 1 auto;
}

.foot-brand a {
  display: block;
  font-size: clamp(1.8rem, 5.6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 0.95;
  text-decoration: none;
}

.foot-nav {
  flex: 1 1 320px;
}

.foot-nav dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 0 1.4rem;
  margin: 0;
}

.foot-nav dt {
  margin: 0;
}

.foot-nav dd {
  margin: 0;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: rgba(0, 0, 0, 0.5);
  align-self: center;
}

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.22s ease;
}

.foot-nav a:hover {
  border-bottom-color: var(--ink);
}

.foot-copy {
  flex: 0 0 auto;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  color: rgba(0, 0, 0, 0.62);
  padding-bottom: 0.35rem;
}

/* 回到顶部 */
.to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  min-width: 64px;
  min-height: 44px;
  padding: 0.6rem 0.9rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.to-top.on {
  opacity: 1;
  visibility: visible;
  transform: none;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    padding-top: 1.4rem;
  }

  main {
    order: 1;
  }

  .rail {
    order: 2;
    position: static;
    border-top: 1px solid var(--line);
    padding-top: 1rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    padding: 1.6rem var(--pad) 2rem;
  }

  .hero-text {
    text-align: left;
  }

  .hero-media img {
    aspect-ratio: 16 / 10;
  }

  .doc > div {
    padding: 2rem var(--pad);
  }

  .foot {
    align-items: flex-start;
    padding-bottom: 3.6rem;
  }

  .foot-nav {
    flex: 1 1 100%;
  }

  .foot-nav dl {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 460px) {
  :root {
    --pad: 1.15rem;
  }

  .menu-link {
    padding: 0.65rem 0.6rem;
    font-size: 0.86rem;
  }

  .ghost {
    font-size: 4.6rem;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

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