:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: #5c5c5c;
  --hair: #d8d8d8;
  --r: 10px;
  --gutter: clamp(1.1rem, 4vw, 2.4rem);
  --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: "Be Vietnam Pro", "Noto Sans", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 17px;
  line-height: 1.68;
  letter-spacing: 0.005em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* 顶部细条 */
.strip {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  text-align: center;
  font-size: 16px;
  line-height: 1.35;
  letter-spacing: 0.28em;
  padding: 0.55rem var(--gutter);
  text-indent: 0.28em;
}

/* 主导航 */
.mast {
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
  white-space: nowrap;
}

.dot {
  width: 13px;
  height: 13px;
  background: var(--ink);
  border-radius: 2px;
}

.mark:hover .dot {
  border-radius: 50%;
  transition: border-radius 220ms ease;
}

.bar nav {
  min-width: 0;
}

.bar nav p,
.dock p {
  margin: 0;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.bar nav a,
.dock a,
.flinks a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 16px;
  line-height: 1.4;
  white-space: nowrap;
  transition: background 220ms ease, color 220ms ease, border-color 220ms ease;
}

.bar nav a:hover,
.dock a:hover,
.dock a.on,
.flinks a:hover {
  background: var(--ink);
  color: var(--paper);
}

/* 粘性锚点条 */
.dock {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
}

.dock p {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.45rem var(--gutter);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.dock a {
  flex: 0 0 auto;
  border-color: transparent;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(1.2rem, 4vw, 2.4rem);
  padding: clamp(2rem, 7vw, 4rem) var(--gutter);
  border-bottom: 2px solid var(--ink);
}

.ghost {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(2.2rem, 12vw, 11rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
  opacity: 0.07;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 24ch;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 6.4vw, 4.3rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  text-wrap: balance;
}

.lede {
  margin: 1rem auto 0;
  max-width: 44ch;
  color: var(--mute);
  font-size: clamp(1rem, 1.6vw, 1.125rem);
  line-height: 1.6;
}

.hero-media {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--maxw);
  border: 2px solid var(--ink);
  border-radius: var(--r);
  overflow: hidden;
}

.hero-media img {
  width: 100%;
  max-height: 42vh;
  object-fit: cover;
}

/* 主体栅格 */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.6rem) var(--gutter) clamp(2.5rem, 7vw, 4rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: clamp(1.5rem, 3vw, 2rem);
  align-items: start;
}

.col {
  min-width: 0;
}

/* 正文 */
.prose {
  min-width: 0;
  font-size: 17px;
}

.prose > article {
  border-top: 2px solid var(--ink);
  margin-top: clamp(2rem, 5vw, 3.4rem);
  padding-top: clamp(1.4rem, 3.5vw, 2.2rem);
  scroll-margin-top: 8.5rem;
}

.prose > article:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.prose h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3.8vw, 2.25rem);
  line-height: 1.14;
  letter-spacing: -0.028em;
  font-weight: 700;
}

.prose h3 {
  margin: 1.8rem 0 0.5rem;
  font-size: 1.2rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.prose p {
  margin: 0 0 1.1rem;
  max-width: 68ch;
}

.prose ul,
.prose ol {
  margin: 0 0 1.15rem;
  padding-left: 1.35rem;
  max-width: 68ch;
}

.prose li {
  margin: 0.35rem 0;
}

.prose blockquote {
  margin: 1.4rem 0;
  padding: 0.35rem 0 0.35rem 1.1rem;
  border-left: 4px solid var(--ink);
  color: #2e2e2e;
}

.prose a {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
  transition: background 220ms ease, color 220ms ease;
}

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

.prose strong {
  font-weight: 700;
}

.prose img {
  border-radius: var(--r);
  margin: 1.1rem 0;
  border: 1.5px solid var(--ink);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 16px;
}

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

.prose th {
  background: #f3f3f3;
  font-weight: 600;
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  background: #f0f0f0;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

hr {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 1.4rem 0;
}

.prose h2 + hr,
.prose h3 + hr {
  border-top: 2px solid var(--ink);
  margin: 0 0 1.26rem;
}

/* 侧栏 */
.rail {
  position: sticky;
  top: 4.4rem;
  background: rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1.5px solid var(--ink);
  border-radius: var(--r);
  padding: 0.9rem 0.9rem 1rem;
}

.rail h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-indent: 0.22em;
}

.rail hr {
  border-top: 2px solid var(--ink);
  margin: 0.6rem 0 0.7rem;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
}

.rail-list a {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-height: 40px;
  padding: 0.4rem 0.35rem;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.5;
  transition: background 220ms ease, color 220ms ease;
}

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

.num {
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}

.rail-list a:hover .num {
  color: var(--paper);
}

/* 页脚 */
footer {
  border-top: 3px solid var(--ink);
  padding: clamp(2rem, 5vw, 3.2rem) max(var(--gutter), calc((100% - var(--maxw)) / 2 + var(--gutter))) 1.4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "cta links"
    "small small";
  gap: 1.4rem 2rem;
  align-items: end;
}

.cta {
  grid-area: cta;
  margin: 0;
  font-size: clamp(1.9rem, 8vw, 5.2rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cta a {
  border-bottom: 5px solid var(--ink);
  padding-bottom: 0.06em;
  transition: background 220ms ease, color 220ms ease;
}

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

.flinks {
  grid-area: links;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: flex-end;
}

footer small {
  grid-area: small;
  display: block;
  border-top: 1px solid var(--hair);
  padding-top: 0.85rem;
  font-size: 16px;
  line-height: 1.5;
  color: var(--mute);
  letter-spacing: 0.04em;
}

/* 滚动淡入 */
html.js .prose > article.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 460ms ease, transform 460ms ease;
}

html.js .prose > article.in {
  opacity: 1;
  transform: none;
}

/* 窄屏 */
@media (max-width: 900px) {
  .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail {
    position: static;
    order: 2;
  }

  .bar {
    flex-wrap: nowrap;
    gap: 0.8rem;
  }

  .bar nav {
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .bar nav p {
    flex-wrap: nowrap;
  }

  footer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "cta"
      "links"
      "small";
  }

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

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

  .hero {
    min-height: auto;
    padding-block: clamp(2.2rem, 12vw, 3.4rem);
  }

  .prose p,
  .prose ul,
  .prose ol {
    max-width: none;
  }
}

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

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

  html.js .prose > article.reveal {
    opacity: 1;
    transform: none;
  }
}

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