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

:root {
  --ink: #000000;
  --paper: #ffffff;
  --rail: 200px;
  --bar: 40px;
  --line: rgba(0, 0, 0, 0.16);
}

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

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

body {
  margin: 0;
  padding-top: var(--bar);
  background: var(--paper);
  color: var(--ink);
  font-family: 'Space Mono', ui-monospace, 'SFMono-Regular', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  overflow-x: hidden;
}

h1,
h2,
h3,
summary,
.mark,
footer p,
aside h2,
.announce-brand {
  font-family: 'Syncopate', 'Space Mono', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

img {
  max-width: 100%;
}

a {
  color: var(--ink);
}

/* 顶部细条 */
.announce {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  background: var(--ink);
  color: var(--paper);
  z-index: 50;
}

.announce-brand {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.36em;
}

.announce-rule {
  flex: 1 1 auto;
  height: 1px;
  background: rgba(255, 255, 255, 0.45);
}

/* 左侧固定竖向导航 */
.rail {
  position: fixed;
  left: 0;
  top: var(--bar);
  bottom: 0;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1rem 1.75rem;
  background: var(--paper);
  border-right: 1px solid var(--ink);
  overflow-y: auto;
  z-index: 40;
}

.mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  transition: background 0.22s ease, color 0.22s ease;
}

.mark:hover,
.mark:focus-visible {
  background: var(--paper);
  color: var(--ink);
}

.mark-img {
  width: 24px;
  height: 24px;
  display: block;
  filter: invert(1);
}

.mark:hover .mark-img,
.mark:focus-visible .mark-img {
  filter: none;
}

.menu-wrap summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--ink);
  font-size: 0.9rem;
  letter-spacing: 0.26em;
  cursor: pointer;
  list-style: none;
}

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

.burger {
  position: relative;
  display: block;
  width: 14px;
  height: 10px;
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  flex: 0 0 auto;
}

.burger::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  background: var(--ink);
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.menu li a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  padding: 0.4rem 0;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: padding-left 0.22s ease;
}

.menu li a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--ink);
  transition: width 0.22s ease;
}

.menu li a:hover::after,
.menu li a:focus-visible::after {
  width: 100%;
}

.menu li a:hover,
.menu li a:focus-visible {
  padding-left: 0.35rem;
}

.dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  background: var(--ink);
}

/* 正文网格：aside 在左 */
main {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 1200px;
  margin-left: var(--rail);
  padding: 2.5rem 2rem 4rem;
}

aside {
  position: sticky;
  top: calc(var(--bar) + 1.5rem);
  align-self: start;
}

aside h2 {
  margin: 0 0 0.5rem;
  font-size: 0.82rem;
  letter-spacing: 0.3em;
  font-weight: 700;
}

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

.toc {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}

.toc a {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  transition: color 0.22s ease, padding-left 0.22s ease;
}

.toc a:hover,
.toc a:focus-visible {
  padding-left: 0.3rem;
}

div {
  min-width: 0;
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
  min-height: 70vh;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--ink);
  margin-bottom: 0.5rem;
}

.hero-media {
  position: relative;
  margin: 0;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--ink);
  overflow: hidden;
  background: var(--paper);
}

.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.06);
  transition: transform 0.5s ease;
}

.hero-media:hover .hero-img {
  transform: scale(1.03);
}

.badge {
  position: absolute;
  left: 0;
  bottom: 0;
  margin: 0;
  padding: 0.45rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.74rem;
  letter-spacing: 0.3em;
}

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

.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  letter-spacing: 0.34em;
}

.hero-text h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 4.4vw, 3.3rem);
  line-height: 1.28;
  letter-spacing: 0.04em;
  font-weight: 700;
}

.lede {
  margin: 0 auto 1.5rem;
  max-width: 34ch;
  font-size: 1rem;
  line-height: 1.75;
}

.cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0.7rem 1.8rem;
  border: 1px solid var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.26em;
  transition: background 0.22s ease, color 0.22s ease;
}

.cta:hover,
.cta:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

/* 正文区块 */
div > article:not(.hero) {
  padding: 2.25rem 0;
  border-bottom: 1px solid var(--line);
}

div article[id] {
  scroll-margin-top: calc(var(--bar) + 1.25rem);
}

div h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.3rem, 2.6vw, 1.95rem);
  line-height: 1.35;
  letter-spacing: 0.04em;
  font-weight: 700;
}

div h3 {
  margin: 1.6rem 0 0.6rem;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

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

div p {
  margin: 0 0 1rem;
  max-width: 68ch;
}

div ul,
div ol {
  padding-left: 1.25rem;
}

div li {
  margin-bottom: 0.4rem;
}

div a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

div img {
  display: block;
  height: auto;
  border: 1px solid var(--ink);
  filter: grayscale(100%);
  margin: 1rem 0;
}

div blockquote {
  margin: 1.25rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--ink);
}

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

/* 页脚 */
footer {
  margin-left: var(--rail);
  padding: 2rem 1rem 2.5rem;
  border-top: 1px solid var(--ink);
  text-align: center;
}

footer p {
  margin: 0 0 0.9rem;
  font-size: clamp(2rem, 13vw, 8.5rem);
  line-height: 0.92;
  font-weight: 700;
  letter-spacing: -0.02em;
}

footer p a {
  text-decoration: none;
  transition: opacity 0.22s ease;
}

footer p a:hover,
footer p a:focus-visible {
  opacity: 0.55;
}

footer small {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.24em;
}

/* 动效 */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.menu li,
.toc li,
.hero-text,
.hero-media {
  animation: rise 0.5s ease both;
}

.menu li:nth-child(1) { animation-delay: 0.03s; }
.menu li:nth-child(2) { animation-delay: 0.07s; }
.menu li:nth-child(3) { animation-delay: 0.11s; }
.menu li:nth-child(4) { animation-delay: 0.15s; }
.menu li:nth-child(5) { animation-delay: 0.19s; }
.menu li:nth-child(6) { animation-delay: 0.23s; }
.menu li:nth-child(7) { animation-delay: 0.27s; }

.toc li:nth-child(1) { animation-delay: 0.05s; }
.toc li:nth-child(2) { animation-delay: 0.1s; }
.toc li:nth-child(3) { animation-delay: 0.15s; }
.toc li:nth-child(4) { animation-delay: 0.2s; }
.toc li:nth-child(5) { animation-delay: 0.25s; }
.toc li:nth-child(6) { animation-delay: 0.3s; }

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

/* 移动端 */
@media (max-width: 900px) {
  main {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    margin-left: 0;
    padding: 1.25rem 1rem 3rem;
  }

  .rail {
    position: static;
    width: auto;
    top: auto;
    bottom: auto;
    padding: 0.75rem 1rem 1rem;
    border-right: 0;
    border-bottom: 1px solid var(--ink);
    overflow: visible;
    gap: 0.75rem;
  }

  aside {
    position: static;
    display: block;
  }

  aside h2,
  aside hr {
    display: none;
  }

  .toc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .toc a {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 0.4rem 0.6rem;
    font-size: 0.82rem;
    border: 1px solid var(--ink);
  }

  .toc a:hover,
  .toc a:focus-visible {
    padding-left: 0.6rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    gap: 1.25rem;
    padding-bottom: 1.5rem;
  }

  .hero-media {
    order: 2;
    aspect-ratio: 4 / 3;
  }

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

  .lede {
    margin: 0 0 1.25rem;
    max-width: none;
  }

  .cta {
    width: 100%;
    justify-content: center;
  }

  footer {
    margin-left: 0;
    padding: 1.5rem 1rem 2rem;
  }

  div > article:not(.hero) {
    padding: 1.6rem 0;
  }
}

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

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

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