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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mute: #5a5a5a;
  --hair: #d9d9d9;
  --rail: 248px;
  --pad: clamp(20px, 4.2vw, 72px);
}

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

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

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

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 60;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  text-decoration: none;
  font-size: 16px;
}

.skip:focus {
  left: 12px;
  top: 12px;
}

/* ---------- 左侧竖向栏 ---------- */

.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--ink);
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 52px;
  padding: 17px 22px;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.26em;
}

.brand .mark {
  width: 9px;
  height: 9px;
  flex: none;
  background: var(--paper);
  transition: transform 0.22s ease, background 0.22s ease;
}

.brand:hover .mark {
  background: #9a9a9a;
  transform: rotate(45deg);
}

.rail nav {
  padding: 22px 0;
  overflow-y: auto;
}

.rail nav p {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 22px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.4;
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.rail nav a::before {
  content: "";
  width: 6px;
  height: 6px;
  flex: none;
  background: var(--ink);
  transition: transform 0.18s ease, background 0.18s ease;
}

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

.rail nav a:hover::before,
.rail nav a:focus-visible::before {
  background: var(--paper);
  transform: rotate(45deg);
}

/* ---------- 主体 ---------- */

main {
  margin-left: var(--rail);
}

.hero {
  min-height: 45vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(40px, 7vw, 88px) var(--pad) clamp(26px, 4vw, 48px);
  border-bottom: 1px solid var(--ink);
}

.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-size: clamp(2.1rem, 8.2vw, 6.4rem);
  line-height: 0.94;
  font-weight: 900;
  letter-spacing: -0.05em;
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero-media {
  margin: clamp(24px, 4vw, 46px) 0 0;
  width: 100%;
  max-width: 860px;
  overflow: hidden;
  border-radius: 4px;
}

.hero-media img {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1.1);
  transform-origin: 50% 50%;
  will-change: transform;
}

.frame {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  gap: clamp(26px, 4vw, 56px);
  align-items: start;
  padding: clamp(38px, 5.5vw, 76px) var(--pad) clamp(46px, 7vw, 96px);
}

/* ---------- 侧栏索引 ---------- */

.aside {
  position: sticky;
  top: 24px;
  background: var(--paper);
  border-top: 3px solid var(--ink);
  border-radius: 4px;
  padding: 16px 14px 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), 0 1px 0 rgba(0, 0, 0, 0.04);
}

.aside-label {
  margin: 0 0 10px;
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--mute);
}

.aside ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.aside a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 2px;
  color: var(--ink);
  text-decoration: none;
  font-size: 16px;
  line-height: 1.4;
  border-bottom: 1px solid #ebebeb;
  transition: padding-left 0.16s ease, font-weight 0.16s ease;
}

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

.aside a:hover {
  padding-left: 9px;
  font-weight: 600;
}

/* ---------- 引导块 ---------- */

.lede {
  margin: 0 0 clamp(30px, 4.5vw, 60px);
}

.lede h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4.4vw, 3.4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.subtitle {
  margin: 14px 0 0;
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.6;
  color: var(--mute);
}

/* ---------- 正文 ---------- */

.content {
  max-width: 74ch;
  overflow-wrap: break-word;
}

.content section {
  padding: clamp(34px, 5vw, 68px) 0;
  border-top: 1px solid var(--hair);
  scroll-margin-top: 24px;
}

.content section:first-child {
  padding-top: 0;
  border-top: 0;
}

.content section:last-child {
  padding-bottom: clamp(20px, 3vw, 40px);
}

.content h2 {
  margin: 0 0 0.55em;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.content h3 {
  margin: 1.6em 0 0.5em;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.content p {
  margin: 0 0 1.1em;
}

.content ul,
.content ol {
  margin: 0 0 1.2em;
  padding-left: 1.35em;
}

.content li {
  margin: 0 0 0.45em;
}

.content a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

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

.content strong {
  font-weight: 700;
}

.content blockquote {
  margin: 1.6em 0;
  padding: 4px 0 4px 20px;
  border-left: 4px solid var(--ink);
  font-size: 1.06rem;
}

.content figure {
  margin: 1.6em 0;
}

.content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

.content figcaption {
  margin-top: 8px;
  font-size: 16px;
  color: var(--mute);
}

.content table {
  width: 100%;
  margin: 1.4em 0;
  border-collapse: collapse;
  font-size: 16px;
}

.content th,
.content td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid var(--hair);
}

.content pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: 4px;
  background: #0a0a0a;
  color: #ffffff;
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.55;
}

.content code {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 0.94em;
}

/* ---------- 页脚 ---------- */

footer {
  margin-left: var(--rail);
  padding: clamp(44px, 7vw, 88px) var(--pad) 28px;
  border-top: 1px solid var(--ink);
}

.cta {
  margin: 0 0 clamp(36px, 6vw, 64px);
}

.cta a {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  padding: 0 clamp(22px, 4vw, 44px);
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  text-decoration: none;
  font-size: clamp(1.3rem, 3.4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.cta a:hover {
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
  transform: translateY(-2px);
}

.colophon {
  display: block;
  margin: 0;
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--mute);
}

/* ---------- 移动端 ---------- */

@media (max-width: 900px) {
  .rail {
    right: 0;
    bottom: auto;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
  }

  .brand {
    min-height: 48px;
    padding: 12px 18px;
  }

  .rail nav {
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .rail nav p {
    flex-direction: row;
    gap: 0;
  }

  .rail nav a {
    min-height: 48px;
    padding: 0 14px;
    white-space: nowrap;
    border-left: 1px solid #ebebeb;
    font-size: 16px;
  }

  .rail nav a::before {
    display: none;
  }

  .rail nav a:hover,
  .rail nav a:focus-visible {
    padding-left: 14px;
  }

  .rail nav p a:first-child {
    border-left: 0;
  }

  main {
    margin-left: 0;
    padding-top: 104px;
  }

  .hero {
    min-height: 0;
    padding-top: 34px;
  }

  .frame {
    grid-template-columns: 1fr;
    padding-top: 28px;
  }

  .aside {
    position: static;
  }

  .aside ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0 6px;
  }

  .aside a {
    min-height: 42px;
    padding: 9px 6px;
    border-bottom: 0;
  }

  .content {
    max-width: none;
  }

  .content section {
    scroll-margin-top: 118px;
  }

  footer {
    margin-left: 0;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

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