@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400&family=Nunito:ital,wght@0,700;0,800;0,900;1,700&display=swap');

:root {
  --ink: #000000;
  --blue: #3bb1ff;
  --coral: #ff5252;
  --paper: #ffffff;
  --cream: #fff8ec;
  --tint: #dff0ff;
  --line: 3px solid #000000;
  --sh: 5px 5px 0 #000000;
  --sh-lg: 8px 8px 0 #000000;
}

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

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--cream);
  color: var(--ink);
  font-family: "Nunito", "DM Sans", system-ui, -apple-system, "Segoe UI", "Noto Sans SC", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  font-weight: 700;
}

a { color: inherit; }
p { margin: 0 0 14px; }
img { max-width: 100%; }

/* 顶部细条 */
.announce {
  background: var(--ink);
  color: #ffffff;
  border-bottom: var(--line);
  text-align: center;
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  padding: 9px 14px;
}

/* 两行页头 */
.masthead {
  background: var(--paper);
  border-bottom: var(--line);
}

.brandrow {
  background: var(--blue);
  border-bottom: var(--line);
  padding: 12px 18px;
  display: flex;
  align-items: center;
}

.logo {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  text-decoration: none;
  font-weight: 900;
  font-size: clamp(1.35rem, 5.6vw, 2.05rem);
  letter-spacing: -0.03em;
  text-shadow: 3px 3px 0 #ffffff;
}
.logo:hover { text-shadow: 3px 3px 0 var(--coral); }

.menurow {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  justify-content: center;
  background: var(--paper);
}

.navcell { position: relative; }

.navlink {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 10px 14px;
  border: var(--line);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.navlink:hover,
.navlink:focus-visible {
  background: var(--coral);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.caret { font-size: 0.8em; }

.dd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 30;
  min-width: 200px;
  background: var(--paper);
  border: var(--line);
  box-shadow: var(--sh);
  display: none;
}
.dd:hover .dd-list,
.dd:focus-within .dd-list { display: block; }

.dd-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 11px 14px;
  font-weight: 900;
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
}
.dd-list li:last-child a { border-bottom: 0; }
.dd-list a:hover,
.dd-list a:focus-visible { background: var(--coral); }

/* 首屏 */
.hero {
  min-height: 45vh;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  gap: 16px;
  padding: 44px 18px 52px;
  border-bottom: var(--line);
  background-color: var(--paper);
  background-image: radial-gradient(var(--ink) 1.6px, transparent 1.6px);
  background-size: 22px 22px;
  background-position: 0 0;
}

.hero-title {
  margin: 0;
  max-width: 17ch;
  font-weight: 900;
  font-size: clamp(2rem, 9vw, 4.3rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-shadow: 5px 5px 0 var(--coral);
}

.hero-sub {
  margin: 0;
  max-width: 36ch;
  padding: 10px 16px;
  background: var(--blue);
  border: var(--line);
  box-shadow: var(--sh);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.55;
}

/* 主体：正文在左，侧栏在右 */
.wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 34px 18px 60px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  align-items: start;
}

.sheet {
  background: var(--paper);
  border: var(--line);
  border-radius: 4px;
  box-shadow: var(--sh-lg);
  padding: clamp(18px, 3vw, 34px);
  min-width: 0;
}

.prose { min-width: 0; }

.prose div[id] { scroll-margin-top: 26px; }

.prose div + div {
  margin-top: 30px;
  padding-top: 26px;
  border-top: 3px dashed var(--ink);
}

