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

:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --wash: #f5f5f5;
  --line: #1f1f1f;
  --mute: #5d5d5d;
  --soft: #8a8a8a;
  --r: 18px;
  --gap: 16px;
  --mono: 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Fira Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow-x: clip;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---- 顶部细条 ---- */
.topline {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.22em;
  padding: 9px 18px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--paper);
  opacity: 0.75;
  flex: 0 0 auto;
}

.brandtxt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- 粘性锚点条 ---- */
.bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.94);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.corner {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.corner:hover { background: var(--ink); color: var(--paper); }
.corner img { width: 22px; height: 22px; display: block; }

.rail {
  display: flex;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rail::-webkit-scrollbar { display: none; }

.rail a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}

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

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: flex-end;
  padding: 110px 22px 104px;
  background: var(--ink);
  color: var(--paper);
  overflow: hidden;
}

.hero-media { position: absolute; inset: 0; z-index: 0; }

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(31, 31, 31, 0.3) 0%, rgba(31, 31, 31, 0.72) 55%, rgba(31, 31, 31, 0.95) 100%);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 900px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(29px, 6.2vw, 62px);
  line-height: 1.16;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.hero h1 span { display: block; }

.slash {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 64px;
  z-index: 3;
  background: var(--wash);
  clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

/* ---- 主体 ---- */
main {
  background: var(--wash);
  padding: 12px 0 72px;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 258px;
  gap: 24px;
  align-items: start;
}

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

/* ---- bento 卡片网格（正文即卡片） ---- */
div.content {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  counter-reset: panel;
}

div.content > section {
  counter-increment: panel;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 22px 22px 26px;
  min-width: 0;
  scroll-margin-top: 96px;
  transition: transform 0.25s ease, background 0.25s ease;
}

div.content > section:first-child { grid-column: span 2; }
div.content > section:nth-child(4n) { grid-column: span 2; }

div.content > section:hover { transform: scale(1.012); }

div.content > * { min-width: 0; }

/* ---- 卡片内排版 ---- */
div.content :is(h2, h3):first-child { margin-top: 0; }

div.content h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 0 0 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

div.content h2::before {
  content: counter(panel, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--soft);
  margin-right: 10px;
}

div.content h3 {
  font-size: 17px;
  margin: 20px 0 8px;
  font-weight: 600;
}

div.content p { margin: 0 0 14px; }
div.content p:last-child { margin-bottom: 0; }

div.content ul,
div.content ol { margin: 0 0 14px; padding-left: 1.25em; }

div.content li { margin: 0 0 6px; }

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

div.content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
}

div.content blockquote {
  margin: 14px 0;
  padding: 6px 0 6px 14px;
  border-left: 3px solid var(--ink);
  color: var(--mute);
}

div.content strong { font-weight: 600; }

/* ---- 侧栏 ---- */
.side {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 76px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px 14px 18px;
}

.side h2 {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--soft);
}

.side h2 span::after { content: ''; }

.side ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.side li { counter-increment: toc; }

.side li a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  transition: background 0.2s ease;
}

.side li a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--soft);
  flex: 0 0 auto;
}

.side li a:hover { background: var(--wash); }

/* ---- 页脚 ---- */
footer {
  background: var(--ink);
  color: var(--paper);
  padding: 52px 20px 24px;
}

.fbrand {
  margin: 0 0 30px;
  font-family: var(--mono);
  font-weight: 600;
  font-size: clamp(32px, 10vw, 84px);
  line-height: 0.96;
  letter-spacing: -0.02em;
  color: var(--paper);
  word-break: break-all;
}

footer nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  padding-top: 20px;
}

footer dl { margin: 0; }
footer dt,
footer dd { margin: 0 0 4px; }

footer dl a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: #e4e4e4;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.03em;
  text-decoration: none;
}

footer dl a:hover {
  color: var(--paper);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.footline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.24);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.copy { margin: 0; color: #c8c8c8; }

.totop {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  color: var(--paper);
  text-decoration: none;
}

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

/* ---- 入场 ---- */
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

div.content > section {
  animation: rise 0.48s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

div.content > section:nth-child(1) { animation-delay: 0.03s; }
div.content > section:nth-child(2) { animation-delay: 0.07s; }
div.content > section:nth-child(3) { animation-delay: 0.11s; }
div.content > section:nth-child(4) { animation-delay: 0.15s; }
div.content > section:nth-child(5) { animation-delay: 0.19s; }
div.content > section:nth-child(6) { animation-delay: 0.23s; }
div.content > section:nth-child(7) { animation-delay: 0.27s; }
div.content > section:nth-child(8) { animation-delay: 0.31s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  div.content > section { animation: none; }
  div.content > section:hover { transform: none; }
}

/* ---- 中屏 ---- */
@media (max-width: 900px) {
  .wrap { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .body { grid-column: 1; grid-row: auto; }
  .side {
    grid-column: 1;
    grid-row: auto;
    position: static;
    order: 2;
  }
  .side ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
  .hero { padding: 96px 18px 92px; }
}

/* ---- 窄屏 ---- */
@media (max-width: 620px) {
  body { font-size: 16px; line-height: 1.72; }
  div.content { grid-template-columns: minmax(0, 1fr); }
  div.content > section,
  div.content > section:first-child,
  div.content > section:nth-child(4n) { grid-column: span 1; }
  div.content > section { padding: 18px 16px 22px; }
  div.content h2 { font-size: 18px; }
  .wrap { padding: 0 14px; }
  main { padding-bottom: 52px; }
  .hero { min-height: 92vh; padding: 84px 16px 88px; }
  .slash { height: 44px; }
  footer nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side ol { grid-template-columns: minmax(0, 1fr); }
  .footline { flex-wrap: wrap; }
}

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