@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --ink: #000000;
  --paper: #ffffff;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  --gut: clamp(1.1rem, 4vw, 3.5rem);
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 17px;
  line-height: 1.72;
  letter-spacing: 0.005em;
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0 0 1.1em; max-width: 68ch; }
ul, ol, dl { margin: 0 0 1.1em; padding-left: 1.2em; }
h2, h3, h4 { margin: 0 0 0.6em; font-weight: 900; letter-spacing: -0.03em; line-height: 1.15; }
h2 { font-size: clamp(1.45rem, 4.2vw, 2.3rem); }
h3 { font-size: clamp(1.15rem, 3vw, 1.5rem); }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.site-head :focus-visible, .site-foot :focus-visible { outline-color: var(--paper); }

.vh {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 页头：品牌独占一行，菜单与搜索在下一行 */
.site-head {
  background: var(--ink);
  color: var(--paper);
  padding: calc(var(--gut) * 0.7) var(--gut) 0.2rem;
  border-bottom: 3px solid var(--ink);
}

.brandrow {
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
  padding-bottom: 0.55rem;
}

.brand {
  margin: 0;
  max-width: none;
  font-size: clamp(1.85rem, 8.5vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.86;
}

.menurow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  padding: 0.7rem 0;
}

.menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.menu a,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 1rem;
  color: var(--paper);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.menu a:hover,
.menu-toggle:hover { background: var(--paper); color: var(--ink); }

.has-sub { position: relative; }

.sub {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 16rem;
  padding: 0.5rem;
  background: var(--ink);
  border: 1px solid var(--paper);
  border-radius: 4px;
}

.has-sub[data-open="true"] .sub,
.has-sub:hover .sub,
.has-sub:focus-within .sub { display: flex; }

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

.search {
  display: flex;
  gap: 0.4rem;
  flex: 1 1 12rem;
  min-width: 0;
  max-width: 26rem;
}

.search input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0.4rem 0.6rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--paper);
  border-radius: 4px;
}

.search button {
  min-height: 44px;
  padding: 0.4rem 0.9rem;
  font: inherit;
  font-size: 1rem;
  color: var(--paper);
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

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

/* 首屏 */
.hero {
  min-height: 45vh;
  padding: clamp(1.6rem, 6vh, 3rem) var(--gut);
  border-bottom: 3px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  text-align: center;
  max-width: 24ch;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 10.5vw, 7rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  line-height: 0.9;
}

.hero-mark { width: 48px; height: 48px; object-fit: contain; }

@media (min-width: 900px) {
  .hero-in { flex-direction: row; text-align: left; max-width: 40ch; gap: 1.8rem; }
  .hero h1 { max-width: 22ch; }
}

/* 内容区：侧栏在左 */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gut);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.side {
  align-self: start;
  margin: 1.8rem 0 0;
  padding: 1rem 1rem 1.2rem;
  border: 2px solid var(--ink);
  border-radius: 4px;
}

.side small {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  opacity: 0.7;
}

.side h2 { margin: 0.25rem 0 0.9rem; font-size: 1.35rem; }

.side nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.side a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0.4rem 0.2rem;
  font-size: 0.95rem;
  text-decoration: none;
  border-top: 1px solid rgba(0, 0, 0, 0.18);
  transition: background 0.18s ease, color 0.18s ease, padding-left 0.18s ease;
}

.side li:first-child a { border-top: 0; }
.side a:hover { background: var(--ink); color: var(--paper); padding-left: 0.7rem; }

@media (min-width: 960px) {
  .wrap {
    grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
    gap: clamp(1.5rem, 4vw, 3.2rem);
    align-items: start;
  }
  .side { position: sticky; top: 1rem; margin: 2.6rem 0 0; }
}

.doc { min-width: 0; }

article {
  padding: 2rem 0 3.4rem;
  max-width: 70ch;
}

article > section {
  padding: 2.2rem 0;
  border-top: 2px solid var(--ink);
  scroll-margin-top: 6rem;
}

article > section:first-child { border-top: 0; padding-top: 1rem; }

article h2 { font-size: clamp(1.5rem, 4.6vw, 2.4rem); line-height: 1.12; }
article h3 { margin-top: 1.6rem; }

article a {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

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

article img { margin: 1.2rem 0; border: 2px solid var(--ink); border-radius: 4px; }

article blockquote {
  margin: 1.4rem 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 4px solid var(--ink);
  font-style: italic;
}

article ul, article ol { padding-left: 1.3em; }
article li { margin: 0.35em 0; }

article code {
  font-size: 0.95em;
  padding: 0.1em 0.3em;
  border: 1px solid var(--ink);
  border-radius: 4px;
}

article hr { border: 0; border-top: 2px solid var(--ink); margin: 2rem 0; }

/* 页脚 */
.site-foot {
  margin-top: 2.6rem;
  padding: clamp(2.2rem, 7vw, 4.5rem) var(--gut) 1.4rem;
  display: grid;
  gap: 1.8rem;
  background: var(--ink);
  color: var(--paper);
  border-top: 3px solid var(--ink);
}

.f-brand {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.45);
}

.f-word {
  display: block;
  font-size: clamp(2.4rem, 13vw, 8rem);
  font-weight: 900;
  letter-spacing: -0.07em;
  line-height: 0.85;
}

.f-nav dl { margin: 0; display: grid; gap: 0.15rem; }
.f-nav dt, .f-nav dd { margin: 0; }

.f-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.1rem;
  font-size: 1rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.28);
  transition: background 0.18s ease, color 0.18s ease;
}

.f-nav dt a { font-weight: 700; }
.f-nav a:hover { background: var(--paper); color: var(--ink); }

.f-base {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  font-size: 0.9rem;
}

.f-base p { margin: 0; max-width: none; }

.f-base a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.5);
}

@media (min-width: 760px) {
  .site-foot { grid-template-columns: 1.6fr 1fr; gap: 2.4rem; }
  .f-base { grid-column: 1 / -1; }
}

/* 窄屏：分组菜单直接铺开 */
@media (max-width: 760px) {
  .has-sub { width: 100%; }
  .menu-toggle { display: none; }
  .sub {
    position: static;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-width: 0;
    padding: 0.5rem 0 0;
    background: none;
    border: 0;
  }
  .sub a { font-size: 0.95rem; }
  .f-word { letter-spacing: -0.05em; }
}

@media (prefers-reduced-motion: no-preference) {
  .side li { animation: rise 0.45s both; }
  .side li:nth-child(2) { animation-delay: 0.05s; }
  .side li:nth-child(3) { animation-delay: 0.1s; }
  .side li:nth-child(4) { animation-delay: 0.15s; }
  .side li:nth-child(5) { animation-delay: 0.2s; }
  .side li:nth-child(6) { animation-delay: 0.25s; }
  .side li:nth-child(7) { animation-delay: 0.3s; }
}

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

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