@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@700&display=swap');

:root {
  --paper: #fdfbf7;
  --sheet: #f5f5f5;
  --ink: #1a1a1a;
  --line: #e0e0e0;
  --muted: #6f6b64;
  --head: "Space Grotesk", "Helvetica Neue", Arial, "PingFang SC", sans-serif;
  --read: Georgia, "Songti SC", "Source Han Serif SC", "Noto Serif CJK SC", SimSun, serif;
}

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

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

body.paper-page {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--read);
  font-size: 17px;
  line-height: 1.8;
  overflow-x: hidden;
}

body.paper-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.26'/%3E%3C/svg%3E");
}

::selection { background: var(--ink); color: var(--paper); }

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

menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

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

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

/* 页头：品牌独行 + 菜单行 */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 2px solid var(--ink);
}

.brand-row {
  padding: .55rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  text-decoration: none;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: .03em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 1rem;
  line-height: 1;
}

.brand:hover .brand-name,
.brand:focus-visible .brand-name {
  border-bottom: 2px solid var(--ink);
}

.menu-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1rem;
  padding: .5rem 1.1rem .65rem;
}

.nav-toggle summary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 44px;
  padding: .35rem .85rem;
  border: 1px solid var(--ink);
  border-radius: 10px;
  font-family: var(--head);
  font-weight: 700;
  font-size: .95rem;
  cursor: pointer;
  list-style: none;
}

.nav-toggle summary::-webkit-details-marker { display: none; }

.nav-toggle summary::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--ink);
}

.nav-toggle[open] summary::after {
  border-top: 0;
  border-bottom: 6px solid var(--ink);
}

.nav-toggle[open] summary {
  background: var(--ink);
  color: var(--paper);
}

.nav-toggle[open] summary::after {
  border-bottom-color: var(--paper);
  border-top-color: var(--paper);
}

.nav-menu {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: .1rem 1rem;
  padding: .35rem 0 .1rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: .95rem;
}

.nav-menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .1rem 0;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

.nav-menu a:hover,
.nav-menu a:focus-visible { border-bottom-color: var(--ink); }

.nav-search {
  display: flex;
  gap: .4rem;
  margin-left: auto;
}

.nav-search input {
  width: 9.5rem;
  padding: .35rem .6rem;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 44px;
}

.nav-search button {
  min-height: 44px;
  padding: .35rem .95rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: .95rem;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 10px;
  cursor: pointer;
}

/* 首屏 */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--sheet);
  border-bottom: 2px solid var(--ink);
}

.hero-media,
.hero-mask {
  position: absolute;
  inset: 0;
}

.hero-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.hero-media img.on { display: block; }

.hero-mask {
  background: linear-gradient(180deg, rgba(26, 26, 26, .2) 0%, rgba(26, 26, 26, .82) 100%);
}

.hero-mask.is-plain { background: none; }

.hero-back {
  position: absolute;
  top: 2rem;
  left: .6rem;
  right: .6rem;
  margin: 0;
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(2.4rem, 13vw, 10rem);
  line-height: .86;
  letter-spacing: -.02em;
  word-break: break-all;
  color: rgba(26, 26, 26, .13);
  pointer-events: none;
}

.hero.has-img .hero-back { color: rgba(253, 251, 247, .3); }

.hero-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 48rem;
  padding: 3rem 1.1rem 2.4rem;
}

.hero.has-img .hero-copy { color: var(--paper); }

.hero-kicker {
  margin: 0;
  font-family: var(--head);
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  opacity: .8;
}

.hero-copy h1 {
  margin: .5rem 0 .8rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(2rem, 7vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -.01em;
}

.hero-lead {
  margin: 0;
  max-width: 34rem;
  font-size: 1rem;
  line-height: 1.7;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  margin-top: 1.2rem;
  padding: .45rem 1.15rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: .95rem;
  text-decoration: none;
  color: var(--ink);
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 6px 16px rgba(26, 26, 26, .18);
}

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

/* 正文 + 右侧栏 */
.page-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 2.4rem;
  align-items: start;
  max-width: 74rem;
  margin: 0 auto;
  padding: 2.4rem 1.1rem 3.4rem;
}

