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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --line: rgba(0, 0, 0, 0.16);
  --faint: rgba(0, 0, 0, 0.52);
  --head: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(1rem, 4vw, 2.75rem);
  --shadow: 0 26px 42px -32px rgba(0, 0, 0, 0.75);
}

*,
*::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(--body);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.002em;
  overflow-x: hidden;
}

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

a {
  color: inherit;
}

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

body.nav-open {
  overflow: hidden;
}

/* ---------- 页头：品牌行在上，菜单行在下 ---------- */

.site-head {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.15rem 0.75rem;
  padding: 0.55rem var(--pad) 0.45rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.brandrow {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  font-family: var(--head);
  font-size: clamp(1.02rem, 3.4vw, 1.3rem);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-decoration: none;
  white-space: nowrap;
}

.brand .logo {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
}

.menurow {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.burger {
  min-height: 44px;
  padding: 0.45rem 1.05rem;
  font-family: var(--head);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

body.nav-open .site-head {
  background: #000;
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.24);
}

body.nav-open .burger {
  background: #fff;
  color: #000;
  border-color: #fff;
}

/* ---------- 全屏遮罩菜单 ---------- */

.nav {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: none;
  padding: 6.5rem var(--pad) 3rem;
  background: #000;
  color: #fff;
  overflow-y: auto;
}

.nav.is-open {
  display: block;
}

.nav p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.4rem;
  margin: 0;
  font-family: var(--head);
  font-size: clamp(1.55rem, 7vw, 3.1rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.nav a {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.12em 0;
  color: #fff;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.nav a:hover,
.nav a:focus-visible {
  border-bottom-color: #fff;
}

/* ---------- 主栅格 ---------- */

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(7rem, 16vw, 9rem) var(--pad) 1rem;
  display: grid;
  gap: clamp(1.8rem, 4vw, 3.25rem);
  grid-template-columns: minmax(0, 1fr);
}

section {
  min-width: 0;
}

@media (min-width: 900px) {
  main {
    grid-template-columns: minmax(0, 1fr) 17rem;
    align-items: start;
  }
}

/* ---------- Hero：右对齐超大标题 ---------- */

.hero {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  min-height: 70vh;
  text-align: right;
  padding-bottom: clamp(1.75rem, 6vw, 3rem);
  border-bottom: 2px solid var(--ink);
  margin-bottom: clamp(1.75rem, 5vw, 2.75rem);
}

.hero h1 {
  margin: 0;
  font-family: var(--head);
  font-size: clamp(2.35rem, 10.5vw, 5.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-align: right;
  text-wrap: balance;
  will-change: transform;
}

.dek {
  max-width: 42ch;
  margin: 1.15rem 0 0;
  font-size: 1rem;
  line-height: 1.7;
  color: #303030;
  text-align: right;
}

/* ---------- 正文章节 ---------- */

section > article {
  scroll-margin-top: 7.5rem;
}

section > article + article {
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
  padding-top: clamp(1.5rem, 4vw, 2.25rem);
  border-top: 1px solid var(--line);
}

section > article h2,
section > article h3 {
  font-family: var(--head);
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin: 0 0 0.8rem;
}

section > article h2 {
  font-size: clamp(1.45rem, 4.6vw, 2.1rem);
  font-weight: 700;
}

section > article h3 {
  font-size: clamp(1.18rem, 3.2vw, 1.45rem);
  font-weight: 600;
  margin-top: 1.6rem;
}

section > article h2 > span,
section > article h3 > span {
  display: inline-block;
  padding-top: 0.34rem;
  border-top: 3px solid var(--ink);
}

section > article p,
section > article li {
  max-width: 66ch;
  margin: 0 0 1rem;
}

section > article p:last-child,
section > article ul:last-child,
section > article ol:last-child {
  margin-bottom: 0;
}

section > article ul,
section > article ol {
  max-width: 66ch;
  padding-left: 1.2rem;
  margin: 0 0 1rem;
}

section > article li {
  max-width: none;
  margin-bottom: 0.45rem;
}

@media (min-width: 760px) {
  section > article ul {
    columns: 2 13rem;
    column-gap: 2rem;
  }

  section > article ul li {
    break-inside: avoid;
  }
}

section > article a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

section > article strong {
  font-weight: 700;
}

section > article:nth-child(2) > p:first-of-type::first-letter,
section > article:nth-child(3) > p:first-of-type::first-letter {
  float: left;
  font-family: var(--head);
  font-weight: 700;
  font-size: 3.5em;
  line-height: 0.8;
  padding: 0.06em 0.14em 0 0;
}

section blockquote {
  margin: 1.75rem 0;
  padding: 0.2rem 0 0.2rem 1.15rem;
  border-left: 3px solid var(--ink);
  font-family: var(--head);
  font-size: clamp(1.12rem, 3.2vw, 1.45rem);
  line-height: 1.4;
  letter-spacing: -0.015em;
}

section blockquote p {
  max-width: 44ch;
  margin: 0 0 0.6rem;
}

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

section figure {
  margin: 1.6rem 0;
}

section figcaption {
  margin-top: 0.5rem;
  font-size: 0.94rem;
  color: var(--faint);
}

section table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}

section th,
section td {
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

section th {
  font-family: var(--head);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

/* ---------- 右侧栏 ---------- */

.rail {
  display: grid;
  gap: 1.1rem;
  align-content: start;
  font-size: 1rem;
}

@media (min-width: 900px) {
  .rail {
    position: sticky;
    top: 8.5rem;
  }
}

.rail-block {
  padding: 1rem 1.1rem 1.15rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.rail h2 {
  margin: 0 0 0.55rem;
  font-family: var(--head);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  line-height: 1.4;
}

.rail h2 > span {
  display: inline-block;
  padding-bottom: 0.2rem;
  border-bottom: 2px solid var(--ink);
}

.toc {
  display: grid;
  gap: 0.1rem;
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.5;
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0.2rem 0;
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

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

.toc a:hover {
  text-decoration: underline;
  text-underline-offset: 0.24em;
}

.rail-p {
  margin: 0;
}

.up {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-family: var(--head);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
}

/* ---------- 页脚：仅 p 与 small ---------- */

footer {
  max-width: 1180px;
  margin: clamp(2.5rem, 8vw, 4rem) auto 0;
  padding: 2rem var(--pad) 2.5rem;
  border-top: 2px solid var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

@media (min-width: 720px) {
  footer {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    gap: 1.25rem;
  }
}

footer small {
  display: block;
  font-size: 0.94rem;
  line-height: 1.6;
  color: var(--faint);
}

.foot-mark {
  margin: 0;
  font-family: var(--head);
  font-size: clamp(2rem, 9vw, 4.2rem);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.045em;
  text-align: left;
}

@media (max-width: 719px) {
  .foot-mark {
    order: -1;
  }
}

@media (min-width: 720px) {
  .foot-mark {
    text-align: center;
  }
}

.foot-top {
  margin: 0;
}

@media (min-width: 720px) {
  .foot-top {
    text-align: right;
  }
}

.foot-top a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.2rem 0;
  font-family: var(--head);
  font-size: 0.98rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

/* ---------- 动效 ---------- */

.rv {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.75s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

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

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

  .hero h1 {
    transform: none !important;
  }
}

/* ---------- 窄屏微调 ---------- */

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

  .dek {
    max-width: 34ch;
  }

  .hero {
    min-height: 66vh;
  }

  .nav p {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.1rem;
  }
}

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