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

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

body {
  margin: 0;
  overflow-x: hidden;
  font-family: 'Fredoka', 'Nunito', system-ui, -apple-system, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: #000;
  background-color: #fff;
  background-image: linear-gradient(to right, rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 72px 100%;
  background-attachment: fixed;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.shell {
  position: relative;
  padding-bottom: 40px;
}

/* ---------- 顶栏 ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 70;
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 2px solid #000;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #000;
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 4px;
}

.drop {
  position: relative;
}

.drop-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.drop-btn::-webkit-details-marker {
  display: none;
}

.drop[open] .drop-btn {
  background: #000;
  color: #fff;
}

.drop-list {
  position: fixed;
  inset: 0;
  z-index: 60;
  margin: 0;
  padding: 104px 20px 40px;
  list-style: none;
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  counter-reset: navn;
  overflow-y: auto;
}

.drop-list li {
  display: flex;
  align-items: baseline;
  gap: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.25);
}

.drop-list li::before {
  content: counter(navn, decimal-leading-zero);
  counter-increment: navn;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  min-width: 2.2em;
}

.drop-list a {
  flex: 1;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 6px 8px 6px 0;
  color: #fff;
  text-decoration: none;
  font-size: clamp(1.35rem, 5.4vw, 2.2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  transition: color 0.15s linear, padding-left 0.2s ease;
}

.drop-list a:hover,
.drop-list a:focus-visible {
  background: #fff;
  color: #000;
  padding-left: 12px;
}

.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s linear, color 0.15s linear;
}

.cta:hover,
.cta:focus-visible {
  background: #fff;
  color: #000;
}

/* ---------- 首屏 ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 100svh;
  padding: clamp(28px, 7vw, 80px) 16px 0;
}

.hero-txt {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  text-align: right;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.1rem, 10vw, 5.2rem);
  line-height: 1.02;
  font-weight: 700;
  letter-spacing: -0.025em;
  max-width: 18ch;
}

.hero-desc {
  margin: 0;
  max-width: 40ch;
  font-size: clamp(0.98rem, 2.4vw, 1.15rem);
  line-height: 1.6;
  color: #1a1a1a;
}

.hero-foot {
  position: relative;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.hero-foot::before {
  content: '';
  position: absolute;
  top: -36px;
  right: 0;
  width: min(52%, 460px);
  height: 36px;
  background: #000;
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

.hero-media {
  overflow: hidden;
  border-top: 2px solid #000;
}

.hero-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 46svh;
  object-fit: cover;
  filter: grayscale(1) contrast(1.08);
}

.band {
  height: 10px;
  background: #000;
  margin: 0 -16px;
}

/* ---------- 主体网格 ---------- */

main {
  padding: clamp(36px, 7vw, 88px) 16px 0;
}

.wrap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.rail {
  grid-column: 1 / span 3;
  align-self: start;
  position: sticky;
  top: 78px;
}

.rail-h {
  margin: 0 0 10px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.rail-h span {
  display: inline-block;
  padding-bottom: 6px;
  border-bottom: 3px solid #000;
}

.toc {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.94rem;
}

.toc li {
  border-bottom: 1px solid rgba(0, 0, 0, 0.18);
}

.toc a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 6px 6px 0;
  color: #000;
  text-decoration: none;
  line-height: 1.35;
  transition: padding-left 0.18s ease, background 0.18s linear, color 0.18s linear;
}

.toc a:hover,
.toc a:focus-visible {
  background: #000;
  color: #fff;
  padding-left: 10px;
}

.stream {
  grid-column: 4 / span 9;
  min-width: 0;
}

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

.prose div {
  padding: clamp(26px, 4vw, 52px) clamp(16px, 3vw, 44px);
  margin: 0 0 20px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
  border: 2px solid #000;
  border-radius: 0;
  scroll-margin-top: 86px;
  transition: box-shadow 0.22s ease;
}

.prose div:hover {
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.88);
}

.prose h2,
.prose h3 {
  margin: 0 0 18px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.012em;
}

.prose h2 {
  font-size: clamp(1.5rem, 3.6vw, 2.5rem);
}

.prose h3 {
  font-size: clamp(1.2rem, 2.6vw, 1.65rem);
}

.prose h2 span,
.prose h3 span {
  display: inline-block;
  padding-top: 12px;
  border-top: 9px solid #000;
}

.prose p {
  margin: 0 0 16px;
  max-width: 62ch;
}

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

.prose h2 + p,
.prose h3 + p {
  font-size: 1.06rem;
}

.prose a {
  color: #000;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.prose a:hover {
  background: #000;
  color: #fff;
  text-decoration-color: #fff;
}

.prose ul,
.prose ol {
  margin: 0 0 18px;
  padding-left: 1.3em;
  max-width: 62ch;
}

.prose li {
  margin: 0 0 10px;
  line-height: 1.7;
}

.prose strong {
  font-weight: 700;
  background: linear-gradient(to top, #000 0 2px, transparent 2px);
}

.prose blockquote {
  margin: 0 0 18px;
  padding: 4px 0 4px 18px;
  border-left: 6px solid #000;
  font-size: 1.05rem;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 18px 0;
  filter: grayscale(1);
}

.prose hr {
  border: 0;
  height: 2px;
  background: #000;
  margin: 28px 0;
}

.prose code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.94em;
  border: 1px solid #000;
  padding: 1px 5px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 18px;
}

.prose th,
.prose td {
  border: 1px solid #000;
  padding: 8px 10px;
  text-align: left;
}

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

.foot {
  margin-top: clamp(44px, 8vw, 96px);
  padding: 40px 16px 8px;
  border-top: 2px solid #000;
  text-align: center;
  background: #fff;
}

.foot p {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.foot small {
  display: inline-block;
  font-size: 1rem;
  line-height: 1.6;
  color: #333;
}

/* ---------- 回到顶部 ---------- */

.top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  background: #000;
  color: #fff;
  border: 2px solid #000;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.top:hover,
.top:focus-visible {
  background: #fff;
  color: #000;
}

/* ---------- 入场动效 ---------- */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.22s ease;
}

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

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

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

  .drop-list a,
  .toc a,
  .cta,
  .prose div {
    transition: none;
  }
}

/* ---------- 断点 ---------- */

@media (max-width: 980px) {
  .rail {
    grid-column: 1 / span 4;
  }

  .stream {
    grid-column: 5 / span 8;
  }
}

@media (max-width: 800px) {
  body {
    background-size: 48px 100%;
  }

  .bar {
    gap: 8px;
    padding: 8px 12px;
  }

  .brand {
    font-size: 1rem;
    letter-spacing: 0.02em;
  }

  .cta {
    padding: 0 12px;
    font-size: 0.95rem;
  }

  .drop-btn {
    padding: 0 12px;
    font-size: 0.95rem;
  }

  .hero {
    padding: clamp(24px, 8vw, 48px) 12px 0;
  }

  .hero-txt {
    justify-content: flex-start;
    padding-top: 24px;
  }

  .hero-foot::before {
    top: -24px;
    height: 24px;
  }

  .band {
    margin: 0 -12px;
  }

  main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .wrap {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .rail,
  .stream {
    grid-column: 1 / -1;
  }

  .rail {
    position: static;
  }

  .toc {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toc a {
    min-height: 44px;
  }

  .drop-list {
    padding-top: 96px;
  }
}

@media (max-width: 420px) {
  .drop-list {
    padding-left: 14px;
    padding-right: 14px;
  }

  .drop-list a {
    font-size: 1.25rem;
  }

  .prose h2 span,
  .prose h3 span {
    border-top-width: 7px;
  }
}

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