div article[id] { scroll-margin-top: 165px; }

.prose {
  min-width: 0;
  font-size: 1.03rem;
  overflow-wrap: anywhere;
}

.prose article {
  border-top: 2px solid var(--ink);
  padding-top: 1.6rem;
  margin-bottom: 3rem;
}

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

.prose p { margin: 0 0 1.15em; }

.prose h2 {
  margin: .1rem 0 1rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -.01em;
}

.prose h3 {
  margin: 1.6rem 0 .7rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.3;
}

.prose h2 span,
.prose h3 span {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: .04em .34em;
  border-radius: 6px;
  box-decoration-break: clone;
}

.prose a {
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
}

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

.prose ul,
.prose ol { padding-left: 1.4em; margin: 0 0 1.15em; }

.prose li { margin-bottom: .4em; }

.prose img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(26, 26, 26, .09);
}

.prose blockquote {
  margin: 1.4em 0;
  padding: .2em 0 .2em 1.1em;
  border-left: 3px solid var(--ink);
  color: var(--muted);
}

.prose table {
  display: block;
  width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: .95rem;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: .5em .7em;
  text-align: left;
}

.prose th { background: var(--sheet); }

.side {
  position: sticky;
  top: 158px;
  display: grid;
  gap: 1rem;
  font-family: var(--head);
}

.side-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.05rem;
  box-shadow: 0 8px 20px rgba(26, 26, 26, .07);
}

.side-title {
  margin: 0 0 .7rem;
  font-size: .92rem;
  letter-spacing: .16em;
  font-weight: 700;
}

.side-title span {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: .1em .42em;
  border-radius: 6px;
}

.side-list a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: .93rem;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.side-list li:last-child a { border-bottom: 0; }

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

.to-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 42px;
  font-size: .93rem;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid var(--ink);
  border-radius: 10px;
}

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

/* 页脚：四栏 + 底栏 */
.site-foot {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.8rem;
  border-top: 2px solid var(--ink);
  background: var(--sheet);
  padding: 2.4rem clamp(1.1rem, 5vw, 4rem) 1.2rem;
}

.site-foot h3 {
  margin: 0 0 .7rem;
  font-family: var(--head);
  font-size: .88rem;
  letter-spacing: .16em;
  font-weight: 700;
}

.site-foot h3 span {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  padding: .12em .45em;
  border-radius: 6px;
}

.f-name {
  margin: 0 0 .5rem;
  font-family: var(--head);
  font-weight: 700;
  font-size: 1.15rem;
}

.f-desc {
  margin: 0;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--muted);
}

.site-foot menu a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  font-family: var(--head);
  font-size: .93rem;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-foot menu a:hover,
.site-foot menu a:focus-visible { border-bottom-color: var(--ink); }

.foot-base {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .6rem 1rem;
  margin-top: .6rem;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
  font-family: var(--head);
  font-size: .88rem;
}

.foot-base p { margin: 0; }

.foot-link a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: none;
  border-bottom: 2px solid var(--ink);
}

@media (max-width: 960px) {
  .page-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.6rem;
    padding-top: 1.7rem;
  }

  .side {
    position: static;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  div article[id] { scroll-margin-top: 215px; }
}

@media (max-width: 680px) {
  .nav-search {
    width: 100%;
    margin-left: 0;
  }

  .nav-search input {
    flex: 1;
    width: auto;
    min-width: 0;
  }

  .site-foot { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .hero-copy { padding: 5rem 1.1rem 1.9rem; }

  .hero-back { top: 1.4rem; }

  .side { grid-template-columns: minmax(0, 1fr); }
}

@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}
