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

:root {
  --ink: #1f1f1f;
  --paper: #ffffff;
  --mist: #f5f5f5;
  --line: #dedede;
  --line-2: #bdbdbd;
  --mono: 'Fira Code', 'Share Tech Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gap: clamp(14px, 3vw, 28px);
  --pad: clamp(14px, 4vw, 48px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

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

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

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

/* ---------- 顶栏 ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px var(--pad);
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}

.mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  background: var(--paper);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  overflow: hidden;
  transition: background 0.18s ease, color 0.18s ease;
}

.mark:hover { background: var(--ink); color: var(--paper); }
.mark img { width: 24px; height: 24px; object-fit: contain; }

.bar-nav {
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.bar-nav p {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 1px 0;
}

.pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--paper);
  font-size: 16px;
  line-height: 1.4;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

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

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
  align-content: center;
  min-height: 70vh;
  padding: clamp(26px, 6vw, 64px) var(--pad);
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.tile {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: transform 0.22s ease, border-color 0.22s ease;
}

.tile:hover { transform: scale(1.012); border-color: var(--ink); }

.tile-lead {
  grid-column: span 3;
  border: 0;
  padding: 0;
  justify-content: flex-start;
}

.tile-lead h1 {
  margin: 0;
  font-size: clamp(30px, 5.4vw, 62px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 700;
  text-wrap: balance;
}

.tile-icon {
  grid-column: span 1;
  align-items: center;
  justify-content: center;
  background: var(--mist);
  color: var(--ink);
  min-height: 96px;
}

.tile-desc { grid-column: span 3; background: var(--mist); }

.tile-desc p {
  margin: 0;
  font-size: 17px;
  line-height: 1.65;
  opacity: 0.85;
}

.band {
  height: 12px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, var(--ink) 0 8px, var(--paper) 8px 16px);
}

/* ---------- 正文 ---------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 44px) var(--pad);
}

.content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: var(--gap);
  align-items: start;
}

.doc { min-width: 0; }

.doc article { scroll-margin-top: 92px; }

.doc > article {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: clamp(18px, 3.4vw, 36px);
  margin-bottom: 14px;
  transition: border-color 0.2s ease;
}

.doc > article:last-child { margin-bottom: 0; }
.doc > article:hover { border-color: var(--line-2); }

.doc h2 {
  margin: 0 0 6px;
  font-size: clamp(20px, 3vw, 30px);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.doc h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  line-height: 1.4;
}

.doc h2 + p,
.doc h3 + p { margin-top: 12px; }

.doc hr {
  height: 0;
  margin: 10px 0 18px;
  border: 0;
  border-top: 1px solid var(--ink);
}

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

.doc ul,
.doc ol { margin: 0 0 14px; padding-left: 1.4em; }

.doc li { margin: 0 0 6px; }

.doc blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  border-left: 3px solid var(--ink);
  background: var(--mist);
}

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

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

.doc th,
.doc td {
  border: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

.doc th { background: var(--mist); }

.doc code {
  background: var(--mist);
  padding: 1px 5px;
  border: 1px solid var(--line);
}

/* ---------- 侧栏 ---------- */
.side {
  position: sticky;
  top: 86px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 18px;
}

.side h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.16em;
  line-height: 1.5;
}

.side hr {
  height: 0;
  margin: 10px 0 8px;
  border: 0;
  border-top: 1px solid var(--ink);
}

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

.side li + li { border-top: 1px dotted var(--line); }

.side a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 4px;
  font-size: 16px;
  text-decoration: none;
  transition: background 0.16s ease, padding-left 0.16s ease;
}

.side a:hover {
  background: var(--mist);
  padding-left: 10px;
}

/* ---------- 页脚 ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  align-items: center;
  justify-content: space-between;
  margin-top: clamp(20px, 4vw, 44px);
  padding: 14px var(--pad);
  background: var(--paper);
  border-top: 1px solid var(--ink);
}

.foot article { min-width: 0; }
.foot p { margin: 0; font-size: 16px; }
.fbrand { font-weight: 700; }

.fnav {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 16px;
}

.fnav a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  text-decoration: none;
  opacity: 0.85;
}

.fnav a:hover { opacity: 1; text-decoration: underline; }

.fcopy { opacity: 0.65; }

/* ---------- 动效 ---------- */
@media (prefers-reduced-motion: no-preference) {
  .side li {
    animation: rise 0.36s ease both;
  }
  .side li:nth-child(1) { animation-delay: 0.02s; }
  .side li:nth-child(2) { animation-delay: 0.05s; }
  .side li:nth-child(3) { animation-delay: 0.08s; }
  .side li:nth-child(4) { animation-delay: 0.11s; }
  .side li:nth-child(5) { animation-delay: 0.14s; }
  .side li:nth-child(6) { animation-delay: 0.17s; }
  .side li:nth-child(7) { animation-delay: 0.2s; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .tile:hover { transform: none; }
}

/* ---------- 断点 ---------- */
@media (max-width: 900px) {
  .content { grid-template-columns: 1fr; }
  .side { position: static; }
}

@media (max-width: 640px) {
  .bar { gap: 10px; padding-left: 12px; padding-right: 12px; }
  .hero {
    grid-template-columns: repeat(2, 1fr);
    min-height: 70vh;
  }
  .tile-lead { grid-column: span 2; }
  .tile-icon {
    grid-column: span 2;
    min-height: 92px;
    flex-direction: row;
    gap: 14px;
  }
  .tile-desc { grid-column: span 2; }
  .tile-desc p { font-size: 16px; }
  .foot { justify-content: flex-start; }
}

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