.prose h2 {
  margin: 30px 0 10px;
  font-weight: 900;
  font-size: clamp(1.4rem, 3.6vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.prose div:first-of-type h2 { margin-top: 0; }

.prose h2 + hr,
.prose h3 + hr {
  border: 0;
  border-top: var(--line);
  margin: 0 0 18px;
}

.prose h3 {
  margin: 24px 0 8px;
  font-weight: 900;
  font-size: clamp(1.15rem, 2.6vw, 1.35rem);
  line-height: 1.3;
}

.prose hr {
  border: 0;
  border-top: var(--line);
  margin: 18px 0;
}

.prose ul,
.prose ol {
  margin: 0 0 16px;
  padding-left: 1.35em;
}
.prose li { margin-bottom: 8px; }
.prose ul { list-style: square; }
.prose li::marker { color: var(--coral); }

.prose a {
  font-weight: 900;
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 3px;
}
.prose a:hover { background: var(--coral); }

.prose strong { font-weight: 900; }

.prose blockquote {
  margin: 0 0 16px;
  padding: 12px 16px;
  background: var(--tint);
  border: var(--line);
  box-shadow: var(--sh);
}

.prose code {
  font-family: ui-monospace, "SFMono-Regular", "Menlo", monospace;
  font-size: 0.94em;
  padding: 1px 6px;
  background: var(--cream);
  border: 2px solid var(--ink);
}

.prose img,
.prose figure img {
  display: block;
  height: auto;
  border: var(--line);
  box-shadow: var(--sh);
  margin: 0 0 16px;
}

.prose figure { margin: 0 0 18px; }

.prose figcaption {
  font-size: 0.95rem;
  font-weight: 800;
}

/* 右侧目录 */
.rail {
  position: sticky;
  top: 18px;
  background: var(--tint);
  border: var(--line);
  border-radius: 4px;
  box-shadow: var(--sh);
  padding: 16px;
}

.rail-h {
  margin: 0 0 8px;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.rail hr {
  border: 0;
  border-top: var(--line);
  margin: 0 0 14px;
}

.rail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.rail-list a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  background: var(--paper);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-weight: 900;
  font-size: 0.98rem;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}
.rail-list a:hover,
.rail-list a:focus-visible {
  background: var(--coral);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

/* 页脚 */
footer {
  margin-top: 10px;
  padding: 26px 20px;
  border-top: var(--line);
  background: var(--blue);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.foot-logo {
  font-weight: 900;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  letter-spacing: -0.04em;
  text-decoration: none;
  text-shadow: 4px 4px 0 #ffffff;
}

.foot-nav dl {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.foot-nav dt {
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
}

.foot-nav dd { margin: 0; }

.foot-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 10px;
  background: var(--paper);
  border: 2px solid var(--ink);
  font-weight: 900;
  font-size: 0.95rem;
  text-decoration: none;
}
.foot-nav a:hover,
.foot-nav a:focus-visible { background: var(--coral); }

.foot-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 900;
}
.foot-copy p { margin: 0; }

.totop {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 12px;
  background: var(--ink);
  color: #ffffff;
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 #ffffff;
  font-weight: 900;
  font-size: 0.95rem;
  text-decoration: none;
  align-self: flex-start;
}
.totop:hover { background: var(--coral); }

/* 中屏 */
@media (max-width: 900px) {
  .wrap { grid-template-columns: minmax(0, 1fr); padding-bottom: 46px; }
  .rail { position: static; }
}

/* 小屏 */
@media (max-width: 640px) {
  body { font-size: 16.5px; }
  .menurow { justify-content: stretch; gap: 8px; }
  .navcell { flex: 1 1 100%; }
  .navlink { width: 100%; }
  .dd-list {
    position: static;
    display: block;
    min-width: 0;
    border: 0;
    border-top: 2px solid var(--ink);
    box-shadow: none;
    background: var(--tint);
    margin-top: 6px;
  }
  .dd-list a { border-bottom: 2px solid var(--ink); }
  .hero { min-height: 42vh; padding: 36px 16px 40px; }
  .hero-title { text-shadow: 4px 4px 0 var(--coral); }
  footer { flex-direction: column; align-items: flex-start; gap: 16px; }
  .foot-nav dl { flex-direction: column; align-items: flex-start; gap: 8px; }
  .foot-nav dd { width: 100%; }
  .foot-nav a { width: 100%; justify-content: center; }
}

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

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